BokaMera.API.Host

<back to all web services

CodeLockSettingQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin, bookingsupplier-administrator-read
The following routes are available for this service:
GET/codelock/settingsGet code lock settings for the currently logged in userGet code lock settings for the currently logged in user.
<?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 CodeLockSystemResponse implements JsonSerializable
{
    public function __construct(
        /** @description The system type of the code lock */
        // @ApiMember(DataType="int", Description="The system type of the code lock")
        /** @var int */
        public int $Id=0,

        /** @description The name of the code lock system */
        // @ApiMember(DataType="string", Description="The name of the code lock system")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The description of the code lock system */
        // @ApiMember(DataType="string", Description="The description of the code lock system")
        /** @var string|null */
        public ?string $Description=null,

        /** @description The logotype of the code lock system */
        // @ApiMember(Description="The logotype of the code lock system")
        /** @var string|null */
        public ?string $LogoType=null,

        /** @description The supplier name of the code lock system */
        // @ApiMember(Description="The supplier name of the code lock system")
        /** @var string|null */
        public ?string $Supplier=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['Description'])) $this->Description = $o['Description'];
        if (isset($o['LogoType'])) $this->LogoType = JsonConverters::from('string', $o['LogoType']);
        if (isset($o['Supplier'])) $this->Supplier = $o['Supplier'];
    }
    
    /** @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->Description)) $o['Description'] = $this->Description;
        if (isset($this->LogoType)) $o['LogoType'] = JsonConverters::to('string', $this->LogoType);
        if (isset($this->Supplier)) $o['Supplier'] = $this->Supplier;
        return empty($o) ? new class(){} : $o;
    }
}

class CodeLockSettingResponse implements JsonSerializable
{
    public function __construct(
        /** @var string */
        public string $CompanyId='',
        /** @description The system type of the code lock */
        // @ApiMember(DataType="int", Description="The system type of the code lock")
        /** @var int */
        public int $CodeLockSystemsId=0,

        /** @description If code lock sync is active */
        // @ApiMember(DataType="bool", Description="If code lock sync is active")
        /** @var bool|null */
        public ?bool $Active=null,

        /** @description Number of minutes the access should be valid before booking starts. */
        // @ApiMember(DataType="int", Description="Number of minutes the access should be valid before booking starts.")
        /** @var int */
        public int $ValidBeforeMinutes=0,

        /** @description Number of minutes the access should be valid after booking ends. */
        // @ApiMember(DataType="int", Description="Number of minutes the access should be valid after booking ends.")
        /** @var int */
        public int $ValidAfterMinutes=0,

        /** @description If it should clean up old bookings after the passed */
        // @ApiMember(DataType="boolean", Description="If it should clean up old bookings after the passed")
        /** @var bool|null */
        public ?bool $DeleteOldBySchedule=null,

        /** @description If a notification should be sent by Email */
        // @ApiMember(DataType="boolean", Description="If a notification should be sent by Email")
        /** @var bool|null */
        public ?bool $SendEmailNotification=null,

        /** @description If a notification should be sent by SMS */
        // @ApiMember(DataType="boolean", Description="If a notification should be sent by SMS")
        /** @var bool|null */
        public ?bool $SendSMSNotification=null,

        /** @description How long before the booking starts in minutes the notification should be sent */
        // @ApiMember(DataType="int", Description="How long before the booking starts in minutes the notification should be sent")
        /** @var int */
        public int $EmailNotificationTime=0,

        /** @description How long before the booking starts in minutes the notification should be sent */
        // @ApiMember(DataType="int", Description="How long before the booking starts in minutes the notification should be sent")
        /** @var int */
        public int $SMSNotificationTime=0,

        /** @description When settings was created */
        // @ApiMember(DataType="datetime", Description="When settings was created")
        /** @var DateTime */
        public DateTime $Created=new DateTime(),

        /** @description When settings was updated */
        // @ApiMember(DataType="datetime", Description="When settings was updated")
        /** @var DateTime */
        public DateTime $Updated=new DateTime(),

        /** @description The available code lock systems to choose from */
        // @ApiMember(Description="The available code lock systems to choose from")
        /** @var array<CodeLockSystemResponse>|null */
        public ?array $CodeLockSystemOptions=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['CodeLockSystemsId'])) $this->CodeLockSystemsId = $o['CodeLockSystemsId'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['ValidBeforeMinutes'])) $this->ValidBeforeMinutes = $o['ValidBeforeMinutes'];
        if (isset($o['ValidAfterMinutes'])) $this->ValidAfterMinutes = $o['ValidAfterMinutes'];
        if (isset($o['DeleteOldBySchedule'])) $this->DeleteOldBySchedule = $o['DeleteOldBySchedule'];
        if (isset($o['SendEmailNotification'])) $this->SendEmailNotification = $o['SendEmailNotification'];
        if (isset($o['SendSMSNotification'])) $this->SendSMSNotification = $o['SendSMSNotification'];
        if (isset($o['EmailNotificationTime'])) $this->EmailNotificationTime = $o['EmailNotificationTime'];
        if (isset($o['SMSNotificationTime'])) $this->SMSNotificationTime = $o['SMSNotificationTime'];
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
        if (isset($o['CodeLockSystemOptions'])) $this->CodeLockSystemOptions = JsonConverters::fromArray('CodeLockSystemResponse', $o['CodeLockSystemOptions']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->CodeLockSystemsId)) $o['CodeLockSystemsId'] = $this->CodeLockSystemsId;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->ValidBeforeMinutes)) $o['ValidBeforeMinutes'] = $this->ValidBeforeMinutes;
        if (isset($this->ValidAfterMinutes)) $o['ValidAfterMinutes'] = $this->ValidAfterMinutes;
        if (isset($this->DeleteOldBySchedule)) $o['DeleteOldBySchedule'] = $this->DeleteOldBySchedule;
        if (isset($this->SendEmailNotification)) $o['SendEmailNotification'] = $this->SendEmailNotification;
        if (isset($this->SendSMSNotification)) $o['SendSMSNotification'] = $this->SendSMSNotification;
        if (isset($this->EmailNotificationTime)) $o['EmailNotificationTime'] = $this->EmailNotificationTime;
        if (isset($this->SMSNotificationTime)) $o['SMSNotificationTime'] = $this->SMSNotificationTime;
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
        if (isset($this->CodeLockSystemOptions)) $o['CodeLockSystemOptions'] = JsonConverters::toArray('CodeLockSystemResponse', $this->CodeLockSystemOptions);
        return empty($o) ? new class(){} : $o;
    }
}

