| POST | /{Workspace}/ProposeRoute |
|---|
import Foundation
import ServiceStack
public class ProposeRouteRequest : Codable
{
public var workspace:String
public var nodes:[RouteNode] = []
public var allowReorder:Bool
public var startLocation:Location
public var endLocation:Location
public var shortestDistance:Bool
public var startTime:String
public var startClockAtFirstNode:Bool
public var roundStartTimes:Int
public var transitionTime:Int
public var lunchStart:String
public var lunchDuration:Int
public var time:Int
public var realTime:Int
public var distance:Double
required public init(){}
}
public class RouteNode : ClassedItem
{
public var location:Location
public var stopTime:Int
public var schedule:Schedule
public var name:String
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case location
case stopTime
case schedule
case name
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
location = try container.decodeIfPresent(Location.self, forKey: .location)
stopTime = try container.decodeIfPresent(Int.self, forKey: .stopTime)
schedule = try container.decodeIfPresent(Schedule.self, forKey: .schedule)
name = try container.decodeIfPresent(String.self, forKey: .name)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if location != nil { try container.encode(location, forKey: .location) }
if stopTime != nil { try container.encode(stopTime, forKey: .stopTime) }
if schedule != nil { try container.encode(schedule, forKey: .schedule) }
if name != nil { try container.encode(name, forKey: .name) }
}
}
public class ClassedItem : Codable
{
public var objectId:String
public var `class`:String
public var versionId:String
public var ancestors:[String] = []
public var type:String
required public init(){}
}
public class Location : Codable
{
public var y:Double
public var x:Double
required public init(){}
}
public class Schedule : Codable
{
public var workspace:String
public var objectId:String
public var versionId:String
public var basedOn:String
public var start:String
public var end:String
public var timeZone:String
public var users:[String] = []
public var teams:[String] = []
public var data:[String:Object] = [:]
required public init(){}
}
Swift ProposeRouteRequest DTOs
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 /{Workspace}/ProposeRoute HTTP/1.1
Host: dev.fieldsquared.com
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"Workspace":"String","Nodes":[{"Location":{"y":0,"x":0},"StopTime":0,"Schedule":{"Workspace":"String","ObjectId":"String","VersionId":"String","BasedOn":"String","Start":"String","End":"String","TimeZone":"String","Users":["String"],"Teams":["String"],"Data":{"String":{}}},"Name":"String","ObjectId":"String","Class":"String","VersionId":"String","Ancestors":["String"],"Type":"String"}],"AllowReorder":false,"StartLocation":{"y":0,"x":0},"EndLocation":{"y":0,"x":0},"ShortestDistance":false,"StartTime":"String","StartClockAtFirstNode":false,"RoundStartTimes":0,"TransitionTime":0,"LunchStart":"String","LunchDuration":0,"Time":0,"RealTime":0,"Distance":0}