| POST | /{Workspace}/ProposeRoute |
|---|
import 'package:servicestack/servicestack.dart';
class ClassedItem implements IConvertible
{
String? ObjectId;
String? Class;
String? VersionId;
List<String>? Ancestors;
String? Type;
ClassedItem({this.ObjectId,this.Class,this.VersionId,this.Ancestors,this.Type});
ClassedItem.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
ObjectId = json['ObjectId'];
Class = json['Class'];
VersionId = json['VersionId'];
Ancestors = JsonConverters.fromJson(json['Ancestors'],'List<String>',context!);
Type = json['Type'];
return this;
}
Map<String, dynamic> toJson() => {
'ObjectId': ObjectId,
'Class': Class,
'VersionId': VersionId,
'Ancestors': JsonConverters.toJson(Ancestors,'List<String>',context!),
'Type': Type
};
getTypeName() => "ClassedItem";
TypeContext? context = _ctx;
}
class Location implements IConvertible
{
double? y;
double? x;
Location({this.y,this.x});
Location.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
y = JsonConverters.toDouble(json['y']);
x = JsonConverters.toDouble(json['x']);
return this;
}
Map<String, dynamic> toJson() => {
'y': y,
'x': x
};
getTypeName() => "Location";
TypeContext? context = _ctx;
}
class Schedule implements IConvertible
{
String? Workspace;
String? ObjectId;
String? VersionId;
String? BasedOn;
String? Start;
String? End;
String? TimeZone;
List<String>? Users;
List<String>? Teams;
Map<String,dynamic?>? Data;
Schedule({this.Workspace,this.ObjectId,this.VersionId,this.BasedOn,this.Start,this.End,this.TimeZone,this.Users,this.Teams,this.Data});
Schedule.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Workspace = json['Workspace'];
ObjectId = json['ObjectId'];
VersionId = json['VersionId'];
BasedOn = json['BasedOn'];
Start = json['Start'];
End = json['End'];
TimeZone = json['TimeZone'];
Users = JsonConverters.fromJson(json['Users'],'List<String>',context!);
Teams = JsonConverters.fromJson(json['Teams'],'List<String>',context!);
Data = JsonConverters.fromJson(json['Data'],'Map<String,dynamic?>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Workspace': Workspace,
'ObjectId': ObjectId,
'VersionId': VersionId,
'BasedOn': BasedOn,
'Start': Start,
'End': End,
'TimeZone': TimeZone,
'Users': JsonConverters.toJson(Users,'List<String>',context!),
'Teams': JsonConverters.toJson(Teams,'List<String>',context!),
'Data': JsonConverters.toJson(Data,'Map<String,dynamic?>',context!)
};
getTypeName() => "Schedule";
TypeContext? context = _ctx;
}
class RouteNode extends ClassedItem implements IConvertible
{
Location? Location;
int? StopTime;
Schedule? Schedule;
String? Name;
RouteNode({this.Location,this.StopTime,this.Schedule,this.Name});
RouteNode.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
Location = JsonConverters.fromJson(json['Location'],'Location',context!);
StopTime = json['StopTime'];
Schedule = JsonConverters.fromJson(json['Schedule'],'Schedule',context!);
Name = json['Name'];
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'Location': JsonConverters.toJson(Location,'Location',context!),
'StopTime': StopTime,
'Schedule': JsonConverters.toJson(Schedule,'Schedule',context!),
'Name': Name
});
getTypeName() => "RouteNode";
TypeContext? context = _ctx;
}
class ProposeRouteRequest implements IConvertible
{
String? Workspace;
List<RouteNode>? Nodes;
bool? AllowReorder;
Location? StartLocation;
Location? EndLocation;
bool? ShortestDistance;
String? StartTime;
bool? StartClockAtFirstNode;
int? RoundStartTimes;
int? TransitionTime;
String? LunchStart;
int? LunchDuration;
int? Time;
int? RealTime;
double? Distance;
ProposeRouteRequest({this.Workspace,this.Nodes,this.AllowReorder,this.StartLocation,this.EndLocation,this.ShortestDistance,this.StartTime,this.StartClockAtFirstNode,this.RoundStartTimes,this.TransitionTime,this.LunchStart,this.LunchDuration,this.Time,this.RealTime,this.Distance});
ProposeRouteRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Workspace = json['Workspace'];
Nodes = JsonConverters.fromJson(json['Nodes'],'List<RouteNode>',context!);
AllowReorder = json['AllowReorder'];
StartLocation = JsonConverters.fromJson(json['StartLocation'],'Location',context!);
EndLocation = JsonConverters.fromJson(json['EndLocation'],'Location',context!);
ShortestDistance = json['ShortestDistance'];
StartTime = json['StartTime'];
StartClockAtFirstNode = json['StartClockAtFirstNode'];
RoundStartTimes = json['RoundStartTimes'];
TransitionTime = json['TransitionTime'];
LunchStart = json['LunchStart'];
LunchDuration = json['LunchDuration'];
Time = json['Time'];
RealTime = json['RealTime'];
Distance = JsonConverters.toDouble(json['Distance']);
return this;
}
Map<String, dynamic> toJson() => {
'Workspace': Workspace,
'Nodes': JsonConverters.toJson(Nodes,'List<RouteNode>',context!),
'AllowReorder': AllowReorder,
'StartLocation': JsonConverters.toJson(StartLocation,'Location',context!),
'EndLocation': JsonConverters.toJson(EndLocation,'Location',context!),
'ShortestDistance': ShortestDistance,
'StartTime': StartTime,
'StartClockAtFirstNode': StartClockAtFirstNode,
'RoundStartTimes': RoundStartTimes,
'TransitionTime': TransitionTime,
'LunchStart': LunchStart,
'LunchDuration': LunchDuration,
'Time': Time,
'RealTime': RealTime,
'Distance': Distance
};
getTypeName() => "ProposeRouteRequest";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'dev.fieldsquared.com', types: <String, TypeInfo> {
'ClassedItem': TypeInfo(TypeOf.Class, create:() => ClassedItem()),
'Location': TypeInfo(TypeOf.Class, create:() => Location()),
'Schedule': TypeInfo(TypeOf.Class, create:() => Schedule()),
'Map<String,dynamic?>': TypeInfo(TypeOf.Class, create:() => Map<String,dynamic?>()),
'RouteNode': TypeInfo(TypeOf.Class, create:() => RouteNode()),
'ProposeRouteRequest': TypeInfo(TypeOf.Class, create:() => ProposeRouteRequest()),
'List<RouteNode>': TypeInfo(TypeOf.Class, create:() => <RouteNode>[]),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
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: application/json
Content-Type: application/json
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}