// @ValidateRequest(Validator="IsAuthenticated")
// @ApiResponse(Description="You were unauthorized to call this service", StatusCode=401)
// @ApiResponse(Description="You have too low privileges to call this service", StatusCode=403)
class CodeLockSettingQuery implements ICompany, JsonSerializable
{
    public function __construct(
        /** @description The company id, if empty will use the company id for the user you are logged in with. */
        // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
        /** @var string|null */
        public ?string $CompanyId=null,

        /** @description If you want to include code locks that is supported. */
        // @ApiMember(DataType="boolean", Description="If you want to include code locks that is supported.", ParameterType="query")
        /** @var bool|null */
        public ?bool $IncludeCodeLockSystemOptions=null
    ) {
    }

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

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

GET /codelock/settings HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CodeLockSettingResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <Active>false</Active>
  <CodeLockSystemOptions>
    <CodeLockSystemResponse>
      <Description>String</Description>
      <Id>0</Id>
      <LogoType i:nil="true" />
      <Name>String</Name>
      <Supplier>String</Supplier>
    </CodeLockSystemResponse>
  </CodeLockSystemOptions>
  <CodeLockSystemsId>0</CodeLockSystemsId>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <Created>0001-01-01T00:00:00</Created>
  <DeleteOldBySchedule>false</DeleteOldBySchedule>
  <EmailNotificationTime>0</EmailNotificationTime>
  <SMSNotificationTime>0</SMSNotificationTime>
  <SendEmailNotification>false</SendEmailNotification>
  <SendSMSNotification>false</SendSMSNotification>
  <Updated>0001-01-01T00:00:00</Updated>
  <ValidAfterMinutes>0</ValidAfterMinutes>
  <ValidBeforeMinutes>0</ValidBeforeMinutes>
</CodeLockSettingResponse>