POST | /authorization |
---|
<?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 GetAuthorizationResponse implements JsonSerializable
{
public function __construct(
/** @var bool|null */
public ?bool $isAuthorized=null,
/** @var array<string,string>|null */
public ?array $parameters=null,
/** @var string|null */
public ?string $userObjectId=null,
/** @var string|null */
public ?string $userTenant=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['isAuthorized'])) $this->isAuthorized = $o['isAuthorized'];
if (isset($o['parameters'])) $this->parameters = JsonConverters::from(JsonConverters::context('Dictionary',genericArgs:['string','string']), $o['parameters']);
if (isset($o['userObjectId'])) $this->userObjectId = $o['userObjectId'];
if (isset($o['userTenant'])) $this->userTenant = $o['userTenant'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->isAuthorized)) $o['isAuthorized'] = $this->isAuthorized;
if (isset($this->parameters)) $o['parameters'] = JsonConverters::to(JsonConverters::context('Dictionary',genericArgs:['string','string']), $this->parameters);
if (isset($this->userObjectId)) $o['userObjectId'] = $this->userObjectId;
if (isset($this->userTenant)) $o['userTenant'] = $this->userTenant;
return empty($o) ? new class(){} : $o;
}
}
class GetAuthorizationPost implements IGetAuthorization, JsonSerializable
{
public function __construct(
// @ApiMember()
/** @var string|null */
public ?string $serviceName=null,
// @ApiMember()
/** @var string|null */
public ?string $tokenString=null,
// @ApiMember()
/** @var string|null */
public ?string $userTokenString=null,
// @ApiMember()
/** @var string|null */
public ?string $profile=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['serviceName'])) $this->serviceName = $o['serviceName'];
if (isset($o['tokenString'])) $this->tokenString = $o['tokenString'];
if (isset($o['userTokenString'])) $this->userTokenString = $o['userTokenString'];
if (isset($o['profile'])) $this->profile = $o['profile'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->serviceName)) $o['serviceName'] = $this->serviceName;
if (isset($this->tokenString)) $o['tokenString'] = $this->tokenString;
if (isset($this->userTokenString)) $o['userTokenString'] = $this->userTokenString;
if (isset($this->profile)) $o['profile'] = $this->profile;
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.
POST /authorization HTTP/1.1
Host: nkapi-sgepz3-auth-r1.azurewebsites.net
Accept: application/json
Content-Type: application/json
Content-Length: length
{"serviceName":"String","tokenString":"String","userTokenString":"String","profile":"String"}
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"isAuthorized":false,"parameters":{"String":"String"},"userTenant":"String"}