Platform Subscription API

<back to all web services

SaveContact

Inserts or Updates a contact and its details and roles.

Requires Authentication
<?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 RuleValidationResult implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $RuleCode=null,
        /** @var string|null */
        public ?string $Message=null,
        /** @var string|null */
        public ?string $Key=null,
        /** @var string|null */
        public ?string $Tag=null,
        /** @var string|null */
        public ?string $ErrorCode=null
    ) {
    }

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

class ValidationErrorList implements JsonSerializable
{
    public function __construct(
        /** @var array<RuleValidationResult>|null */
        public ?array $ValidationErrors=null
    ) {
    }

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

class ContactRole implements JsonSerializable
{
    public function __construct(
        /** @description Guid of the Role List Item object within Eros. */
        // @ApiMember(DataType="Guid", Description="Guid of the Role List Item object within Eros.", IsRequired=true, Name="RoleId", ParameterType="query")
        /** @var string */
        public string $RoleId='',

        /** @description The unique key that represents the role type on the external system. */
        // @ApiMember(DataType="string", Description="The unique key that represents the role type on the external system.", Name="AlternateKey", ParameterType="query")
        /** @var string|null */
        public ?string $AlternateKey=null
    ) {
    }

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

class LocationCoordinatesModel implements JsonSerializable
{
    public function __construct(
        /** @description The latitude of an address - geographic coordinates specifying the north-south position of a point on the Earth's surface. */
        // @ApiMember(DataType="Double?", Description="The latitude of an address - geographic coordinates specifying the north-south position of a point on the Earth's surface.", IsRequired=true, Name="Latitude", ParameterType="query")
        /** @var float */
        public float $Latitude=0.0,

        /** @description The longitude of an address - geographic coordinates specifying the east-west position of a point on the Earth's surface. */
        // @ApiMember(DataType="Double?", Description="The longitude of an address - geographic coordinates specifying the east-west position of a point on the Earth's surface.", IsRequired=true, Name="Longitude", ParameterType="query")
        /** @var float */
        public float $Longitude=0.0,

        /** @description The altitude of an address - the altitude above sea level. */
        // @ApiMember(DataType="Double?", Description="The altitude of an address - the altitude above sea level.", Name="Altitude", ParameterType="query")
        /** @var float|null */
        public ?float $Altitude=null,

        /** @description Accuracy of the latitude and longitude. */
        // @ApiMember(DataType="Double?", Description="Accuracy of the latitude and longitude.", Name="Accuracy", ParameterType="query")
        /** @var float|null */
        public ?float $Accuracy=null,

        /** @description Accurancy of the Altitude. */
        // @ApiMember(DataType="Double?", Description="Accurancy of the Altitude.", Name="AltitudeAccuracy", ParameterType="query")
        /** @var float|null */
        public ?float $AltitudeAccuracy=null,

        /** @description Direction you are heading. */
        // @ApiMember(DataType="Double?", Description="Direction you are heading.", Name="Heading", ParameterType="query")
        /** @var float|null */
        public ?float $Heading=null,

        /** @description Speed you are going. */
        // @ApiMember(DataType="Double?", Description="Speed you are going.", Name="Speed", ParameterType="query")
        /** @var float|null */
        public ?float $Speed=null,

        /** @description Speed your altitude is ascending/descending at. */
        // @ApiMember(DataType="Double?", Description="Speed your altitude is ascending/descending at.", Name="VerticalSpeed", ParameterType="query")
        /** @var float|null */
        public ?float $VerticalSpeed=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Latitude'])) $this->Latitude = $o['Latitude'];
        if (isset($o['Longitude'])) $this->Longitude = $o['Longitude'];
        if (isset($o['Altitude'])) $this->Altitude = $o['Altitude'];
        if (isset($o['Accuracy'])) $this->Accuracy = $o['Accuracy'];
        if (isset($o['AltitudeAccuracy'])) $this->AltitudeAccuracy = $o['AltitudeAccuracy'];
        if (isset($o['Heading'])) $this->Heading = $o['Heading'];
        if (isset($o['Speed'])) $this->Speed = $o['Speed'];
        if (isset($o['VerticalSpeed'])) $this->VerticalSpeed = $o['VerticalSpeed'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Latitude)) $o['Latitude'] = $this->Latitude;
        if (isset($this->Longitude)) $o['Longitude'] = $this->Longitude;
        if (isset($this->Altitude)) $o['Altitude'] = $this->Altitude;
        if (isset($this->Accuracy)) $o['Accuracy'] = $this->Accuracy;
        if (isset($this->AltitudeAccuracy)) $o['AltitudeAccuracy'] = $this->AltitudeAccuracy;
        if (isset($this->Heading)) $o['Heading'] = $this->Heading;
        if (isset($this->Speed)) $o['Speed'] = $this->Speed;
        if (isset($this->VerticalSpeed)) $o['VerticalSpeed'] = $this->VerticalSpeed;
        return empty($o) ? new class(){} : $o;
    }
}

class AddressModel implements JsonSerializable
{
    public function __construct(
        /** @description The distance between this project and another specified set of gps coordinates. */
        // @ApiMember(DataType="double", Description="The distance between this project and another specified set of gps coordinates.", Name="DistanceAway", ParameterType="query")
        /** @var float */
        public float $DistanceAway=0.0,

        /** @description The latitude of an address - geographic coordinates specifying the north-south position of a point on the Earth's surface. */
        // @ApiMember(DataType="Double?", Description="The latitude of an address - geographic coordinates specifying the north-south position of a point on the Earth's surface.", IsRequired=true, Name="Latitude", ParameterType="query")
        /** @var float */
        public float $Latitude=0.0,

        /** @description The longitude of an address - geographic coordinates specifying the east-west position of a point on the Earth's surface. */
        // @ApiMember(DataType="Double?", Description="The longitude of an address - geographic coordinates specifying the east-west position of a point on the Earth's surface.", IsRequired=true, Name="Longitude", ParameterType="query")
        /** @var float */
        public float $Longitude=0.0,

        /** @description Address Format Id Guid - this will be determined by the service. */
        // @ApiMember(DataType="Guid", Description="Address Format Id Guid - this will be determined by the service.", Name="AddressFormatId", ParameterType="query")
        /** @var string */
        public string $AddressFormatId='',

        /** @description Suburb Id Guid - this will attempt to be determined by the SuburbName, StateShortName and Postcode entered. */
        // @ApiMember(DataType="Guid", Description="Suburb Id Guid - this will attempt to be determined by the SuburbName, StateShortName and Postcode entered.", Name="SuburbId", ParameterType="query")
        /** @var string */
        public string $SuburbId='',

        /** @description The suburb name. */
        // @ApiMember(DataType="string", Description="The suburb name.", Name="SuburbName", ParameterType="query")
        /** @var string|null */
        public ?string $SuburbName=null,

        /** @description The shortened State Name e.g Vic for Victoria. */
        // @ApiMember(DataType="string", Description="The shortened State Name e.g Vic for Victoria.", Name="StateShortName", ParameterType="query")
        /** @var string|null */
        public ?string $StateShortName=null,

        /** @description The suburb postcode. */
        // @ApiMember(DataType="string", Description="The suburb postcode.", Name="PostCode", ParameterType="query")
        /** @var string|null */
        public ?string $PostCode=null,

        /** @description Country Id Guid - this will be determined by the CountrName or ISOCountryCode entered. */
        // @ApiMember(DataType="Guid", Description="Country Id Guid - this will be determined by the CountrName or ISOCountryCode entered.", Name="CountryId", ParameterType="query")
        /** @var string */
        public string $CountryId='',

        /** @description the name of the country the address is within. */
        // @ApiMember(DataType="string", Description="the name of the country the address is within.", Name="CountryName", ParameterType="query")
        /** @var string|null */
        public ?string $CountryName=null,

        /** @description A 2 digit ISO Country Code representing the country. */
        // @ApiMember(DataType="string", Description="A 2 digit ISO Country Code representing the country.", Name="ISOCountryCode", ParameterType="query")
        /** @var string|null */
        public ?string $ISOCountryCode=null,

        /** @description The address Lot number. */
        // @ApiMember(DataType="string", Description="The address Lot number.", Name="LotNumber", ParameterType="query")
        /** @var string|null */
        public ?string $LotNumber=null,

        /** @description The address Sub Unit number. */
        // @ApiMember(DataType="string", Description="The address Sub Unit number.", Name="SubUnit", ParameterType="query")
        /** @var string|null */
        public ?string $SubUnit=null,

        /** @description The address building number. */
        // @ApiMember(DataType="string", Description="The address building number.", Name="BuildingNumber", ParameterType="query")
        /** @var string|null */
        public ?string $BuildingNumber=null,

        /** @description The address street number. */
        // @ApiMember(DataType="string", Description="The address street number.", Name="StreetNumber", ParameterType="query")
        /** @var string|null */
        public ?string $StreetNumber=null,

        /** @description The address street name including street type. */
        // @ApiMember(DataType="string", Description="The address street name including street type.", Name="StreetName", ParameterType="query")
        /** @var string|null */
        public ?string $StreetName=null,

        /** @description A formatted address Line 1. */
        // @ApiMember(DataType="string", Description="A formatted address Line 1.", Name="AddressLineOne", ParameterType="query")
        /** @var string|null */
        public ?string $AddressLineOne=null,

        /** @description A formatted address Line 2. */
        // @ApiMember(DataType="string", Description="A formatted address Line 2.", Name="AddressLineTwo", ParameterType="query")
        /** @var string|null */
        public ?string $AddressLineTwo=null,

        /** @description The full address string. */
        // @ApiMember(DataType="string", Description="The full address string.", Name="AddressFull", ParameterType="query")
        /** @var string|null */
        public ?string $AddressFull=null,

        /** @description True if the address is a physical location. */
        // @ApiMember(DataType="bool?", Description="True if the address is a physical location.", Name="IsPhysical", ParameterType="query")
        /** @var bool|null */
        public ?bool $IsPhysical=null,

        /** @description Notes about the address. */
        // @ApiMember(DataType="string", Description="Notes about the address.", Name="Notes", ParameterType="query")
        /** @var string|null */
        public ?string $Notes=null,

        /** @description If true, the address is eligible for having its coordinates calculated/updated. */
        // @ApiMember(DataType="bool?", Description="If true, the address is eligible for having its coordinates calculated/updated.", Name="AutoMapCoordinates", ParameterType="query")
        /** @var bool|null */
        public ?bool $AutoMapCoordinates=null,

        /** @description Location Coordinates for the address. */
        // @ApiMember(DataType="LocationCoordinates", Description="Location Coordinates for the address.", Name="LocationCoordinates", ParameterType="query")
        /** @var LocationCoordinatesModel|null */
        public ?LocationCoordinatesModel $LocationCoordinates=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['DistanceAway'])) $this->DistanceAway = $o['DistanceAway'];
        if (isset($o['Latitude'])) $this->Latitude = $o['Latitude'];
        if (isset($o['Longitude'])) $this->Longitude = $o['Longitude'];
        if (isset($o['AddressFormatId'])) $this->AddressFormatId = $o['AddressFormatId'];
        if (isset($o['SuburbId'])) $this->SuburbId = $o['SuburbId'];
        if (isset($o['SuburbName'])) $this->SuburbName = $o['SuburbName'];
        if (isset($o['StateShortName'])) $this->StateShortName = $o['StateShortName'];
        if (isset($o['PostCode'])) $this->PostCode = $o['PostCode'];
        if (isset($o['CountryId'])) $this->CountryId = $o['CountryId'];
        if (isset($o['CountryName'])) $this->CountryName = $o['CountryName'];
        if (isset($o['ISOCountryCode'])) $this->ISOCountryCode = $o['ISOCountryCode'];
        if (isset($o['LotNumber'])) $this->LotNumber = $o['LotNumber'];
        if (isset($o['SubUnit'])) $this->SubUnit = $o['SubUnit'];
        if (isset($o['BuildingNumber'])) $this->BuildingNumber = $o['BuildingNumber'];
        if (isset($o['StreetNumber'])) $this->StreetNumber = $o['StreetNumber'];
        if (isset($o['StreetName'])) $this->StreetName = $o['StreetName'];
        if (isset($o['AddressLineOne'])) $this->AddressLineOne = $o['AddressLineOne'];
        if (isset($o['AddressLineTwo'])) $this->AddressLineTwo = $o['AddressLineTwo'];
        if (isset($o['AddressFull'])) $this->AddressFull = $o['AddressFull'];
        if (isset($o['IsPhysical'])) $this->IsPhysical = $o['IsPhysical'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['AutoMapCoordinates'])) $this->AutoMapCoordinates = $o['AutoMapCoordinates'];
        if (isset($o['LocationCoordinates'])) $this->LocationCoordinates = JsonConverters::from('LocationCoordinatesModel', $o['LocationCoordinates']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->DistanceAway)) $o['DistanceAway'] = $this->DistanceAway;
        if (isset($this->Latitude)) $o['Latitude'] = $this->Latitude;
        if (isset($this->Longitude)) $o['Longitude'] = $this->Longitude;
        if (isset($this->AddressFormatId)) $o['AddressFormatId'] = $this->AddressFormatId;
        if (isset($this->SuburbId)) $o['SuburbId'] = $this->SuburbId;
        if (isset($this->SuburbName)) $o['SuburbName'] = $this->SuburbName;
        if (isset($this->StateShortName)) $o['StateShortName'] = $this->StateShortName;
        if (isset($this->PostCode)) $o['PostCode'] = $this->PostCode;
        if (isset($this->CountryId)) $o['CountryId'] = $this->CountryId;
        if (isset($this->CountryName)) $o['CountryName'] = $this->CountryName;
        if (isset($this->ISOCountryCode)) $o['ISOCountryCode'] = $this->ISOCountryCode;
        if (isset($this->LotNumber)) $o['LotNumber'] = $this->LotNumber;
        if (isset($this->SubUnit)) $o['SubUnit'] = $this->SubUnit;
        if (isset($this->BuildingNumber)) $o['BuildingNumber'] = $this->BuildingNumber;
        if (isset($this->StreetNumber)) $o['StreetNumber'] = $this->StreetNumber;
        if (isset($this->StreetName)) $o['StreetName'] = $this->StreetName;
        if (isset($this->AddressLineOne)) $o['AddressLineOne'] = $this->AddressLineOne;
        if (isset($this->AddressLineTwo)) $o['AddressLineTwo'] = $this->AddressLineTwo;
        if (isset($this->AddressFull)) $o['AddressFull'] = $this->AddressFull;
        if (isset($this->IsPhysical)) $o['IsPhysical'] = $this->IsPhysical;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->AutoMapCoordinates)) $o['AutoMapCoordinates'] = $this->AutoMapCoordinates;
        if (isset($this->LocationCoordinates)) $o['LocationCoordinates'] = JsonConverters::to('LocationCoordinatesModel', $this->LocationCoordinates);
        return empty($o) ? new class(){} : $o;
    }
}

