Agentivity API

<back to all web services

GetHotelSegments

The following routes are available for this service:
GET/HotelSegments
<?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};


// @DataContract(Name="Metadata", Namespace="schemas.agentivity.com/types")
class PagingMetadata implements JsonSerializable
{
    public function __construct(
        /** @description Starting Record */
        // @DataMember
        // @ApiMember(DataType="string", Description="Starting Record", Name="Offset", ParameterType="query")
        /** @var string|null */
        public ?string $Offset=null,

        /** @description Number of records to return (PageSize) */
        // @DataMember
        // @ApiMember(DataType="string", Description="Number of records to return (PageSize)", Name="Limit", ParameterType="query")
        /** @var string|null */
        public ?string $Limit=null,

        /** @description Total Number of Records in a Full Reponse (if no paging) */
        // @DataMember
        // @ApiMember(DataType="string", Description="Total Number of Records in a Full Reponse (if no paging)", Name="TotalRecords", ParameterType="query")
        /** @var int */
        public int $TotalRecords=0,

        /** @description Total Number of Records in this Reponse (on this page) */
        // @DataMember
        // @ApiMember(DataType="string", Description="Total Number of Records in this Reponse (on this page)", Name="ResponseRecords", ParameterType="query")
        /** @var int */
        public int $ResponseRecords=0
    ) {
    }

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

// @DataContract(Namespace="schemas.agentivity.com/types")
class CompanyLevelRequestBase extends PagingMetadata implements IMemberUsername, IMemberOwningCompanyCode, JsonSerializable
{
    /**
     * @param string|null $Offset
     * @param string|null $Limit
     * @param int $TotalRecords
     * @param int $ResponseRecords
     */
    public function __construct(
        ?string $Offset=null,
        ?string $Limit=null,
        int $TotalRecords=0,
        int $ResponseRecords=0,
        /** @description Comma Delimited List of Owning Company Codes */
        // @DataMember
        /** @var string[]|null */
        public ?array $OwningCompanyCode=null,

        /** @description UserName in form of an email address */
        // @DataMember
        /** @var string|null */
        public ?string $UserName=null
    ) {
        parent::__construct($Offset,$Limit,$TotalRecords,$ResponseRecords);
    }

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

// @DataContract(Name="CustomField", Namespace="schemas.agentivity.com/types")
class CustomFieldData implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=20)
        /** @var string|null */
        public ?string $FieldName=null,

        // @DataMember(Order=30)
        /** @var string|null */
        public ?string $FieldValue=null
    ) {
    }

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

/**
 * @template array of CustomFieldData
 */
class CustomFieldsCollection extends \ArrayObject implements JsonSerializable
{
    public function __construct(CustomFieldData ...$items) {
        parent::__construct($items, \ArrayObject::STD_PROP_LIST);
    }
    
    /** @throws \Exception */
    public function append($value): void {
        if ($value instanceof CustomFieldData)
            parent::append($value);
        else
            throw new \Exception("Can only append a CustomFieldData to " . __CLASS__);
    }
    
    /** @throws Exception */
    public function fromMap($o): void {
        foreach ($o as $item) {
            $el = new CustomFieldData();
            $el->fromMap($item);
            $this->append($el);
        }
    }
    
    /** @throws Exception */
    public function jsonSerialize(): array {
        return parent::getArrayCopy();
    }
}

