| GET | /api/v1/devices |
|---|
import 'package:servicestack/servicestack.dart';
import 'dart:typed_data';
// @DataContract
class Device implements IConvertible
{
// @DataMember(Name="Guid")
String? Guid;
// @DataMember(Name="Geraetenummer")
String? Geraetenummer;
// @DataMember(Name="Bezeichnung")
String? Bezeichnung;
// @DataMember(Name="Beschreibung")
String? Beschreibung;
// @DataMember(Name="Einbaudatum")
DateTime? Einbaudatum;
// @DataMember(Name="Ausbaudatum")
DateTime? Ausbaudatum;
// @DataMember(Name="Eichdatum")
DateTime? Eichdatum;
// @DataMember(Name="Einheit")
String? Einheit;
// @DataMember(Name="Memo")
String? Memo;
// @DataMember(Name="DeviceCatalogGuid")
String? DeviceCatalogGuid;
Device({this.Guid,this.Geraetenummer,this.Bezeichnung,this.Beschreibung,this.Einbaudatum,this.Ausbaudatum,this.Eichdatum,this.Einheit,this.Memo,this.DeviceCatalogGuid});
Device.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Guid = json['guid'];
Geraetenummer = json['number'];
Bezeichnung = json['label'];
Beschreibung = json['description'];
Einbaudatum = JsonConverters.fromJson(json['installationDate'],'DateTime',context!);
Ausbaudatum = JsonConverters.fromJson(json['deinstallationDate'],'DateTime',context!);
Eichdatum = JsonConverters.fromJson(json['calibrationDate'],'DateTime',context!);
Einheit = json['unit'];
Memo = json['note'];
DeviceCatalogGuid = json['deviceCatalogGuid'];
return this;
}
Map<String, dynamic> toJson() => {
'guid': Guid,
'geraetenummer': Geraetenummer,
'bezeichnung': Bezeichnung,
'beschreibung': Beschreibung,
'einbaudatum': JsonConverters.toJson(Einbaudatum,'DateTime',context!),
'ausbaudatum': JsonConverters.toJson(Ausbaudatum,'DateTime',context!),
'eichdatum': JsonConverters.toJson(Eichdatum,'DateTime',context!),
'einheit': Einheit,
'memo': Memo,
'deviceCatalogGuid': DeviceCatalogGuid
};
getTypeName() => "Device";
TypeContext? context = _ctx;
}
class GetDeviceListResponse implements IConvertible
{
List<Device>? deviceList;
ResponseStatus? responseStatus;
GetDeviceListResponse({this.deviceList,this.responseStatus});
GetDeviceListResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
deviceList = JsonConverters.fromJson(json['deviceList'],'List<Device>',context!);
responseStatus = JsonConverters.fromJson(json['responseStatus'],'ResponseStatus',context!);
return this;
}
Map<String, dynamic> toJson() => {
'deviceList': JsonConverters.toJson(deviceList,'List<Device>',context!),
'responseStatus': JsonConverters.toJson(responseStatus,'ResponseStatus',context!)
};
getTypeName() => "GetDeviceListResponse";
TypeContext? context = _ctx;
}
class GetDeviceList implements IHasBearerToken, IConvertible
{
// @ApiMember(IsRequired=true, ParameterType="query")
String? bearerToken;
/**
* Optional! Follow the format : /api/v1/devices?filter[ObjektGuid]=*
*/
// @DataMember(Name="filter[ObjektGuid]")
// @ApiMember(Description="Optional! Follow the format : /api/v1/devices?filter[ObjektGuid]=*", ParameterType="query")
String? filter_ObjektGuid_;
/**
* Optional! Follow the format : /api/v1/devices?filter[NutzerGuid]=*
*/
// @DataMember(Name="filter[NutzerGuid]")
// @ApiMember(Description="Optional! Follow the format : /api/v1/devices?filter[NutzerGuid]=*", ParameterType="query")
String? filter_NutzerGuid_;
GetDeviceList({this.bearerToken,this.filter_ObjektGuid_,this.filter_NutzerGuid_});
GetDeviceList.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
bearerToken = json['bearerToken'];
filter_ObjektGuid_ = json['filterByObjektGuid'];
filter_NutzerGuid_ = json['filterByNutzeinheitGuid'];
return this;
}
Map<String, dynamic> toJson() => {
'bearerToken': bearerToken,
'filter_ObjektGuid_': filter_ObjektGuid_,
'filter_NutzerGuid_': filter_NutzerGuid_
};
getTypeName() => "GetDeviceList";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'stage_servdesk.eras_online.de', types: <String, TypeInfo> {
'Device': TypeInfo(TypeOf.Class, create:() => Device()),
'GetDeviceListResponse': TypeInfo(TypeOf.Class, create:() => GetDeviceListResponse()),
'List<Device>': TypeInfo(TypeOf.Class, create:() => <Device>[]),
'GetDeviceList': TypeInfo(TypeOf.Class, create:() => GetDeviceList()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/v1/devices HTTP/1.1 Host: stage-servdesk.eras-online.de Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}}