| POST | /cmd/locations |
|---|
import 'package:servicestack/servicestack.dart';
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 RefEx extends Ref implements IConvertible
{
RecordDictionary<String,String>? data;
RefEx({this.data});
RefEx.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
data = JsonConverters.fromJson(json['data'],'RecordDictionary<String,String>',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'data': JsonConverters.toJson(data,'RecordDictionary<String,String>',context!)
});
getTypeName() => "RefEx";
TypeContext? context = _ctx;
}
class GPSCoordinates implements IConvertible
{
double? lat;
double? lng;
GPSCoordinates({this.lat,this.lng});
GPSCoordinates.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
lat = JsonConverters.toDouble(json['lat']);
lng = JsonConverters.toDouble(json['lng']);
return this;
}
Map<String, dynamic> toJson() => {
'lat': lat,
'lng': lng
};
getTypeName() => "GPSCoordinates";
TypeContext? context = _ctx;
}
class Address implements IConvertible
{
String? street;
String? city;
String? state;
String? postalCode;
Ref? country;
GPSCoordinates? gps;
RecordDictionary<String,String>? data;
Address({this.street,this.city,this.state,this.postalCode,this.country,this.gps,this.data});
Address.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
street = json['street'];
city = json['city'];
state = json['state'];
postalCode = json['postalCode'];
country = JsonConverters.fromJson(json['country'],'Ref',context!);
gps = JsonConverters.fromJson(json['gps'],'GPSCoordinates',context!);
data = JsonConverters.fromJson(json['data'],'RecordDictionary<String,String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'street': street,
'city': city,
'state': state,
'postalCode': postalCode,
'country': JsonConverters.toJson(country,'Ref',context!),
'gps': JsonConverters.toJson(gps,'GPSCoordinates',context!),
'data': JsonConverters.toJson(data,'RecordDictionary<String,String>',context!)
};
getTypeName() => "Address";
TypeContext? context = _ctx;
}
class DeviceType
{
static const DeviceType ClerkServicedKiosk = const DeviceType._(0);
static const DeviceType PersonalOnline = const DeviceType._(1);
static const DeviceType SelfServiceKiosk = const DeviceType._(2);
static const DeviceType Unknown = const DeviceType._(-1);
final int _value;
const DeviceType._(this._value);
int get value => _value;
static List<DeviceType> get values => const [ClerkServicedKiosk,PersonalOnline,SelfServiceKiosk,Unknown];
}
class Device implements IConvertible
{
String? id;
String? name;
bool? isActive;
DeviceType? type;
RecordDictionary<String,String>? integrationsData;
Device({this.id,this.name,this.isActive,this.type,this.integrationsData});
Device.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
isActive = json['isActive'];
type = JsonConverters.fromJson(json['type'],'DeviceType',context!);
integrationsData = JsonConverters.fromJson(json['integrationsData'],'RecordDictionary<String,String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'isActive': isActive,
'type': JsonConverters.toJson(type,'DeviceType',context!),
'integrationsData': JsonConverters.toJson(integrationsData,'RecordDictionary<String,String>',context!)
};
getTypeName() => "Device";
TypeContext? context = _ctx;
}
class ProductReference implements IConvertible
{
String? id;
String? value;
String? category;
Ref? productProvider;
ProductReference({this.id,this.value,this.category,this.productProvider});
ProductReference.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
value = json['value'];
category = json['category'];
productProvider = JsonConverters.fromJson(json['productProvider'],'Ref',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'value': value,
'category': category,
'productProvider': JsonConverters.toJson(productProvider,'Ref',context!)
};
getTypeName() => "ProductReference";
TypeContext? context = _ctx;
}
class ProductInstanceRef implements IConvertible
{
String? id;
String? name;
String? title;
ProductReference? product;
ProductInstanceRef({this.id,this.name,this.title,this.product});
ProductInstanceRef.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
title = json['title'];
product = JsonConverters.fromJson(json['product'],'ProductReference',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'title': title,
'product': JsonConverters.toJson(product,'ProductReference',context!)
};
getTypeName() => "ProductInstanceRef";
TypeContext? context = _ctx;
}
class Locale implements IConvertible
{
Ref? timeZone;
Ref? currency;
Ref? language;
Locale({this.timeZone,this.currency,this.language});
Locale.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
timeZone = JsonConverters.fromJson(json['timeZone'],'Ref',context!);
currency = JsonConverters.fromJson(json['currency'],'Ref',context!);
language = JsonConverters.fromJson(json['language'],'Ref',context!);
return this;
}
Map<String, dynamic> toJson() => {
'timeZone': JsonConverters.toJson(timeZone,'Ref',context!),
'currency': JsonConverters.toJson(currency,'Ref',context!),
'language': JsonConverters.toJson(language,'Ref',context!)
};
getTypeName() => "Locale";
TypeContext? context = _ctx;
}
class OpenLocation implements IConvertible
{
String? id;
String? name;
RefEx? organization;
Ref? region;
Ref? group;
Address? address;
List<Device>? devices;
List<ProductInstanceRef>? productInstances;
Locale? locale;
Map<String,String?>? integrationsData;
OpenLocation({this.id,this.name,this.organization,this.region,this.group,this.address,this.devices,this.productInstances,this.locale,this.integrationsData});
OpenLocation.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
organization = JsonConverters.fromJson(json['organization'],'RefEx',context!);
region = JsonConverters.fromJson(json['region'],'Ref',context!);
group = JsonConverters.fromJson(json['group'],'Ref',context!);
address = JsonConverters.fromJson(json['address'],'Address',context!);
devices = JsonConverters.fromJson(json['devices'],'List<Device>',context!);
productInstances = JsonConverters.fromJson(json['productInstances'],'List<ProductInstanceRef>',context!);
locale = JsonConverters.fromJson(json['locale'],'Locale',context!);
integrationsData = JsonConverters.toStringMap(json['integrationsData']);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'organization': JsonConverters.toJson(organization,'RefEx',context!),
'region': JsonConverters.toJson(region,'Ref',context!),
'group': JsonConverters.toJson(group,'Ref',context!),
'address': JsonConverters.toJson(address,'Address',context!),
'devices': JsonConverters.toJson(devices,'List<Device>',context!),
'productInstances': JsonConverters.toJson(productInstances,'List<ProductInstanceRef>',context!),
'locale': JsonConverters.toJson(locale,'Locale',context!),
'integrationsData': integrationsData
};
getTypeName() => "OpenLocation";
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.sbbet.ath.cx', types: <String, TypeInfo> {
'Ref': TypeInfo(TypeOf.Class, create:() => Ref()),
'RefEx': TypeInfo(TypeOf.Class, create:() => RefEx()),
'RecordDictionary<String,String>': TypeInfo(TypeOf.Class, create:() => RecordDictionary<String,String>()),
'GPSCoordinates': TypeInfo(TypeOf.Class, create:() => GPSCoordinates()),
'Address': TypeInfo(TypeOf.Class, create:() => Address()),
'DeviceType': TypeInfo(TypeOf.Enum, enumValues:DeviceType.values),
'Device': TypeInfo(TypeOf.Class, create:() => Device()),
'ProductReference': TypeInfo(TypeOf.Class, create:() => ProductReference()),
'ProductInstanceRef': TypeInfo(TypeOf.Class, create:() => ProductInstanceRef()),
'Locale': TypeInfo(TypeOf.Class, create:() => Locale()),
'OpenLocation': TypeInfo(TypeOf.Class, create:() => OpenLocation()),
'List<Device>': TypeInfo(TypeOf.Class, create:() => <Device>[]),
'List<ProductInstanceRef>': TypeInfo(TypeOf.Class, create:() => <ProductInstanceRef>[]),
'RecordDictionary<TKey,TVal>': TypeInfo(TypeOf.GenericDef,create:() => RecordDictionary()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /cmd/locations HTTP/1.1
Host: api.sbbet.ath.cx
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
id: String,
name: String,
organization:
{
data:
{
String: String
},
id: String,
val: String
},
region:
{
id: String,
val: String
},
group:
{
id: String,
val: String
},
address:
{
street: String,
city: String,
state: String,
postalCode: String,
country:
{
id: String,
val: String
},
gps:
{
lat: 0,
lng: 0
},
data:
{
String: String
}
},
devices:
[
{
id: String,
name: String,
isActive: False,
type: 0,
integrationsData:
{
String: String
}
}
],
productInstances:
[
{
id: String,
name: String,
title: String,
product:
{
id: String,
value: String,
category: String,
productProvider:
{
id: String,
val: String
}
}
}
],
locale:
{
timeZone:
{
id: String,
val: String
},
currency:
{
id: String,
val: String
},
language:
{
id: String,
val: String
}
},
integrationsData:
{
String: String
}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
errorCode: String,
message: String,
stackTrace: String,
errors:
[
{
errorCode: String,
fieldName: String,
message: String,
meta:
{
String: String
}
}
],
meta:
{
String: String
}
}