// @DataContract(Name="Segment", Namespace="schemas.agentivity.com/types")
class HotelSegment implements IBookingCustomFields, JsonSerializable
{
    public function __construct(
        // @DataMember(Order=10)
        /** @var int */
        public int $AgentivityRef=0,

        // @DataMember(Order=15)
        /** @var DateTime|null */
        public ?DateTime $PNRCreationDate=null,

        // @DataMember(Order=20)
        /** @var string|null */
        public ?string $HotelSegmentNbr=null,

        // @DataMember(Order=30)
        /** @var string|null */
        public ?string $RecordLocator=null,

        // @DataMember(Order=50)
        /** @var string|null */
        public ?string $OwningAgencyLocationID=null,

        // @DataMember(Order=60)
        /** @var string|null */
        public ?string $Account=null,

        // @DataMember(Order=70)
        /** @var string|null */
        public ?string $OwningConsultantID=null,

        // @DataMember(Order=80)
        /** @var string|null */
        public ?string $OwningConsultant=null,

        // @DataMember(Order=90)
        /** @var string|null */
        public ?string $StatusCode=null,

        // @DataMember(Order=95)
        /** @var DateTime|null */
        public ?DateTime $SegmentCreationDate=null,

        // @DataMember(Order=100)
        /** @var DateTime|null */
        public ?DateTime $ArrivalDate=null,

        // @DataMember(Order=110)
        /** @var DateTime|null */
        public ?DateTime $DepartureDate=null,

        // @DataMember(Order=120)
        /** @var int */
        public int $NbrNights=0,

        // @DataMember(Order=130)
        /** @var string|null */
        public ?string $VendorCode=null,

        // @DataMember(Order=140)
        /** @var string|null */
        public ?string $PropertyName=null,

        // @DataMember(Order=150)
        /** @var string|null */
        public ?string $PropertyNbr=null,

        // @DataMember(Order=160)
        /** @var string|null */
        public ?string $PropertyAddress=null,

        // @DataMember(Order=145)
        /** @var string|null */
        public ?string $PropertyPhoneNbr=null,

        // @DataMember(Order=170)
        /** @var string|null */
        public ?string $CityCode=null,

        // @DataMember(Order=170)
        /** @var string|null */
        public ?string $CityName=null,

        // @DataMember(Order=180)
        /** @var string|null */
        public ?string $CountryCode=null,

        // @DataMember(Order=190)
        /** @var string|null */
        public ?string $CountryName=null,

        // @DataMember(Order=200)
        /** @var string|null */
        public ?string $Passenger=null,

        // @DataMember(Order=210)
        /** @var string|null */
        public ?string $ConfirmationNbr=null,

        // @DataMember(Order=220)
        /** @var string|null */
        public ?string $RateAccessCode=null,

        // @DataMember(Order=230)
        /** @var string|null */
        public ?string $RoomBookingCode=null,

        // @DataMember(Order=240)
        /** @var string|null */
        public ?string $CurrencyCode=null,

        // @DataMember(Order=250)
        /** @var string|null */
        public ?string $RateAmount=null,

        // @DataMember(Order=260)
        /** @var int */
        public int $NbrRooms=0,

        // @DataMember(Order=270)
        /** @var string|null */
        public ?string $BookedInName=null,

        // @DataMember(Order=275)
        /** @var string|null */
        public ?string $ServiceInformation=null,

        // @DataMember(Order=280)
        /** @var string|null */
        public ?string $TotalAirSegs=null,

        // @DataMember(Order=290)
        /** @var string|null */
        public ?string $CreatingAgencyIata=null,

        // @DataMember(Order=310)
        /** @var bool|null */
        public ?bool $IsCommissionable=null,

        // @DataMember(Order=320)
        /** @var string|null */
        public ?string $Commission=null,

        // @DataMember(Order=330)
        /** @var bool|null */
        public ?bool $IsPassive=null,

        // @DataMember(Order=340)
        /** @var CustomFieldsCollection|null */
        public ?CustomFieldsCollection $CustomFields=null,

        // @DataMember(Order=350)
        /** @var string|null */
        public ?string $HotelNotepad=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['AgentivityRef'])) $this->AgentivityRef = $o['AgentivityRef'];
        if (isset($o['PNRCreationDate'])) $this->PNRCreationDate = JsonConverters::from('DateTime', $o['PNRCreationDate']);
        if (isset($o['HotelSegmentNbr'])) $this->HotelSegmentNbr = $o['HotelSegmentNbr'];
        if (isset($o['RecordLocator'])) $this->RecordLocator = $o['RecordLocator'];
        if (isset($o['OwningAgencyLocationID'])) $this->OwningAgencyLocationID = $o['OwningAgencyLocationID'];
        if (isset($o['Account'])) $this->Account = $o['Account'];
        if (isset($o['OwningConsultantID'])) $this->OwningConsultantID = $o['OwningConsultantID'];
        if (isset($o['OwningConsultant'])) $this->OwningConsultant = $o['OwningConsultant'];
        if (isset($o['StatusCode'])) $this->StatusCode = $o['StatusCode'];
        if (isset($o['SegmentCreationDate'])) $this->SegmentCreationDate = JsonConverters::from('DateTime', $o['SegmentCreationDate']);
        if (isset($o['ArrivalDate'])) $this->ArrivalDate = JsonConverters::from('DateTime', $o['ArrivalDate']);
        if (isset($o['DepartureDate'])) $this->DepartureDate = JsonConverters::from('DateTime', $o['DepartureDate']);
        if (isset($o['NbrNights'])) $this->NbrNights = $o['NbrNights'];
        if (isset($o['VendorCode'])) $this->VendorCode = $o['VendorCode'];
        if (isset($o['PropertyName'])) $this->PropertyName = $o['PropertyName'];
        if (isset($o['PropertyNbr'])) $this->PropertyNbr = $o['PropertyNbr'];
        if (isset($o['PropertyAddress'])) $this->PropertyAddress = $o['PropertyAddress'];
        if (isset($o['PropertyPhoneNbr'])) $this->PropertyPhoneNbr = $o['PropertyPhoneNbr'];
        if (isset($o['CityCode'])) $this->CityCode = $o['CityCode'];
        if (isset($o['CityName'])) $this->CityName = $o['CityName'];
        if (isset($o['CountryCode'])) $this->CountryCode = $o['CountryCode'];
        if (isset($o['CountryName'])) $this->CountryName = $o['CountryName'];
        if (isset($o['Passenger'])) $this->Passenger = $o['Passenger'];
        if (isset($o['ConfirmationNbr'])) $this->ConfirmationNbr = $o['ConfirmationNbr'];
        if (isset($o['RateAccessCode'])) $this->RateAccessCode = $o['RateAccessCode'];
        if (isset($o['RoomBookingCode'])) $this->RoomBookingCode = $o['RoomBookingCode'];
        if (isset($o['CurrencyCode'])) $this->CurrencyCode = $o['CurrencyCode'];
        if (isset($o['RateAmount'])) $this->RateAmount = $o['RateAmount'];
        if (isset($o['NbrRooms'])) $this->NbrRooms = $o['NbrRooms'];
        if (isset($o['BookedInName'])) $this->BookedInName = $o['BookedInName'];
        if (isset($o['ServiceInformation'])) $this->ServiceInformation = $o['ServiceInformation'];
        if (isset($o['TotalAirSegs'])) $this->TotalAirSegs = $o['TotalAirSegs'];
        if (isset($o['CreatingAgencyIata'])) $this->CreatingAgencyIata = $o['CreatingAgencyIata'];
        if (isset($o['IsCommissionable'])) $this->IsCommissionable = $o['IsCommissionable'];
        if (isset($o['Commission'])) $this->Commission = $o['Commission'];
        if (isset($o['IsPassive'])) $this->IsPassive = $o['IsPassive'];
        if (isset($o['CustomFields'])) $this->CustomFields = JsonConverters::from('CustomFieldsCollection', $o['CustomFields']);
        if (isset($o['HotelNotepad'])) $this->HotelNotepad = $o['HotelNotepad'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->AgentivityRef)) $o['AgentivityRef'] = $this->AgentivityRef;
        if (isset($this->PNRCreationDate)) $o['PNRCreationDate'] = JsonConverters::to('DateTime', $this->PNRCreationDate);
        if (isset($this->HotelSegmentNbr)) $o['HotelSegmentNbr'] = $this->HotelSegmentNbr;
        if (isset($this->RecordLocator)) $o['RecordLocator'] = $this->RecordLocator;
        if (isset($this->OwningAgencyLocationID)) $o['OwningAgencyLocationID'] = $this->OwningAgencyLocationID;
        if (isset($this->Account)) $o['Account'] = $this->Account;
        if (isset($this->OwningConsultantID)) $o['OwningConsultantID'] = $this->OwningConsultantID;
        if (isset($this->OwningConsultant)) $o['OwningConsultant'] = $this->OwningConsultant;
        if (isset($this->StatusCode)) $o['StatusCode'] = $this->StatusCode;
        if (isset($this->SegmentCreationDate)) $o['SegmentCreationDate'] = JsonConverters::to('DateTime', $this->SegmentCreationDate);
        if (isset($this->ArrivalDate)) $o['ArrivalDate'] = JsonConverters::to('DateTime', $this->ArrivalDate);
        if (isset($this->DepartureDate)) $o['DepartureDate'] = JsonConverters::to('DateTime', $this->DepartureDate);
        if (isset($this->NbrNights)) $o['NbrNights'] = $this->NbrNights;
        if (isset($this->VendorCode)) $o['VendorCode'] = $this->VendorCode;
        if (isset($this->PropertyName)) $o['PropertyName'] = $this->PropertyName;
        if (isset($this->PropertyNbr)) $o['PropertyNbr'] = $this->PropertyNbr;
        if (isset($this->PropertyAddress)) $o['PropertyAddress'] = $this->PropertyAddress;
        if (isset($this->PropertyPhoneNbr)) $o['PropertyPhoneNbr'] = $this->PropertyPhoneNbr;
        if (isset($this->CityCode)) $o['CityCode'] = $this->CityCode;
        if (isset($this->CityName)) $o['CityName'] = $this->CityName;
        if (isset($this->CountryCode)) $o['CountryCode'] = $this->CountryCode;
        if (isset($this->CountryName)) $o['CountryName'] = $this->CountryName;
        if (isset($this->Passenger)) $o['Passenger'] = $this->Passenger;
        if (isset($this->ConfirmationNbr)) $o['ConfirmationNbr'] = $this->ConfirmationNbr;
        if (isset($this->RateAccessCode)) $o['RateAccessCode'] = $this->RateAccessCode;
        if (isset($this->RoomBookingCode)) $o['RoomBookingCode'] = $this->RoomBookingCode;
        if (isset($this->CurrencyCode)) $o['CurrencyCode'] = $this->CurrencyCode;
        if (isset($this->RateAmount)) $o['RateAmount'] = $this->RateAmount;
        if (isset($this->NbrRooms)) $o['NbrRooms'] = $this->NbrRooms;
        if (isset($this->BookedInName)) $o['BookedInName'] = $this->BookedInName;
        if (isset($this->ServiceInformation)) $o['ServiceInformation'] = $this->ServiceInformation;
        if (isset($this->TotalAirSegs)) $o['TotalAirSegs'] = $this->TotalAirSegs;
        if (isset($this->CreatingAgencyIata)) $o['CreatingAgencyIata'] = $this->CreatingAgencyIata;
        if (isset($this->IsCommissionable)) $o['IsCommissionable'] = $this->IsCommissionable;
        if (isset($this->Commission)) $o['Commission'] = $this->Commission;
        if (isset($this->IsPassive)) $o['IsPassive'] = $this->IsPassive;
        if (isset($this->CustomFields)) $o['CustomFields'] = JsonConverters::to('CustomFieldsCollection', $this->CustomFields);
        if (isset($this->HotelNotepad)) $o['HotelNotepad'] = $this->HotelNotepad;
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract(Namespace="schemas.agentivity.com/types")
/**
 * @template TItemResponse
 * @template TItem
 */
