Required role: | User |
PATCH | /app/user-info |
---|
<?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 AppUserInfo implements JsonSerializable
{
public function __construct(
/** @description The user's first name */
// @ApiMember(Description="The user's first name")
/** @var string|null */
public ?string $firstName=null,
/** @description The user's last name */
// @ApiMember(Description="The user's last name")
/** @var string|null */
public ?string $lastName=null,
/** @description Shortcut to the user's full name */
// @ApiMember(Description="Shortcut to the user's full name")
/** @var string|null */
public ?string $name=null,
/** @description The URL to the user's avatar */
// @ApiMember(Description="The URL to the user's avatar")
/** @var string|null */
public ?string $avatarUrl=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['firstName'])) $this->firstName = $o['firstName'];
if (isset($o['lastName'])) $this->lastName = $o['lastName'];
if (isset($o['name'])) $this->name = $o['name'];
if (isset($o['avatarUrl'])) $this->avatarUrl = $o['avatarUrl'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->firstName)) $o['firstName'] = $this->firstName;
if (isset($this->lastName)) $o['lastName'] = $this->lastName;
if (isset($this->name)) $o['name'] = $this->name;
if (isset($this->avatarUrl)) $o['avatarUrl'] = $this->avatarUrl;
return empty($o) ? new class(){} : $o;
}
}
/** @description Updates the user's info */
// @Api(Description="Updates the user's info")
class UpdateUserInfo implements IPatch, JsonSerializable
{
public function __construct(
/** @description The new first name */
// @ApiMember(Description="The new first name")
/** @var string|null */
public ?string $firstName=null,
/** @description The new last name */
// @ApiMember(Description="The new last name")
/** @var string|null */
public ?string $lastName=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['firstName'])) $this->firstName = $o['firstName'];
if (isset($o['lastName'])) $this->lastName = $o['lastName'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->firstName)) $o['firstName'] = $this->firstName;
if (isset($this->lastName)) $o['lastName'] = $this->lastName;
return empty($o) ? new class(){} : $o;
}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PATCH /app/user-info HTTP/1.1
Host: team.evovoice.io
Accept: application/json
Content-Type: application/json
Content-Length: length
{"firstName":"String","lastName":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"firstName":"String","lastName":"String","name":"String","avatarUrl":"String"}