| POST | /cmd/self-service-device-betting-sessions/issue |
|---|
import 'package:servicestack/servicestack.dart';
class Money implements IConvertible
{
double amount = 0;
String currency = "";
Money({this.amount=0,this.currency=""});
Money.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
amount = JsonConverters.toDouble(json['amount']) ?? 0;
currency = json['currency'] ?? "";
return this;
}
Map<String, dynamic> toJson() => {
'amount': amount,
'currency': currency
};
getTypeName() => "Money";
TypeContext? context = _ctx;
}
class IdentificationDocumentType
{
static const IdentificationDocumentType IdentityCard = const IdentificationDocumentType._(1);
static const IdentificationDocumentType Passport = const IdentificationDocumentType._(2);
final int _value;
const IdentificationDocumentType._(this._value);
int get value => _value;
static List<IdentificationDocumentType> get values => const [IdentityCard,Passport];
}
class PatronIdentity implements IConvertible
{
String? fullName;
String? identificationNumber;
IdentificationDocumentType? identificationDocumentType;
PatronIdentity({this.fullName,this.identificationNumber,this.identificationDocumentType});
PatronIdentity.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
fullName = json['fullName'];
identificationNumber = json['identificationNumber'];
identificationDocumentType = JsonConverters.fromJson(json['identificationDocumentType'],'IdentificationDocumentType',context!);
return this;
}
Map<String, dynamic> toJson() => {
'fullName': fullName,
'identificationNumber': identificationNumber,
'identificationDocumentType': JsonConverters.toJson(identificationDocumentType,'IdentificationDocumentType',context!)
};
getTypeName() => "PatronIdentity";
TypeContext? context = _ctx;
}
class BettingApp implements IConvertible
{
String? name;
String? version;
BettingApp({this.name,this.version});
BettingApp.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
name = json['name'];
version = json['version'];
return this;
}
Map<String, dynamic> toJson() => {
'name': name,
'version': version
};
getTypeName() => "BettingApp";
TypeContext? context = _ctx;
}
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 Origin implements IConvertible
{
BettingApp? application;
String? ip;
RefEx? organization;
Ref? region;
Ref? locationGroup;
RefEx? location;
RefEx? device;
Ref? clerk;
Origin({this.application,this.ip,this.organization,this.region,this.locationGroup,this.location,this.device,this.clerk});
Origin.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
application = JsonConverters.fromJson(json['application'],'BettingApp',context!);
ip = json['ip'];
organization = JsonConverters.fromJson(json['organization'],'RefEx',context!);
region = JsonConverters.fromJson(json['region'],'Ref',context!);
locationGroup = JsonConverters.fromJson(json['locationGroup'],'Ref',context!);
location = JsonConverters.fromJson(json['location'],'RefEx',context!);
device = JsonConverters.fromJson(json['device'],'RefEx',context!);
clerk = JsonConverters.fromJson(json['clerk'],'Ref',context!);
return this;
}
Map<String, dynamic> toJson() => {
'application': JsonConverters.toJson(application,'BettingApp',context!),
'ip': ip,
'organization': JsonConverters.toJson(organization,'RefEx',context!),
'region': JsonConverters.toJson(region,'Ref',context!),
'locationGroup': JsonConverters.toJson(locationGroup,'Ref',context!),
'location': JsonConverters.toJson(location,'RefEx',context!),
'device': JsonConverters.toJson(device,'RefEx',context!),
'clerk': JsonConverters.toJson(clerk,'Ref',context!)
};
getTypeName() => "Origin";
TypeContext? context = _ctx;
}
class IssueSelfServiceDevice implements IConvertible
{
String? sessionId;
String? deviceId;
Money? initialCredit;
PatronIdentity? patron;
Origin? origin;
IssueSelfServiceDevice({this.sessionId,this.deviceId,this.initialCredit,this.patron,this.origin});
IssueSelfServiceDevice.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
sessionId = json['sessionId'];
deviceId = json['deviceId'];
initialCredit = JsonConverters.fromJson(json['initialCredit'],'Money',context!);
patron = JsonConverters.fromJson(json['patron'],'PatronIdentity',context!);
origin = JsonConverters.fromJson(json['origin'],'Origin',context!);
return this;
}
Map<String, dynamic> toJson() => {
'sessionId': sessionId,
'deviceId': deviceId,
'initialCredit': JsonConverters.toJson(initialCredit,'Money',context!),
'patron': JsonConverters.toJson(patron,'PatronIdentity',context!),
'origin': JsonConverters.toJson(origin,'Origin',context!)
};
getTypeName() => "IssueSelfServiceDevice";
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.testenv.webhop.biz', types: <String, TypeInfo> {
'Money': TypeInfo(TypeOf.Class, create:() => Money()),
'IdentificationDocumentType': TypeInfo(TypeOf.Enum, enumValues:IdentificationDocumentType.values),
'PatronIdentity': TypeInfo(TypeOf.Class, create:() => PatronIdentity()),
'BettingApp': TypeInfo(TypeOf.Class, create:() => BettingApp()),
'Ref': TypeInfo(TypeOf.Class, create:() => Ref()),
'RefEx': TypeInfo(TypeOf.Class, create:() => RefEx()),
'RecordDictionary<String,String>': TypeInfo(TypeOf.Class, create:() => RecordDictionary<String,String>()),
'Origin': TypeInfo(TypeOf.Class, create:() => Origin()),
'IssueSelfServiceDevice': TypeInfo(TypeOf.Class, create:() => IssueSelfServiceDevice()),
'RecordDictionary<TKey,TVal>': TypeInfo(TypeOf.GenericDef,create:() => RecordDictionary()),
});
Dart IssueSelfServiceDevice DTOs
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/self-service-device-betting-sessions/issue HTTP/1.1
Host: api.testenv.webhop.biz
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"sessionId":"String","deviceId":"String","initialCredit":{"amount":0,"currency":"String"},"patron":{"fullName":"String","identificationNumber":"String","identificationDocumentType":1},"origin":{"application":{"name":"String","version":"String"},"ip":"String","organization":{"data":{"String":"String"},"id":"String","val":"String"},"region":{"id":"String","val":"String"},"locationGroup":{"id":"String","val":"String"},"location":{"data":{"String":"String"},"id":"String","val":"String"},"device":{"data":{"String":"String"},"id":"String","val":"String"},"clerk":{"id":"String","val":"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"}}