Client_Initiations

<back to all web services

ConsumerInitiation

Consumer Initiation Service

Requires Authentication
The following routes are available for this service:
POST/consumerinitiation
<?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 ValidateError implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $ErrorNumber=null,
        /** @var string|null */
        public ?string $ErrorDescription=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ErrorNumber'])) $this->ErrorNumber = $o['ErrorNumber'];
        if (isset($o['ErrorDescription'])) $this->ErrorDescription = $o['ErrorDescription'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ErrorNumber)) $o['ErrorNumber'] = $this->ErrorNumber;
        if (isset($this->ErrorDescription)) $o['ErrorDescription'] = $this->ErrorDescription;
        return empty($o) ? new class(){} : $o;
    }
}

class ConsumerInitiationResponse implements JsonSerializable
{
    public function __construct(
        /** @description Response message */
        // @ApiMember(Description="Response message")
        /** @var string|null */
        public ?string $Message=null,

        /** @description File identifier for the created initiation */
        // @ApiMember(Description="File identifier for the created initiation")
        /** @var string|null */
        public ?string $FileId=null,

        /** @description List of validation errors, if any */
        // @ApiMember(Description="List of validation errors, if any")
        /** @var array<ValidateError>|null */
        public ?array $Errors=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Message'])) $this->Message = $o['Message'];
        if (isset($o['FileId'])) $this->FileId = $o['FileId'];
        if (isset($o['Errors'])) $this->Errors = JsonConverters::fromArray('ValidateError', $o['Errors']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Message)) $o['Message'] = $this->Message;
        if (isset($this->FileId)) $o['FileId'] = $this->FileId;
        if (isset($this->Errors)) $o['Errors'] = JsonConverters::toArray('ValidateError', $this->Errors);
        return empty($o) ? new class(){} : $o;
    }
}

class RelocationsRequestFileTransfereeDetails implements JsonSerializable
{
    public function __construct(
        /** @description First name of the transferee */
        // @ApiMember(Description="First name of the transferee", IsRequired=true)
        /** @var string */
        public string $FirstName='',

        /** @description Last name of the transferee */
        // @ApiMember(Description="Last name of the transferee", IsRequired=true)
        /** @var string */
        public string $LastName='',

        /** @description Preferred email address */
        // @ApiMember(Description="Preferred email address", IsRequired=true)
        /** @var string */
        public string $PreferredEmail=''
    ) {
    }

    /** @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['PreferredEmail'])) $this->PreferredEmail = $o['PreferredEmail'];
    }
    
    /** @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->PreferredEmail)) $o['PreferredEmail'] = $this->PreferredEmail;
        return empty($o) ? new class(){} : $o;
    }
}

class AssignmentLocationDetails implements JsonSerializable
{
    public function __construct(
        /** @description Work city */
        // @ApiMember(Description="Work city", IsRequired=true)
        /** @var string */
        public string $WorkCity='',

        /** @description Current work location state */
        // @ApiMember(Description="Current work location state")
        /** @var string|null */
        public ?string $CurrentWorkState=null,

        /** @description Work state or province */
        // @ApiMember(Description="Work state or province")
        /** @var string|null */
        public ?string $WorkState=null,

        /** @description Destination work location state */
        // @ApiMember(Description="Destination work location state")
        /** @var string|null */
        public ?string $DestinationWorkState=null,

        /** @description Work country */
        // @ApiMember(Description="Work country", IsRequired=true)
        /** @var string */
        public string $WorkCountry='',

        /** @description Preferred work location state */
        // @ApiMember(Description="Preferred work location state")
        /** @var string|null */
        public ?string $PreferredWorkState=null,

