| Required role: | Business |
| POST | /place/update_opening_hour |
|---|
<?php namespace BusinessApi;
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 OpeningHour implements JsonSerializable
{
public function __construct(
/** @var int */
public int $openAtHour=0,
/** @var int */
public int $openAtMinute=0,
/** @var int */
public int $closeAtHour=0,
/** @var int */
public int $closeAtMinute=0
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['openAtHour'])) $this->openAtHour = $o['openAtHour'];
if (isset($o['openAtMinute'])) $this->openAtMinute = $o['openAtMinute'];
if (isset($o['closeAtHour'])) $this->closeAtHour = $o['closeAtHour'];
if (isset($o['closeAtMinute'])) $this->closeAtMinute = $o['closeAtMinute'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->openAtHour)) $o['openAtHour'] = $this->openAtHour;
if (isset($this->openAtMinute)) $o['openAtMinute'] = $this->openAtMinute;
if (isset($this->closeAtHour)) $o['closeAtHour'] = $this->closeAtHour;
if (isset($this->closeAtMinute)) $o['closeAtMinute'] = $this->closeAtMinute;
return empty($o) ? new class(){} : $o;
}
}
class WeeklyOpeningHours implements JsonSerializable
{
public function __construct(
/** @var OpeningHour|null */
public ?OpeningHour $monday=null,
/** @var OpeningHour|null */
public ?OpeningHour $tuesday=null,
/** @var OpeningHour|null */
public ?OpeningHour $wednesday=null,
/** @var OpeningHour|null */
public ?OpeningHour $thursday=null,
/** @var OpeningHour|null */
public ?OpeningHour $friday=null,
/** @var OpeningHour|null */
public ?OpeningHour $saturday=null,
/** @var OpeningHour|null */
public ?OpeningHour $sunday=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['monday'])) $this->monday = JsonConverters::from('OpeningHour', $o['monday']);
if (isset($o['tuesday'])) $this->tuesday = JsonConverters::from('OpeningHour', $o['tuesday']);
if (isset($o['wednesday'])) $this->wednesday = JsonConverters::from('OpeningHour', $o['wednesday']);
if (isset($o['thursday'])) $this->thursday = JsonConverters::from('OpeningHour', $o['thursday']);
if (isset($o['friday'])) $this->friday = JsonConverters::from('OpeningHour', $o['friday']);
if (isset($o['saturday'])) $this->saturday = JsonConverters::from('OpeningHour', $o['saturday']);
if (isset($o['sunday'])) $this->sunday = JsonConverters::from('OpeningHour', $o['sunday']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->monday)) $o['monday'] = JsonConverters::to('OpeningHour', $this->monday);
if (isset($this->tuesday)) $o['tuesday'] = JsonConverters::to('OpeningHour', $this->tuesday);
if (isset($this->wednesday)) $o['wednesday'] = JsonConverters::to('OpeningHour', $this->wednesday);
if (isset($this->thursday)) $o['thursday'] = JsonConverters::to('OpeningHour', $this->thursday);
if (isset($this->friday)) $o['friday'] = JsonConverters::to('OpeningHour', $this->friday);
if (isset($this->saturday)) $o['saturday'] = JsonConverters::to('OpeningHour', $this->saturday);
if (isset($this->sunday)) $o['sunday'] = JsonConverters::to('OpeningHour', $this->sunday);
return empty($o) ? new class(){} : $o;
}
}
class OpeningHours implements JsonSerializable
{
public function __construct(
/** @var WeeklyOpeningHours|null */
public ?WeeklyOpeningHours $weekly=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['weekly'])) $this->weekly = JsonConverters::from('WeeklyOpeningHours', $o['weekly']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->weekly)) $o['weekly'] = JsonConverters::to('WeeklyOpeningHours', $this->weekly);
return empty($o) ? new class(){} : $o;
}
}
PHP PlaceUpdateOpeningHourRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /place/update_opening_hour HTTP/1.1
Host: business-api.brovs.com
Accept: application/json
Content-Type: application/json
Content-Length: length
{"placeId":0,"openingHours":{"weekly":{"monday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"tuesday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"wednesday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"thursday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"friday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"saturday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"sunday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0}}}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length
{"openingHours":{"weekly":{"monday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"tuesday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"wednesday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"thursday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"friday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"saturday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0},"sunday":{"openAtHour":0,"openAtMinute":0,"closeAtHour":0,"closeAtMinute":0}}}}