class ContactAddressModel implements JsonSerializable
{
    public function __construct(
        /** @var AddressModel|null */
        public ?AddressModel $Address=null,
        /** @var bool|null */
        public ?bool $IsPostal=null,
        /** @var bool|null */
        public ?bool $IsPrimaryLocation=null,
        /** @var bool|null */
        public ?bool $IsRegisteredLocation=null,
        /** @var string|null */
        public ?string $SuburbName=null,
        /** @var string|null */
        public ?string $StateName=null,
        /** @var string|null */
        public ?string $CountryName=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Address'])) $this->Address = JsonConverters::from('AddressModel', $o['Address']);
        if (isset($o['IsPostal'])) $this->IsPostal = $o['IsPostal'];
        if (isset($o['IsPrimaryLocation'])) $this->IsPrimaryLocation = $o['IsPrimaryLocation'];
        if (isset($o['IsRegisteredLocation'])) $this->IsRegisteredLocation = $o['IsRegisteredLocation'];
        if (isset($o['SuburbName'])) $this->SuburbName = $o['SuburbName'];
        if (isset($o['StateName'])) $this->StateName = $o['StateName'];
        if (isset($o['CountryName'])) $this->CountryName = $o['CountryName'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Address)) $o['Address'] = JsonConverters::to('AddressModel', $this->Address);
        if (isset($this->IsPostal)) $o['IsPostal'] = $this->IsPostal;
        if (isset($this->IsPrimaryLocation)) $o['IsPrimaryLocation'] = $this->IsPrimaryLocation;
        if (isset($this->IsRegisteredLocation)) $o['IsRegisteredLocation'] = $this->IsRegisteredLocation;
        if (isset($this->SuburbName)) $o['SuburbName'] = $this->SuburbName;
        if (isset($this->StateName)) $o['StateName'] = $this->StateName;
        if (isset($this->CountryName)) $o['CountryName'] = $this->CountryName;
        return empty($o) ? new class(){} : $o;
    }
}

