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
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


class SimpleSchedulingRuleTypes(str, Enum):
    ALWAYS = 'Always'
    CUSTOMER_STATE = 'CustomerState'
    TIME = 'Time'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Value:
    bool_value: Optional[bool] = None
    string_value: Optional[str] = None
    number_value: Optional[float] = None
    list_value: Optional[List[Struct]] = None
    struct_value: Optional[Struct] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Struct(Dict[str,Value]):
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ScheduleDay:
    offset: Optional[int] = None
    day_of_week: Optional[DayOfWeek] = None


class SchedulingRuleFrequency(str, Enum):
    NONE = 'None'
    SECONDLY = 'Secondly'
    MINUTELY = 'Minutely'
    HOURLY = 'Hourly'
    DAILY = 'Daily'
    WEEKLY = 'Weekly'
    MONTHLY = 'Monthly'
    YEARLY = 'Yearly'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SchedulingRule:
    id: Optional[str] = None
    name: Optional[str] = None
    priority: Optional[int] = None
    state: Optional[str] = None
    source: Optional[str] = None
    condition: Optional[str] = None
    simple_rule_type: Optional[SimpleSchedulingRuleTypes] = None
    customer_state: Optional[str] = None
    flow_id: Optional[str] = None
    flow_params: Optional[Struct] = None
    is_all_day: Optional[bool] = None
    start_date: Optional[str] = None
    start_time: Optional[str] = None
    end_time: Optional[str] = None
    by_set_position: Optional[List[int]] = None
    by_month: Optional[List[int]] = None
    by_week_no: Optional[List[int]] = None
    by_year_day: Optional[List[int]] = None
    by_month_day: Optional[List[int]] = None
    by_day: Optional[List[ScheduleDay]] = None
    by_hour: Optional[List[int]] = None
    by_minute: Optional[List[int]] = None
    interval: Optional[int] = None
    count: Optional[int] = None
    until_date: Optional[str] = None
    frequency: Optional[SchedulingRuleFrequency] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Schedule:
    time_zone_id: Optional[str] = None
    inherit: Optional[bool] = None
    force_closed: Optional[bool] = None
    rules: Optional[List[SchedulingRule]] = None
    default_state: Optional[str] = None


# @Api(Description="Test the customer's schedule")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class TestSchedule:
    """
    Test the customer's schedule
    """

    # @ApiMember(Description="The ID of the customer whose schedule you want to test")
    customer_id: Optional[str] = None
    """
    The ID of the customer whose schedule you want to test
    """


    # @ApiMember(Description="The ID of the endpoint whose schedule you want to test.")
    endpoint_id: Optional[str] = None
    """
    The ID of the endpoint whose schedule you want to test.
    """


    # @ApiMember(Description="The schedule to use (leave null to use the current saved schedule)")
    schedule: Optional[Schedule] = None
    """
    The schedule to use (leave null to use the current saved schedule)
    """


    # @ApiMember(Description="The ISO string of the date and time you want to test")
    date_time: Optional[str] = None
    """
    The ISO string of the date and time you want to test
    """


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class TestScheduleResponse:
    state_name: Optional[str] = None
    time_zone_id: Optional[str] = None

Python 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: 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,
				flowParams: 
				{
					String: 
					{
						boolValue: False,
						stringValue: String,
						numberValue: 0,
						listValue: 
						[
							{
								String: 
								{
									boolValue: False,
									stringValue: String,
									numberValue: 0,
									listValue: 
									[
										{
											String: 
											{
												boolValue: False,
												stringValue: String,
												numberValue: 0,
												listValue: 
												[
													null
												]
											}
										}
									],
									structValue: 
									{
										String: 
										{
											boolValue: False,
											stringValue: String,
											numberValue: 0,
											listValue: 
											[
												null
											]
										}
									}
								}
							}
						],
						structValue: 
						{
							String: 
							{
								boolValue: False,
								stringValue: String,
								numberValue: 0,
								listValue: 
								[
									{
										String: 
										{
											boolValue: False,
											stringValue: String,
											numberValue: 0,
											listValue: 
											[
												null
											]
										}
									}
								],
								structValue: 
								{
									String: 
									{
										boolValue: False,
										stringValue: String,
										numberValue: 0,
										listValue: 
										[
											null
										]
									}
								}
							}
						}
					}
				},
				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
}