Field Squared API Services

<back to all web services

ProposeRouteRequest

The following routes are available for this service:
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>[]),
});

Dart ProposeRouteRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

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/xml
Content-Type: application/xml
Content-Length: length

<ProposeRouteRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.MapRoute">
  <AllowReorder>false</AllowReorder>
  <Distance>0</Distance>
  <EndLocation xmlns:d2p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
    <d2p1:x>0</d2p1:x>
    <d2p1:y>0</d2p1:y>
  </EndLocation>
  <LunchDuration>0</LunchDuration>
  <LunchStart>String</LunchStart>
  <Nodes>
    <RouteNode>
      <Ancestors xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">
        <d4p1:string>String</d4p1:string>
      </Ancestors>
      <Class xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</Class>
      <ObjectId xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</ObjectId>
      <Type xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</Type>
      <VersionId xmlns="http://schemas.datacontract.org/2004/07/Field2Office.DomainObjects.Model">String</VersionId>
      <Location xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:x>0</d4p1:x>
        <d4p1:y>0</d4p1:y>
      </Location>
      <Name>String</Name>
      <Schedule xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.Schedules">
        <d4p1:BasedOn>String</d4p1:BasedOn>
        <d4p1:Data xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringanyType>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value />
          </d5p1:KeyValueOfstringanyType>
        </d4p1:Data>
        <d4p1:End>String</d4p1:End>
        <d4p1:ObjectId>String</d4p1:ObjectId>
        <d4p1:Start>String</d4p1:Start>
        <d4p1:Teams xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:string>String</d5p1:string>
        </d4p1:Teams>
        <d4p1:TimeZone>String</d4p1:TimeZone>
        <d4p1:Users xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:string>String</d5p1:string>
        </d4p1:Users>
        <d4p1:VersionId>String</d4p1:VersionId>
        <d4p1:Workspace>String</d4p1:Workspace>
      </Schedule>
      <StopTime>0</StopTime>
    </RouteNode>
  </Nodes>
  <RealTime>0</RealTime>
  <RoundStartTimes>0</RoundStartTimes>
  <ShortestDistance>false</ShortestDistance>
  <StartClockAtFirstNode>false</StartClockAtFirstNode>
  <StartLocation xmlns:d2p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
    <d2p1:x>0</d2p1:x>
    <d2p1:y>0</d2p1:y>
  </StartLocation>
  <StartTime>String</StartTime>
  <Time>0</Time>
  <TransitionTime>0</TransitionTime>
  <Workspace>String</Workspace>
</ProposeRouteRequest>