class PhoneModel implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CountryCode=null,
        /** @var string|null */
        public ?string $AreaCode=null,
        /** @var string|null */
        public ?string $LocalNumber=null
    ) {
    }

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

class ContactDetailModel implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $ContactMethodId='',
        /** @var string|null */
        public ?string $ContactMethodName=null,
        /** @var ContactAddressModel|null */
        public ?ContactAddressModel $ContactAddress=null,
        /** @var PhoneModel|null */
        public ?PhoneModel $ContactPhone=null,
        /** @var string|null */
        public ?string $CountryId=null,
        /** @var string|null */
        public ?string $ContactDetails=null,
        /** @var string|null */
        public ?string $Notes=null,
        /** @var string|null */
        public ?string $ContactDetailsCode=null,
        /** @var int */
        public int $OrderContactMethod=0,
        /** @var bool|null */
        public ?bool $IsPrimaryContactMethod=null,
        /** @var bool|null */
        public ?bool $IsAddress=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ContactMethodId'])) $this->ContactMethodId = $o['ContactMethodId'];
        if (isset($o['ContactMethodName'])) $this->ContactMethodName = $o['ContactMethodName'];
        if (isset($o['ContactAddress'])) $this->ContactAddress = JsonConverters::from('ContactAddressModel', $o['ContactAddress']);
        if (isset($o['ContactPhone'])) $this->ContactPhone = JsonConverters::from('PhoneModel', $o['ContactPhone']);
        if (isset($o['CountryId'])) $this->CountryId = $o['CountryId'];
        if (isset($o['ContactDetails'])) $this->ContactDetails = $o['ContactDetails'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['ContactDetailsCode'])) $this->ContactDetailsCode = $o['ContactDetailsCode'];
        if (isset($o['OrderContactMethod'])) $this->OrderContactMethod = $o['OrderContactMethod'];
        if (isset($o['IsPrimaryContactMethod'])) $this->IsPrimaryContactMethod = $o['IsPrimaryContactMethod'];
        if (isset($o['IsAddress'])) $this->IsAddress = $o['IsAddress'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ContactMethodId)) $o['ContactMethodId'] = $this->ContactMethodId;
        if (isset($this->ContactMethodName)) $o['ContactMethodName'] = $this->ContactMethodName;
        if (isset($this->ContactAddress)) $o['ContactAddress'] = JsonConverters::to('ContactAddressModel', $this->ContactAddress);
        if (isset($this->ContactPhone)) $o['ContactPhone'] = JsonConverters::to('PhoneModel', $this->ContactPhone);
        if (isset($this->CountryId)) $o['CountryId'] = $this->CountryId;
        if (isset($this->ContactDetails)) $o['ContactDetails'] = $this->ContactDetails;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->ContactDetailsCode)) $o['ContactDetailsCode'] = $this->ContactDetailsCode;
        if (isset($this->OrderContactMethod)) $o['OrderContactMethod'] = $this->OrderContactMethod;
        if (isset($this->IsPrimaryContactMethod)) $o['IsPrimaryContactMethod'] = $this->IsPrimaryContactMethod;
        if (isset($this->IsAddress)) $o['IsAddress'] = $this->IsAddress;
        return empty($o) ? new class(){} : $o;
    }
}

