GET POST | /report/keyhistory |
---|
import 'package:servicestack/servicestack.dart';
// @DataContract
class Location implements IConvertible
{
// @DataMember
double? latitude;
// @DataMember
double? longitude;
Location({this.latitude,this.longitude});
Location.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
latitude = JsonConverters.toDouble(json['latitude']);
longitude = JsonConverters.toDouble(json['longitude']);
return this;
}
Map<String, dynamic> toJson() => {
'latitude': latitude,
'longitude': longitude
};
getTypeName() => "Location";
TypeContext? context = _ctx;
}
// @DataContract
class Address implements IConvertible
{
// @DataMember
String? country;
// @DataMember
String? zipCode;
// @DataMember
String? city;
// @DataMember
String? streetAddress;
Address({this.country,this.zipCode,this.city,this.streetAddress});
Address.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
country = json['country'];
zipCode = json['zipCode'];
city = json['city'];
streetAddress = json['streetAddress'];
return this;
}
Map<String, dynamic> toJson() => {
'country': country,
'zipCode': zipCode,
'city': city,
'streetAddress': streetAddress
};
getTypeName() => "Address";
TypeContext? context = _ctx;
}
// @DataContract
class KeyHistory implements IConvertible
{
// @DataMember
String? unitId;
// @DataMember
DateTime? time;
// @DataMember
Location? location;
// @DataMember
Address? address;
// @DataMember
int? heading;
// @DataMember
double? speed;
// @DataMember
double? km;
// @DataMember
double? run1;
// @DataMember
double? run2;
// @DataMember
double? runOdo;
// @DataMember
double? temperature1;
// @DataMember
double? temperature2;
// @DataMember
bool? input1;
// @DataMember
bool? input2;
// @DataMember
bool? output3;
// @DataMember
double? batteryLevel;
// @DataMember
double? externalPower;
KeyHistory({this.unitId,this.time,this.location,this.address,this.heading,this.speed,this.km,this.run1,this.run2,this.runOdo,this.temperature1,this.temperature2,this.input1,this.input2,this.output3,this.batteryLevel,this.externalPower});
KeyHistory.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
unitId = json['unitId'];
time = JsonConverters.fromJson(json['time'],'DateTime',context!);
location = JsonConverters.fromJson(json['location'],'Location',context!);
address = JsonConverters.fromJson(json['address'],'Address',context!);
heading = json['heading'];
speed = JsonConverters.toDouble(json['speed']);
km = JsonConverters.toDouble(json['km']);
run1 = JsonConverters.toDouble(json['run1']);
run2 = JsonConverters.toDouble(json['run2']);
runOdo = JsonConverters.toDouble(json['runOdo']);
temperature1 = JsonConverters.toDouble(json['temperature1']);
temperature2 = JsonConverters.toDouble(json['temperature2']);
input1 = json['input1'];
input2 = json['input2'];
output3 = json['output3'];
batteryLevel = JsonConverters.toDouble(json['batteryLevel']);
externalPower = JsonConverters.toDouble(json['externalPower']);
return this;
}
Map<String, dynamic> toJson() => {
'unitId': unitId,
'time': JsonConverters.toJson(time,'DateTime',context!),
'location': JsonConverters.toJson(location,'Location',context!),
'address': JsonConverters.toJson(address,'Address',context!),
'heading': heading,
'speed': speed,
'km': km,
'run1': run1,
'run2': run2,
'runOdo': runOdo,
'temperature1': temperature1,
'temperature2': temperature2,
'input1': input1,
'input2': input2,
'output3': output3,
'batteryLevel': batteryLevel,
'externalPower': externalPower
};
getTypeName() => "KeyHistory";
TypeContext? context = _ctx;
}
// @DataContract
class GetReportKeyHistoryResponse implements IConvertible
{
// @DataMember
List<KeyHistory>? list;
// @DataMember
ResponseStatus? responseStatus;
GetReportKeyHistoryResponse({this.list,this.responseStatus});
GetReportKeyHistoryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
list = JsonConverters.fromJson(json['list'],'List<KeyHistory>',context!);
responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'list': JsonConverters.toJson(list,'List<KeyHistory>',context!),
'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
};
getTypeName() => "GetReportKeyHistoryResponse";
TypeContext? context = _ctx;
}
// @DataContract
class GetReportKeyHistory implements IConvertible
{
// @DataMember
String? keyId;
// @DataMember
DateTime? from;
// @DataMember
DateTime? to;
GetReportKeyHistory({this.keyId,this.from,this.to});
GetReportKeyHistory.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
keyId = json['keyId'];
from = JsonConverters.fromJson(json['from'],'DateTime',context!);
to = JsonConverters.fromJson(json['to'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'keyId': keyId,
'from': JsonConverters.toJson(from,'DateTime',context!),
'to': JsonConverters.toJson(to,'DateTime',context!)
};
getTypeName() => "GetReportKeyHistory";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.trackunit.com', types: <String, TypeInfo> {
'Location': TypeInfo(TypeOf.Class, create:() => Location()),
'Address': TypeInfo(TypeOf.Class, create:() => Address()),
'KeyHistory': TypeInfo(TypeOf.Class, create:() => KeyHistory()),
'GetReportKeyHistoryResponse': TypeInfo(TypeOf.Class, create:() => GetReportKeyHistoryResponse()),
'List<KeyHistory>': TypeInfo(TypeOf.Class, create:() => <KeyHistory>[]),
'GetReportKeyHistory': TypeInfo(TypeOf.Class, create:() => GetReportKeyHistory()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /report/keyhistory HTTP/1.1
Host: api.trackunit.com
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"keyId":"String","from":"0001-01-01T00:00:00.0000000Z","to":"0001-01-01T00:00:00.0000000Z"}
HTTP/1.1 200 OK Content-Type: text/jsonl Content-Length: length {"list":[{"unitId":"String","time":"0001-01-01T00:00:00.0000000Z","location":{"latitude":0,"longitude":0},"address":{"country":"String","zipCode":"String","city":"String","streetAddress":"String"},"heading":0,"speed":0,"km":0,"run1":0,"run2":0,"runOdo":0,"temperature1":0,"temperature2":0,"input1":false,"input2":false,"output3":false,"batteryLevel":0,"externalPower":0}],"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}