Six4Win.WebApi

<back to all web services

PlaceBets

Requires Authentication
The following routes are available for this service:
POST/cmd/bets/v2
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 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 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 Bet implements IConvertible
{
    String? id;
    int? ordinalOfAvailableRoundToAssignTo;
    String? content;
    double? stake;
    Map<String,String?>? payload;

    Bet({this.id,this.ordinalOfAvailableRoundToAssignTo,this.content,this.stake,this.payload});
    Bet.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        ordinalOfAvailableRoundToAssignTo = json['ordinalOfAvailableRoundToAssignTo'];
        content = json['content'];
        stake = JsonConverters.toDouble(json['stake']);
        payload = JsonConverters.toStringMap(json['payload']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'ordinalOfAvailableRoundToAssignTo': ordinalOfAvailableRoundToAssignTo,
        'content': content,
        'stake': stake,
        'payload': payload
    };

    getTypeName() => "Bet";
    TypeContext? context = _ctx;
}

class PlaceBets implements IConvertible
{
    String? slipId;
    Ref? bettor;
    Origin? origin;
    DateTime? placedAt;
    List<Bet>? bets;

    PlaceBets({this.slipId,this.bettor,this.origin,this.placedAt,this.bets});
    PlaceBets.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        slipId = json['slipId'];
        bettor = JsonConverters.fromJson(json['bettor'],'Ref',context!);
        origin = JsonConverters.fromJson(json['origin'],'Origin',context!);
        placedAt = JsonConverters.fromJson(json['placedAt'],'DateTime',context!);
        bets = JsonConverters.fromJson(json['bets'],'List<Bet>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'slipId': slipId,
        'bettor': JsonConverters.toJson(bettor,'Ref',context!),
        'origin': JsonConverters.toJson(origin,'Origin',context!),
        'placedAt': JsonConverters.toJson(placedAt,'DateTime',context!),
        'bets': JsonConverters.toJson(bets,'List<Bet>',context!)
    };

    getTypeName() => "PlaceBets";
    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: 's4w2.api.bettor.cc', types: <String, TypeInfo> {
    'Ref': TypeInfo(TypeOf.Class, create:() => Ref()),
    'BettingApp': TypeInfo(TypeOf.Class, create:() => BettingApp()),
    'RefEx': TypeInfo(TypeOf.Class, create:() => RefEx()),
    'RecordDictionary<String,String>': TypeInfo(TypeOf.Class, create:() => RecordDictionary<String,String>()),
    'Origin': TypeInfo(TypeOf.Class, create:() => Origin()),
    'Bet': TypeInfo(TypeOf.Class, create:() => Bet()),
    'PlaceBets': TypeInfo(TypeOf.Class, create:() => PlaceBets()),
    'List<Bet>': TypeInfo(TypeOf.Class, create:() => <Bet>[]),
    'RecordDictionary<TKey,TVal>': TypeInfo(TypeOf.GenericDef,create:() => RecordDictionary()),
});

Dart PlaceBets DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /cmd/bets/v2 HTTP/1.1 
Host: s4w2.api.bettor.cc 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"slipId":"String","bettor":{"id":"String","val":"String"},"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"}},"placedAt":"0001-01-01T00:00:00.0000000Z","bets":[{"id":"String","ordinalOfAvailableRoundToAssignTo":0,"content":"String","stake":0,"payload":{"String":"String"}}]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}