class SubscriptionContactModel implements JsonSerializable
{
    public function __construct(
        /** @description Guid of the contact object within Eros. */
        // @ApiMember(DataType="Guid", Description="Guid of the contact object within Eros.", Name="ContactId", ParameterType="query")
        /** @var string */
        public string $ContactId='',

        /** @description Guid of the Contact Type List Item object within Eros. */
        // @ApiMember(DataType="Guid", Description="Guid of the Contact Type List Item object within Eros.", IsRequired=true, Name="ContactType", ParameterType="query")
        /** @var string */
        public string $ContactType='',

        /** @description Guid of the Marital Status List Item object within Eros. */
        // @ApiMember(DataType="Guid?", Description="Guid of the Marital Status List Item object within Eros.", Name="MaritalStatus", ParameterType="query")
        /** @var string|null */
        public ?string $MaritalStatus=null,

        /** @description Guid of the Gender List Item object within Eros. */
        // @ApiMember(DataType="Guid?", Description="Guid of the Gender List Item object within Eros.", Name="Gender", ParameterType="query")
        /** @var string|null */
        public ?string $Gender=null,

        /** @description The first given name for the contact.  Applies to a person contact type. */
        // @ApiMember(DataType="string", Description="The first given name for the contact.  Applies to a person contact type.", Name="FirstName", ParameterType="query")
        /** @var string|null */
        public ?string $FirstName=null,

        /** @description The middle name(s) for the contact.  Applies to a person contact type. */
        // @ApiMember(DataType="string", Description="The middle name(s) for the contact.  Applies to a person contact type.", Name="MiddleName", ParameterType="query")
        /** @var string|null */
        public ?string $MiddleName=null,

        /** @description The surname for the contact.  Applies to a person contact type. */
        // @ApiMember(DataType="string", Description="The surname for the contact.  Applies to a person contact type.", Name="Surname", ParameterType="query")
        /** @var string|null */
        public ?string $Surname=null,

        /** @description The full name for the contact. */
        // @ApiMember(DataType="string", Description="The full name for the contact.", Name="FullName", ParameterType="query")
        /** @var string|null */
        public ?string $FullName=null,

        /** @description A short name for the contact. */
        // @ApiMember(DataType="string", Description="A short name for the contact.", Name="ShortName", ParameterType="query")
        /** @var string|null */
        public ?string $ShortName=null,

        /** @description The birth date for the contact.  Applies to a person contact type. */
        // @ApiMember(DataType="DateTime?", Description="The birth date for the contact.  Applies to a person contact type.", Name="BirthDate", ParameterType="query")
        /** @var DateTime|null */
        public ?DateTime $BirthDate=null,

        /** @description The title for the contact.  Applies to a person contact type. */
        // @ApiMember(DataType="string", Description="The title for the contact.  Applies to a person contact type.", Name="Title", ParameterType="query")
        /** @var string|null */
        public ?string $Title=null,

        /** @description A salutation for the contact. */
        // @ApiMember(DataType="string", Description="A salutation for the contact.", Name="Salutation", ParameterType="query")
        /** @var string|null */
        public ?string $Salutation=null,

        /** @description The A.B.N for the contact. */
        // @ApiMember(DataType="string", Description="The A.B.N for the contact.", Name="Abn", ParameterType="query")
        /** @var string|null */
        public ?string $Abn=null,

        /** @description The A.C.N for the contact. */
        // @ApiMember(DataType="string", Description="The A.C.N for the contact.", Name="Acn", ParameterType="query")
        /** @var string|null */
        public ?string $Acn=null,

        /** @description The A.R.B.N for the contact. */
        // @ApiMember(DataType="string", Description="The A.R.B.N for the contact.", Name="Arbn", ParameterType="query")
        /** @var string|null */
        public ?string $Arbn=null,

        /** @description A trading name for the contact. */
        // @ApiMember(DataType="string", Description="A trading name for the contact.", Name="TradingName", ParameterType="query")
        /** @var string|null */
        public ?string $TradingName=null,

        /** @description A legal name for the contact. */
        // @ApiMember(DataType="string", Description="A legal name for the contact.", Name="LegalName", ParameterType="query")
        /** @var string|null */
        public ?string $LegalName=null,

        /** @description Any notes/description for the contact. */
        // @ApiMember(DataType="string", Description="Any notes/description for the contact.", Name="Notes", ParameterType="query")
        /** @var string|null */
        public ?string $Notes=null,

        /** @description Contact Employment Industry. */
        // @ApiMember(DataType="string", Description="Contact Employment Industry.", Name="EmploymentIndustry", ParameterType="query")
        /** @var string|null */
        public ?string $EmploymentIndustry=null,

        /** @description Contact Employment Role. */
        // @ApiMember(DataType="string", Description="Contact Employment Role.", Name="EmploymentRole", ParameterType="query")
        /** @var string|null */
        public ?string $EmploymentRole=null,

        /** @description Contact Employment Geographic Area. */
        // @ApiMember(DataType="string", Description="Contact Employment Geographic Area.", Name="EmploymentGeographicArea", ParameterType="query")
        /** @var string|null */
        public ?string $EmploymentGeographicArea=null,

        /** @description The Contacts Drivers Licence Number */
        // @ApiMember(DataType="string", Description="The Contacts Drivers Licence Number", Name="DriversLicence", ParameterType="query")
        /** @var string|null */
        public ?string $DriversLicence=null,

        /** @description Indicates if the Contact is registered for GST */
        // @ApiMember(DataType="bool", Description="Indicates if the Contact is registered for GST", Name="GstRegistered", ParameterType="query")
        /** @var bool|null */
        public ?bool $GstRegistered=null,

        /** @description The status of the contact in EROS */
        // @ApiMember(DataType="string", Description="The status of the contact in EROS", Name="RecordStatus", ParameterType="query")
        /** @var string|null */
        public ?string $RecordStatus=null,

        /** @description A list of roles this contact has. */
        // @ApiMember(DataType="List<ContactRole>", Description="A list of roles this contact has.", IsRequired=true, Name="ContactRoles", ParameterType="query")
        /** @var array<ContactRole>|null */
        public ?array $ContactRoles=null,

        /** @description A list of the contact details for the contact. */
        // @ApiMember(DataType="List<ContactDetailModel>", Description="A list of the contact details for the contact.", IsRequired=true, Name="ContactDetails", ParameterType="query")
        /** @var array<ContactDetailModel>|null */
        public ?array $ContactDetails=null,

        /** @description Custom Content XML for the contact. */
        // @ApiMember(DataType="string", Description="Custom Content XML for the contact.", Name="CustomContentXML", ParameterType="query")
        /** @var string|null */
        public ?string $CustomContentXML=null,

        /** @var string|null */
        public ?string $BlobImageURLPrimary=null,
        /** @var string|null */
        public ?string $BlobImageURLPrimaryThumbnail=null,
        /** @description The primary mobile for the contact. */
        // @ApiMember(DataType="string", Description="The primary mobile for the contact.", Name="PrimaryMobile", ParameterType="query")
        /** @var string|null */
        public ?string $PrimaryMobile=null,

        /** @description The primary email for the contact. */
        // @ApiMember(DataType="string", Description="The primary email for the contact.", Name="PrimaryEmail", ParameterType="query")
        /** @var string|null */
        public ?string $PrimaryEmail=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['ContactId'])) $this->ContactId = $o['ContactId'];
        if (isset($o['ContactType'])) $this->ContactType = $o['ContactType'];
        if (isset($o['MaritalStatus'])) $this->MaritalStatus = $o['MaritalStatus'];
        if (isset($o['Gender'])) $this->Gender = $o['Gender'];
        if (isset($o['FirstName'])) $this->FirstName = $o['FirstName'];
        if (isset($o['MiddleName'])) $this->MiddleName = $o['MiddleName'];
        if (isset($o['Surname'])) $this->Surname = $o['Surname'];
        if (isset($o['FullName'])) $this->FullName = $o['FullName'];
        if (isset($o['ShortName'])) $this->ShortName = $o['ShortName'];
        if (isset($o['BirthDate'])) $this->BirthDate = JsonConverters::from('DateTime', $o['BirthDate']);
        if (isset($o['Title'])) $this->Title = $o['Title'];
        if (isset($o['Salutation'])) $this->Salutation = $o['Salutation'];
        if (isset($o['Abn'])) $this->Abn = $o['Abn'];
        if (isset($o['Acn'])) $this->Acn = $o['Acn'];
        if (isset($o['Arbn'])) $this->Arbn = $o['Arbn'];
        if (isset($o['TradingName'])) $this->TradingName = $o['TradingName'];
        if (isset($o['LegalName'])) $this->LegalName = $o['LegalName'];
        if (isset($o['Notes'])) $this->Notes = $o['Notes'];
        if (isset($o['EmploymentIndustry'])) $this->EmploymentIndustry = $o['EmploymentIndustry'];
        if (isset($o['EmploymentRole'])) $this->EmploymentRole = $o['EmploymentRole'];
        if (isset($o['EmploymentGeographicArea'])) $this->EmploymentGeographicArea = $o['EmploymentGeographicArea'];
        if (isset($o['DriversLicence'])) $this->DriversLicence = $o['DriversLicence'];
        if (isset($o['GstRegistered'])) $this->GstRegistered = $o['GstRegistered'];
        if (isset($o['RecordStatus'])) $this->RecordStatus = $o['RecordStatus'];
        if (isset($o['ContactRoles'])) $this->ContactRoles = JsonConverters::fromArray('ContactRole', $o['ContactRoles']);
        if (isset($o['ContactDetails'])) $this->ContactDetails = JsonConverters::fromArray('ContactDetailModel', $o['ContactDetails']);
        if (isset($o['CustomContentXML'])) $this->CustomContentXML = $o['CustomContentXML'];
        if (isset($o['BlobImageURLPrimary'])) $this->BlobImageURLPrimary = $o['BlobImageURLPrimary'];
        if (isset($o['BlobImageURLPrimaryThumbnail'])) $this->BlobImageURLPrimaryThumbnail = $o['BlobImageURLPrimaryThumbnail'];
        if (isset($o['PrimaryMobile'])) $this->PrimaryMobile = $o['PrimaryMobile'];
        if (isset($o['PrimaryEmail'])) $this->PrimaryEmail = $o['PrimaryEmail'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->ContactId)) $o['ContactId'] = $this->ContactId;
        if (isset($this->ContactType)) $o['ContactType'] = $this->ContactType;
        if (isset($this->MaritalStatus)) $o['MaritalStatus'] = $this->MaritalStatus;
        if (isset($this->Gender)) $o['Gender'] = $this->Gender;
        if (isset($this->FirstName)) $o['FirstName'] = $this->FirstName;
        if (isset($this->MiddleName)) $o['MiddleName'] = $this->MiddleName;
        if (isset($this->Surname)) $o['Surname'] = $this->Surname;
        if (isset($this->FullName)) $o['FullName'] = $this->FullName;
        if (isset($this->ShortName)) $o['ShortName'] = $this->ShortName;
        if (isset($this->BirthDate)) $o['BirthDate'] = JsonConverters::to('DateTime', $this->BirthDate);
        if (isset($this->Title)) $o['Title'] = $this->Title;
        if (isset($this->Salutation)) $o['Salutation'] = $this->Salutation;
        if (isset($this->Abn)) $o['Abn'] = $this->Abn;
        if (isset($this->Acn)) $o['Acn'] = $this->Acn;
        if (isset($this->Arbn)) $o['Arbn'] = $this->Arbn;
        if (isset($this->TradingName)) $o['TradingName'] = $this->TradingName;
        if (isset($this->LegalName)) $o['LegalName'] = $this->LegalName;
        if (isset($this->Notes)) $o['Notes'] = $this->Notes;
        if (isset($this->EmploymentIndustry)) $o['EmploymentIndustry'] = $this->EmploymentIndustry;
        if (isset($this->EmploymentRole)) $o['EmploymentRole'] = $this->EmploymentRole;
        if (isset($this->EmploymentGeographicArea)) $o['EmploymentGeographicArea'] = $this->EmploymentGeographicArea;
        if (isset($this->DriversLicence)) $o['DriversLicence'] = $this->DriversLicence;
        if (isset($this->GstRegistered)) $o['GstRegistered'] = $this->GstRegistered;
        if (isset($this->RecordStatus)) $o['RecordStatus'] = $this->RecordStatus;
        if (isset($this->ContactRoles)) $o['ContactRoles'] = JsonConverters::toArray('ContactRole', $this->ContactRoles);
        if (isset($this->ContactDetails)) $o['ContactDetails'] = JsonConverters::toArray('ContactDetailModel', $this->ContactDetails);
        if (isset($this->CustomContentXML)) $o['CustomContentXML'] = $this->CustomContentXML;
        if (isset($this->BlobImageURLPrimary)) $o['BlobImageURLPrimary'] = $this->BlobImageURLPrimary;
        if (isset($this->BlobImageURLPrimaryThumbnail)) $o['BlobImageURLPrimaryThumbnail'] = $this->BlobImageURLPrimaryThumbnail;
        if (isset($this->PrimaryMobile)) $o['PrimaryMobile'] = $this->PrimaryMobile;
        if (isset($this->PrimaryEmail)) $o['PrimaryEmail'] = $this->PrimaryEmail;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Inserts or Updates a contact and its details and roles. */
