| POST | /dependent | Add a dependent onto a user's profile. |
|---|
<?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 ApiServiceRequest implements IServiceRequest, IHasApiKey, JsonSerializable
{
public function __construct(
/** @description The API Key required for authentication */
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
/** @var string */
public string $ApiKey=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['ApiKey'])) $this->ApiKey = $o['ApiKey'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->ApiKey)) $o['ApiKey'] = $this->ApiKey;
return empty($o) ? new class(){} : $o;
}
}
class ApiServiceResponse implements IServiceResponse, JsonSerializable
{
public function __construct(
/** @var string|null */
public ?string $Description=null,
/** @var string|null */
public ?string $Heading=null,
/** @var bool|null */
public ?bool $WasSuccessful=null,
/** @var Object|null */
public ?Object $ModelState=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Description'])) $this->Description = $o['Description'];
if (isset($o['Heading'])) $this->Heading = $o['Heading'];
if (isset($o['WasSuccessful'])) $this->WasSuccessful = $o['WasSuccessful'];
if (isset($o['ModelState'])) $this->ModelState = JsonConverters::from('Object', $o['ModelState']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Description)) $o['Description'] = $this->Description;
if (isset($this->Heading)) $o['Heading'] = $this->Heading;
if (isset($this->WasSuccessful)) $o['WasSuccessful'] = $this->WasSuccessful;
if (isset($this->ModelState)) $o['ModelState'] = JsonConverters::to('Object', $this->ModelState);
return empty($o) ? new class(){} : $o;
}
}
class DependentData implements JsonSerializable
{
public function __construct(
/** @description Dependent's Galaxy Id used for referring to or deleting. */
// @ApiMember(Description="Dependent's Galaxy Id used for referring to or deleting.", IsRequired=true)
/** @var int */
public int $DependentId=0,
/** @description Dependent's first name. */
// @ApiMember(Description="Dependent's first name.", IsRequired=true)
/** @var string */
public string $FirstName='',
/** @description Dependent's surname. */
// @ApiMember(Description="Dependent's surname.", IsRequired=true)
/** @var string */
public string $Surname='',
/** @description Dependent's mobile contact number. */
// @ApiMember(Description="Dependent's mobile contact number.", IsRequired=true)
/** @var string */
public string $MobileNumber='',
/** @description Dependent's email address. */
// @ApiMember(Description="Dependent's email address.", IsRequired=true)
/** @var string */
public string $Email='',
/** @description Depdendent's ID number. */
// @ApiMember(Description="Depdendent's ID number.", IsRequired=true)
/** @var string */
public string $IdNumber=''
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['DependentId'])) $this->DependentId = $o['DependentId'];
if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
if (isset($o['Surname'])) $this->Surname = $o['Surname'];
if (isset($o['MobileNumber'])) $this->MobileNumber = $o['MobileNumber'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['IdNumber'])) $this->IdNumber = $o['IdNumber'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->DependentId)) $o['DependentId'] = $this->DependentId;
if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
if (isset($this->Surname)) $o['Surname'] = $this->Surname;
if (isset($this->MobileNumber)) $o['MobileNumber'] = $this->MobileNumber;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->IdNumber)) $o['IdNumber'] = $this->IdNumber;
return empty($o) ? new class(){} : $o;
}
}
class AddDependentResponse extends ApiServiceResponse implements JsonSerializable
{
/**
* @param string|null $Description
* @param string|null $Heading
* @param bool|null $WasSuccessful
* @param Object|null $ModelState
*/
public function __construct(
?string $Description=null,
?string $Heading=null,
?bool $WasSuccessful=null,
?Object $ModelState=null,
/** @description Updated list of the user's dependents. */
// @ApiMember(Description="Updated list of the user's dependents.")
/** @var array<DependentData>|null */
public ?array $Dependents=null
) {
parent::__construct($Description,$Heading,$WasSuccessful,$ModelState);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['Dependents'])) $this->Dependents = JsonConverters::fromArray('DependentData', $o['Dependents']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->Dependents)) $o['Dependents'] = JsonConverters::toArray('DependentData', $this->Dependents);
return empty($o) ? new class(){} : $o;
}
}
class AddDependent extends ApiServiceRequest implements JsonSerializable
{
/**
* @param string $ApiKey
*/
public function __construct(
string $ApiKey='',
/** @description ID Number of the primary user you wish to add a dependent onto. */
// @ApiMember(Description="ID Number of the primary user you wish to add a dependent onto.", IsRequired=true)
/** @var string */
public string $IdNumber='',
/** @description Data of the dependent. */
// @ApiMember(Description="Data of the dependent.", IsRequired=true)
/** @var DependentData|null */
public ?DependentData $DependentData=null
) {
parent::__construct($ApiKey);
}
/** @throws Exception */
public function fromMap($o): void {
parent::fromMap($o);
if (isset($o['IdNumber'])) $this->IdNumber = $o['IdNumber'];
if (isset($o['DependentData'])) $this->DependentData = JsonConverters::from('DependentData', $o['DependentData']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = parent::jsonSerialize();
if (isset($this->IdNumber)) $o['IdNumber'] = $this->IdNumber;
if (isset($this->DependentData)) $o['DependentData'] = JsonConverters::to('DependentData', $this->DependentData);
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.
POST /dependent HTTP/1.1
Host: galaxymobile.api.client.prod.86degrees.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
IdNumber: String,
DependentData:
{
DependentId: 0,
FirstName: String,
Surname: String,
MobileNumber: String,
Email: String,
IdNumber: String
},
ApiKey: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Dependents:
[
{
DependentId: 0,
FirstName: String,
Surname: String,
MobileNumber: String,
Email: String,
IdNumber: String
}
],
Description: String,
Heading: String,
WasSuccessful: False,
ModelState: {}
}