class Report2 implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): Report2 {
        $to = new Report2();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    public function __construct(
        // @DataMember(Order=1, EmitDefaultValue=false)
        /** @var TItem|null */
        public mixed $Item=null
    ) {
    }

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

// @DataContract(Name="HotelSegment", Namespace="schemas.agentivity.com/types")
/**
 * @template Report2 of HotelSegmentsItemResponse
 * @template Report21 of HotelSegment
 */
class HotelSegmentsResponseReport extends Report2 implements JsonSerializable
{
    /**
     * @param TItem|null $Item
     */
    public function __construct(
        ?TItem $Item=null
    ) {
        parent::__construct($Item);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract(Name="CacheMetadata", Namespace="schemas.agentivity.com/types")
class CacheMetadata implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=1)
        /** @var DateTime */
        public DateTime $CachedAt=new DateTime(),

        // @DataMember(Order=2)
        /** @var DateTime */
        public DateTime $CacheExpiresAt=new DateTime(),

        // @DataMember(Order=0)
        /** @var bool|null */
        public ?bool $IsFromCache=null
    ) {
    }

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

// @DataContract(Name="ResponseMetadata", Namespace="schemas.agentivity.com/types")
class ResponseMetadata implements JsonSerializable
{
    public function __construct(
        // @DataMember(Order=0)
        /** @var bool|null */
        public ?bool $Success=null,

        // @DataMember(Order=1)
        /** @var bool|null */
        public ?bool $HasCache=null,

        // @DataMember(Order=2)
        /** @var bool|null */
        public ?bool $HasPaging=null,

        // @DataMember(Order=3, EmitDefaultValue=false)
        /** @var CacheMetadata|null */
        public ?CacheMetadata $CacheMetadata=null,

        // @DataMember(Order=4, EmitDefaultValue=false)
        /** @var PagingMetadata|null */
        public ?PagingMetadata $PagingMetadata=null
    ) {
    }

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

// @DataContract(Name="ResponseMetadata", Namespace="schemas.agentivity.com/types")
class AgentivityError implements JsonSerializable
{
    public function __construct(
        // @DataMember
        /** @var string|null */
        public ?string $ErrorCode=null,

        // @DataMember
        /** @var string|null */
        public ?string $Message=null,

        // @DataMember
        /** @var string|null */
        public ?string $StatusCode=null,

        // @DataMember
        /** @var string|null */
        public ?string $VerboseMessage=null
    ) {
    }

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

// @DataContract(Name="AgentivityResponse", Namespace="schemas.agentivity.com/types")
/**
 * @template TItem
 * @template TReport
 */
class ItemResponse2 implements JsonSerializable
{
    public array $genericArgs = [];
    public static function create(array $genericArgs=[]): ItemResponse2 {
        $to = new ItemResponse2();
        $to->genericArgs = $genericArgs;
        return $to;
    }