        /** @description Preferred work location country */
        // @ApiMember(Description="Preferred work location country")
        /** @var string|null */
        public ?string $PreferredWorkCountry=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['WorkCity'])) $this->WorkCity = $o['WorkCity'];
        if (isset($o['CurrentWorkState'])) $this->CurrentWorkState = $o['CurrentWorkState'];
        if (isset($o['WorkState'])) $this->WorkState = $o['WorkState'];
        if (isset($o['DestinationWorkState'])) $this->DestinationWorkState = $o['DestinationWorkState'];
        if (isset($o['WorkCountry'])) $this->WorkCountry = $o['WorkCountry'];
        if (isset($o['PreferredWorkState'])) $this->PreferredWorkState = $o['PreferredWorkState'];
        if (isset($o['PreferredWorkCountry'])) $this->PreferredWorkCountry = $o['PreferredWorkCountry'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->WorkCity)) $o['WorkCity'] = $this->WorkCity;
        if (isset($this->CurrentWorkState)) $o['CurrentWorkState'] = $this->CurrentWorkState;
        if (isset($this->WorkState)) $o['WorkState'] = $this->WorkState;
        if (isset($this->DestinationWorkState)) $o['DestinationWorkState'] = $this->DestinationWorkState;
        if (isset($this->WorkCountry)) $o['WorkCountry'] = $this->WorkCountry;
        if (isset($this->PreferredWorkState)) $o['PreferredWorkState'] = $this->PreferredWorkState;
        if (isset($this->PreferredWorkCountry)) $o['PreferredWorkCountry'] = $this->PreferredWorkCountry;
        return empty($o) ? new class(){} : $o;
    }
}

class RelocationsRequestFileAssignmentDetails implements JsonSerializable
{
    public function __construct(
        /** @description Program name or code */
        // @ApiMember(Description="Program name or code", IsRequired=true)
        /** @var string */
        public string $Program='',

        /** @description Type of assignment */
        // @ApiMember(Description="Type of assignment", IsRequired=true)
        /** @var string */
        public string $AssignmentType='',

        /** @description Assignment start date */
        // @ApiMember(Description="Assignment start date", IsRequired=true)
        /** @var DateTime */
        public DateTime $StartDate=new DateTime(),

        /** @description Company name */
        // @ApiMember(Description="Company name", IsRequired=true)
        /** @var string */
        public string $CompanyName='',

        /** @description Contact */
        // @ApiMember(Description="Contact", IsRequired=true)
        /** @var string */
        public string $Contact='',

        /** @description Current assignment location details */
        // @ApiMember(Description="Current assignment location details", IsRequired=true)
        /** @var AssignmentLocationDetails|null */
        public ?AssignmentLocationDetails $Current=null,

        /** @description Destination assignment location details */
        // @ApiMember(Description="Destination assignment location details", IsRequired=true)
        /** @var AssignmentLocationDetails|null */
        public ?AssignmentLocationDetails $Destination=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Program'])) $this->Program = $o['Program'];
        if (isset($o['AssignmentType'])) $this->AssignmentType = $o['AssignmentType'];
        if (isset($o['StartDate'])) $this->StartDate = JsonConverters::from('DateTime', $o['StartDate']);
        if (isset($o['CompanyName'])) $this->CompanyName = $o['CompanyName'];
        if (isset($o['Contact'])) $this->Contact = $o['Contact'];
        if (isset($o['Current'])) $this->Current = JsonConverters::from('AssignmentLocationDetails', $o['Current']);
        if (isset($o['Destination'])) $this->Destination = JsonConverters::from('AssignmentLocationDetails', $o['Destination']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Program)) $o['Program'] = $this->Program;
        if (isset($this->AssignmentType)) $o['AssignmentType'] = $this->AssignmentType;
        if (isset($this->StartDate)) $o['StartDate'] = JsonConverters::to('DateTime', $this->StartDate);
        if (isset($this->CompanyName)) $o['CompanyName'] = $this->CompanyName;
        if (isset($this->Contact)) $o['Contact'] = $this->Contact;
        if (isset($this->Current)) $o['Current'] = JsonConverters::to('AssignmentLocationDetails', $this->Current);
        if (isset($this->Destination)) $o['Destination'] = JsonConverters::to('AssignmentLocationDetails', $this->Destination);
        return empty($o) ? new class(){} : $o;
    }
}

