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. |
---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HomepageSchedulerServiceResponse:
# @ApiMember(Description="The service id.")
id: int = 0
"""
The service id.
"""
# @ApiMember(Description="The service name.")
name: Optional[str] = None
"""
The service name.
"""
# @ApiMember(Description="The service description.")
description: Optional[str] = None
"""
The service description.
"""
# @ApiMember(Description="The service image url.")
image_url: Optional[str] = None
"""
The service image url.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HomepageSchedulerResourceResponse:
# @ApiMember(Description="The resource id.")
id: int = 0
"""
The resource id.
"""
# @ApiMember(Description="The resource name.")
name: Optional[str] = None
"""
The resource name.
"""
# @ApiMember(Description="The resource description.")
description: Optional[str] = None
"""
The resource description.
"""
# @ApiMember(Description="The resource image url.")
image_url: Optional[str] = None
"""
The resource image url.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HomepageSchedulerFieldResponse:
# @ApiMember(Description="The field id.")
id: int = 0
"""
The field id.
"""
# @ApiMember(Description="If the field should be shown on booking.")
show_on_booking: bool = False
"""
If the field should be shown on booking.
"""
# @ApiMember(Description="If the field should be shown on tooltip.")
show_on_tooltip: bool = False
"""
If the field should be shown on tooltip.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HomepageSchedulerFieldOptionsResponse:
# @ApiMember(Description="The field id.")
id: int = 0
"""
The field id.
"""
# @ApiMember(Description="The field name.")
name: Optional[str] = None
"""
The field name.
"""
# @ApiMember(Description="The field description.")
description: Optional[str] = None
"""
The field description.
"""
# @ApiMember(Description="The field sort order when listing.")
sort_order: int = 0
"""
The field sort order when listing.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ScheduleViewResponse:
id: int = 0
name: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HomepageSchedulerSettingsQueryResponse:
# @ApiMember(Description="The company id.")
company_id: Optional[str] = None
"""
The company id.
"""
# @ApiMember(Description="If the user schedule is activated.")
active: bool = False
"""
If the user schedule is activated.
"""
# @ApiMember(Description="If the user schedule views id.")
schedule_view_id: int = 0
"""
If the user schedule views id.
"""
# @ApiMember(Description="If the user schedule time slots in minutes.")
schedule_time_slot_minutes: int = 0
"""
If the user schedule time slots in minutes.
"""
# @ApiMember(Description="If the user schedule time start time.")
start_time: Optional[datetime.timedelta] = None
"""
If the user schedule time start time.
"""
# @ApiMember(Description="If the user schedule time end time.")
end_time: Optional[datetime.timedelta] = None
"""
If the user schedule time end time.
"""
# @ApiMember(Description="If the user schedule should contain time exceptions.")
show_time_exceptions: bool = False
"""
If the user schedule should contain time exceptions.
"""
# @ApiMember(Description="If allow booking in the scheduler.")
enable_booking: bool = False
"""
If allow booking in the scheduler.
"""
# @ApiMember(Description="The homepage schedule services that are selected")
services: Optional[List[HomepageSchedulerServiceResponse]] = None
"""
The homepage schedule services that are selected
"""
# @ApiMember(Description="The homepage schedule resources that are selected")
resources: Optional[List[HomepageSchedulerResourceResponse]] = None
"""
The homepage schedule resources that are selected
"""
# @ApiMember(Description="The homepage schedule fields that are selected")
fields: Optional[List[HomepageSchedulerFieldResponse]] = None
"""
The homepage schedule fields that are selected
"""
# @ApiMember(Description="The homepage schedule fields select from")
field_options: Optional[List[HomepageSchedulerFieldOptionsResponse]] = None
"""
The homepage schedule fields select from
"""
# @ApiMember(Description="The available schedule view options to choose from")
schedule_view_options: Optional[List[ScheduleViewResponse]] = None
"""
The available schedule view options to choose from
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HomepageSchedulerResource:
# @ApiMember(Description="The resource id.")
id: int = 0
"""
The resource id.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HomepageSchedulerService:
# @ApiMember(Description="The service id.")
id: int = 0
"""
The service id.
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HomepageScheduleField:
# @ApiMember(Description="The field id.", IsRequired=true)
id: int = 0
"""
The field id.
"""
# @ApiMember(Description="If the field showed on the booking.", IsRequired=true)
show_on_booking: bool = False
"""
If the field showed on the booking.
"""
# @ApiMember(Description="If the field showed on the bookings tooltip.", IsRequired=true)
show_on_tooltip: bool = False
"""
If the field showed on the bookings tooltip.
"""
# @ValidateRequest(Validator="IsAuthenticated")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UpdateHomepageSchedulerSettings(ICompany):
# @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
company_id: Optional[str] = None
"""
The company id, if empty will use the company id for the user you are logged in with.
"""
# @ApiMember(Description="If the user schedule is activated.")
active: Optional[bool] = None
"""
If the user schedule is activated.
"""
# @ApiMember(Description="If the user schedule views id.")
schedule_view_id: Optional[int] = None
"""
If the user schedule views id.
"""
# @ApiMember(Description="If the user schedule time slots in minutes.")
schedule_time_slot_minutes: Optional[int] = None
"""
If the user schedule time slots in minutes.
"""
# @ApiMember(Description="If the user schedule time start time.")
start_time: Optional[datetime.timedelta] = None
"""
If the user schedule time start time.
"""
# @ApiMember(Description="If the user schedule time end time.")
end_time: Optional[datetime.timedelta] = None
"""
If the user schedule time end time.
"""
# @ApiMember(Description="If the user schedule should contain time exceptions.")
show_time_exceptions: Optional[bool] = None
"""
If the user schedule should contain time exceptions.
"""
# @ApiMember(Description="If allow booking in the scheduler.")
enable_booking: Optional[bool] = None
"""
If allow booking in the scheduler.
"""
# @ApiMember(Description="What resources you want to be shown in scheduler.")
resources: Optional[List[HomepageSchedulerResource]] = None
"""
What resources you want to be shown in scheduler.
"""
# @ApiMember(Description="What services you want to be shown in scheduler.")
services: Optional[List[HomepageSchedulerService]] = None
"""
What services you want to be shown in scheduler.
"""
# @ApiMember(Description="What fields you want to be shown in scheduler.")
fields: Optional[List[HomepageScheduleField]] = None
"""
What fields you want to be shown in scheduler.
"""
Python 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 } ] }