BokaMera.API.Host

<back to all web services

UpdateHomepageWidgetSettings

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, superadmin
The following routes are available for this service:
PUT/homepage/widget/settingsUpdate homepage widget settingsUpdate homepage widget 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 HomepageWidgetServiceLayoutsResponse implements JsonSerializable
{
    public function __construct(
        /** @description The layout id. */
        // @ApiMember(Description="The layout id.")
        /** @var int */
        public int $Id=0,

        /** @description The layout name. */
        // @ApiMember(Description="The layout name.")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The layout description. */
        // @ApiMember(Description="The layout description.")
        /** @var string|null */
        public ?string $Description=null,

        /** @description The layout code. */
        // @ApiMember(Description="The layout code.")
        /** @var string|null */
        public ?string $Code=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['Code'])) $this->Code = $o['Code'];
    }
    
    /** @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->Code)) $o['Code'] = $this->Code;
        return empty($o) ? new class(){} : $o;
    }
}

class HomepageWidgetTimeLayoutsResponse implements JsonSerializable
{
    public function __construct(
        /** @description The layout id. */
        // @ApiMember(Description="The layout id.")
        /** @var int */
        public int $Id=0,

        /** @description The layout name. */
        // @ApiMember(Description="The layout name.")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The layout description. */
        // @ApiMember(Description="The layout description.")
        /** @var string|null */
        public ?string $Description=null,

        /** @description The layout code. */
        // @ApiMember(Description="The layout code.")
        /** @var string|null */
        public ?string $Code=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['Code'])) $this->Code = $o['Code'];
    }
    
    /** @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->Code)) $o['Code'] = $this->Code;
        return empty($o) ? new class(){} : $o;
    }
}

class HomepageWidgetBookingLayoutsResponse implements JsonSerializable
{
    public function __construct(
        /** @description The layout id. */
        // @ApiMember(Description="The layout id.")
        /** @var int */
        public int $Id=0,

        /** @description The layout name. */
        // @ApiMember(Description="The layout name.")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The layout description. */
        // @ApiMember(Description="The layout description.")
        /** @var string|null */
        public ?string $Description=null,

        /** @description The layout code. */
        // @ApiMember(Description="The layout code.")
        /** @var string|null */
        public ?string $Code=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['Code'])) $this->Code = $o['Code'];
    }
    
    /** @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->Code)) $o['Code'] = $this->Code;
        return empty($o) ? new class(){} : $o;
    }
}

class HomepageWidgetBookingMethodsResponse implements JsonSerializable
{
    public function __construct(
        /** @description The layout id. */
        // @ApiMember(Description="The layout id.")
        /** @var int */
        public int $Id=0,

        /** @description The layout name. */
        // @ApiMember(Description="The layout name.")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The layout description. */
        // @ApiMember(Description="The layout description.")
        /** @var string|null */
        public ?string $Description=null,

        /** @description The layout code. */
        // @ApiMember(Description="The layout code.")
        /** @var string|null */
        public ?string $Code=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['Code'])) $this->Code = $o['Code'];
    }
    
    /** @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->Code)) $o['Code'] = $this->Code;
        return empty($o) ? new class(){} : $o;
    }
}

class HomepageWidgetSettingsQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description The company id. */
        // @ApiMember(Description="The company id.")
        /** @var string */
        public string $CompanyId='',

        /** @description The service layouts id. */
        // @ApiMember(Description="The service layouts id.")
        /** @var int */
        public int $ServiceLayoutId=0,

        /** @description The time layouts id. */
        // @ApiMember(Description="The time layouts id.")
        /** @var int */
        public int $TimeLayoutId=0,

        /** @description The booking layouts id. */
        // @ApiMember(Description="The booking layouts id.")
        /** @var int */
        public int $BookingLayoutId=0,

        /** @description The primary color of the booking widget. */
        // @ApiMember(Description="The primary color of the booking widget.")
        /** @var string|null */
        public ?string $PrimaryColor=null,

        /** @description If you should show the service image in the booking widget. */
        // @ApiMember(Description="If you should show the service image in the booking widget.")
        /** @var bool|null */
        public ?bool $ShowServiceImage=null,

        /** @description If you should show the rebate code field in the booking widget. */
        // @ApiMember(Description="If you should show the rebate code field in the booking widget.")
        /** @var bool|null */
        public ?bool $ShowRebateCodeField=null,

        /** @description If you should show the next available time in the booking widget. */
        // @ApiMember(Description="If you should show the next available time in the booking widget.")
        /** @var bool|null */
        public ?bool $ShowNextAvailableTime=null,

        /** @description If you should show the subscribe to newsletter checkbox in the booking widget. */
        // @ApiMember(Description="If you should show the subscribe to newsletter checkbox in the booking widget.")
        /** @var bool|null */
        public ?bool $ShowSubscribeToNewsletter=null,

        /** @description If you should show the create account option. */
        // @ApiMember(Description="If you should show the create account option.")
        /** @var bool|null */
        public ?bool $EnableCreateAccount=null,

        /** @description If you should show the login to account option. */
        // @ApiMember(Description="If you should show the login to account option.")
        /** @var bool|null */
        public ?bool $EnableLogin=null,

        /** @description If you should show the facebook login to account option. */
        // @ApiMember(Description="If you should show the facebook login to account option.")
        /** @var bool|null */
        public ?bool $EnableFacebookLogin=null,

        /** @description If you should show the direct booking option. This enables customer to book with entering contact information. */
        // @ApiMember(Description="If you should show the direct booking option. This enables customer to book with entering contact information.")
        /** @var bool|null */
        public ?bool $EnableDirectBooking=null,

        /** @description If the site should have dark theme or not. */
        // @ApiMember(Description="If the site should have dark theme or not.")
        /** @var bool|null */
        public ?bool $DarkTheme=null,

        /** @description If you should show the end time in the booking widget. */
        // @ApiMember(Description="If you should show the end time in the booking widget.")
        /** @var bool|null */
        public ?bool $ShowEndTime=null,

        /** @description What text to show on booked time slots. Default text is Booked */
        // @ApiMember(Description="What text to show on booked time slots. Default text is Booked")
        /** @var string|null */
        public ?string $BookedTimeSlotText=null,

        /** @var array<HomepageWidgetServiceLayoutsResponse>|null */
        public ?array $ServiceLayoutOptions=null,
        /** @var array<HomepageWidgetTimeLayoutsResponse>|null */
        public ?array $TimeLayoutOptions=null,
        /** @var array<HomepageWidgetBookingLayoutsResponse>|null */
        public ?array $BookingLayoutOptions=null,
        /** @var array<HomepageWidgetBookingMethodsResponse>|null */
        public ?array $BookingMethodOptions=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['ServiceLayoutId'])) $this->ServiceLayoutId = $o['ServiceLayoutId'];
        if (isset($o['TimeLayoutId'])) $this->TimeLayoutId = $o['TimeLayoutId'];
        if (isset($o['BookingLayoutId'])) $this->BookingLayoutId = $o['BookingLayoutId'];
        if (isset($o['PrimaryColor'])) $this->PrimaryColor = $o['PrimaryColor'];
        if (isset($o['ShowServiceImage'])) $this->ShowServiceImage = $o['ShowServiceImage'];
        if (isset($o['ShowRebateCodeField'])) $this->ShowRebateCodeField = $o['ShowRebateCodeField'];
        if (isset($o['ShowNextAvailableTime'])) $this->ShowNextAvailableTime = $o['ShowNextAvailableTime'];
        if (isset($o['ShowSubscribeToNewsletter'])) $this->ShowSubscribeToNewsletter = $o['ShowSubscribeToNewsletter'];
        if (isset($o['EnableCreateAccount'])) $this->EnableCreateAccount = $o['EnableCreateAccount'];
        if (isset($o['EnableLogin'])) $this->EnableLogin = $o['EnableLogin'];
        if (isset($o['EnableFacebookLogin'])) $this->EnableFacebookLogin = $o['EnableFacebookLogin'];
        if (isset($o['EnableDirectBooking'])) $this->EnableDirectBooking = $o['EnableDirectBooking'];
        if (isset($o['DarkTheme'])) $this->DarkTheme = $o['DarkTheme'];
        if (isset($o['ShowEndTime'])) $this->ShowEndTime = $o['ShowEndTime'];
        if (isset($o['BookedTimeSlotText'])) $this->BookedTimeSlotText = $o['BookedTimeSlotText'];
        if (isset($o['ServiceLayoutOptions'])) $this->ServiceLayoutOptions = JsonConverters::fromArray('HomepageWidgetServiceLayoutsResponse', $o['ServiceLayoutOptions']);
        if (isset($o['TimeLayoutOptions'])) $this->TimeLayoutOptions = JsonConverters::fromArray('HomepageWidgetTimeLayoutsResponse', $o['TimeLayoutOptions']);
        if (isset($o['BookingLayoutOptions'])) $this->BookingLayoutOptions = JsonConverters::fromArray('HomepageWidgetBookingLayoutsResponse', $o['BookingLayoutOptions']);
        if (isset($o['BookingMethodOptions'])) $this->BookingMethodOptions = JsonConverters::fromArray('HomepageWidgetBookingMethodsResponse', $o['BookingMethodOptions']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->ServiceLayoutId)) $o['ServiceLayoutId'] = $this->ServiceLayoutId;
        if (isset($this->TimeLayoutId)) $o['TimeLayoutId'] = $this->TimeLayoutId;
        if (isset($this->BookingLayoutId)) $o['BookingLayoutId'] = $this->BookingLayoutId;
        if (isset($this->PrimaryColor)) $o['PrimaryColor'] = $this->PrimaryColor;
        if (isset($this->ShowServiceImage)) $o['ShowServiceImage'] = $this->ShowServiceImage;
        if (isset($this->ShowRebateCodeField)) $o['ShowRebateCodeField'] = $this->ShowRebateCodeField;
        if (isset($this->ShowNextAvailableTime)) $o['ShowNextAvailableTime'] = $this->ShowNextAvailableTime;
        if (isset($this->ShowSubscribeToNewsletter)) $o['ShowSubscribeToNewsletter'] = $this->ShowSubscribeToNewsletter;
        if (isset($this->EnableCreateAccount)) $o['EnableCreateAccount'] = $this->EnableCreateAccount;
        if (isset($this->EnableLogin)) $o['EnableLogin'] = $this->EnableLogin;
        if (isset($this->EnableFacebookLogin)) $o['EnableFacebookLogin'] = $this->EnableFacebookLogin;
        if (isset($this->EnableDirectBooking)) $o['EnableDirectBooking'] = $this->EnableDirectBooking;
        if (isset($this->DarkTheme)) $o['DarkTheme'] = $this->DarkTheme;
        if (isset($this->ShowEndTime)) $o['ShowEndTime'] = $this->ShowEndTime;
        if (isset($this->BookedTimeSlotText)) $o['BookedTimeSlotText'] = $this->BookedTimeSlotText;
        if (isset($this->ServiceLayoutOptions)) $o['ServiceLayoutOptions'] = JsonConverters::toArray('HomepageWidgetServiceLayoutsResponse', $this->ServiceLayoutOptions);
        if (isset($this->TimeLayoutOptions)) $o['TimeLayoutOptions'] = JsonConverters::toArray('HomepageWidgetTimeLayoutsResponse', $this->TimeLayoutOptions);
        if (isset($this->BookingLayoutOptions)) $o['BookingLayoutOptions'] = JsonConverters::toArray('HomepageWidgetBookingLayoutsResponse', $this->BookingLayoutOptions);
        if (isset($this->BookingMethodOptions)) $o['BookingMethodOptions'] = JsonConverters::toArray('HomepageWidgetBookingMethodsResponse', $this->BookingMethodOptions);
        return empty($o) ? new class(){} : $o;
    }
}

// @ValidateRequest(Validator="IsAuthenticated")
class UpdateHomepageWidgetSettings 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 Serivce Layout. */
        // @ApiMember(Description="Serivce Layout.")
        /** @var int|null */
        public ?int $ServiceLayoutId=null,

        /** @description Time Layout. */
        // @ApiMember(Description="Time Layout.")
        /** @var int|null */
        public ?int $TimeLayoutId=null,

        /** @description Booking Layout. */
        // @ApiMember(Description="Booking Layout.")
        /** @var int|null */
        public ?int $BookingLayoutId=null,

        /** @description The primary color of the booking widget. */
        // @ApiMember(Description="The primary color of the booking widget.")
        /** @var string|null */
        public ?string $PrimaryColor=null,

        /** @description If the site should have dark theme or not. */
        // @ApiMember(Description="If the site should have dark theme or not.")
        /** @var bool|null */
        public ?bool $DarkTheme=null,

        /** @description If you should show the service image in the booking widget. */
        // @ApiMember(Description="If you should show the service image in the booking widget.")
        /** @var bool|null */
        public ?bool $ShowServiceImage=null,

        /** @description If you should show the rebate code field in the booking widget. */
        // @ApiMember(Description="If you should show the rebate code field in the booking widget.")
        /** @var bool|null */
        public ?bool $ShowRebateCodeField=null,

        /** @description If you should show the next available time in the booking widget. */
        // @ApiMember(Description="If you should show the next available time in the booking widget.")
        /** @var bool|null */
        public ?bool $ShowNextAvailableTime=null,

        /** @description If you should show the end time in the booking widget. */
        // @ApiMember(Description="If you should show the end time in the booking widget.")
        /** @var bool|null */
        public ?bool $ShowEndTime=null,

        /** @description Show subscribe to newsletter checkbox on the page */
        // @ApiMember(Description="Show subscribe to newsletter checkbox on the page")
        /** @var bool|null */
        public ?bool $ShowSubscribeToNewsletter=null,

        /** @description What text to show on booked time slots. Default text is Booked */
        // @ApiMember(Description="What text to show on booked time slots. Default text is Booked")
        /** @var string|null */
        public ?string $BookedTimeSlotText=null,

        /** @description If you should show the create account option. */
        // @ApiMember(Description="If you should show the create account option.")
        /** @var bool|null */
        public ?bool $EnableCreateAccount=null,

        /** @description If you should show the login to account option. */
        // @ApiMember(Description="If you should show the login to account option.")
        /** @var bool|null */
        public ?bool $EnableLogin=null,

        /** @description If you should show the facebook login to account option. */
        // @ApiMember(Description="If you should show the facebook login to account option.")
        /** @var bool|null */
        public ?bool $EnableFacebookLogin=null,

        /** @description If you should show the direct booking option. This enables customer to book with entering contact information. */
        // @ApiMember(Description="If you should show the direct booking option. This enables customer to book with entering contact information.")
        /** @var bool|null */
        public ?bool $EnableDirectBooking=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['ServiceLayoutId'])) $this->ServiceLayoutId = $o['ServiceLayoutId'];
        if (isset($o['TimeLayoutId'])) $this->TimeLayoutId = $o['TimeLayoutId'];
        if (isset($o['BookingLayoutId'])) $this->BookingLayoutId = $o['BookingLayoutId'];
        if (isset($o['PrimaryColor'])) $this->PrimaryColor = $o['PrimaryColor'];
        if (isset($o['DarkTheme'])) $this->DarkTheme = $o['DarkTheme'];
        if (isset($o['ShowServiceImage'])) $this->ShowServiceImage = $o['ShowServiceImage'];
        if (isset($o['ShowRebateCodeField'])) $this->ShowRebateCodeField = $o['ShowRebateCodeField'];
        if (isset($o['ShowNextAvailableTime'])) $this->ShowNextAvailableTime = $o['ShowNextAvailableTime'];
        if (isset($o['ShowEndTime'])) $this->ShowEndTime = $o['ShowEndTime'];
        if (isset($o['ShowSubscribeToNewsletter'])) $this->ShowSubscribeToNewsletter = $o['ShowSubscribeToNewsletter'];
        if (isset($o['BookedTimeSlotText'])) $this->BookedTimeSlotText = $o['BookedTimeSlotText'];
        if (isset($o['EnableCreateAccount'])) $this->EnableCreateAccount = $o['EnableCreateAccount'];
        if (isset($o['EnableLogin'])) $this->EnableLogin = $o['EnableLogin'];
        if (isset($o['EnableFacebookLogin'])) $this->EnableFacebookLogin = $o['EnableFacebookLogin'];
        if (isset($o['EnableDirectBooking'])) $this->EnableDirectBooking = $o['EnableDirectBooking'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->ServiceLayoutId)) $o['ServiceLayoutId'] = $this->ServiceLayoutId;
        if (isset($this->TimeLayoutId)) $o['TimeLayoutId'] = $this->TimeLayoutId;
        if (isset($this->BookingLayoutId)) $o['BookingLayoutId'] = $this->BookingLayoutId;
        if (isset($this->PrimaryColor)) $o['PrimaryColor'] = $this->PrimaryColor;
        if (isset($this->DarkTheme)) $o['DarkTheme'] = $this->DarkTheme;
        if (isset($this->ShowServiceImage)) $o['ShowServiceImage'] = $this->ShowServiceImage;
        if (isset($this->ShowRebateCodeField)) $o['ShowRebateCodeField'] = $this->ShowRebateCodeField;
        if (isset($this->ShowNextAvailableTime)) $o['ShowNextAvailableTime'] = $this->ShowNextAvailableTime;
        if (isset($this->ShowEndTime)) $o['ShowEndTime'] = $this->ShowEndTime;
        if (isset($this->ShowSubscribeToNewsletter)) $o['ShowSubscribeToNewsletter'] = $this->ShowSubscribeToNewsletter;
        if (isset($this->BookedTimeSlotText)) $o['BookedTimeSlotText'] = $this->BookedTimeSlotText;
        if (isset($this->EnableCreateAccount)) $o['EnableCreateAccount'] = $this->EnableCreateAccount;
        if (isset($this->EnableLogin)) $o['EnableLogin'] = $this->EnableLogin;
        if (isset($this->EnableFacebookLogin)) $o['EnableFacebookLogin'] = $this->EnableFacebookLogin;
        if (isset($this->EnableDirectBooking)) $o['EnableDirectBooking'] = $this->EnableDirectBooking;
        return empty($o) ? new class(){} : $o;
    }
}

PHP UpdateHomepageWidgetSettings DTOs

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

HTTP + JSV

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

PUT /homepage/widget/settings HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	CompanyId: 00000000-0000-0000-0000-000000000000,
	ServiceLayoutId: 0,
	TimeLayoutId: 0,
	BookingLayoutId: 0,
	PrimaryColor: String,
	DarkTheme: False,
	ShowServiceImage: False,
	ShowRebateCodeField: False,
	ShowNextAvailableTime: False,
	ShowEndTime: False,
	ShowSubscribeToNewsletter: False,
	BookedTimeSlotText: String,
	EnableCreateAccount: False,
	EnableLogin: False,
	EnableFacebookLogin: False,
	EnableDirectBooking: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ServiceLayoutId: 0,
	TimeLayoutId: 0,
	BookingLayoutId: 0,
	PrimaryColor: String,
	ShowServiceImage: False,
	ShowRebateCodeField: False,
	ShowNextAvailableTime: False,
	ShowSubscribeToNewsletter: False,
	EnableCreateAccount: False,
	EnableLogin: False,
	EnableFacebookLogin: False,
	EnableDirectBooking: False,
	DarkTheme: False,
	ShowEndTime: False,
	BookedTimeSlotText: String,
	ServiceLayoutOptions: 
	[
		{
			Id: 0,
			Name: String,
			Description: String,
			Code: String
		}
	],
	TimeLayoutOptions: 
	[
		{
			Id: 0,
			Name: String,
			Description: String,
			Code: String
		}
	],
	BookingLayoutOptions: 
	[
		{
			Id: 0,
			Name: String,
			Description: String,
			Code: String
		}
	],
	BookingMethodOptions: 
	[
		{
			Id: 0,
			Name: String,
			Description: String,
			Code: String
		}
	]
}