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 'package:servicestack/servicestack.dart';
import 'dart:typed_data';

enum SimpleSchedulingRuleTypes
{
    Always,
    CustomerState,
    Time,
}

class Value implements IConvertible
{
    bool? boolValue;
    String? stringValue;
    double? numberValue;
    List<Struct>? listValue;
    Struct? structValue;

    Value({this.boolValue,this.stringValue,this.numberValue,this.listValue,this.structValue});
    Value.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        boolValue = json['boolValue'];
        stringValue = json['stringValue'];
        numberValue = JsonConverters.toDouble(json['numberValue']);
        listValue = JsonConverters.fromJson(json['listValue'],'List<Struct>',context!);
        structValue = JsonConverters.fromJson(json['structValue'],'Struct',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'boolValue': boolValue,
        'stringValue': stringValue,
        'numberValue': numberValue,
        'listValue': JsonConverters.toJson(listValue,'List<Struct>',context!),
        'structValue': JsonConverters.toJson(structValue,'Struct',context!)
    };

    getTypeName() => "Value";
    TypeContext? context = _ctx;
}

class Struct extends Map<String,Value?> implements IConvertible
{
    Struct();
    Struct.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "Struct";
    TypeContext? context = _ctx;
}

class ScheduleDay implements IConvertible
{
    int? offset;
    DayOfWeek? dayOfWeek;

    ScheduleDay({this.offset,this.dayOfWeek});
    ScheduleDay.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        offset = json['offset'];
        dayOfWeek = JsonConverters.fromJson(json['dayOfWeek'],'DayOfWeek',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'offset': offset,
        'dayOfWeek': JsonConverters.toJson(dayOfWeek,'DayOfWeek',context!)
    };

    getTypeName() => "ScheduleDay";
    TypeContext? context = _ctx;
}

enum SchedulingRuleFrequency
{
    None,
    Secondly,
    Minutely,
    Hourly,
    Daily,
    Weekly,
    Monthly,
    Yearly,
}

class SchedulingRule implements IConvertible
{
    String? id;
    String? name;
    int? priority;
    String? state;
    String? source;
    String? condition;
    SimpleSchedulingRuleTypes? simpleRuleType;
    String? customerState;
    String? flowId;
    Struct? flowParams;
    bool? isAllDay;
    String? startDate;
    String? startTime;
    String? endTime;
    List<int>? bySetPosition;
    List<int>? byMonth;
    List<int>? byWeekNo;
    List<int>? byYearDay;
    List<int>? byMonthDay;
    List<ScheduleDay>? byDay;
    List<int>? byHour;
    List<int>? byMinute;
    int? interval;
    int? count;
    String? untilDate;
    SchedulingRuleFrequency? frequency;

    SchedulingRule({this.id,this.name,this.priority,this.state,this.source,this.condition,this.simpleRuleType,this.customerState,this.flowId,this.flowParams,this.isAllDay,this.startDate,this.startTime,this.endTime,this.bySetPosition,this.byMonth,this.byWeekNo,this.byYearDay,this.byMonthDay,this.byDay,this.byHour,this.byMinute,this.interval,this.count,this.untilDate,this.frequency});
    SchedulingRule.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        name = json['name'];
        priority = json['priority'];
        state = json['state'];
        source = json['source'];
        condition = json['condition'];
        simpleRuleType = JsonConverters.fromJson(json['simpleRuleType'],'SimpleSchedulingRuleTypes',context!);
        customerState = json['customerState'];
        flowId = json['flowId'];
        flowParams = JsonConverters.fromJson(json['flowParams'],'Struct',context!);
        isAllDay = json['isAllDay'];
        startDate = json['startDate'];
        startTime = json['startTime'];
        endTime = json['endTime'];
        bySetPosition = JsonConverters.fromJson(json['bySetPosition'],'List<int>',context!);
        byMonth = JsonConverters.fromJson(json['byMonth'],'List<int>',context!);
        byWeekNo = JsonConverters.fromJson(json['byWeekNo'],'List<int>',context!);
        byYearDay = JsonConverters.fromJson(json['byYearDay'],'List<int>',context!);
        byMonthDay = JsonConverters.fromJson(json['byMonthDay'],'List<int>',context!);
        byDay = JsonConverters.fromJson(json['byDay'],'List<ScheduleDay>',context!);
        byHour = JsonConverters.fromJson(json['byHour'],'List<int>',context!);
        byMinute = JsonConverters.fromJson(json['byMinute'],'List<int>',context!);
        interval = json['interval'];
        count = json['count'];
        untilDate = json['untilDate'];
        frequency = JsonConverters.fromJson(json['frequency'],'SchedulingRuleFrequency',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'priority': priority,
        'state': state,
        'source': source,
        'condition': condition,
        'simpleRuleType': JsonConverters.toJson(simpleRuleType,'SimpleSchedulingRuleTypes',context!),
        'customerState': customerState,
        'flowId': flowId,
        'flowParams': JsonConverters.toJson(flowParams,'Struct',context!),
        'isAllDay': isAllDay,
        'startDate': startDate,
        'startTime': startTime,
        'endTime': endTime,
        'bySetPosition': JsonConverters.toJson(bySetPosition,'List<int>',context!),
        'byMonth': JsonConverters.toJson(byMonth,'List<int>',context!),
        'byWeekNo': JsonConverters.toJson(byWeekNo,'List<int>',context!),
        'byYearDay': JsonConverters.toJson(byYearDay,'List<int>',context!),
        'byMonthDay': JsonConverters.toJson(byMonthDay,'List<int>',context!),
        'byDay': JsonConverters.toJson(byDay,'List<ScheduleDay>',context!),
        'byHour': JsonConverters.toJson(byHour,'List<int>',context!),
        'byMinute': JsonConverters.toJson(byMinute,'List<int>',context!),
        'interval': interval,
        'count': count,
        'untilDate': untilDate,
        'frequency': JsonConverters.toJson(frequency,'SchedulingRuleFrequency',context!)
    };

