Evo Voice

<back to all web services

GetInheritedSchedule

Get the inherited schedule for this customer

Requires Authentication
Requires any of the roles:SystemAdministrator, Manager, Customer
The following routes are available for this service:
GET/customers/{customerId}/inherited-schedule
GET/endpoints/{endpointId}/inherited-schedule
<?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};


enum SimpleSchedulingRuleTypes : string
{
    case Always = 'Always';
    case CustomerState = 'CustomerState';
    case Time = 'Time';
}

class Value implements JsonSerializable
{
    public function __construct(
        /** @var bool|null */
        public ?bool $boolValue=null,
        /** @var string|null */
        public ?string $stringValue=null,
        /** @var float|null */
        public ?float $numberValue=null,
        /** @var array<Struct>|null */
        public ?array $listValue=null,
        /** @var Struct|null */
        public ?Struct $structValue=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['boolValue'])) $this->boolValue = $o['boolValue'];
        if (isset($o['stringValue'])) $this->stringValue = $o['stringValue'];
        if (isset($o['numberValue'])) $this->numberValue = $o['numberValue'];
        if (isset($o['listValue'])) $this->listValue = JsonConverters::fromArray('Struct', $o['listValue']);
        if (isset($o['structValue'])) $this->structValue = JsonConverters::from('Struct', $o['structValue']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->boolValue)) $o['boolValue'] = $this->boolValue;
        if (isset($this->stringValue)) $o['stringValue'] = $this->stringValue;
        if (isset($this->numberValue)) $o['numberValue'] = $this->numberValue;
        if (isset($this->listValue)) $o['listValue'] = JsonConverters::toArray('Struct', $this->listValue);
        if (isset($this->structValue)) $o['structValue'] = JsonConverters::to('Struct', $this->structValue);
        return empty($o) ? new class(){} : $o;
    }
}

/**
 * @template array of String
 * @template array1 of Value
 */
class Struct extends array implements JsonSerializable
{
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = parent::jsonSerialize();
        return empty($o) ? new class(){} : $o;
    }
}

class ScheduleDay implements JsonSerializable
{
    public function __construct(
        /** @var int */
        public int $offset=0,
        /** @var DayOfWeek|null */
        public ?DayOfWeek $dayOfWeek=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['offset'])) $this->offset = $o['offset'];
        if (isset($o['dayOfWeek'])) $this->dayOfWeek = JsonConverters::from('DayOfWeek', $o['dayOfWeek']);
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->offset)) $o['offset'] = $this->offset;
        if (isset($this->dayOfWeek)) $o['dayOfWeek'] = JsonConverters::to('DayOfWeek', $this->dayOfWeek);
        return empty($o) ? new class(){} : $o;
    }
}

enum SchedulingRuleFrequency : string
{
    case None = 'None';
    case Secondly = 'Secondly';
    case Minutely = 'Minutely';
    case Hourly = 'Hourly';
    case Daily = 'Daily';
    case Weekly = 'Weekly';
    case Monthly = 'Monthly';
    case Yearly = 'Yearly';
}

