GET | /MyInfo |
---|
<?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 MyInfo implements JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
class UserInfo implements JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var string|null */
public ?string $userAuthId=null,
/** @var string|null */
public ?string $nickName=null,
/** @var string|null */
public ?string $firstName=null,
/** @var string|null */
public ?string $lastName=null,
/** @var string|null */
public ?string $email=null,
/** @var string|null */
public ?string $company=null,
/** @var string|null */
public ?string $phoneNumber=null,
/** @var string|null */
public ?string $addressLine1=null,
/** @var string|null */
public ?string $addressLine2=null,
/** @var string|null */
public ?string $addressCity=null,
/** @var string|null */
public ?string $addressZip=null,
/** @var string|null */
public ?string $addressState=null,
/** @var string|null */
public ?string $addressCountry=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['userAuthId'])) $this->userAuthId = $o['userAuthId'];
if (isset($o['nickName'])) $this->nickName = $o['nickName'];
if (isset($o['firstName'])) $this->firstName = $o['firstName'];
if (isset($o['lastName'])) $this->lastName = $o['lastName'];
if (isset($o['email'])) $this->email = $o['email'];
if (isset($o['company'])) $this->company = $o['company'];
if (isset($o['phoneNumber'])) $this->phoneNumber = $o['phoneNumber'];
if (isset($o['addressLine1'])) $this->addressLine1 = $o['addressLine1'];
if (isset($o['addressLine2'])) $this->addressLine2 = $o['addressLine2'];
if (isset($o['addressCity'])) $this->addressCity = $o['addressCity'];
if (isset($o['addressZip'])) $this->addressZip = $o['addressZip'];
if (isset($o['addressState'])) $this->addressState = $o['addressState'];
if (isset($o['addressCountry'])) $this->addressCountry = $o['addressCountry'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->userAuthId)) $o['userAuthId'] = $this->userAuthId;
if (isset($this->nickName)) $o['nickName'] = $this->nickName;
if (isset($this->firstName)) $o['firstName'] = $this->firstName;
if (isset($this->lastName)) $o['lastName'] = $this->lastName;
if (isset($this->email)) $o['email'] = $this->email;
if (isset($this->company)) $o['company'] = $this->company;
if (isset($this->phoneNumber)) $o['phoneNumber'] = $this->phoneNumber;
if (isset($this->addressLine1)) $o['addressLine1'] = $this->addressLine1;
if (isset($this->addressLine2)) $o['addressLine2'] = $this->addressLine2;
if (isset($this->addressCity)) $o['addressCity'] = $this->addressCity;
if (isset($this->addressZip)) $o['addressZip'] = $this->addressZip;
if (isset($this->addressState)) $o['addressState'] = $this->addressState;
if (isset($this->addressCountry)) $o['addressCountry'] = $this->addressCountry;
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.
GET /MyInfo HTTP/1.1 Host: account.servicestack.net Accept: text/jsv
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { id: 0, userAuthId: String, nickName: String, firstName: String, lastName: String, email: String, company: String, phoneNumber: String, addressLine1: String, addressLine2: String, addressCity: String, addressZip: String, addressState: String, addressCountry: String }