BokaMera.API.Host

<back to all web services

GetVossTargetGroups

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
GET/voss/targetGroupsGet all Voss target groupsReturns every target group in the Voss tenant (all pages).
<?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="TargetGroupConfigurationResult")
class TargetGroupConfigurationResult implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="id", IsRequired=true)
        /** @var string */
        public string $id='',

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

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

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

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

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

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

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

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['organizationNumberRequired'])) $this->organizationNumberRequired = $o['organizationNumberRequired'];
        if (isset($o['organizationNumberUnique'])) $this->organizationNumberUnique = $o['organizationNumberUnique'];
        if (isset($o['customerNumberRequired'])) $this->customerNumberRequired = $o['customerNumberRequired'];
        if (isset($o['customerAddressRequired'])) $this->customerAddressRequired = $o['customerAddressRequired'];
        if (isset($o['contactPersonRequired'])) $this->contactPersonRequired = $o['contactPersonRequired'];
        if (isset($o['expiryDateRequired'])) $this->expiryDateRequired = $o['expiryDateRequired'];
        if (isset($o['excludeCustomerFromInvoiceFile'])) $this->excludeCustomerFromInvoiceFile = $o['excludeCustomerFromInvoiceFile'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->organizationNumberRequired)) $o['organizationNumberRequired'] = $this->organizationNumberRequired;
        if (isset($this->organizationNumberUnique)) $o['organizationNumberUnique'] = $this->organizationNumberUnique;
        if (isset($this->customerNumberRequired)) $o['customerNumberRequired'] = $this->customerNumberRequired;
        if (isset($this->customerAddressRequired)) $o['customerAddressRequired'] = $this->customerAddressRequired;
        if (isset($this->contactPersonRequired)) $o['contactPersonRequired'] = $this->contactPersonRequired;
        if (isset($this->expiryDateRequired)) $o['expiryDateRequired'] = $this->expiryDateRequired;
        if (isset($this->excludeCustomerFromInvoiceFile)) $o['excludeCustomerFromInvoiceFile'] = $this->excludeCustomerFromInvoiceFile;
        return empty($o) ? new class(){} : $o;
    }
}

enum TypeEnum : string
{
    case Exclusivity = 'Exclusivity';
}

// @DataContract(Name="TargetGroupTagDto")
class TargetGroupTagDto implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="type", IsRequired=true)
        /** @var TypeEnum|null */
        public ?TypeEnum $type=null,

        // @DataMember(Name="tag", IsRequired=true)
        /** @var string */
        public string $tag=''
    ) {
    }

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

// @DataContract(Name="TargetGroupResult")
class TargetGroupResult implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="id", IsRequired=true)
        /** @var string */
        public string $id='',

        // @DataMember(Name="name", IsRequired=true)
        /** @var string */
        public string $name='',

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

        // @DataMember(Name="externalId")
        /** @var string */
        public string $externalId='',

        // @DataMember(Name="configuration", EmitDefaultValue=false)
        /** @var TargetGroupConfigurationResult|null */
        public ?TargetGroupConfigurationResult $configuration=null,

        // @DataMember(Name="tags", EmitDefaultValue=false)
        /** @var array<TargetGroupTagDto>|null */
        public ?array $tags=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['id'])) $this->id = $o['id'];
        if (isset($o['name'])) $this->name = $o['name'];
        if (isset($o['isDefault'])) $this->isDefault = $o['isDefault'];
        if (isset($o['externalId'])) $this->externalId = $o['externalId'];
        if (isset($o['configuration'])) $this->configuration = JsonConverters::from('TargetGroupConfigurationResult', $o['configuration']);
        if (isset($o['tags'])) $this->tags = JsonConverters::fromArray('TargetGroupTagDto', $o['tags']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->id)) $o['id'] = $this->id;
        if (isset($this->name)) $o['name'] = $this->name;
        if (isset($this->isDefault)) $o['isDefault'] = $this->isDefault;
        if (isset($this->externalId)) $o['externalId'] = $this->externalId;
        if (isset($this->configuration)) $o['configuration'] = JsonConverters::to('TargetGroupConfigurationResult', $this->configuration);
        if (isset($this->tags)) $o['tags'] = JsonConverters::toArray('TargetGroupTagDto', $this->tags);
        return empty($o) ? new class(){} : $o;
    }
}

class GetVossTargetGroupsResponse implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $TotalCount=0,
        /** @var array<TargetGroupResult>|null */
        public ?array $Items=null
    ) {
    }

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class GetVossTargetGroups implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        return empty($o) ? new class(){} : $o;
    }
}

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

GET /voss/targetGroups HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"TotalCount":0,"Items":[{}]}