    public function __construct(
        // @DataMember(Order=1)
        /** @var ResponseMetadata|null */
        public mixed $ResponseMetadata=null,

        // @DataMember(Order=2, EmitDefaultValue=false)
        /** @var TReport|null */
        public mixed $ResponseReport=null,

        // @DataMember(Order=3, EmitDefaultValue=false)
        /** @var AgentivityError|null */
        public mixed $ResponseError=null
    ) {
    }

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

// @DataContract(Name="AgentivityResponse", Namespace="schemas.agentivity.com/types")
/**
 * @template ItemResponse2 of HotelSegment
 * @template ItemResponse21 of HotelSegmentsResponseReport
 */
class HotelSegmentsItemResponse extends ItemResponse2 implements JsonSerializable
{
    /**
     * @param ResponseMetadata|null $ResponseMetadata
     * @param TReport|null $ResponseReport
     * @param AgentivityError|null $ResponseError
     */
    public function __construct(
        ?ResponseMetadata $ResponseMetadata=null,
        ?TReport $ResponseReport=null,
        ?AgentivityError $ResponseError=null
    ) {
        parent::__construct($ResponseMetadata,$ResponseReport,$ResponseError);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

// @DataContract(Namespace="schemas.agentivity.com/types")
class GetHotelSegments extends CompanyLevelRequestBase implements JsonSerializable
{
    /**
     * @param string|null $Offset
     * @param string|null $Limit
     * @param int $TotalRecords
     * @param int $ResponseRecords
     * @param string[]|null $OwningCompanyCode
     * @param string|null $UserName
     */
    public function __construct(
        ?string $Offset=null,
        ?string $Limit=null,
        int $TotalRecords=0,
        int $ResponseRecords=0,
        ?array $OwningCompanyCode=null,
        ?string $UserName=null,
        /** @description Date in format YYYYMMDD */
        // @DataMember
        /** @var string */
        public string $DateStart='',

        /** @description Date in format YYYYMMDD */
        // @DataMember
        /** @var string */
        public string $DateEnd='',

        /** @description Comma Delimited List of Accounts */
        // @DataMember
        /** @var string[]|null */
        public ?array $Account=null,

        /** @description 3 letter city code */
        // @DataMember
        /** @var string|null */
        public ?string $CityCode=null,

        /** @description Include Notepad Entry: 1=Yes */
        // @DataMember
        /** @var string|null */
        public ?string $WithNotepad=null,

        /** @description Comma Delimited List of PCCs */
        // @DataMember
        /** @var string[]|null */
        public ?array $OwningAgencyLocationID=null,

        /** @description Comma Delimited List of CountryCodes */
        // @DataMember
        /** @var string[]|null */
        public ?array $OwningAgencyCountryCode=null,

        /** @description Date search type option, a single character (A to search by Arrival dates, C to search by booking creation dates, S to search by segment creation dates). */
        // @DataMember
        /** @var string|null */
        public ?string $DateSearchType=null,

        /** @description IsGDS=0 (bookings from Non-GDS eg Supplier Direct). IsGDS=1 (bookings from GDS). */
        // @DataMember
        /** @var string|null */
        public ?string $IsGDS=null,

        /** @description IsPassive=0 (only include non-passive segments). IsPassive=1 (only include passive segments). */
        // @DataMember
        /** @var string|null */
        public ?string $IsPassive=null,

        /** @description Comma Delimited List of Custom Fields */
        // @DataMember
        /** @var string[]|null */
        public ?array $CustomField=null
    ) {
        parent::__construct($Offset,$Limit,$TotalRecords,$ResponseRecords,$OwningCompanyCode,$UserName);
    }

    /** @throws Exception */
    public function fromMap($o): void {
        parent::fromMap($o);
        if (isset($o['DateStart'])) $this->DateStart = $o['DateStart'];
        if (isset($o['DateEnd'])) $this->DateEnd = $o['DateEnd'];
        if (isset($o['Account'])) $this->Account = JsonConverters::fromArray('string', $o['Account']);
        if (isset($o['CityCode'])) $this->CityCode = $o['CityCode'];
        if (isset($o['WithNotepad'])) $this->WithNotepad = $o['WithNotepad'];
        if (isset($o['OwningAgencyLocationID'])) $this->OwningAgencyLocationID = JsonConverters::fromArray('string', $o['OwningAgencyLocationID']);
        if (isset($o['OwningAgencyCountryCode'])) $this->OwningAgencyCountryCode = JsonConverters::fromArray('string', $o['OwningAgencyCountryCode']);
        if (isset($o['DateSearchType'])) $this->DateSearchType = $o['DateSearchType'];
        if (isset($o['IsGDS'])) $this->IsGDS = $o['IsGDS'];
        if (isset($o['IsPassive'])) $this->IsPassive = $o['IsPassive'];
        if (isset($o['CustomField'])) $this->CustomField = JsonConverters::fromArray('string', $o['CustomField']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        if (isset($this->DateStart)) $o['DateStart'] = $this->DateStart;
        if (isset($this->DateEnd)) $o['DateEnd'] = $this->DateEnd;
        if (isset($this->Account)) $o['Account'] = JsonConverters::toArray('string', $this->Account);
        if (isset($this->CityCode)) $o['CityCode'] = $this->CityCode;
        if (isset($this->WithNotepad)) $o['WithNotepad'] = $this->WithNotepad;
        if (isset($this->OwningAgencyLocationID)) $o['OwningAgencyLocationID'] = JsonConverters::toArray('string', $this->OwningAgencyLocationID);
        if (isset($this->OwningAgencyCountryCode)) $o['OwningAgencyCountryCode'] = JsonConverters::toArray('string', $this->OwningAgencyCountryCode);
        if (isset($this->DateSearchType)) $o['DateSearchType'] = $this->DateSearchType;
        if (isset($this->IsGDS)) $o['IsGDS'] = $this->IsGDS;
        if (isset($this->IsPassive)) $o['IsPassive'] = $this->IsPassive;
        if (isset($this->CustomField)) $o['CustomField'] = JsonConverters::toArray('string', $this->CustomField);
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetHotelSegments 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.

GET /HotelSegments HTTP/1.1 
Host: api.agentivity.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"ResponseMetadata":{"Success":false,"HasCache":false,"HasPaging":false,"CacheMetadata":{"IsFromCache":false,"CachedAt":"\/Date(-62135596800000-0000)\/","CacheExpiresAt":"\/Date(-62135596800000-0000)\/"},"PagingMetadata":{"Offset":"String","Limit":"String","TotalRecords":0,"ResponseRecords":0}},"ResponseReport":{"Item":{"AgentivityRef":0,"PNRCreationDate":"\/Date(-62135596800000-0000)\/","HotelSegmentNbr":"String","RecordLocator":"String","OwningAgencyLocationID":"String","Account":"String","OwningConsultantID":"String","OwningConsultant":"String","StatusCode":"String","SegmentCreationDate":"\/Date(-62135596800000-0000)\/","ArrivalDate":"\/Date(-62135596800000-0000)\/","DepartureDate":"\/Date(-62135596800000-0000)\/","NbrNights":0,"VendorCode":"String","PropertyName":"String","PropertyPhoneNbr":"String","PropertyNbr":"String","PropertyAddress":"String","CityCode":"String","CityName":"String","CountryCode":"String","CountryName":"String","Passenger":"String","ConfirmationNbr":"String","RateAccessCode":"String","RoomBookingCode":"String","CurrencyCode":"String","RateAmount":"String","NbrRooms":0,"BookedInName":"String","ServiceInformation":"String","TotalAirSegs":"String","CreatingAgencyIata":"String","IsCommissionable":false,"Commission":"String","IsPassive":false,"CustomFields":[{"FieldName":"String","FieldValue":"String"}],"HotelNotepad":"String"}},"ResponseError":{"ErrorCode":"String","Message":"String","StatusCode":"String","VerboseMessage":"String"}}