// @Api(Description="Inserts or Updates a contact and its details and roles.")
class SaveContact extends ValidationErrorList implements ISubscription, JsonSerializable
{
    /**
     * @param array<RuleValidationResult>|null $ValidationErrors
     */
    public function __construct(
        ?array $ValidationErrors=null,
        /** @description Guid representing the external systems datasource information. */
        // @ApiMember(DataType="Guid", Description="Guid representing the external systems datasource information.", IsRequired=true, Name="SuiteDataSourceInstanceId", ParameterType="query")
        /** @var string */
        public string $SuiteDataSourceInstanceId='',

        /** @description The unique key that represents the contact on the external system. */
        // @ApiMember(DataType="string", Description="The unique key that represents the contact on the external system.", IsRequired=true, Name="AlternateKey", ParameterType="query")
        /** @var string */
        public string $AlternateKey='',

        /** @description Guid of the contact object within Eros.  If ObjectId is known, the external system may pass this instead of the alternate key. */
        // @ApiMember(DataType="Guid", Description="Guid of the contact object within Eros.  If ObjectId is known, the external system may pass this instead of the alternate key.", Name="ObjectId", ParameterType="query")
        /** @var string */
        public string $ObjectId='',

        /** @description If set to true, the object will be updated/refreshed. If false, the hash representation of the Contact model and its data will be compared with the current Contact to determine if there are any changes to save. */
        // @ApiMember(DataType="bool", Description="If set to true, the object will be updated/refreshed. If false, the hash representation of the Contact model and its data will be compared with the current Contact to determine if there are any changes to save.", Name="IgnoreHash")
        /** @var bool|null */
        public ?bool $IgnoreHash=null,

        /** @var bool|null */
        public ?bool $IgnoreValidation=null,
        /** @description Set this to be true if the contact is to be deleted */
        // @ApiMember(DataType="bool", Description="Set this to be true if the contact is to be deleted", Name="MarkAsDeleted", ParameterType="query")
        /** @var bool|null */
        public ?bool $MarkAsDeleted=null,

        /** @description Object containing all details of the contact to be inserted or updated. */
        // @ApiMember(DataType="SubscriptionContactModel", Description="Object containing all details of the contact to be inserted or updated.", IsRequired=true, Name="Contact", ParameterType="query")
        /** @var SubscriptionContactModel|null */
        public ?SubscriptionContactModel $Contact=null,

        /** @var string */
        public string $LicenseeId='',
        /** @var string */
        public string $SessionId=''
    ) {
        parent::__construct($ValidationErrors);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['SuiteDataSourceInstanceId'])) $this->SuiteDataSourceInstanceId = $o['SuiteDataSourceInstanceId'];
        if (isset($o['AlternateKey'])) $this->AlternateKey = $o['AlternateKey'];
        if (isset($o['ObjectId'])) $this->ObjectId = $o['ObjectId'];
        if (isset($o['IgnoreHash'])) $this->IgnoreHash = $o['IgnoreHash'];
        if (isset($o['IgnoreValidation'])) $this->IgnoreValidation = $o['IgnoreValidation'];
        if (isset($o['MarkAsDeleted'])) $this->MarkAsDeleted = $o['MarkAsDeleted'];
        if (isset($o['Contact'])) $this->Contact = JsonConverters::from('SubscriptionContactModel', $o['Contact']);
        if (isset($o['LicenseeId'])) $this->LicenseeId = $o['LicenseeId'];
        if (isset($o['SessionId'])) $this->SessionId = $o['SessionId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->SuiteDataSourceInstanceId)) $o['SuiteDataSourceInstanceId'] = $this->SuiteDataSourceInstanceId;
        if (isset($this->AlternateKey)) $o['AlternateKey'] = $this->AlternateKey;
        if (isset($this->ObjectId)) $o['ObjectId'] = $this->ObjectId;
        if (isset($this->IgnoreHash)) $o['IgnoreHash'] = $this->IgnoreHash;
        if (isset($this->IgnoreValidation)) $o['IgnoreValidation'] = $this->IgnoreValidation;
        if (isset($this->MarkAsDeleted)) $o['MarkAsDeleted'] = $this->MarkAsDeleted;
        if (isset($this->Contact)) $o['Contact'] = JsonConverters::to('SubscriptionContactModel', $this->Contact);
        if (isset($this->LicenseeId)) $o['LicenseeId'] = $this->LicenseeId;
        if (isset($this->SessionId)) $o['SessionId'] = $this->SessionId;
        return empty($o) ? new class(){} : $o;
    }
}

