POST | /superadmin/apikey | Creates an api key for the customer. |
---|
<?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};
// @ApiResponse(Description="", StatusCode=400)
// @ApiResponse(Description="Returned if the current user is not allowed to perform the action", StatusCode=401)
class CreateApiKeySuperAdminUser implements ICompany, JsonSerializable
{
public function __construct(
/** @description Enter the companyId for the customer */
// @ApiMember(Description="Enter the companyId for the customer", IsRequired=true, ParameterType="query")
/** @var string */
public string $CompanyId='',
// @ApiMember(IsRequired=true)
/** @var string */
public string $FirstName='',
// @ApiMember(IsRequired=true)
/** @var string */
public string $LastName='',
// @ApiMember(IsRequired=true)
/** @var string */
public string $ClientId='',
// @ApiMember(IsRequired=true)
/** @var array<string>|null */
public ?array $RedirectUrls=null,
// @ApiMember(IsRequired=true)
/** @var string */
public string $ContactEmail='',
// @ApiMember(IsRequired=true)
/** @var string */
public string $ContactPhone='',
// @ApiMember()
/** @var string|null */
public ?string $Notes=null,
// @ApiMember()
/** @var array<string>|null */
public ?array $WebOrigins=null,
// @ApiMember()
/** @var array<string>|null */
public ?array $DefaultClientScopes=null,
// @ApiMember()
/** @var array<string>|null */
public ?array $OptionalClientScopes=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
if (isset($o['LastName'])) $this->LastName = $o['LastName'];
if (isset($o['ClientId'])) $this->ClientId = $o['ClientId'];
if (isset($o['RedirectUrls'])) $this->RedirectUrls = JsonConverters::fromArray('string', $o['RedirectUrls']);
if (isset($o['ContactEmail'])) $this->ContactEmail = $o['ContactEmail'];
if (isset($o['ContactPhone'])) $this->ContactPhone = $o['ContactPhone'];
if (isset($o['Notes'])) $this->Notes = $o['Notes'];
if (isset($o['WebOrigins'])) $this->WebOrigins = JsonConverters::fromArray('string', $o['WebOrigins']);
if (isset($o['DefaultClientScopes'])) $this->DefaultClientScopes = JsonConverters::fromArray('string', $o['DefaultClientScopes']);
if (isset($o['OptionalClientScopes'])) $this->OptionalClientScopes = JsonConverters::fromArray('string', $o['OptionalClientScopes']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
if (isset($this->LastName)) $o['LastName'] = $this->LastName;
if (isset($this->ClientId)) $o['ClientId'] = $this->ClientId;
if (isset($this->RedirectUrls)) $o['RedirectUrls'] = JsonConverters::toArray('string', $this->RedirectUrls);
if (isset($this->ContactEmail)) $o['ContactEmail'] = $this->ContactEmail;
if (isset($this->ContactPhone)) $o['ContactPhone'] = $this->ContactPhone;
if (isset($this->Notes)) $o['Notes'] = $this->Notes;
if (isset($this->WebOrigins)) $o['WebOrigins'] = JsonConverters::toArray('string', $this->WebOrigins);
if (isset($this->DefaultClientScopes)) $o['DefaultClientScopes'] = JsonConverters::toArray('string', $this->DefaultClientScopes);
if (isset($this->OptionalClientScopes)) $o['OptionalClientScopes'] = JsonConverters::toArray('string', $this->OptionalClientScopes);
return empty($o) ? new class(){} : $o;
}
}
PHP CreateApiKeySuperAdminUser DTOs
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 /superadmin/apikey HTTP/1.1
Host: api.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
FirstName: String,
LastName: String,
ClientId: String,
RedirectUrls:
[
String
],
ContactEmail: String,
ContactPhone: String,
Notes: String,
WebOrigins:
[
String
],
DefaultClientScopes:
[
String
],
OptionalClientScopes:
[
String
]
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { }