BokaMera.API.Host

<back to all web services

UpdateCodeLockSetting

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/codelock/settingsUpdate settings for the code locks of the company of the currently logged in userUpdate settings for code lock of the company of 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 UpdateCodeLockSetting 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 code lock sync is active */
        // @ApiMember(DataType="bool", Description="If code lock sync is active")
        /** @var bool|null */
        public ?bool $Active=null,

        /** @description The system type of the code lock */
        // @ApiMember(DataType="int", Description="The system type of the code lock")
        /** @var int|null */
        public ?int $CodeLockSystemsId=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|null */
        public ?int $ValidBeforeMinutes=null,

        /** @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|null */
        public ?int $ValidAfterMinutes=null,

        /** @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|null */
        public ?int $EmailNotificationTime=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|null */
        public ?int $SMSNotificationTime=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Active'])) $this->Active = $o['Active'];
        if (isset($o['CodeLockSystemsId'])) $this->CodeLockSystemsId = $o['CodeLockSystemsId'];
        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'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Active)) $o['Active'] = $this->Active;
        if (isset($this->CodeLockSystemsId)) $o['CodeLockSystemsId'] = $this->CodeLockSystemsId;
        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;
        return empty($o) ? new class(){} : $o;
    }
}

PHP UpdateCodeLockSetting DTOs

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

HTTP + CSV

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

PUT /codelock/settings HTTP/1.1 
Host: testapi.bokamera.se 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"CompanyId":"00000000-0000-0000-0000-000000000000","Active":false,"CodeLockSystemsId":0,"ValidBeforeMinutes":0,"ValidAfterMinutes":0,"DeleteOldBySchedule":false,"SendEmailNotification":false,"SendSMSNotification":false,"EmailNotificationTime":0,"SMSNotificationTime":0}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"CodeLockSystemsId":0,"Active":false,"ValidBeforeMinutes":0,"ValidAfterMinutes":0,"DeleteOldBySchedule":false,"SendEmailNotification":false,"SendSMSNotification":false,"EmailNotificationTime":0,"SMSNotificationTime":0,"CodeLockSystemOptions":[{"Id":0,"Name":"String","Description":"String","Supplier":"String"}]}