| GET POST | /report/unitsummary | ||
|---|---|---|---|
| GET POST | /report/unitsummary/{Id} |
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 UnitDaySummary implements IConvertible
{
// @DataMember
String? unitId;
// @DataMember
DateTime? startTime;
// @DataMember
Location? startLocation;
// @DataMember
Address? startAddress;
// @DataMember
DateTime? stopTime;
// @DataMember
Location? stopLocation;
// @DataMember
Address? stopAddress;
// @DataMember
int? input1ChangeCounter;
// @DataMember
int? input2ChangeCounter;
// @DataMember
double? run1;
// @DataMember
double? run2;
// @DataMember
double? run3;
// @DataMember
double? run4;
// @DataMember
double? runOdo;
// @DataMember
double? km;
UnitDaySummary({this.unitId,this.startTime,this.startLocation,this.startAddress,this.stopTime,this.stopLocation,this.stopAddress,this.input1ChangeCounter,this.input2ChangeCounter,this.run1,this.run2,this.run3,this.run4,this.runOdo,this.km});
UnitDaySummary.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
unitId = json['unitId'];
startTime = JsonConverters.fromJson(json['startTime'],'DateTime',context!);
startLocation = JsonConverters.fromJson(json['startLocation'],'Location',context!);
startAddress = JsonConverters.fromJson(json['startAddress'],'Address',context!);
stopTime = JsonConverters.fromJson(json['stopTime'],'DateTime',context!);
stopLocation = JsonConverters.fromJson(json['stopLocation'],'Location',context!);
stopAddress = JsonConverters.fromJson(json['stopAddress'],'Address',context!);
input1ChangeCounter = json['input1ChangeCounter'];
input2ChangeCounter = json['input2ChangeCounter'];
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']);
km = JsonConverters.toDouble(json['km']);
return this;
}
Map<String, dynamic> toJson() => {
'unitId': unitId,
'startTime': JsonConverters.toJson(startTime,'DateTime',context!),
'startLocation': JsonConverters.toJson(startLocation,'Location',context!),
'startAddress': JsonConverters.toJson(startAddress,'Address',context!),
'stopTime': JsonConverters.toJson(stopTime,'DateTime',context!),
'stopLocation': JsonConverters.toJson(stopLocation,'Location',context!),
'stopAddress': JsonConverters.toJson(stopAddress,'Address',context!),
'input1ChangeCounter': input1ChangeCounter,
'input2ChangeCounter': input2ChangeCounter,
'run1': run1,
'run2': run2,
'run3': run3,
'run4': run4,
'runOdo': runOdo,
'km': km
};
getTypeName() => "UnitDaySummary";
TypeContext? context = _ctx;
}
// @DataContract
class GetReportUnitSummaryResponse implements IConvertible
{
// @DataMember
List<UnitDaySummary>? list;
// @DataMember
ResponseStatus? responseStatus;
GetReportUnitSummaryResponse({this.list,this.responseStatus});
GetReportUnitSummaryResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
list = JsonConverters.fromJson(json['list'],'List<UnitDaySummary>',context!);
responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'list': JsonConverters.toJson(list,'List<UnitDaySummary>',context!),
'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
};
getTypeName() => "GetReportUnitSummaryResponse";
TypeContext? context = _ctx;
}
// @DataContract
class GetReportUnitSummary implements IConvertible
{
// @DataMember
String? unitId;
// @DataMember
DateTime? date;
GetReportUnitSummary({this.unitId,this.date});
GetReportUnitSummary.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
unitId = json['unitId'];
date = JsonConverters.fromJson(json['date'],'DateTime',context!);
return this;
}
Map<String, dynamic> toJson() => {
'unitId': unitId,
'date': JsonConverters.toJson(date,'DateTime',context!)
};
getTypeName() => "GetReportUnitSummary";
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()),
'UnitDaySummary': TypeInfo(TypeOf.Class, create:() => UnitDaySummary()),
'GetReportUnitSummaryResponse': TypeInfo(TypeOf.Class, create:() => GetReportUnitSummaryResponse()),
'List<UnitDaySummary>': TypeInfo(TypeOf.Class, create:() => <UnitDaySummary>[]),
'GetReportUnitSummary': TypeInfo(TypeOf.Class, create:() => GetReportUnitSummary()),
});
Dart GetReportUnitSummary 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/unitsummary HTTP/1.1
Host: api.trackunit.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<GetReportUnitSummary xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<Date>0001-01-01T00:00:00</Date>
<UnitId>String</UnitId>
</GetReportUnitSummary>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length
<GetReportUnitSummaryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<List>
<UnitDaySummary>
<Input1ChangeCounter>0</Input1ChangeCounter>
<Input2ChangeCounter>0</Input2ChangeCounter>
<Km>0</Km>
<Run1>0</Run1>
<Run2>0</Run2>
<Run3>0</Run3>
<Run4>0</Run4>
<RunOdo>0</RunOdo>
<StartAddress>
<City>String</City>
<Country>String</Country>
<StreetAddress>String</StreetAddress>
<ZipCode>String</ZipCode>
</StartAddress>
<StartLocation>
<Latitude>0</Latitude>
<Longitude>0</Longitude>
</StartLocation>
<StartTime>0001-01-01T00:00:00</StartTime>
<StopAddress>
<City>String</City>
<Country>String</Country>
<StreetAddress>String</StreetAddress>
<ZipCode>String</ZipCode>
</StopAddress>
<StopLocation>
<Latitude>0</Latitude>
<Longitude>0</Longitude>
</StopLocation>
<StopTime>0001-01-01T00:00:00</StopTime>
<UnitId>String</UnitId>
</UnitDaySummary>
</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>
</GetReportUnitSummaryResponse>