BokaMera.API.Host

<back to all web services

GetVossProductGroup

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
GET/voss/productGroups/{ProductGroupId}gets voss product group
<?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};


enum ProductGroupTypeEnum : string
{
    case Optional = 'Optional';
    case Included = 'Included';
}

enum ProductTypeEnum : string
{
    case Main = 'Main';
    case Addon = 'Addon';
    case License = 'License';
    case Usage = 'Usage';
}

enum StatusEnum : string
{
    case Active = 'Active';
    case Terminated = 'Terminated';
}

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

        // @DataMember(Name="status", IsRequired=true)
        /** @var StatusEnum|null */
        public ?StatusEnum $status=null,

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

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

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

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

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

enum TypeEnum : string
{
    case AtSubscriptionBillingPeriodEnd = 'AtSubscriptionBillingPeriodEnd';
    case AtBindingPeriodEnd = 'AtBindingPeriodEnd';
    case Immediately = 'Immediately';
}

// @DataContract(Name="ProductGroupTagDto")
class ProductGroupTagDto 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="ProductGroupResult")
class ProductGroupResult implements JsonSerializable
{
    public function __construct(
        // @DataMember(Name="productGroupType", IsRequired=true)
        /** @var ProductGroupTypeEnum|null */
        public ?ProductGroupTypeEnum $productGroupType=null,

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

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

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

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

        // @DataMember(Name="products", EmitDefaultValue=false)
        /** @var array<ProductGroupProductDto>|null */
        public ?array $products=null,

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

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
class GetVossProductGroup implements JsonSerializable
{
    public function __construct(
        /** @description Passed if we have multilpe packages */
        // @ApiMember(Description="Passed if we have multilpe packages")
        /** @var string|null */
        public ?string $PackageId=null,

        /** @description Procut Group id to get */
        // @ApiMember(Description="Procut Group id to get", IsRequired=true)
        /** @var string */
        public string $ProductGroupId='',

        /** @description Tier id required because it is used it voss url */
        // @ApiMember(Description="Tier id required because it is used it voss url", IsRequired=true)
        /** @var string */
        public string $TierId=''
    ) {
    }

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

PHP GetVossProductGroup DTOs

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

HTTP + JSV

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

GET /voss/productGroups/{ProductGroupId} HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	productGroupType: Optional,
	name: String,
	externalId: String,
	products: 
	[
		{
			
		}
	],
	tags: 
	[
		{
			
		}
	]
}