Evo Voice

<back to all web services

TestSchedule

Test the customer's schedule

Requires Authentication
Requires any of the roles:SystemAdministrator, Manager, Customer
The following routes are available for this service:
POST/customers/{customerId}/test-schedule
POST/endpoints/{endpointId}/test-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 Test the customer's schedule */
// @Api(Description="Test the customer's schedule")
class TestSchedule implements JsonSerializable
{
    public function __construct(
        /** @description The ID of the customer whose schedule you want to test */
        // @ApiMember(Description="The ID of the customer whose schedule you want to test")
        /** @var string|null */
        public ?string $customerId=null,

        /** @description The ID of the endpoint whose schedule you want to test. */
        // @ApiMember(Description="The ID of the endpoint whose schedule you want to test.")
        /** @var string|null */
        public ?string $endpointId=null,

        /** @description The schedule to use (leave null to use the current saved schedule) */
        // @ApiMember(Description="The schedule to use (leave null to use the current saved schedule)")
        /** @var Schedule|null */
        public ?Schedule $schedule=null,

        /** @description The ISO string of the date and time you want to test */
        // @ApiMember(Description="The ISO string of the date and time you want to test")
        /** @var string|null */
        public ?string $dateTime=null
    ) {
    }

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

class TestScheduleResponse implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $stateName=null,
        /** @var string|null */
        public ?string $timeZoneId=null
    ) {
    }

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

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

POST /customers/{customerId}/test-schedule HTTP/1.1 
Host: team.evovoice.io 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	customerId: String,
	endpointId: String,
	schedule: 
	{
		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
	},
	dateTime: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	stateName: String,
	timeZoneId: String
}