BokaMera.API.Host

<back to all web services

UpdatePackage

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/voss/packagePublish a package
<?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="CreatePackageSalesChannelRequestDto")
class CreatePackageSalesChannelRequestDto implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="id", IsRequired=true)
        /** @var string */
        public string $id='',

        // @DataMember(Name="validFrom")
        /** @var DateTime|null */
        public ?DateTime $validFrom=null,

        // @DataMember(Name="validTo")
        /** @var DateTime|null */
        public ?DateTime $validTo=null
    ) {
    }

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class UpdatePackage implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $PackageId=null,
        /** @var array<CreatePackageSalesChannelRequestDto>|null */
        public ?array $SalesChannels=null
    ) {
    }

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

PHP UpdatePackage DTOs

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

HTTP + XML

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

PUT /voss/package HTTP/1.1 
Host: api.bookmore.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<UpdatePackage xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <PackageId>00000000-0000-0000-0000-000000000000</PackageId>
  <SalesChannels xmlns:d2p1="http://schemas.datacontract.org/2004/07/BokaMera.VossIntegration.ApiTools.Model">
    <d2p1:CreatePackageSalesChannelRequestDto i:nil="true" />
  </SalesChannels>
</UpdatePackage>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />