Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
PUT | /homepage/settings | Update the homepage settings | Update the homepage 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 HomepageTemplateResponse implements JsonSerializable
{
public function __construct(
/** @description The template id */
// @ApiMember(Description="The template id")
/** @var int */
public int $Id=0,
/** @description The template name */
// @ApiMember(Description="The template name")
/** @var string|null */
public ?string $Name=null,
/** @description The template description */
// @ApiMember(Description="The template description")
/** @var string|null */
public ?string $Description=null,
/** @description The template image url */
// @ApiMember(Description="The template 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 HomepageHeroSectionStyleResponse implements JsonSerializable
{
public function __construct(
/** @description The hero section style id */
// @ApiMember(Description="The hero section style id")
/** @var int */
public int $Id=0,
/** @description The hero section style name */
// @ApiMember(Description="The hero section style name")
/** @var string|null */
public ?string $Name=null,
/** @description The hero section style description */
// @ApiMember(Description="The hero section style description")
/** @var string|null */
public ?string $Description=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'];
}
/** @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;
return empty($o) ? new class(){} : $o;
}
}
class HomepageSettingsQueryResponse implements JsonSerializable
{
public function __construct(
/** @description The company id */
// @ApiMember(Description="The company id")
/** @var string */
public string $CompanyId='',
/** @description The text for homepage heading */
// @ApiMember(Description="The text for homepage heading")
/** @var string|null */
public ?string $HomepageHeading=null,
/** @description The text for homepage startpage heading */
// @ApiMember(Description="The text for homepage startpage heading")
/** @var string|null */
public ?string $WelcomePageHeading=null,
/** @description The text for homepage startpage body */
// @ApiMember(Description="The text for homepage startpage body")
/** @var string|null */
public ?string $WelcomePageBody=null,
/** @description The text for homepage about us page heading */
// @ApiMember(Description="The text for homepage about us page heading")
/** @var string|null */
public ?string $AboutUsPageHeading=null,
/** @description The text for homepage about us page body */
// @ApiMember(Description="The text for homepage about us page body")
/** @var string|null */
public ?string $AboutUsPageBody=null,
/** @description The startpage image url */
// @ApiMember(Description="The startpage image url")
/** @var string|null */
public ?string $ImageUrl=null,
/** @description The template for the homepage */
// @ApiMember(Description="The template for the homepage")
/** @var int */
public int $HomePageTemplateId=0,
/** @description The hero section style for the homepage */
// @ApiMember(Description="The hero section style for the homepage")
/** @var int */
public int $HeroSectionStyleId=0,
/** @description Show rating on the page */
// @ApiMember(Description="Show rating on the page")
/** @var bool|null */
public ?bool $ShowRating=null,
/** @description Enable the BokaMera Homepage */
// @ApiMember(Description="Enable the BokaMera Homepage")
/** @var bool|null */
public ?bool $EnableHomepage=null,
/** @description Will show when the homepage settings was created, note it will only be shown if your logged in as admin for the company. */
// @ApiMember(DataType="datetime", Description="Will show when the homepage settings was created, note it will only be shown if your logged in as admin for the company.")
/** @var DateTime|null */
public ?DateTime $Updated=null,
/** @description Will show when the homepage settings was updated, note it will only be shown if your logged in as admin for the company. */
// @ApiMember(DataType="datetime", Description="Will show when the homepage settings was updated, note it will only be shown if your logged in as admin for the company.")
/** @var DateTime|null */
public ?DateTime $Created=null,
/** @description The homepage templates options to select from */
// @ApiMember(DataType="boolean", Description="The homepage templates options to select from", ParameterType="query")
/** @var array<HomepageTemplateResponse>|null */
public ?array $HomePageTemplateOptions=null,
/** @description The homepage hero section style options to select from */
// @ApiMember(DataType="boolean", Description="The homepage hero section style options to select from", ParameterType="query")
/** @var array<HomepageHeroSectionStyleResponse>|null */
public ?array $HomepageHeroSectionStyleOptions=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['HomepageHeading'])) $this->HomepageHeading = $o['HomepageHeading'];
if (isset($o['WelcomePageHeading'])) $this->WelcomePageHeading = $o['WelcomePageHeading'];
if (isset($o['WelcomePageBody'])) $this->WelcomePageBody = $o['WelcomePageBody'];
if (isset($o['AboutUsPageHeading'])) $this->AboutUsPageHeading = $o['AboutUsPageHeading'];
if (isset($o['AboutUsPageBody'])) $this->AboutUsPageBody = $o['AboutUsPageBody'];
if (isset($o['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
if (isset($o['HomePageTemplateId'])) $this->HomePageTemplateId = $o['HomePageTemplateId'];
if (isset($o['HeroSectionStyleId'])) $this->HeroSectionStyleId = $o['HeroSectionStyleId'];
if (isset($o['ShowRating'])) $this->ShowRating = $o['ShowRating'];
if (isset($o['EnableHomepage'])) $this->EnableHomepage = $o['EnableHomepage'];
if (isset($o['Updated'])) $this->Updated = JsonConverters::from('DateTime', $o['Updated']);
if (isset($o['Created'])) $this->Created = JsonConverters::from('DateTime', $o['Created']);
if (isset($o['HomePageTemplateOptions'])) $this->HomePageTemplateOptions = JsonConverters::fromArray('HomepageTemplateResponse', $o['HomePageTemplateOptions']);
if (isset($o['HomepageHeroSectionStyleOptions'])) $this->HomepageHeroSectionStyleOptions = JsonConverters::fromArray('HomepageHeroSectionStyleResponse', $o['HomepageHeroSectionStyleOptions']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->HomepageHeading)) $o['HomepageHeading'] = $this->HomepageHeading;
if (isset($this->WelcomePageHeading)) $o['WelcomePageHeading'] = $this->WelcomePageHeading;
if (isset($this->WelcomePageBody)) $o['WelcomePageBody'] = $this->WelcomePageBody;
if (isset($this->AboutUsPageHeading)) $o['AboutUsPageHeading'] = $this->AboutUsPageHeading;
if (isset($this->AboutUsPageBody)) $o['AboutUsPageBody'] = $this->AboutUsPageBody;
if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
if (isset($this->HomePageTemplateId)) $o['HomePageTemplateId'] = $this->HomePageTemplateId;
if (isset($this->HeroSectionStyleId)) $o['HeroSectionStyleId'] = $this->HeroSectionStyleId;
if (isset($this->ShowRating)) $o['ShowRating'] = $this->ShowRating;
if (isset($this->EnableHomepage)) $o['EnableHomepage'] = $this->EnableHomepage;
if (isset($this->Updated)) $o['Updated'] = JsonConverters::to('DateTime', $this->Updated);
if (isset($this->Created)) $o['Created'] = JsonConverters::to('DateTime', $this->Created);
if (isset($this->HomePageTemplateOptions)) $o['HomePageTemplateOptions'] = JsonConverters::toArray('HomepageTemplateResponse', $this->HomePageTemplateOptions);
if (isset($this->HomepageHeroSectionStyleOptions)) $o['HomepageHeroSectionStyleOptions'] = JsonConverters::toArray('HomepageHeroSectionStyleResponse', $this->HomepageHeroSectionStyleOptions);
return empty($o) ? new class(){} : $o;
}
}
// @ValidateRequest(Validator="IsAuthenticated")
class UpdateHomepageSettings implements ICompany, JsonSerializable
{
public function __construct(
/** @description The company id */
// @ApiMember(Description="The company id")
/** @var string|null */
public ?string $CompanyId=null,
/** @description The text for homepage heading */
// @ApiMember(Description="The text for homepage heading")
/** @var string|null */
public ?string $HomepageHeading=null,
/** @description The text for homepage startpage heading */
// @ApiMember(Description="The text for homepage startpage heading")
/** @var string|null */
public ?string $WelcomePageHeading=null,
/** @description The text for homepage startpage body */
// @ApiMember(Description="The text for homepage startpage body")
/** @var string|null */
public ?string $WelcomePageBody=null,
/** @description The text for homepage about us page heading */
// @ApiMember(Description="The text for homepage about us page heading")
/** @var string|null */
public ?string $AboutUsPageHeading=null,
/** @description The text for homepage about us page body */
// @ApiMember(Description="The text for homepage about us page body")
/** @var string|null */
public ?string $AboutUsPageBody=null,
/** @description The start page image url */
// @ApiMember(Description="The start page image url")
/** @var string|null */
public ?string $ImageUrl=null,
/** @description The template for the homepage */
// @ApiMember(Description="The template for the homepage")
/** @var int|null */
public ?int $HomePageTemplateId=null,
/** @description Show rating on the page */
// @ApiMember(Description="Show rating on the page")
/** @var bool|null */
public ?bool $ShowRating=null,
/** @description Enable the BokaMera Homepage */
// @ApiMember(Description="Enable the BokaMera Homepage")
/** @var bool|null */
public ?bool $EnableHomepage=null,
/** @description The hero section style for the homepage */
// @ApiMember(Description="The hero section style for the homepage")
/** @var int|null */
public ?int $HeroSectionStyleId=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['HomepageHeading'])) $this->HomepageHeading = $o['HomepageHeading'];
if (isset($o['WelcomePageHeading'])) $this->WelcomePageHeading = $o['WelcomePageHeading'];
if (isset($o['WelcomePageBody'])) $this->WelcomePageBody = $o['WelcomePageBody'];
if (isset($o['AboutUsPageHeading'])) $this->AboutUsPageHeading = $o['AboutUsPageHeading'];
if (isset($o['AboutUsPageBody'])) $this->AboutUsPageBody = $o['AboutUsPageBody'];
if (isset($o['ImageUrl'])) $this->ImageUrl = JsonConverters::from('string', $o['ImageUrl']);
if (isset($o['HomePageTemplateId'])) $this->HomePageTemplateId = $o['HomePageTemplateId'];
if (isset($o['ShowRating'])) $this->ShowRating = $o['ShowRating'];
if (isset($o['EnableHomepage'])) $this->EnableHomepage = $o['EnableHomepage'];
if (isset($o['HeroSectionStyleId'])) $this->HeroSectionStyleId = $o['HeroSectionStyleId'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->HomepageHeading)) $o['HomepageHeading'] = $this->HomepageHeading;
if (isset($this->WelcomePageHeading)) $o['WelcomePageHeading'] = $this->WelcomePageHeading;
if (isset($this->WelcomePageBody)) $o['WelcomePageBody'] = $this->WelcomePageBody;
if (isset($this->AboutUsPageHeading)) $o['AboutUsPageHeading'] = $this->AboutUsPageHeading;
if (isset($this->AboutUsPageBody)) $o['AboutUsPageBody'] = $this->AboutUsPageBody;
if (isset($this->ImageUrl)) $o['ImageUrl'] = JsonConverters::to('string', $this->ImageUrl);
if (isset($this->HomePageTemplateId)) $o['HomePageTemplateId'] = $this->HomePageTemplateId;
if (isset($this->ShowRating)) $o['ShowRating'] = $this->ShowRating;
if (isset($this->EnableHomepage)) $o['EnableHomepage'] = $this->EnableHomepage;
if (isset($this->HeroSectionStyleId)) $o['HeroSectionStyleId'] = $this->HeroSectionStyleId;
return empty($o) ? new class(){} : $o;
}
}
PHP UpdateHomepageSettings 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.
PUT /homepage/settings HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UpdateHomepageSettings xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<AboutUsPageBody>String</AboutUsPageBody>
<AboutUsPageHeading>String</AboutUsPageHeading>
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<EnableHomepage>false</EnableHomepage>
<HeroSectionStyleId>0</HeroSectionStyleId>
<HomePageTemplateId>0</HomePageTemplateId>
<HomepageHeading>String</HomepageHeading>
<ImageUrl i:nil="true" />
<ShowRating>false</ShowRating>
<WelcomePageBody>String</WelcomePageBody>
<WelcomePageHeading>String</WelcomePageHeading>
</UpdateHomepageSettings>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <HomepageSettingsQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos"> <AboutUsPageBody>String</AboutUsPageBody> <AboutUsPageHeading>String</AboutUsPageHeading> <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId> <Created>0001-01-01T00:00:00</Created> <EnableHomepage>false</EnableHomepage> <HeroSectionStyleId>0</HeroSectionStyleId> <HomePageTemplateId>0</HomePageTemplateId> <HomePageTemplateOptions> <HomepageTemplateResponse> <Description>String</Description> <Id>0</Id> <ImageUrl i:nil="true" /> <Name>String</Name> </HomepageTemplateResponse> </HomePageTemplateOptions> <HomepageHeading>String</HomepageHeading> <HomepageHeroSectionStyleOptions> <HomepageHeroSectionStyleResponse> <Description>String</Description> <Id>0</Id> <Name>String</Name> </HomepageHeroSectionStyleResponse> </HomepageHeroSectionStyleOptions> <ImageUrl i:nil="true" /> <ShowRating>false</ShowRating> <Updated>0001-01-01T00:00:00</Updated> <WelcomePageBody>String</WelcomePageBody> <WelcomePageHeading>String</WelcomePageHeading> </HomepageSettingsQueryResponse>