BokaMera.API.Host

<back to all web services

DeleteResourceTimeException

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
DELETE/timeexceptions/{Id}Delete a given time exception that the user have access too
<?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 TimeExceptionReosurceDetails implements JsonSerializable
{
    public function __construct(
        /** @description Ids of the resources that owns this exception */
        // @ApiMember(Description="Ids of the resources that owns this exception")
        /** @var int */
        public int $Id=0,

        /** @description Name of the resource */
        // @ApiMember(Description="Name of the resource")
        /** @var string|null */
        public ?string $Name=null,

        /** @description Description of the resource */
        // @ApiMember(Description="Description of the resource")
        /** @var string|null */
        public ?string $Description=null,

        /** @description Color of the resource */
        // @ApiMember(Description="Color of the resource")
        /** @var string|null */
        public ?string $Color=null,

        /** @description Image of the resource */
        // @ApiMember(Description="Image of the resource")
        /** @var string|null */
        public ?string $ImageUrl=null,

        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=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['Color'])) $this->Color = $o['Color'];
        if (isset($o['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @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->Color)) $o['Color'] = $this->Color;
        if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        return empty($o) ? new class(){} : $o;
    }
}

class ExceptionCalendarExportStatus implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $CalendarId=null,
        /** @var int */
        public int $ExceptionId=0,
        /** @var bool|null */
        public ?bool $Synced=null
    ) {
    }

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

class DayOfWeekDto implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $DayOfWeekId=0,
        /** @var int */
        public int $DotNetDayOfWeekId=0,
        /** @var string|null */
        public ?string $DayOfWeek=null
    ) {
    }

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

class ResourceTimeExceptionQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description Time exception id */
        // @ApiMember(Description="Time exception id")
        /** @var int */
        public int $Id=0,

        /** @description Time company id */
        // @ApiMember(Description="Time company id")
        /** @var string */
        public string $CompanyId='',

        /** @description If it's locked for editing for the logged in administrator */
        // @ApiMember(Description="If it's locked for editing for the logged in administrator")
        /** @var bool|null */
        public ?bool $Locked=null,

        /** @description Resources that owns this exception */
        // @ApiMember(Description="Resources that owns this exception")
        /** @var int[]|null */
        public ?array $ResourceIds=null,

        /** @description Resources that owns this exception */
        // @ApiMember(Description="Resources that owns this exception")
        /** @var array<TimeExceptionReosurceDetails>|null */
        public ?array $Resources=null,

        /** @description Indicates wheter or not the time exception is recurring */
        // @ApiMember(Description="Indicates wheter or not the time exception is recurring")
        /** @var bool|null */
        public ?bool $IsRecurring=null,

        /** @description Time exception starting timestamp */
        // @ApiMember(Description="Time exception starting timestamp")
        /** @var DateTime */
        public DateTime $From=new DateTime(),

        /** @description Time exception ending timestamp */
        // @ApiMember(Description="Time exception ending timestamp")
        /** @var DateTime */
        public DateTime $To=new DateTime(),

        /** @description If recurring then this value indicates the time of day when the time exception begins */
        // @ApiMember(Description="If recurring then this value indicates the time of day when the time exception begins")
        /** @var DateInterval|null */
        public ?DateInterval $FromTime=null,

        /** @description If recurring then this value indicates the time of day when the time exception ends */
        // @ApiMember(Description="If recurring then this value indicates the time of day when the time exception ends")
        /** @var DateInterval|null */
        public ?DateInterval $ToTime=null,

        /** @description The reason of the time exception, example: Vacation, doctors appointment, ... */
        // @ApiMember(Description="The reason of the time exception, example: Vacation, doctors appointment, ...")
        /** @var string|null */
        public ?string $ReasonText=null,

        /** @description The reason of the time exception that could be public to customers, example: Vacation, Closed, Sick leave, ... */
        // @ApiMember(Description="The reason of the time exception that could be public to customers, example: Vacation, Closed, Sick leave, ...")
        /** @var string|null */
        public ?string $ReasonTextPublic=null,

        /** @description What hexadecimal color code the exception should have in the scheduler */
        // @ApiMember(Description="What hexadecimal color code the exception should have in the scheduler")
        /** @var string|null */
        public ?string $Color=null,

        /** @description If the time exception should block the time in the scheduler so it's not avaialable to book */
        // @ApiMember(Description="If the time exception should block the time in the scheduler so it's not avaialable to book")
        /** @var bool|null */
        public ?bool $BlockTime=null,

        /** @description If the ReasonText should only be visible to conncted resources. If false, all resources will be able to see it */
        // @ApiMember(Description="If the ReasonText should only be visible to conncted resources. If false, all resources will be able to see it")
        /** @var bool|null */
        public ?bool $Private=null,

        /** @description The status for export to calendars like Gcal */
        // @ApiMember(Description="The status for export to calendars like Gcal")
        /** @var ExceptionCalendarExportStatus|null */
        public ?ExceptionCalendarExportStatus $CalendarExportStatus=null,

        /** @description If recurring, an array indicating which days of the week the exception recures on where 1 = Monday .. 7 = Sunday. When recurring then the time portion of the Fields From and To indicates the time of day the recurrence occurs */
        // @ApiMember(Description="If recurring, an array indicating which days of the week the exception recures on where 1 = Monday .. 7 = Sunday. When recurring then the time portion of the Fields From and To indicates the time of day the recurrence occurs")
        /** @var array<DayOfWeekDto>|null */
        public ?array $DaysOfWeek=null,

        /** @description The datetime the exception was created */
        // @ApiMember(Description="The datetime the exception was created")
        /** @var DateTime */
        public DateTime $Created=new DateTime(),

        /** @var ResponseStatus|null */
        public ?ResponseStatus $ResponseStatus=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Locked'])) $this->Locked = $o['Locked'];
        if (isset($o['ResourceIds'])) $this->ResourceIds = JsonConverters::fromArray('int', $o['ResourceIds']);
        if (isset($o['Resources'])) $this->Resources = JsonConverters::fromArray('TimeExceptionReosurceDetails', $o['Resources']);
        if (isset($o['IsRecurring'])) $this->IsRecurring = $o['IsRecurring'];
        if (isset($o['From'])) $this->From = JsonConverters::from('DateTime', $o['From']);
        if (isset($o['To'])) $this->To = JsonConverters::from('DateTime', $o['To']);
        if (isset($o['FromTime'])) $this->FromTime = JsonConverters::from('DateInterval', $o['FromTime']);
        if (isset($o['ToTime'])) $this->ToTime = JsonConverters::from('DateInterval', $o['ToTime']);
        if (isset($o['ReasonText'])) $this->ReasonText = $o['ReasonText'];
        if (isset($o['ReasonTextPublic'])) $this->ReasonTextPublic = $o['ReasonTextPublic'];
        if (isset($o['Color'])) $this->Color = $o['Color'];
        if (isset($o['BlockTime'])) $this->BlockTime = $o['BlockTime'];
        if (isset($o['Private'])) $this->Private = $o['Private'];
        if (isset($o['CalendarExportStatus'])) $this->CalendarExportStatus = JsonConverters::from('ExceptionCalendarExportStatus', $o['CalendarExportStatus']);
        if (isset($o['DaysOfWeek'])) $this->DaysOfWeek = JsonConverters::fromArray('DayOfWeekDto', $o['DaysOfWeek']);
        if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
        if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Locked)) $o['Locked'] = $this->Locked;
        if (isset($this->ResourceIds)) $o['ResourceIds'] = JsonConverters::toArray('int', $this->ResourceIds);
        if (isset($this->Resources)) $o['Resources'] = JsonConverters::toArray('TimeExceptionReosurceDetails', $this->Resources);
        if (isset($this->IsRecurring)) $o['IsRecurring'] = $this->IsRecurring;
        if (isset($this->From)) $o['From'] = JsonConverters::to('DateTime', $this->From);
        if (isset($this->To)) $o['To'] = JsonConverters::to('DateTime', $this->To);
        if (isset($this->FromTime)) $o['FromTime'] = JsonConverters::to('DateInterval', $this->FromTime);
        if (isset($this->ToTime)) $o['ToTime'] = JsonConverters::to('DateInterval', $this->ToTime);
        if (isset($this->ReasonText)) $o['ReasonText'] = $this->ReasonText;
        if (isset($this->ReasonTextPublic)) $o['ReasonTextPublic'] = $this->ReasonTextPublic;
        if (isset($this->Color)) $o['Color'] = $this->Color;
        if (isset($this->BlockTime)) $o['BlockTime'] = $this->BlockTime;
        if (isset($this->Private)) $o['Private'] = $this->Private;
        if (isset($this->CalendarExportStatus)) $o['CalendarExportStatus'] = JsonConverters::to('ExceptionCalendarExportStatus', $this->CalendarExportStatus);
        if (isset($this->DaysOfWeek)) $o['DaysOfWeek'] = JsonConverters::toArray('DayOfWeekDto', $this->DaysOfWeek);
        if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
        if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
        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 DeleteResourceTimeException 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 Time exception id to be deleted */
        // @ApiMember(Description="Time exception id to be deleted")
        /** @var int */
        public int $Id=0
    ) {
    }

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

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

DELETE /timeexceptions/{Id} HTTP/1.1 
Host: api.bokamera.se 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"Id":0,"Locked":false,"ResourceIds":[0],"Resources":[{"Id":0,"Name":"String","Description":"String","Color":"String","ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}],"IsRecurring":false,"FromTime":"00:00:00","ToTime":"00:00:00","ReasonText":"String","ReasonTextPublic":"String","Color":"String","BlockTime":false,"Private":false,"CalendarExportStatus":{"CalendarId":"String","ExceptionId":0,"Synced":false},"DaysOfWeek":[{"DayOfWeekId":0,"DotNetDayOfWeekId":0,"DayOfWeek":"String"}],"ResponseStatus":{"ErrorCode":"String","Message":"String","StackTrace":"String","Errors":[{"ErrorCode":"String","FieldName":"String","Message":"String","Meta":{"String":"String"}}],"Meta":{"String":"String"}}}