    getTypeName() => "SchedulingRule";
    TypeContext? context = _ctx;
}

class Schedule implements IConvertible
{
    String? timeZoneId;
    bool? inherit;
    bool? forceClosed;
    List<SchedulingRule>? rules;
    String? defaultState;

    Schedule({this.timeZoneId,this.inherit,this.forceClosed,this.rules,this.defaultState});
    Schedule.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        timeZoneId = json['timeZoneId'];
        inherit = json['inherit'];
        forceClosed = json['forceClosed'];
        rules = JsonConverters.fromJson(json['rules'],'List<SchedulingRule>',context!);
        defaultState = json['defaultState'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'timeZoneId': timeZoneId,
        'inherit': inherit,
        'forceClosed': forceClosed,
        'rules': JsonConverters.toJson(rules,'List<SchedulingRule>',context!),
        'defaultState': defaultState
    };

    getTypeName() => "Schedule";
    TypeContext? context = _ctx;
}

/**
* Test the customer's schedule
*/
// @Api(Description="Test the customer's schedule")
class TestSchedule implements IConvertible
{
    /**
    * The ID of the customer whose schedule you want to test
    */
    // @ApiMember(Description="The ID of the customer whose schedule you want to test")
    String? customerId;

    /**
    * The ID of the endpoint whose schedule you want to test.
    */
    // @ApiMember(Description="The ID of the endpoint whose schedule you want to test.")
    String? endpointId;

    /**
    * 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)")
    Schedule? schedule;

    /**
    * 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")
    String? dateTime;

    TestSchedule({this.customerId,this.endpointId,this.schedule,this.dateTime});
    TestSchedule.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        customerId = json['customerId'];
        endpointId = json['endpointId'];
        schedule = JsonConverters.fromJson(json['schedule'],'Schedule',context!);
        dateTime = json['dateTime'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'customerId': customerId,
        'endpointId': endpointId,
        'schedule': JsonConverters.toJson(schedule,'Schedule',context!),
        'dateTime': dateTime
    };

    getTypeName() => "TestSchedule";
    TypeContext? context = _ctx;
}

class TestScheduleResponse implements IConvertible
{
    String? stateName;
    String? timeZoneId;

    TestScheduleResponse({this.stateName,this.timeZoneId});
    TestScheduleResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        stateName = json['stateName'];
        timeZoneId = json['timeZoneId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'stateName': stateName,
        'timeZoneId': timeZoneId
    };

    getTypeName() => "TestScheduleResponse";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'evovoice.io', types: <String, TypeInfo> {
    'SimpleSchedulingRuleTypes': TypeInfo(TypeOf.Enum, enumValues:SimpleSchedulingRuleTypes.values),
    'Value': TypeInfo(TypeOf.Class, create:() => Value()),
    'List<Struct>': TypeInfo(TypeOf.Class, create:() => <Struct>[]),
    'Struct': TypeInfo(TypeOf.Class, create:() => Struct()),
    'ScheduleDay': TypeInfo(TypeOf.Class, create:() => ScheduleDay()),
    'DayOfWeek': TypeInfo(TypeOf.Class, create:() => DayOfWeek()),
    'SchedulingRuleFrequency': TypeInfo(TypeOf.Enum, enumValues:SchedulingRuleFrequency.values),
    'SchedulingRule': TypeInfo(TypeOf.Class, create:() => SchedulingRule()),
    'List<ScheduleDay>': TypeInfo(TypeOf.Class, create:() => <ScheduleDay>[]),
    'Schedule': TypeInfo(TypeOf.Class, create:() => Schedule()),
    'List<SchedulingRule>': TypeInfo(TypeOf.Class, create:() => <SchedulingRule>[]),
    'TestSchedule': TypeInfo(TypeOf.Class, create:() => TestSchedule()),
    'TestScheduleResponse': TypeInfo(TypeOf.Class, create:() => TestScheduleResponse()),
});

Dart 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
}