PHP SaveContact DTOs

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

HTTP + OTHER

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

POST /jsonl/reply/SaveContact HTTP/1.1 
Host: production-eros-platform-apisubscription.azurewebsites.net 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"AlternateKey":"String","IgnoreHash":false,"IgnoreValidation":false,"MarkAsDeleted":false,"Contact":{"MaritalStatus":"00000000-0000-0000-0000-000000000000","Gender":"00000000-0000-0000-0000-000000000000","FirstName":"String","MiddleName":"String","Surname":"String","FullName":"String","ShortName":"String","BirthDate":"0001-01-01T00:00:00.0000000","Title":"String","Salutation":"String","Abn":"String","Acn":"String","Arbn":"String","TradingName":"String","LegalName":"String","Notes":"String","EmploymentIndustry":"String","EmploymentRole":"String","EmploymentGeographicArea":"String","DriversLicence":"String","GstRegistered":false,"RecordStatus":"String","ContactRoles":[{"AlternateKey":"String"}],"ContactDetails":[{"ContactMethodName":"String","ContactAddress":{"Address":{"DistanceAway":0,"Latitude":0,"Longitude":0,"SuburbName":"String","StateShortName":"String","PostCode":"String","CountryName":"String","ISOCountryCode":"String","LotNumber":"String","SubUnit":"String","BuildingNumber":"String","StreetNumber":"String","StreetName":"String","AddressLineOne":"String","AddressLineTwo":"String","AddressFull":"String","IsPhysical":false,"Notes":"String","AutoMapCoordinates":false,"LocationCoordinates":{"Latitude":0,"Longitude":0,"Altitude":0,"Accuracy":0,"AltitudeAccuracy":0,"Heading":0,"Speed":0,"VerticalSpeed":0}},"IsPostal":false,"IsPrimaryLocation":false,"IsRegisteredLocation":false,"SuburbName":"String","StateName":"String","CountryName":"String"},"ContactPhone":{"CountryCode":"String","AreaCode":"String","LocalNumber":"String"},"CountryId":"00000000-0000-0000-0000-000000000000","ContactDetails":"String","Notes":"String","ContactDetailsCode":"String","OrderContactMethod":0,"IsPrimaryContactMethod":false,"IsAddress":true}],"CustomContentXML":"String","BlobImageURLPrimary":"String","BlobImageURLPrimaryThumbnail":"String","PrimaryMobile":"String","PrimaryEmail":"String"},"ValidationErrors":[{"RuleCode":"String","Message":"String","Key":"String","Tag":"String","ErrorCode":"String"}]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}