BokaMera.API.Host

<back to all web services

CustomFieldSlotsQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
GET/customfields/slotsFind all slots to store custom fields data inGet all available slots that are avaialble to store data in
<?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 CustomFieldSlotsQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description Table to which the field belongs */
        // @ApiMember(Description="Table to which the field belongs")
        /** @var string|null */
        public ?string $Table=null,

        /** @description Custom field id */
        // @ApiMember(Description="Custom field id")
        /** @var int */
        public int $Id=0,

        /** @description Custom field column name */
        // @ApiMember(Description="Custom field column name")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The field datatype */
        // @ApiMember(Description="The field datatype")
        /** @var string|null */
        public ?string $Datatype=null,

        /** @description If the slot is free or occupied */
        // @ApiMember(Description="If the slot is free or occupied")
        /** @var bool|null */
        public ?bool $Occupied=null
    ) {
    }

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

// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="You have too low privilegies to call this service", StatusCode=403)
// @ValidateRequest(Validator="IsAuthenticated")
class CustomFieldSlotsQuery implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description Company id to find custom fields for */
        // @ApiMember(Description="Company id to find custom fields for", ParameterType="query")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description Table to which the field belongs */
        // @ApiMember(Description="Table to which the field belongs", IsRequired=true)
        /** @var string */
        public string $Table='',

        /** @description If you want to receive only free slots (not occupied). */
        // @ApiMember(Description="If you want to receive only free slots (not occupied).")
        /** @var bool|null */
        public ?bool $FreeSlots=null
    ) {
    }

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

PHP CustomFieldSlotsQuery DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

GET /customfields/slots HTTP/1.1 
Host: testapi.bokamera.se 
Accept: application/json
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Table":"String","Id":0,"Name":"String","Datatype":"String","Occupied":false}