Field Squared API Services

<back to all web services

DriveTimeBatch

The following routes are available for this service:
POST/{Workspace}/DriveTimeBatch
import 'package:servicestack/servicestack.dart';

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 DriveTime implements IConvertible
{
    String? Workspace;
    Location? StartLoc;
    Location? EndLoc;
    double? Duration;
    double? Distance;
    String? Error;
    String? UserId;
    String? EndScheduleId;
    int? TimeBetweenSchedules;

    DriveTime({this.Workspace,this.StartLoc,this.EndLoc,this.Duration,this.Distance,this.Error,this.UserId,this.EndScheduleId,this.TimeBetweenSchedules});
    DriveTime.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Workspace = json['Workspace'];
        StartLoc = JsonConverters.fromJson(json['StartLoc'],'Location',context!);
        EndLoc = JsonConverters.fromJson(json['EndLoc'],'Location',context!);
        Duration = JsonConverters.toDouble(json['Duration']);
        Distance = JsonConverters.toDouble(json['Distance']);
        Error = json['Error'];
        UserId = json['UserId'];
        EndScheduleId = json['EndScheduleId'];
        TimeBetweenSchedules = json['TimeBetweenSchedules'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Workspace': Workspace,
        'StartLoc': JsonConverters.toJson(StartLoc,'Location',context!),
        'EndLoc': JsonConverters.toJson(EndLoc,'Location',context!),
        'Duration': Duration,
        'Distance': Distance,
        'Error': Error,
        'UserId': UserId,
        'EndScheduleId': EndScheduleId,
        'TimeBetweenSchedules': TimeBetweenSchedules
    };

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

class DriveTimeBatch implements IConvertible
{
    List<DriveTime>? DriveTimes;
    String? Workspace;

    DriveTimeBatch({this.DriveTimes,this.Workspace});
    DriveTimeBatch.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        DriveTimes = JsonConverters.fromJson(json['DriveTimes'],'List<DriveTime>',context!);
        Workspace = json['Workspace'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'DriveTimes': JsonConverters.toJson(DriveTimes,'List<DriveTime>',context!),
        'Workspace': Workspace
    };

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

TypeContext _ctx = TypeContext(library: 'dev.fieldsquared.com', types: <String, TypeInfo> {
    'Location': TypeInfo(TypeOf.Class, create:() => Location()),
    'DriveTime': TypeInfo(TypeOf.Class, create:() => DriveTime()),
    'DriveTimeBatch': TypeInfo(TypeOf.Class, create:() => DriveTimeBatch()),
    'List<DriveTime>': TypeInfo(TypeOf.Class, create:() => <DriveTime>[]),
});

Dart DriveTimeBatch 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}/DriveTimeBatch HTTP/1.1 
Host: dev.fieldsquared.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<DriveTimeBatch xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Field2Office.API.Model.Geocoding">
  <DriveTimes>
    <DriveTime>
      <Distance>0</Distance>
      <Duration>0</Duration>
      <EndLoc xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:x>0</d4p1:x>
        <d4p1:y>0</d4p1:y>
      </EndLoc>
      <EndScheduleId>String</EndScheduleId>
      <Error>String</Error>
      <StartLoc xmlns:d4p1="http://schemas.datacontract.org/2004/07/Field2Office.API.Model">
        <d4p1:x>0</d4p1:x>
        <d4p1:y>0</d4p1:y>
      </StartLoc>
      <TimeBetweenSchedules>0</TimeBetweenSchedules>
      <UserId>String</UserId>
      <Workspace>String</Workspace>
    </DriveTime>
  </DriveTimes>
  <Workspace>String</Workspace>
</DriveTimeBatch>