POST | /v1/User/RefreshToken | Refresh user token before timeout |
---|
<?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 Account implements JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $GasUserId=null,
/** @var int */
public int $UserId=0,
/** @var array<int>|null */
public ?array $UserRoleId=null,
/** @var string|null */
public ?string $UserRoleRedirectUrl=null,
/** @var string */
public string $UserToken='',
/** @var string|null */
public ?string $RetailerGroupId=null,
/** @var DateTime */
public DateTime $Modified=new DateTime(),
/** @var bool|null */
public ?bool $Exists=null,
/** @var string|null */
public ?string $DefaultVehicleType=null,
/** @var string|null */
public ?string $DefaultRetailerGssn=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['GasUserId'])) $this->GasUserId = $o['GasUserId'];
if (isset($o['UserId'])) $this->UserId = $o['UserId'];
if (isset($o['UserRoleId'])) $this->UserRoleId = JsonConverters::fromArray('int', $o['UserRoleId']);
if (isset($o['UserRoleRedirectUrl'])) $this->UserRoleRedirectUrl = $o['UserRoleRedirectUrl'];
if (isset($o['UserToken'])) $this->UserToken = $o['UserToken'];
if (isset($o['RetailerGroupId'])) $this->RetailerGroupId = $o['RetailerGroupId'];
if (isset($o['Modified'])) $this->Modified = JsonConverters::from('DateTime', $o['Modified']);
if (isset($o['Exists'])) $this->Exists = $o['Exists'];
if (isset($o['DefaultVehicleType'])) $this->DefaultVehicleType = $o['DefaultVehicleType'];
if (isset($o['DefaultRetailerGssn'])) $this->DefaultRetailerGssn = $o['DefaultRetailerGssn'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->GasUserId)) $o['GasUserId'] = $this->GasUserId;
if (isset($this->UserId)) $o['UserId'] = $this->UserId;
if (isset($this->UserRoleId)) $o['UserRoleId'] = JsonConverters::toArray('int', $this->UserRoleId);
if (isset($this->UserRoleRedirectUrl)) $o['UserRoleRedirectUrl'] = $this->UserRoleRedirectUrl;
if (isset($this->UserToken)) $o['UserToken'] = $this->UserToken;
if (isset($this->RetailerGroupId)) $o['RetailerGroupId'] = $this->RetailerGroupId;
if (isset($this->Modified)) $o['Modified'] = JsonConverters::to('DateTime', $this->Modified);
if (isset($this->Exists)) $o['Exists'] = $this->Exists;
if (isset($this->DefaultVehicleType)) $o['DefaultVehicleType'] = $this->DefaultVehicleType;
if (isset($this->DefaultRetailerGssn)) $o['DefaultRetailerGssn'] = $this->DefaultRetailerGssn;
return empty($o) ? new class(){} : $o;
}
}
class RefreshUserTokenResponse implements JsonSerializable
{
public function __construct(
/** @var Account|null */
public ?Account $Account=null,
/** @var bool|null */
public ?bool $IsValid=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Account'])) $this->Account = JsonConverters::from('Account', $o['Account']);
if (isset($o['IsValid'])) $this->IsValid = $o['IsValid'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Account)) $o['Account'] = JsonConverters::to('Account', $this->Account);
if (isset($this->IsValid)) $o['IsValid'] = $this->IsValid;
return empty($o) ? new class(){} : $o;
}
}
class RefreshUserTokenRequest implements IPost, JsonSerializable
{
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
return empty($o) ? new class(){} : $o;
}
}
PHP RefreshUserTokenRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/User/RefreshToken HTTP/1.1
Host: prod-api-auth-mb-dhc.rapp-customers.co.uk
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"Account":{"GasUserId":"String","UserId":0,"UserRoleId":[0],"UserRoleRedirectUrl":"String","UserToken":"00000000000000000000000000000000","RetailerGroupId":"String","Modified":"\/Date(-62135596800000-0000)\/","Exists":false,"DefaultVehicleType":"String","DefaultRetailerGssn":"String"},"IsValid":false}