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 .csv suffix or ?format=csv

HTTP + CSV

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: text/csv
Content-Type: text/csv
Content-Length: length

{"DriveTimes":[{"Workspace":"String","StartLoc":{"y":0,"x":0},"EndLoc":{"y":0,"x":0},"Duration":0,"Distance":0,"Error":"String","UserId":"String","EndScheduleId":"String","TimeBetweenSchedules":0}],"Workspace":"String"}