class RelocationsRequestFile implements JsonSerializable
{
    public function __construct(
        /** @description Command type for the request (INITIATE) */
        // @ApiMember(Description="Command type for the request (INITIATE)", IsRequired=true)
        /** @var string */
        public string $Command='',

        /** @description External identifier for the transferee */
        // @ApiMember(Description="External identifier for the transferee", IsRequired=true)
        /** @var string */
        public string $ExternalID='',

        /** @description Details about the transferee */
        // @ApiMember(Description="Details about the transferee", IsRequired=true)
        /** @var RelocationsRequestFileTransfereeDetails|null */
        public ?RelocationsRequestFileTransfereeDetails $TransfereeDetails=null,

        /** @description List of addresses associated with the transferee */
        // @ApiMember(Description="List of addresses associated with the transferee", IsRequired=true)
        /** @var RelocationsRequestFileAddress[] */
        public array $Addresses=[],

        /** @description List of phone numbers associated with the transferee */
        // @ApiMember(Description="List of phone numbers associated with the transferee", IsRequired=true)
        /** @var RelocationsRequestFilePhone[] */
        public array $Phones=[],

        /** @description Assignment details for the relocation */
        // @ApiMember(Description="Assignment details for the relocation", IsRequired=true)
        /** @var RelocationsRequestFileAssignmentDetails|null */
        public ?RelocationsRequestFileAssignmentDetails $AssignmentDetails=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Command'])) $this->Command = $o['Command'];
        if (isset($o['ExternalID'])) $this->ExternalID = $o['ExternalID'];
        if (isset($o['TransfereeDetails'])) $this->TransfereeDetails = JsonConverters::from('RelocationsRequestFileTransfereeDetails', $o['TransfereeDetails']);
        if (isset($o['Addresses'])) $this->Addresses = JsonConverters::fromArray('RelocationsRequestFileAddress', $o['Addresses']);
        if (isset($o['Phones'])) $this->Phones = JsonConverters::fromArray('RelocationsRequestFilePhone', $o['Phones']);
        if (isset($o['AssignmentDetails'])) $this->AssignmentDetails = JsonConverters::from('RelocationsRequestFileAssignmentDetails', $o['AssignmentDetails']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Command)) $o['Command'] = $this->Command;
        if (isset($this->ExternalID)) $o['ExternalID'] = $this->ExternalID;
        if (isset($this->TransfereeDetails)) $o['TransfereeDetails'] = JsonConverters::to('RelocationsRequestFileTransfereeDetails', $this->TransfereeDetails);
        if (isset($this->Addresses)) $o['Addresses'] = JsonConverters::toArray('RelocationsRequestFileAddress', $this->Addresses);
        if (isset($this->Phones)) $o['Phones'] = JsonConverters::toArray('RelocationsRequestFilePhone', $this->Phones);
        if (isset($this->AssignmentDetails)) $o['AssignmentDetails'] = JsonConverters::to('RelocationsRequestFileAssignmentDetails', $this->AssignmentDetails);
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Consumer Initiation Service */
// @Api(Description="Consumer Initiation Service")
// @ApiResponse(Description="Returned when the consumer initiation was successfully processed", StatusCode=200)
// @ApiResponse(Description="Returned if the request validation failed", StatusCode=400)
// @ApiResponse(Description="Returned if the client is not authorized", StatusCode=401)
// @ApiResponse(Description="Returned if an error occurred while processing the request", StatusCode=500)
class ConsumerInitiation implements IPost, JsonSerializable
{
    public function __construct(
        /** @description Client identifier */
        // @ApiMember(Description="Client identifier", IsRequired=true)
        /** @var string */
        public string $ClientID='',

        /** @description Consumer relocation request file details */
        // @ApiMember(Description="Consumer relocation request file details", IsRequired=true)
        /** @var RelocationsRequestFile|null */
        public ?RelocationsRequestFile $File=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ClientID'])) $this->ClientID = $o['ClientID'];
        if (isset($o['File'])) $this->File = JsonConverters::from('RelocationsRequestFile', $o['File']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ClientID)) $o['ClientID'] = $this->ClientID;
        if (isset($this->File)) $o['File'] = JsonConverters::to('RelocationsRequestFile', $this->File);
        return empty($o) ? new class(){} : $o;
    }
}

enum AddressType : string
{
    case CurrentHome = 'CurrentHome';
    case DestinationHome = 'DestinationHome';
    case CurrentWork = 'CurrentWork';
    case DestinationWork = 'DestinationWork';
}

enum YesNo : string
{
    case Y = 'Y';
    case N = 'N';
    case Item = 'Item';
}