class SchedulingRule implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $id=null,
        /** @var string|null */
        public ?string $name=null,
        /** @var int */
        public int $priority=0,
        /** @var string|null */
        public ?string $state=null,
        /** @var string|null */
        public ?string $source=null,
        /** @var string|null */
        public ?string $condition=null,
        /** @var SimpleSchedulingRuleTypes|null */
        public ?SimpleSchedulingRuleTypes $simpleRuleType=null,
        /** @var string|null */
        public ?string $customerState=null,
        /** @var string|null */
        public ?string $flowId=null,
        /** @var Struct|null */
        public ?Struct $flowParams=null,
        /** @var bool|null */
        public ?bool $isAllDay=null,
        /** @var string|null */
        public ?string $startDate=null,
        /** @var string|null */
        public ?string $startTime=null,
        /** @var string|null */
        public ?string $endTime=null,
        /** @var array<int>|null */
        public ?array $bySetPosition=null,
        /** @var array<int>|null */
        public ?array $byMonth=null,
        /** @var array<int>|null */
        public ?array $byWeekNo=null,
        /** @var array<int>|null */
        public ?array $byYearDay=null,
        /** @var array<int>|null */
        public ?array $byMonthDay=null,
        /** @var array<ScheduleDay>|null */
        public ?array $byDay=null,
        /** @var array<int>|null */
        public ?array $byHour=null,
        /** @var array<int>|null */
        public ?array $byMinute=null,
        /** @var int */
        public int $interval=0,
        /** @var int */
        public int $count=0,
        /** @var string|null */
        public ?string $untilDate=null,
        /** @var SchedulingRuleFrequency|null */
        public ?SchedulingRuleFrequency $frequency=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['priority'])) $this->priority = $o['priority'];
        if (isset($o['state'])) $this->state = $o['state'];
        if (isset($o['source'])) $this->source = $o['source'];
        if (isset($o['condition'])) $this->condition = $o['condition'];
        if (isset($o['simpleRuleType'])) $this->simpleRuleType = JsonConverters::from('SimpleSchedulingRuleTypes', $o['simpleRuleType']);
        if (isset($o['customerState'])) $this->customerState = $o['customerState'];
        if (isset($o['flowId'])) $this->flowId = $o['flowId'];
        if (isset($o['flowParams'])) $this->flowParams = JsonConverters::from('Struct', $o['flowParams']);
        if (isset($o['isAllDay'])) $this->isAllDay = $o['isAllDay'];
        if (isset($o['startDate'])) $this->startDate = $o['startDate'];
        if (isset($o['startTime'])) $this->startTime = $o['startTime'];
        if (isset($o['endTime'])) $this->endTime = $o['endTime'];
        if (isset($o['bySetPosition'])) $this->bySetPosition = JsonConverters::fromArray('int', $o['bySetPosition']);
        if (isset($o['byMonth'])) $this->byMonth = JsonConverters::fromArray('int', $o['byMonth']);
        if (isset($o['byWeekNo'])) $this->byWeekNo = JsonConverters::fromArray('int', $o['byWeekNo']);
        if (isset($o['byYearDay'])) $this->byYearDay = JsonConverters::fromArray('int', $o['byYearDay']);
        if (isset($o['byMonthDay'])) $this->byMonthDay = JsonConverters::fromArray('int', $o['byMonthDay']);
        if (isset($o['byDay'])) $this->byDay = JsonConverters::fromArray('ScheduleDay', $o['byDay']);
        if (isset($o['byHour'])) $this->byHour = JsonConverters::fromArray('int', $o['byHour']);
        if (isset($o['byMinute'])) $this->byMinute = JsonConverters::fromArray('int', $o['byMinute']);
        if (isset($o['interval'])) $this->interval = $o['interval'];
        if (isset($o['count'])) $this->count = $o['count'];
        if (isset($o['untilDate'])) $this->untilDate = $o['untilDate'];
        if (isset($o['frequency'])) $this->frequency = JsonConverters::from('SchedulingRuleFrequency', $o['frequency']);
    }
    
    /** @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->priority)) $o['priority'] = $this->priority;
        if (isset($this->state)) $o['state'] = $this->state;
        if (isset($this->source)) $o['source'] = $this->source;
        if (isset($this->condition)) $o['condition'] = $this->condition;
        if (isset($this->simpleRuleType)) $o['simpleRuleType'] = JsonConverters::to('SimpleSchedulingRuleTypes', $this->simpleRuleType);
        if (isset($this->customerState)) $o['customerState'] = $this->customerState;
        if (isset($this->flowId)) $o['flowId'] = $this->flowId;
        if (isset($this->flowParams)) $o['flowParams'] = JsonConverters::to('Struct', $this->flowParams);
        if (isset($this->isAllDay)) $o['isAllDay'] = $this->isAllDay;
        if (isset($this->startDate)) $o['startDate'] = $this->startDate;
        if (isset($this->startTime)) $o['startTime'] = $this->startTime;
        if (isset($this->endTime)) $o['endTime'] = $this->endTime;
        if (isset($this->bySetPosition)) $o['bySetPosition'] = JsonConverters::toArray('int', $this->bySetPosition);
        if (isset($this->byMonth)) $o['byMonth'] = JsonConverters::toArray('int', $this->byMonth);
        if (isset($this->byWeekNo)) $o['byWeekNo'] = JsonConverters::toArray('int', $this->byWeekNo);
        if (isset($this->byYearDay)) $o['byYearDay'] = JsonConverters::toArray('int', $this->byYearDay);
        if (isset($this->byMonthDay)) $o['byMonthDay'] = JsonConverters::toArray('int', $this->byMonthDay);
        if (isset($this->byDay)) $o['byDay'] = JsonConverters::toArray('ScheduleDay', $this->byDay);
        if (isset($this->byHour)) $o['byHour'] = JsonConverters::toArray('int', $this->byHour);
        if (isset($this->byMinute)) $o['byMinute'] = JsonConverters::toArray('int', $this->byMinute);
        if (isset($this->interval)) $o['interval'] = $this->interval;
        if (isset($this->count)) $o['count'] = $this->count;
        if (isset($this->untilDate)) $o['untilDate'] = $this->untilDate;
        if (isset($this->frequency)) $o['frequency'] = JsonConverters::to('SchedulingRuleFrequency', $this->frequency);
        return empty($o) ? new class(){} : $o;
    }
}

class Schedule implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $timeZoneId=null,
        /** @var bool|null */
        public ?bool $inherit=null,
        /** @var bool|null */
        public ?bool $forceClosed=null,
        /** @var array<SchedulingRule>|null */
        public ?array $rules=null,
        /** @var string|null */
        public ?string $defaultState=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['timeZoneId'])) $this->timeZoneId = $o['timeZoneId'];
        if (isset($o['inherit'])) $this->inherit = $o['inherit'];
        if (isset($o['forceClosed'])) $this->forceClosed = $o['forceClosed'];
        if (isset($o['rules'])) $this->rules = JsonConverters::fromArray('SchedulingRule', $o['rules']);
        if (isset($o['defaultState'])) $this->defaultState = $o['defaultState'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->timeZoneId)) $o['timeZoneId'] = $this->timeZoneId;
        if (isset($this->inherit)) $o['inherit'] = $this->inherit;
        if (isset($this->forceClosed)) $o['forceClosed'] = $this->forceClosed;
        if (isset($this->rules)) $o['rules'] = JsonConverters::toArray('SchedulingRule', $this->rules);
        if (isset($this->defaultState)) $o['defaultState'] = $this->defaultState;
        return empty($o) ? new class(){} : $o;
    }
}

