GET POST | /report/unithistory |
---|
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 UnitHistory implements IConvertible
{
// @DataMember
DateTime? time;
// @DataMember
int? event;
// @DataMember
String? keyId;
// @DataMember
Location? location;
// @DataMember
Address? address;
// @DataMember
int? heading;
// @DataMember
double? speed;
// @DataMember
double? km;
// @DataMember
double? run1;
// @DataMember
double? run2;
// @DataMember
double? run3;
// @DataMember
double? run4;
// @DataMember
double? runOdo;
// @DataMember
double? temperature1;
// @DataMember
double? temperature2;
// @DataMember
bool? input1;
// @DataMember
bool? input2;
// @DataMember
bool? input3;
// @DataMember
bool? input4;
// @DataMember
bool? input5;
// @DataMember
bool? input6;
// @DataMember
bool? input7;
// @DataMember
bool? input8;
// @DataMember
bool? input9;
// @DataMember
bool? input10;
// @DataMember
bool? output1;
// @DataMember
bool? output2;
// @DataMember
bool? output3;
// @DataMember
bool? output4;
// @DataMember
bool? output5;
// @DataMember
double? analogInput1;
// @DataMember
double? analogInput2;
// @DataMember
double? analogInput4;
// @DataMember
int? input1ChangeCounter;
// @DataMember
int? input2ChangeCounter;
// @DataMember
int? input3ChangeCounter;
// @DataMember
int? input4ChangeCounter;
// @DataMember
double? batteryLevel;
// @DataMember
double? externalPower;
UnitHistory({this.time,this.event,this.keyId,this.location,this.address,this.heading,this.speed,this.km,this.run1,this.run2,this.run3,this.run4,this.runOdo,this.temperature1,this.temperature2,this.input1,this.input2,this.input3,this.input4,this.input5,this.input6,this.input7,this.input8,this.input9,this.input10,this.output1,this.output2,this.output3,this.output4,this.output5,this.analogInput1,this.analogInput2,this.analogInput4,this.input1ChangeCounter,this.input2ChangeCounter,this.input3ChangeCounter,this.input4ChangeCounter,this.batteryLevel,this.externalPower});
UnitHistory.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
time = JsonConverters.fromJson(json['time'],'DateTime',context!);
event = json['event'];
keyId = json['keyId'];
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']);
run3 = JsonConverters.toDouble(json['run3']);
run4 = JsonConverters.toDouble(json['run4']);
runOdo = JsonConverters.toDouble(json['runOdo']);
temperature1 = JsonConverters.toDouble(json['temperature1']);
temperature2 = JsonConverters.toDouble(json['temperature2']);
input1 = json['input1'];
input2 = json['input2'];
input3 = json['input3'];
input4 = json['input4'];
input5 = json['input5'];
input6 = json['input6'];
input7 = json['input7'];
input8 = json['input8'];
input9 = json['input9'];
input10 = json['input10'];
output1 = json['output1'];
output2 = json['output2'];
output3 = json['output3'];
output4 = json['output4'];
output5 = json['output5'];
analogInput1 = JsonConverters.toDouble(json['analogInput1']);
analogInput2 = JsonConverters.toDouble(json['analogInput2']);
analogInput4 = JsonConverters.toDouble(json['analogInput4']);
input1ChangeCounter = json['input1ChangeCounter'];
input2ChangeCounter = json['input2ChangeCounter'];
input3ChangeCounter = json['input3ChangeCounter'];
input4ChangeCounter = json['input4ChangeCounter'];
batteryLevel = JsonConverters.toDouble(json['batteryLevel']);
externalPower = JsonConverters.toDouble(json['externalPower']);
return this;
}
Map<String, dynamic> toJson() => {
'time': JsonConverters.toJson(time,'DateTime',context!),
'event': event,
'keyId': keyId,
'location': JsonConverters.toJson(location,'Location',context!),
'address': JsonConverters.toJson(address,'Address',context!),
'heading': heading,
'speed': speed,
'km': km,
'run1': run1,
'run2': run2,
'run3': run3,
'run4': run4,
'runOdo': runOdo,
'temperature1': temperature1,
'temperature2': temperature2,
'input1': input1,
'input2': input2,
'input3': input3,
'input4': input4,
'input5': input5,
'input6': input6,
'input7': input7,
'input8': input8,
'input9': input9,
'input10': input10,
'output1': output1,
'output2': output2,
'output3': output3,
'output4': output4,
'output5': output5,
'analogInput1': analogInput1,
'analogInput2': analogInput2,
'analogInput4': analogInput4,
'input1ChangeCounter': input1ChangeCounter,
'input2ChangeCounter': input2ChangeCounter,
'input3ChangeCounter': input3ChangeCounter,
'input4ChangeCounter': input4ChangeCounter,
'batteryLevel': batteryLevel,
'externalPower': externalPower
};
getTypeName() => "UnitHistory";
TypeContext? context = _ctx;
}
// @DataContract
class GetReportUnitHistoryResponse implements IConvertible
{
// @DataMember
List<UnitHistory>? list;
// @DataMember
ResponseStatus? responseStatus;
GetReportUnitHistoryResponse({this.list,this.responseStatus});
GetReportUnitHistoryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
list = JsonConverters.fromJson(json['list'],'List<UnitHistory>',context!);
responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'list': JsonConverters.toJson(list,'List<UnitHistory>',context!),
'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
};
getTypeName() => "GetReportUnitHistoryResponse";
TypeContext? context = _ctx;
}
// @DataContract
class GetReportUnitHistory implements IConvertible
{
// @DataMember
String? unitId;
// @DataMember
DateTime? from;
// @DataMember
DateTime? to;
GetReportUnitHistory({this.unitId,this.from,this.to});
GetReportUnitHistory.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
unitId = json['unitId'];
from = JsonConverters.fromJson(json['from'],'DateTime',context!);
to = JsonConverters.fromJson(json['to'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'unitId': unitId,
'from': JsonConverters.toJson(from,'DateTime',context!),
'to': JsonConverters.toJson(to,'DateTime',context!)
};
getTypeName() => "GetReportUnitHistory";
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()),
'UnitHistory': TypeInfo(TypeOf.Class, create:() => UnitHistory()),
'GetReportUnitHistoryResponse': TypeInfo(TypeOf.Class, create:() => GetReportUnitHistoryResponse()),
'List<UnitHistory>': TypeInfo(TypeOf.Class, create:() => <UnitHistory>[]),
'GetReportUnitHistory': TypeInfo(TypeOf.Class, create:() => GetReportUnitHistory()),
});
Dart GetReportUnitHistory DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /report/unithistory HTTP/1.1
Host: api.trackunit.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<GetReportUnitHistory xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<From>0001-01-01T00:00:00</From>
<To>0001-01-01T00:00:00</To>
<UnitId>String</UnitId>
</GetReportUnitHistory>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <GetReportUnitHistoryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types"> <List> <UnitHistory> <Address> <City>String</City> <Country>String</Country> <StreetAddress>String</StreetAddress> <ZipCode>String</ZipCode> </Address> <AnalogInput1>0</AnalogInput1> <AnalogInput2>0</AnalogInput2> <AnalogInput4>0</AnalogInput4> <BatteryLevel>0</BatteryLevel> <Event>0</Event> <ExternalPower>0</ExternalPower> <Heading>0</Heading> <Input1>false</Input1> <Input10>false</Input10> <Input1ChangeCounter>0</Input1ChangeCounter> <Input2>false</Input2> <Input2ChangeCounter>0</Input2ChangeCounter> <Input3>false</Input3> <Input3ChangeCounter>0</Input3ChangeCounter> <Input4>false</Input4> <Input4ChangeCounter>0</Input4ChangeCounter> <Input5>false</Input5> <Input6>false</Input6> <Input7>false</Input7> <Input8>false</Input8> <Input9>false</Input9> <KeyId>String</KeyId> <Km>0</Km> <Location> <Latitude>0</Latitude> <Longitude>0</Longitude> </Location> <Output1>false</Output1> <Output2>false</Output2> <Output3>false</Output3> <Output4>false</Output4> <Output5>false</Output5> <Run1>0</Run1> <Run2>0</Run2> <Run3>0</Run3> <Run4>0</Run4> <RunOdo>0</RunOdo> <Speed>0</Speed> <Temperature1>0</Temperature1> <Temperature2>0</Temperature2> <Time>0001-01-01T00:00:00</Time> </UnitHistory> </List> <ResponseStatus> <ErrorCode>String</ErrorCode> <Message>String</Message> <StackTrace>String</StackTrace> <Errors> <ResponseError> <ErrorCode>String</ErrorCode> <FieldName>String</FieldName> <Message>String</Message> <Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </Meta> </ResponseError> </Errors> <Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </Meta> </ResponseStatus> </GetReportUnitHistoryResponse>