Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
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 .xml suffix or ?format=xml
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: testapi.bokamera.se Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <ResourceTimeExceptionQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <BlockTime>false</BlockTime> <CalendarExportStatus> <CalendarId>String</CalendarId> <ExceptionId>0</ExceptionId> <Synced>false</Synced> </CalendarExportStatus> <Color>String</Color> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <Created>0001-01-01T00:00:00</Created> <DaysOfWeek> <DayOfWeekDto> <DayOfWeek>String</DayOfWeek> <DayOfWeekId>0</DayOfWeekId> <DotNetDayOfWeekId>0</DotNetDayOfWeekId> </DayOfWeekDto> </DaysOfWeek> <From>0001-01-01T00:00:00</From> <FromTime>PT0S</FromTime> <Id>0</Id> <IsRecurring>false</IsRecurring> <Locked>false</Locked> <Private>false</Private> <ReasonText>String</ReasonText> <ReasonTextPublic>String</ReasonTextPublic> <ResourceIds xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d2p1:int>0</d2p1:int> </ResourceIds> <Resources> <TimeExceptionReosurceDetails> <Color>String</Color> <Description>String</Description> <Id>0</Id> <ImageUrl i:nil="true" /> <Name>String</Name> <ResponseStatus xmlns:d4p1="http://schemas.servicestack.net/types"> <d4p1:ErrorCode>String</d4p1:ErrorCode> <d4p1:Message>String</d4p1:Message> <d4p1:StackTrace>String</d4p1:StackTrace> <d4p1:Errors> <d4p1:ResponseError> <d4p1:ErrorCode>String</d4p1:ErrorCode> <d4p1:FieldName>String</d4p1:FieldName> <d4p1:Message>String</d4p1:Message> <d4p1:Meta xmlns:d7p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d7p1:KeyValueOfstringstring> <d7p1:Key>String</d7p1:Key> <d7p1:Value>String</d7p1:Value> </d7p1:KeyValueOfstringstring> </d4p1:Meta> </d4p1:ResponseError> </d4p1:Errors> <d4p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d4p1:Meta> </ResponseStatus> </TimeExceptionReosurceDetails> </Resources> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> <To>0001-01-01T00:00:00</To> <ToTime>PT0S</ToTime> </ResourceTimeExceptionQueryResponse>