| PUT,POST | /register |
|---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
// @DataContract
class RegisterResponse implements IMeta, IHasSessionId, IHasBearerToken, JsonSerializable
{
public function __construct(
// @DataMember(Order=1)
/** @var string|null */
public ?string $UserId=null,
// @DataMember(Order=2)
/** @var string|null */
public ?string $SessionId=null,
// @DataMember(Order=3)
/** @var string|null */
public ?string $UserName=null,
// @DataMember(Order=4)
/** @var string|null */
public ?string $ReferrerUrl=null,
// @DataMember(Order=5)
/** @var string|null */
public ?string $BearerToken=null,
// @DataMember(Order=6)
/** @var string|null */
public ?string $RefreshToken=null,
// @DataMember(Order=7)
/** @var DateTime|null */
public ?DateTime $RefreshTokenExpiry=null,
// @DataMember(Order=8)
/** @var array<string>|null */
public ?array $Roles=null,
// @DataMember(Order=9)
/** @var array<string>|null */
public ?array $Permissions=null,
// @DataMember(Order=10)
/** @var string|null */
public ?string $RedirectUrl=null,
// @DataMember(Order=11)
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null,
// @DataMember(Order=12)
/** @var array<string,string>|null */
public ?array $Meta=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['UserId'])) $this->UserId = $o['UserId'];
if (isset($o['SessionId'])) $this->SessionId = $o['SessionId'];
if (isset($o['UserName'])) $this->UserName = $o['UserName'];
if (isset($o['ReferrerUrl'])) $this->ReferrerUrl = $o['ReferrerUrl'];
if (isset($o['BearerToken'])) $this->BearerToken = $o['BearerToken'];
if (isset($o['RefreshToken'])) $this->RefreshToken = $o['RefreshToken'];
if (isset($o['RefreshTokenExpiry'])) $this->RefreshTokenExpiry = JsonConverters::from('DateTime', $o['RefreshTokenExpiry']);
if (isset($o['Roles'])) $this->Roles = JsonConverters::fromArray('string', $o['Roles']);
if (isset($o['Permissions'])) $this->Permissions = JsonConverters::fromArray('string', $o['Permissions']);
if (isset($o['RedirectUrl'])) $this->RedirectUrl = $o['RedirectUrl'];
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
if (isset($o['Meta'])) $this->Meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Meta']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->UserId)) $o['UserId'] = $this->UserId;
if (isset($this->SessionId)) $o['SessionId'] = $this->SessionId;
if (isset($this->UserName)) $o['UserName'] = $this->UserName;
if (isset($this->ReferrerUrl)) $o['ReferrerUrl'] = $this->ReferrerUrl;
if (isset($this->BearerToken)) $o['BearerToken'] = $this->BearerToken;
if (isset($this->RefreshToken)) $o['RefreshToken'] = $this->RefreshToken;
if (isset($this->RefreshTokenExpiry)) $o['RefreshTokenExpiry'] = JsonConverters::to('DateTime', $this->RefreshTokenExpiry);
if (isset($this->Roles)) $o['Roles'] = JsonConverters::toArray('string', $this->Roles);
if (isset($this->Permissions)) $o['Permissions'] = JsonConverters::toArray('string', $this->Permissions);
if (isset($this->RedirectUrl)) $o['RedirectUrl'] = $this->RedirectUrl;
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
if (isset($this->Meta)) $o['Meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Meta);
return empty($o) ? new class(){} : $o;
}
}
/** @description Sign Up */
// @Api(Description="Sign Up")
// @DataContract
class Register implements IPost, IMeta, JsonSerializable
{
public function __construct(
// @DataMember(Order=1)
/** @var string|null */
public ?string $UserName=null,
// @DataMember(Order=2)
/** @var string|null */
public ?string $FirstName=null,
// @DataMember(Order=3)
/** @var string|null */
public ?string $LastName=null,
// @DataMember(Order=4)
/** @var string|null */
public ?string $DisplayName=null,
// @DataMember(Order=5)
/** @var string|null */
public ?string $Email=null,
// @DataMember(Order=6)
/** @var string|null */
public ?string $Password=null,
// @DataMember(Order=7)
/** @var string|null */
public ?string $ConfirmPassword=null,
// @DataMember(Order=8)
/** @var bool|null */
public ?bool $AutoLogin=null,
// @DataMember(Order=10)
/** @var string|null */
public ?string $ErrorView=null,
// @DataMember(Order=11)
/** @var array<string,string>|null */
public ?array $Meta=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['UserName'])) $this->UserName = $o['UserName'];
if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
if (isset($o['LastName'])) $this->LastName = $o['LastName'];
if (isset($o['DisplayName'])) $this->DisplayName = $o['DisplayName'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['Password'])) $this->Password = $o['Password'];
if (isset($o['ConfirmPassword'])) $this->ConfirmPassword = $o['ConfirmPassword'];
if (isset($o['AutoLogin'])) $this->AutoLogin = $o['AutoLogin'];
if (isset($o['ErrorView'])) $this->ErrorView = $o['ErrorView'];
if (isset($o['Meta'])) $this->Meta = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['Meta']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->UserName)) $o['UserName'] = $this->UserName;
if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
if (isset($this->LastName)) $o['LastName'] = $this->LastName;
if (isset($this->DisplayName)) $o['DisplayName'] = $this->DisplayName;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->Password)) $o['Password'] = $this->Password;
if (isset($this->ConfirmPassword)) $o['ConfirmPassword'] = $this->ConfirmPassword;
if (isset($this->AutoLogin)) $o['AutoLogin'] = $this->AutoLogin;
if (isset($this->ErrorView)) $o['ErrorView'] = $this->ErrorView;
if (isset($this->Meta)) $o['Meta'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->Meta);
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /register HTTP/1.1
Host: duengageapi.uat.scadsoftware.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
UserName: String,
FirstName: String,
LastName: String,
DisplayName: String,
Email: String,
Password: String,
ConfirmPassword: String,
AutoLogin: False,
ErrorView: String,
Meta:
{
String: String
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
UserId: String,
SessionId: String,
UserName: String,
ReferrerUrl: String,
BearerToken: String,
RefreshToken: String,
RefreshTokenExpiry: 0001-01-01,
Roles:
[
String
],
Permissions:
[
String
],
RedirectUrl: String,
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
Meta:
{
String: String
}
}