| POST | /cmd/locations/devices/add |
|---|
import 'package:servicestack/servicestack.dart';
class DeviceUsageMode
{
static const DeviceUsageMode ClerkServiced = const DeviceUsageMode._(0);
static const DeviceUsageMode Personal = const DeviceUsageMode._(1);
static const DeviceUsageMode SelfService = const DeviceUsageMode._(2);
static const DeviceUsageMode Unknown = const DeviceUsageMode._(-1);
final int _value;
const DeviceUsageMode._(this._value);
int get value => _value;
static List<DeviceUsageMode> get values => const [ClerkServiced,Personal,SelfService,Unknown];
}
class DeviceUserInterface
{
static const DeviceUserInterface Tablet = const DeviceUserInterface._(0);
static const DeviceUserInterface Kiosk = const DeviceUserInterface._(1);
static const DeviceUserInterface Default = const DeviceUserInterface._(2);
static const DeviceUserInterface Unknown = const DeviceUserInterface._(-1);
final int _value;
const DeviceUserInterface._(this._value);
int get value => _value;
static List<DeviceUserInterface> get values => const [Tablet,Kiosk,Default,Unknown];
}
class Ref implements IConvertible
{
String id = "";
String val = "";
Ref({this.id="",this.val=""});
Ref.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'] ?? "";
val = json['val'] ?? "";
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'val': val
};
getTypeName() => "Ref";
TypeContext? context = _ctx;
}
class DeviceManagement
{
static const DeviceManagement Partner = const DeviceManagement._(1);
static const DeviceManagement Platform = const DeviceManagement._(2);
final int _value;
const DeviceManagement._(this._value);
int get value => _value;
static List<DeviceManagement> get values => const [Partner,Platform];
}
class DeviceProfile implements IConvertible
{
DeviceUsageMode? usageMode;
DeviceUserInterface? userInterface;
Ref? wallet;
DeviceManagement? managedBy;
DeviceProfile({this.usageMode,this.userInterface,this.wallet,this.managedBy});
DeviceProfile.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
usageMode = JsonConverters.fromJson(json['usageMode'],'DeviceUsageMode',context!);
userInterface = JsonConverters.fromJson(json['userInterface'],'DeviceUserInterface',context!);
wallet = JsonConverters.fromJson(json['wallet'],'Ref',context!);
managedBy = JsonConverters.fromJson(json['managedBy'],'DeviceManagement',context!);
return this;
}
Map<String, dynamic> toJson() => {
'usageMode': JsonConverters.toJson(usageMode,'DeviceUsageMode',context!),
'userInterface': JsonConverters.toJson(userInterface,'DeviceUserInterface',context!),
'wallet': JsonConverters.toJson(wallet,'Ref',context!),
'managedBy': JsonConverters.toJson(managedBy,'DeviceManagement',context!)
};
getTypeName() => "DeviceProfile";
TypeContext? context = _ctx;
}
class Device implements IConvertible
{
String? id;
String? name;
bool? isActive;
DeviceProfile? profile;
RecordDictionary<String,String>? integrationsData;
Device({this.id,this.name,this.isActive,this.profile,this.integrationsData});
Device.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
isActive = json['isActive'];
profile = JsonConverters.fromJson(json['profile'],'DeviceProfile',context!);
integrationsData = JsonConverters.fromJson(json['integrationsData'],'RecordDictionary<String,String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'isActive': isActive,
'profile': JsonConverters.toJson(profile,'DeviceProfile',context!),
'integrationsData': JsonConverters.toJson(integrationsData,'RecordDictionary<String,String>',context!)
};
getTypeName() => "Device";
TypeContext? context = _ctx;
}
class AddLocationDevice implements IConvertible
{
String? id;
Device? device;
AddLocationDevice({this.id,this.device});
AddLocationDevice.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
device = JsonConverters.fromJson(json['device'],'Device',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'device': JsonConverters.toJson(device,'Device',context!)
};
getTypeName() => "AddLocationDevice";
TypeContext? context = _ctx;
}
class RecordDictionary<TKey,TVal> extends Map<TKey,TVal?> implements IConvertible
{
RecordDictionary();
RecordDictionary.fromJson(Map<String, dynamic> json) : super.fromJson(json);
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
return this;
}
Map<String, dynamic> toJson() => super.toJson();
getTypeName() => "RecordDictionary<$TKey,$TVal>";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.bettor.webhop.biz', types: <String, TypeInfo> {
'DeviceUsageMode': TypeInfo(TypeOf.Enum, enumValues:DeviceUsageMode.values),
'DeviceUserInterface': TypeInfo(TypeOf.Enum, enumValues:DeviceUserInterface.values),
'Ref': TypeInfo(TypeOf.Class, create:() => Ref()),
'DeviceManagement': TypeInfo(TypeOf.Enum, enumValues:DeviceManagement.values),
'DeviceProfile': TypeInfo(TypeOf.Class, create:() => DeviceProfile()),
'Device': TypeInfo(TypeOf.Class, create:() => Device()),
'RecordDictionary<String,String>': TypeInfo(TypeOf.Class, create:() => RecordDictionary<String,String>()),
'AddLocationDevice': TypeInfo(TypeOf.Class, create:() => AddLocationDevice()),
'RecordDictionary<TKey,TVal>': TypeInfo(TypeOf.GenericDef,create:() => RecordDictionary()),
});
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.
POST /cmd/locations/devices/add HTTP/1.1
Host: api.bettor.webhop.biz
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"id":"String","device":{"id":"String","name":"String","isActive":false,"profile":{"usageMode":0,"userInterface":0,"wallet":{"id":"String","val":"String"},"managedBy":0},"integrationsData":{"String":"String"}}}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}