/** @description Get the inherited schedule for this customer */
// @Api(Description="Get the inherited schedule for this customer")
class GetInheritedSchedule implements JsonSerializable
{
    public function __construct(
        /** @description The customer ID whose inherited schedule you want to retrieve */
        // @ApiMember(Description="The customer ID whose inherited schedule you want to retrieve")
        /** @var string|null */
        public ?string $customerId=null,

        /** @description The endpoint ID whose inherited schedule you want to retrieve (use this OR customer id */
        // @ApiMember(Description="The endpoint ID whose inherited schedule you want to retrieve (use this OR customer id")
        /** @var string|null */
        public ?string $endpointId=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['customerId'])) $this->customerId = $o['customerId'];
        if (isset($o['endpointId'])) $this->endpointId = $o['endpointId'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->customerId)) $o['customerId'] = $this->customerId;
        if (isset($this->endpointId)) $o['endpointId'] = $this->endpointId;
        return empty($o) ? new class(){} : $o;
    }
}

PHP GetInheritedSchedule 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.

GET /customers/{customerId}/inherited-schedule HTTP/1.1 
Host: team.evovoice.io 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	timeZoneId: String,
	inherit: False,
	forceClosed: False,
	rules: 
	[
		{
			id: String,
			name: String,
			priority: 0,
			state: String,
			source: String,
			condition: String,
			simpleRuleType: Always,
			customerState: String,
			flowId: String,
			isAllDay: False,
			startDate: String,
			startTime: String,
			endTime: String,
			bySetPosition: 
			[
				0
			],
			byMonth: 
			[
				0
			],
			byWeekNo: 
			[
				0
			],
			byYearDay: 
			[
				0
			],
			byMonthDay: 
			[
				0
			],
			byDay: 
			[
				{
					offset: 0,
					dayOfWeek: Sunday
				}
			],
			byHour: 
			[
				0
			],
			byMinute: 
			[
				0
			],
			interval: 0,
			count: 0,
			untilDate: String,
			frequency: None
		}
	],
	defaultState: String
}