| POST | /api/v1/users/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};
class UserRegister implements JsonSerializable
{
public function __construct(
/** @var string */
public string $userName='',
/** @var string */
public string $email='',
/** @var string */
public string $fullName='',
/** @var string */
public string $firstName='',
/** @var string */
public string $lastName='',
/** @var string */
public string $password='',
/** @var string */
public string $confirmPassword='',
/** @var string */
public string $phone='',
/** @var string */
public string $address='',
/** @var string */
public string $idNumber='',
/** @var DateTime|null */
public ?DateTime $idRegDate=null,
/** @var string */
public string $idAddressProvide='',
/** @var DateTime|null */
public ?DateTime $dob=null,
/** @var int */
public int $gender=0,
/** @var string */
public string $job='',
/** @var string */
public string $country='',
/** @var string */
public string $captcha='',
/** @var string */
public string $session='',
/** @var string */
public string $referenceSource='',
/** @var string */
public string $returnUrl=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['userName'])) $this->userName = $o['userName'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['fullName'])) $this->fullName = $o['fullName'];
if (isset($o['firstName'])) $this->firstName = $o['firstName'];
if (isset($o['lastName'])) $this->lastName = $o['lastName'];
if (isset($o['password'])) $this->password = $o['password'];
if (isset($o['confirmPassword'])) $this->confirmPassword = $o['confirmPassword'];
if (isset($o['phone'])) $this->phone = $o['phone'];
if (isset($o['address'])) $this->address = $o['address'];
if (isset($o['idNumber'])) $this->idNumber = $o['idNumber'];
if (isset($o['idRegDate'])) $this->idRegDate = JsonConverters::from('DateTime', $o['idRegDate']);
if (isset($o['idAddressProvide'])) $this->idAddressProvide = $o['idAddressProvide'];
if (isset($o['dob'])) $this->dob = JsonConverters::from('DateTime', $o['dob']);
if (isset($o['gender'])) $this->gender = $o['gender'];
if (isset($o['job'])) $this->job = $o['job'];
if (isset($o['country'])) $this->country = $o['country'];
if (isset($o['captcha'])) $this->captcha = $o['captcha'];
if (isset($o['session'])) $this->session = $o['session'];
if (isset($o['referenceSource'])) $this->referenceSource = $o['referenceSource'];
if (isset($o['returnUrl'])) $this->returnUrl = $o['returnUrl'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->userName)) $o['userName'] = $this->userName;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->fullName)) $o['fullName'] = $this->fullName;
if (isset($this->firstName)) $o['firstName'] = $this->firstName;
if (isset($this->lastName)) $o['lastName'] = $this->lastName;
if (isset($this->password)) $o['password'] = $this->password;
if (isset($this->confirmPassword)) $o['confirmPassword'] = $this->confirmPassword;
if (isset($this->phone)) $o['phone'] = $this->phone;
if (isset($this->address)) $o['address'] = $this->address;
if (isset($this->idNumber)) $o['idNumber'] = $this->idNumber;
if (isset($this->idRegDate)) $o['idRegDate'] = JsonConverters::to('DateTime', $this->idRegDate);
if (isset($this->idAddressProvide)) $o['idAddressProvide'] = $this->idAddressProvide;
if (isset($this->dob)) $o['dob'] = JsonConverters::to('DateTime', $this->dob);
if (isset($this->gender)) $o['gender'] = $this->gender;
if (isset($this->job)) $o['job'] = $this->job;
if (isset($this->country)) $o['country'] = $this->country;
if (isset($this->captcha)) $o['captcha'] = $this->captcha;
if (isset($this->session)) $o['session'] = $this->session;
if (isset($this->referenceSource)) $o['referenceSource'] = $this->referenceSource;
if (isset($this->returnUrl)) $o['returnUrl'] = $this->returnUrl;
return empty($o) ? new class(){} : $o;
}
}
class BannerListResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var string */
public string $title='',
/** @var string */
public string $image='',
/** @var string */
public string $url='',
/** @var bool|null */
public ?bool $publish=null,
/** @var DateTime */
public DateTime $publishDate=new DateTime(),
/** @var int */
public int $orderIndex=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['title'])) $this->title = $o['title'];
if (isset($o['image'])) $this->image = $o['image'];
if (isset($o['url'])) $this->url = $o['url'];
if (isset($o['publish'])) $this->publish = $o['publish'];
if (isset($o['publishDate'])) $this->publishDate = JsonConverters::from('DateTime', $o['publishDate']);
if (isset($o['orderIndex'])) $this->orderIndex = $o['orderIndex'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->title)) $o['title'] = $this->title;
if (isset($this->image)) $o['image'] = $this->image;
if (isset($this->url)) $o['url'] = $this->url;
if (isset($this->publish)) $o['publish'] = $this->publish;
if (isset($this->publishDate)) $o['publishDate'] = JsonConverters::to('DateTime', $this->publishDate);
if (isset($this->orderIndex)) $o['orderIndex'] = $this->orderIndex;
return empty($o) ? new class(){} : $o;
}
}
/**
* @template T
*/
class BaseResponse implements IResponseRequest, JsonSerializable
{
public array $genericArgs = [];
public static function create(array $genericArgs=[]): BaseResponse {
$to = new BaseResponse();
$to->genericArgs = $genericArgs;
return $to;
}
public function __construct(
/** @var int */
public mixed $code=0,
/** @var string|null */
public mixed $message=null,
/** @var array<BannerListResponse>|null */
public mixed $data=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['code'])) $this->code = $o['code'];
if (isset($o['message'])) $this->message = $o['message'];
if (isset($o['data'])) $this->data = JsonConverters::fromArray('BannerListResponse', $o['data']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->code)) $o['code'] = $this->code;
if (isset($this->message)) $o['message'] = $this->message;
if (isset($this->data)) $o['data'] = JsonConverters::toArray('BannerListResponse', $this->data);
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 /api/v1/users/register HTTP/1.1
Host: efun-id-api-sandbox.efun.vn
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
userName: String,
email: String,
fullName: String,
firstName: String,
lastName: String,
password: String,
confirmPassword: String,
phone: String,
address: String,
idNumber: String,
idRegDate: "0001-01-01T00:00:00.0000000+07:06",
idAddressProvide: String,
dob: "0001-01-01T00:00:00.0000000+07:06",
gender: 0,
job: String,
country: String,
captcha: String,
session: String,
referenceSource: String,
returnUrl: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
code: 0,
message: String,
data:
{
id: 0,
username: String,
first_name: String,
last_name: String,
full_name: String,
email: String,
phone_number: String,
is_play_now: 0,
status: 0
}
}