Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
PUT | /homepage/scheduler/settings | Update homepage scheduler settings | Update homepage scheduler settings on the company of the currently logged in user, only administrators are allowed to update homepage menu. |
---|
<?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 HomepageSchedulerServiceResponse implements JsonSerializable
{
public function __construct(
/** @description The service id. */
// @ApiMember(Description="The service id.")
/** @var int */
public int $Id=0,
/** @description The service name. */
// @ApiMember(Description="The service name.")
/** @var string|null */
public ?string $Name=null,
/** @description The service description. */
// @ApiMember(Description="The service description.")
/** @var string|null */
public ?string $Description=null,
/** @description The service image url. */
// @ApiMember(Description="The service image url.")
/** @var string|null */
public ?string $ImageUrl=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['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
}
/** @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->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
return empty($o) ? new class(){} : $o;
}
}
class HomepageSchedulerResourceResponse implements JsonSerializable
{
public function __construct(
/** @description The resource id. */
// @ApiMember(Description="The resource id.")
/** @var int */
public int $Id=0,
/** @description The resource name. */
// @ApiMember(Description="The resource name.")
/** @var string|null */
public ?string $Name=null,
/** @description The resource description. */
// @ApiMember(Description="The resource description.")
/** @var string|null */
public ?string $Description=null,
/** @description The resource image url. */
// @ApiMember(Description="The resource image url.")
/** @var string|null */
public ?string $ImageUrl=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['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
}
/** @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->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
return empty($o) ? new class(){} : $o;
}
}
class HomepageSchedulerFieldResponse implements JsonSerializable
{
public function __construct(
/** @description The field id. */
// @ApiMember(Description="The field id.")
/** @var int */
public int $Id=0,
/** @description If the field should be shown on booking. */
// @ApiMember(Description="If the field should be shown on booking.")
/** @var bool|null */
public ?bool $ShowOnBooking=null,
/** @description If the field should be shown on tooltip. */
// @ApiMember(Description="If the field should be shown on tooltip.")
/** @var bool|null */
public ?bool $ShowOnTooltip=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['ShowOnBooking'])) $this->ShowOnBooking = $o['ShowOnBooking'];
if (isset($o['ShowOnTooltip'])) $this->ShowOnTooltip = $o['ShowOnTooltip'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->ShowOnBooking)) $o['ShowOnBooking'] = $this->ShowOnBooking;
if (isset($this->ShowOnTooltip)) $o['ShowOnTooltip'] = $this->ShowOnTooltip;
return empty($o) ? new class(){} : $o;
}
}
class HomepageSchedulerFieldOptionsResponse implements JsonSerializable
{
public function __construct(
/** @description The field id. */
// @ApiMember(Description="The field id.")
/** @var int */
public int $Id=0,
/** @description The field name. */
// @ApiMember(Description="The field name.")
/** @var string|null */
public ?string $Name=null,
/** @description The field description. */
// @ApiMember(Description="The field description.")
/** @var string|null */
public ?string $Description=null,
/** @description The field sort order when listing. */
// @ApiMember(Description="The field sort order when listing.")
/** @var int */
public int $SortOrder=0
) {
}
/** @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['SortOrder'])) $this->SortOrder = $o['SortOrder'];
}
/** @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->SortOrder)) $o['SortOrder'] = $this->SortOrder;
return empty($o) ? new class(){} : $o;
}
}
class ScheduleViewResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $Id=0,
/** @var string|null */
public ?string $Name=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['Name'])) $this->Name = $o['Name'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->Name)) $o['Name'] = $this->Name;
return empty($o) ? new class(){} : $o;
}
}
class HomepageSchedulerSettingsQueryResponse implements JsonSerializable
{
public function __construct(
/** @description The company id. */
// @ApiMember(Description="The company id.")
/** @var string */
public string $CompanyId='',
/** @description If the user schedule is activated. */
// @ApiMember(Description="If the user schedule is activated.")
/** @var bool|null */
public ?bool $Active=null,
/** @description If the user schedule views id. */
// @ApiMember(Description="If the user schedule views id.")
/** @var int */
public int $ScheduleViewId=0,
/** @description If the user schedule time slots in minutes. */
// @ApiMember(Description="If the user schedule time slots in minutes.")
/** @var int */
public int $ScheduleTimeSlotMinutes=0,
/** @description If the user schedule time start time. */
// @ApiMember(Description="If the user schedule time start time.")
/** @var DateInterval|null */
public ?DateInterval $StartTime=null,
/** @description If the user schedule time end time. */
// @ApiMember(Description="If the user schedule time end time.")
/** @var DateInterval|null */
public ?DateInterval $EndTime=null,
/** @description If the user schedule should contain time exceptions. */
// @ApiMember(Description="If the user schedule should contain time exceptions.")
/** @var bool|null */
public ?bool $ShowTimeExceptions=null,
/** @description If allow booking in the scheduler. */
// @ApiMember(Description="If allow booking in the scheduler.")
/** @var bool|null */
public ?bool $EnableBooking=null,
/** @description The homepage schedule services that are selected */
// @ApiMember(Description="The homepage schedule services that are selected")
/** @var array<HomepageSchedulerServiceResponse>|null */
public ?array $Services=null,
/** @description The homepage schedule resources that are selected */
// @ApiMember(Description="The homepage schedule resources that are selected")
/** @var array<HomepageSchedulerResourceResponse>|null */
public ?array $Resources=null,
/** @description The homepage schedule fields that are selected */
// @ApiMember(Description="The homepage schedule fields that are selected")
/** @var array<HomepageSchedulerFieldResponse>|null */
public ?array $Fields=null,
/** @description The homepage schedule fields select from */
// @ApiMember(Description="The homepage schedule fields select from")
/** @var array<HomepageSchedulerFieldOptionsResponse>|null */
public ?array $FieldOptions=null,
/** @description The available schedule view options to choose from */
// @ApiMember(Description="The available schedule view options to choose from")
/** @var array<ScheduleViewResponse>|null */
public ?array $ScheduleViewOptions=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['ScheduleViewId'])) $this->ScheduleViewId = $o['ScheduleViewId'];
if (isset($o['ScheduleTimeSlotMinutes'])) $this->ScheduleTimeSlotMinutes = $o['ScheduleTimeSlotMinutes'];
if (isset($o['StartTime'])) $this->StartTime = JsonConverters::from('TimeSpan', $o['StartTime']);
if (isset($o['EndTime'])) $this->EndTime = JsonConverters::from('TimeSpan', $o['EndTime']);
if (isset($o['ShowTimeExceptions'])) $this->ShowTimeExceptions = $o['ShowTimeExceptions'];
if (isset($o['EnableBooking'])) $this->EnableBooking = $o['EnableBooking'];
if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('HomepageSchedulerServiceResponse', $o['Services']);
if (isset($o['Resources'])) $this->Resources = JsonConverters::fromArray('HomepageSchedulerResourceResponse', $o['Resources']);
if (isset($o['Fields'])) $this->Fields = JsonConverters::fromArray('HomepageSchedulerFieldResponse', $o['Fields']);
if (isset($o['FieldOptions'])) $this->FieldOptions = JsonConverters::fromArray('HomepageSchedulerFieldOptionsResponse', $o['FieldOptions']);
if (isset($o['ScheduleViewOptions'])) $this->ScheduleViewOptions = JsonConverters::fromArray('ScheduleViewResponse', $o['ScheduleViewOptions']);
}
/** @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->ScheduleViewId)) $o['ScheduleViewId'] = $this->ScheduleViewId;
if (isset($this->ScheduleTimeSlotMinutes)) $o['ScheduleTimeSlotMinutes'] = $this->ScheduleTimeSlotMinutes;
if (isset($this->StartTime)) $o['StartTime'] = JsonConverters::to('TimeSpan', $this->StartTime);
if (isset($this->EndTime)) $o['EndTime'] = JsonConverters::to('TimeSpan', $this->EndTime);
if (isset($this->ShowTimeExceptions)) $o['ShowTimeExceptions'] = $this->ShowTimeExceptions;
if (isset($this->EnableBooking)) $o['EnableBooking'] = $this->EnableBooking;
if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('HomepageSchedulerServiceResponse', $this->Services);
if (isset($this->Resources)) $o['Resources'] = JsonConverters::toArray('HomepageSchedulerResourceResponse', $this->Resources);
if (isset($this->Fields)) $o['Fields'] = JsonConverters::toArray('HomepageSchedulerFieldResponse', $this->Fields);
if (isset($this->FieldOptions)) $o['FieldOptions'] = JsonConverters::toArray('HomepageSchedulerFieldOptionsResponse', $this->FieldOptions);
if (isset($this->ScheduleViewOptions)) $o['ScheduleViewOptions'] = JsonConverters::toArray('ScheduleViewResponse', $this->ScheduleViewOptions);
return empty($o) ? new class(){} : $o;
}
}
class HomepageSchedulerResource implements JsonSerializable
{
public function __construct(
/** @description The resource id. */
// @ApiMember(Description="The resource id.")
/** @var int */
public int $Id=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
return empty($o) ? new class(){} : $o;
}
}
class HomepageSchedulerService implements JsonSerializable
{
public function __construct(
/** @description The service id. */
// @ApiMember(Description="The service id.")
/** @var int */
public int $Id=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
return empty($o) ? new class(){} : $o;
}
}
class HomepageScheduleField implements JsonSerializable
{
public function __construct(
/** @description The field id. */
// @ApiMember(Description="The field id.", IsRequired=true)
/** @var int */
public int $Id=0,
/** @description If the field showed on the booking. */
// @ApiMember(Description="If the field showed on the booking.", IsRequired=true)
/** @var bool|null */
public ?bool $ShowOnBooking=null,
/** @description If the field showed on the bookings tooltip. */
// @ApiMember(Description="If the field showed on the bookings tooltip.", IsRequired=true)
/** @var bool|null */
public ?bool $ShowOnTooltip=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['Id'])) $this->Id = $o['Id'];
if (isset($o['ShowOnBooking'])) $this->ShowOnBooking = $o['ShowOnBooking'];
if (isset($o['ShowOnTooltip'])) $this->ShowOnTooltip = $o['ShowOnTooltip'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->Id)) $o['Id'] = $this->Id;
if (isset($this->ShowOnBooking)) $o['ShowOnBooking'] = $this->ShowOnBooking;
if (isset($this->ShowOnTooltip)) $o['ShowOnTooltip'] = $this->ShowOnTooltip;
return empty($o) ? new class(){} : $o;
}
}
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateHomepageSchedulerSettings 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 the user schedule is activated. */
// @ApiMember(Description="If the user schedule is activated.")
/** @var bool|null */
public ?bool $Active=null,
/** @description If the user schedule views id. */
// @ApiMember(Description="If the user schedule views id.")
/** @var int|null */
public ?int $ScheduleViewId=null,
/** @description If the user schedule time slots in minutes. */
// @ApiMember(Description="If the user schedule time slots in minutes.")
/** @var int|null */
public ?int $ScheduleTimeSlotMinutes=null,
/** @description If the user schedule time start time. */
// @ApiMember(Description="If the user schedule time start time.")
/** @var DateInterval|null */
public ?DateInterval $StartTime=null,
/** @description If the user schedule time end time. */
// @ApiMember(Description="If the user schedule time end time.")
/** @var DateInterval|null */
public ?DateInterval $EndTime=null,
/** @description If the user schedule should contain time exceptions. */
// @ApiMember(Description="If the user schedule should contain time exceptions.")
/** @var bool|null */
public ?bool $ShowTimeExceptions=null,
/** @description If allow booking in the scheduler. */
// @ApiMember(Description="If allow booking in the scheduler.")
/** @var bool|null */
public ?bool $EnableBooking=null,
/** @description What resources you want to be shown in scheduler. */
// @ApiMember(Description="What resources you want to be shown in scheduler.")
/** @var array<HomepageSchedulerResource>|null */
public ?array $Resources=null,
/** @description What services you want to be shown in scheduler. */
// @ApiMember(Description="What services you want to be shown in scheduler.")
/** @var array<HomepageSchedulerService>|null */
public ?array $Services=null,
/** @description What fields you want to be shown in scheduler. */
// @ApiMember(Description="What fields you want to be shown in scheduler.")
/** @var array<HomepageScheduleField>|null */
public ?array $Fields=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['ScheduleViewId'])) $this->ScheduleViewId = $o['ScheduleViewId'];
if (isset($o['ScheduleTimeSlotMinutes'])) $this->ScheduleTimeSlotMinutes = $o['ScheduleTimeSlotMinutes'];
if (isset($o['StartTime'])) $this->StartTime = JsonConverters::from('TimeSpan', $o['StartTime']);
if (isset($o['EndTime'])) $this->EndTime = JsonConverters::from('TimeSpan', $o['EndTime']);
if (isset($o['ShowTimeExceptions'])) $this->ShowTimeExceptions = $o['ShowTimeExceptions'];
if (isset($o['EnableBooking'])) $this->EnableBooking = $o['EnableBooking'];
if (isset($o['Resources'])) $this->Resources = JsonConverters::fromArray('HomepageSchedulerResource', $o['Resources']);
if (isset($o['Services'])) $this->Services = JsonConverters::fromArray('HomepageSchedulerService', $o['Services']);
if (isset($o['Fields'])) $this->Fields = JsonConverters::fromArray('HomepageScheduleField', $o['Fields']);
}
/** @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->ScheduleViewId)) $o['ScheduleViewId'] = $this->ScheduleViewId;
if (isset($this->ScheduleTimeSlotMinutes)) $o['ScheduleTimeSlotMinutes'] = $this->ScheduleTimeSlotMinutes;
if (isset($this->StartTime)) $o['StartTime'] = JsonConverters::to('TimeSpan', $this->StartTime);
if (isset($this->EndTime)) $o['EndTime'] = JsonConverters::to('TimeSpan', $this->EndTime);
if (isset($this->ShowTimeExceptions)) $o['ShowTimeExceptions'] = $this->ShowTimeExceptions;
if (isset($this->EnableBooking)) $o['EnableBooking'] = $this->EnableBooking;
if (isset($this->Resources)) $o['Resources'] = JsonConverters::toArray('HomepageSchedulerResource', $this->Resources);
if (isset($this->Services)) $o['Services'] = JsonConverters::toArray('HomepageSchedulerService', $this->Services);
if (isset($this->Fields)) $o['Fields'] = JsonConverters::toArray('HomepageScheduleField', $this->Fields);
return empty($o) ? new class(){} : $o;
}
}
PHP UpdateHomepageSchedulerSettings DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /homepage/scheduler/settings HTTP/1.1
Host: testapi.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
Active: False,
ScheduleViewId: 0,
ScheduleTimeSlotMinutes: 0,
StartTime: PT0S,
EndTime: PT0S,
ShowTimeExceptions: False,
EnableBooking: False,
Resources:
[
{
Id: 0
}
],
Services:
[
{
Id: 0
}
],
Fields:
[
{
Id: 0,
ShowOnBooking: False,
ShowOnTooltip: False
}
]
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Active: False, ScheduleViewId: 0, ScheduleTimeSlotMinutes: 0, StartTime: PT0S, EndTime: PT0S, ShowTimeExceptions: False, EnableBooking: False, Services: [ { Id: 0, Name: String, Description: String } ], Resources: [ { Id: 0, Name: String, Description: String } ], Fields: [ { Id: 0, ShowOnBooking: False, ShowOnTooltip: False } ], FieldOptions: [ { Id: 0, Name: String, Description: String, SortOrder: 0 } ], ScheduleViewOptions: [ { Id: 0, Name: String } ] }