class RelocationsRequestFileAddress implements JsonSerializable
{
    public function __construct(
        /** @description Type of address (CurrentHome, DestinationHome, CurrentWork, DestinationWork) */
        // @ApiMember(Description="Type of address (CurrentHome, DestinationHome, CurrentWork, DestinationWork)", IsRequired=true)
        /** @var AddressType|null */
        public ?AddressType $AddressType=null,

        /** @description Indicates if this is the primary address */
        // @ApiMember(Description="Indicates if this is the primary address", IsRequired=true)
        /** @var YesNo|null */
        public ?YesNo $Primary=null,

        /** @description Address line 1 */
        // @ApiMember(Description="Address line 1", IsRequired=true)
        /** @var string */
        public string $AddressLine1='',

        /** @description City */
        // @ApiMember(Description="City", IsRequired=true)
        /** @var string */
        public string $City='',

        /** @description Country */
        // @ApiMember(Description="Country", IsRequired=true)
        /** @var string */
        public string $Country=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AddressType'])) $this->AddressType = JsonConverters::from('AddressType', $o['AddressType']);
        if (isset($o['Primary'])) $this->Primary = JsonConverters::from('YesNo', $o['Primary']);
        if (isset($o['AddressLine1'])) $this->AddressLine1 = $o['AddressLine1'];
        if (isset($o['City'])) $this->City = $o['City'];
        if (isset($o['Country'])) $this->Country = $o['Country'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AddressType)) $o['AddressType'] = JsonConverters::to('AddressType', $this->AddressType);
        if (isset($this->Primary)) $o['Primary'] = JsonConverters::to('YesNo', $this->Primary);
        if (isset($this->AddressLine1)) $o['AddressLine1'] = $this->AddressLine1;
        if (isset($this->City)) $o['City'] = $this->City;
        if (isset($this->Country)) $o['Country'] = $this->Country;
        return empty($o) ? new class(){} : $o;
    }
}

class RelocationsRequestFilePhone implements JsonSerializable
{
    public function __construct(
        /** @description Phone type (e.g., Mobile, OriginHome) */
        // @ApiMember(Description="Phone type (e.g., Mobile, OriginHome)", IsRequired=true)
        /** @var string */
        public string $Type='',

        /** @description Indicates if this is the primary phone number */
        // @ApiMember(Description="Indicates if this is the primary phone number", IsRequired=true)
        /** @var YesNo|null */
        public ?YesNo $Primary=null,

        /** @description Phone number */
        // @ApiMember(Description="Phone number", IsRequired=true)
        /** @var string */
        public string $Number=''
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Type'])) $this->Type = $o['Type'];
        if (isset($o['Primary'])) $this->Primary = JsonConverters::from('YesNo', $o['Primary']);
        if (isset($o['Number'])) $this->Number = $o['Number'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Type)) $o['Type'] = $this->Type;
        if (isset($this->Primary)) $o['Primary'] = JsonConverters::to('YesNo', $this->Primary);
        if (isset($this->Number)) $o['Number'] = $this->Number;
        return empty($o) ? new class(){} : $o;
    }
}

PHP ConsumerInitiation DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /consumerinitiation HTTP/1.1 
Host: initiation-pen.sirva.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"ClientID":"String","File":{"Command":"String","ExternalID":"String","TransfereeDetails":{"FirstName":"String","LastName":"String","PreferredEmail":"String"},"Addresses":[{"AddressType":"CurrentHome","Primary":"Y","AddressLine1":"String","City":"String","Country":"String"}],"Phones":[{"Type":"String","Primary":"Y","Number":"String"}],"AssignmentDetails":{"Program":"String","AssignmentType":"String","StartDate":"\/Date(-62135596800000-0000)\/","CompanyName":"String","Contact":"String","Current":{"WorkCity":"String","CurrentWorkState":"String","WorkState":"String","DestinationWorkState":"String","WorkCountry":"String","PreferredWorkState":"String","PreferredWorkCountry":"String"},"Destination":{"WorkCity":"String","CurrentWorkState":"String","WorkState":"String","DestinationWorkState":"String","WorkCountry":"String","PreferredWorkState":"String","PreferredWorkCountry":"String"}}}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Message":"String","FileId":"String","Errors":[{"ErrorNumber":"String","ErrorDescription":"String"}]}