Requires any of the roles: | SystemAdministrator, Manager, Customer |
POST | /customers/{customerId}/test-schedule | ||
---|---|---|---|
POST | /endpoints/{endpointId}/test-schedule |
import Foundation
import ServiceStack
/**
* Test the customer's schedule
*/
// @Api(Description="Test the customer's schedule")
public class TestSchedule : Codable
{
/**
* The ID of the customer whose schedule you want to test
*/
// @ApiMember(Description="The ID of the customer whose schedule you want to test")
public var customerId:String?
/**
* The ID of the endpoint whose schedule you want to test.
*/
// @ApiMember(Description="The ID of the endpoint whose schedule you want to test.")
public var endpointId:String?
/**
* 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)")
public var 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")
public var dateTime:String?
required public init(){}
}
public class Schedule : Codable
{
public var timeZoneId:String?
public var inherit:Bool?
public var forceClosed:Bool?
public var rules:[SchedulingRule] = []
public var defaultState:String?
required public init(){}
}
public class SchedulingRule : Codable
{
public var id:String?
public var name:String?
public var priority:Int?
public var state:String?
public var source:String?
public var condition:String?
public var simpleRuleType:SimpleSchedulingRuleTypes?
public var customerState:String?
public var flowId:String?
public var flowParams:Struct?
public var isAllDay:Bool?
public var startDate:String?
public var startTime:String?
public var endTime:String?
public var bySetPosition:[Int] = []
public var byMonth:[Int] = []
public var byWeekNo:[Int] = []
public var byYearDay:[Int] = []
public var byMonthDay:[Int] = []
public var byDay:[ScheduleDay] = []
public var byHour:[Int] = []
public var byMinute:[Int] = []
public var interval:Int?
public var count:Int?
public var untilDate:String?
public var frequency:SchedulingRuleFrequency?
required public init(){}
}
public enum SimpleSchedulingRuleTypes : String, Codable
{
case Always
case CustomerState
case Time
}
public class Struct : List<String:Value>
{
required public init(){ super.init() }
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
}
}
public class Value : Codable
{
public var boolValue:Bool?
public var stringValue:String?
public var numberValue:Double?
public var listValue:[Struct] = []
public var structValue:Struct?
required public init(){}
}
public class ScheduleDay : Codable
{
public var offset:Int?
public var dayOfWeek:DayOfWeek?
required public init(){}
}
public enum SchedulingRuleFrequency : String, Codable
{
case None
case Secondly
case Minutely
case Hourly
case Daily
case Weekly
case Monthly
case Yearly
}
public class TestScheduleResponse : Codable
{
public var stateName:String?
public var timeZoneId:String?
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
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/csv
Content-Type: text/csv
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/csv Content-Length: length {"stateName":"String","timeZoneId":"String"}