| POST | /bets/place |
|---|
import 'package:servicestack/servicestack.dart';
class BetSource
{
static const BetSource Landbase = const BetSource._(0);
static const BetSource Web = const BetSource._(1);
final int _value;
const BetSource._(this._value);
int get value => _value;
static List<BetSource> get values => const [Landbase,Web];
}
class TransactionDtoBase implements IConvertible
{
String? transaction_id;
DateTime? transaction_time;
double? transaction_amount;
String? game_name;
String? betting_place_id;
String? betting_terminal_id;
String? jmbg;
String? passport_number;
BetSource? source;
String? identification_document_country;
String? identification_document_type;
TransactionDtoBase({this.transaction_id,this.transaction_time,this.transaction_amount,this.game_name,this.betting_place_id,this.betting_terminal_id,this.jmbg,this.passport_number,this.source,this.identification_document_country,this.identification_document_type});
TransactionDtoBase.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
transaction_id = json['transaction_id'];
transaction_time = JsonConverters.fromJson(json['transaction_time'],'DateTime',context!);
transaction_amount = JsonConverters.toDouble(json['transaction_amount']);
game_name = json['game_name'];
betting_place_id = json['betting_place_id'];
betting_terminal_id = json['betting_terminal_id'];
jmbg = json['jmbg'];
passport_number = json['passport_number'];
source = JsonConverters.fromJson(json['source'],'BetSource',context!);
identification_document_country = json['identification_document_country'];
identification_document_type = json['identification_document_type'];
return this;
}
Map<String, dynamic> toJson() => {
'transaction_id': transaction_id,
'transaction_time': JsonConverters.toJson(transaction_time,'DateTime',context!),
'transaction_amount': transaction_amount,
'game_name': game_name,
'betting_place_id': betting_place_id,
'betting_terminal_id': betting_terminal_id,
'jmbg': jmbg,
'passport_number': passport_number,
'source': JsonConverters.toJson(source,'BetSource',context!),
'identification_document_country': identification_document_country,
'identification_document_type': identification_document_type
};
getTypeName() => "TransactionDtoBase";
TypeContext? context = _ctx;
}
class TicketDto implements IConvertible
{
String? sy;
int? nc;
double? ac;
RecordList<RecordList<IBetEvent>>? e;
TicketDto({this.sy,this.nc,this.ac,this.e});
TicketDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
sy = json['sy'];
nc = json['nc'];
ac = JsonConverters.toDouble(json['ac']);
e = JsonConverters.fromJson(json['e'],'RecordList<RecordList<IBetEvent>>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'sy': sy,
'nc': nc,
'ac': ac,
'e': JsonConverters.toJson(e,'RecordList<RecordList<IBetEvent>>',context!)
};
getTypeName() => "TicketDto";
TypeContext? context = _ctx;
}
class BetType
{
static const BetType Real = const BetType._(0);
static const BetType Promo = const BetType._(1);
final int _value;
const BetType._(this._value);
int get value => _value;
static List<BetType> get values => const [Real,Promo];
}
class BetDto extends TransactionDtoBase implements IConvertible
{
double? min_odds;
double? max_odds;
double? min_win;
double? max_win;
double? min_bonus;
double? max_bonus;
double? max_payout;
double? promo_amount;
String? ticket_id;
TicketDto? ticket;
BetType? bet_type;
BetDto({this.min_odds,this.max_odds,this.min_win,this.max_win,this.min_bonus,this.max_bonus,this.max_payout,this.promo_amount,this.ticket_id,this.ticket,this.bet_type});
BetDto.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
min_odds = JsonConverters.toDouble(json['min_odds']);
max_odds = JsonConverters.toDouble(json['max_odds']);
min_win = JsonConverters.toDouble(json['min_win']);
max_win = JsonConverters.toDouble(json['max_win']);
min_bonus = JsonConverters.toDouble(json['min_bonus']);
max_bonus = JsonConverters.toDouble(json['max_bonus']);
max_payout = JsonConverters.toDouble(json['max_payout']);
promo_amount = JsonConverters.toDouble(json['promo_amount']);
ticket_id = json['ticket_id'];
ticket = JsonConverters.fromJson(json['ticket'],'TicketDto',context!);
bet_type = JsonConverters.fromJson(json['bet_type'],'BetType',context!);
return this;
}
Map<String, dynamic> toJson() => super.toJson()..addAll({
'min_odds': min_odds,
'max_odds': max_odds,
'min_win': min_win,
'max_win': max_win,
'min_bonus': min_bonus,
'max_bonus': max_bonus,
'max_payout': max_payout,
'promo_amount': promo_amount,
'ticket_id': ticket_id,
'ticket': JsonConverters.toJson(ticket,'TicketDto',context!),
'bet_type': JsonConverters.toJson(bet_type,'BetType',context!)
});
getTypeName() => "BetDto";
TypeContext? context = _ctx;
}
class ReportBetPlacements implements IConvertible
{
RecordList<BetDto>? betPlacements;
ReportBetPlacements({this.betPlacements});
ReportBetPlacements.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
betPlacements = JsonConverters.fromJson(json['betPlacements'],'RecordList<BetDto>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'betPlacements': JsonConverters.toJson(betPlacements,'RecordList<BetDto>',context!)
};
getTypeName() => "ReportBetPlacements";
TypeContext? context = _ctx;
}
class RecordList<T> extends ListBase<T> implements IConvertible
{
final List<T> l = [];
set length(int newLength) { l.length = newLength; }
int get length => l.length;
T operator [](int index) => l[index];
void operator []=(int index, T value) { l[index] = value; }
RecordList();
RecordList.fromJson(Map<String, dynamic> json) : super();
fromMap(Map<String, dynamic> json) {
return this;
}
Map<String, dynamic> toJson() => {};
getTypeName() => "RecordList<$T>";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.sbbet_prod_mnta.webhop.biz', types: <String, TypeInfo> {
'BetSource': TypeInfo(TypeOf.Enum, enumValues:BetSource.values),
'TransactionDtoBase': TypeInfo(TypeOf.Class, create:() => TransactionDtoBase()),
'TicketDto': TypeInfo(TypeOf.Class, create:() => TicketDto()),
'RecordList<RecordList<IBetEvent>>': TypeInfo(TypeOf.Class, create:() => RecordList<RecordList<IBetEvent>>()),
'RecordList<IBetEvent>': TypeInfo(TypeOf.Class, create:() => RecordList<IBetEvent>()),
'IBetEvent': TypeInfo(TypeOf.Class, create:() => IBetEvent()),
'BetType': TypeInfo(TypeOf.Enum, enumValues:BetType.values),
'BetDto': TypeInfo(TypeOf.Class, create:() => BetDto()),
'ReportBetPlacements': TypeInfo(TypeOf.Class, create:() => ReportBetPlacements()),
'RecordList<BetDto>': TypeInfo(TypeOf.Class, create:() => RecordList<BetDto>()),
'RecordList<T>': TypeInfo(TypeOf.GenericDef,create:() => RecordList()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /bets/place HTTP/1.1
Host: api.sbbet-prod-mnta.webhop.biz
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"betPlacements":[{"min_odds":0,"max_odds":0,"min_win":0,"max_win":0,"min_bonus":0,"max_bonus":0,"max_payout":0,"promo_amount":0,"ticket_id":"String","ticket":{"sy":"String","nc":0,"ac":0,"e":[[{}]]},"bet_type":0,"transaction_id":"String","transaction_time":"0001-01-01T00:00:00.0000000Z","transaction_amount":0,"game_name":"String","betting_place_id":"String","betting_terminal_id":"String","jmbg":"String","passport_number":"String","source":0,"identification_document_country":"String","identification_document_type":"String"}]}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}