Greyhounds.WebApi

<back to all web services

GetRace

The following routes are available for this service:
All Verbs/rounds/race
import 'package:servicestack/servicestack.dart';

class Pool implements IConvertible
{
    int id = 0;
    String? name;
    double coefficient = 0;
    double rtp = 0;
    double threshold = 0;
    double balance = 0;

    Pool({this.id,this.name,this.coefficient,this.rtp,this.threshold,this.balance});
    Pool.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        name = json['name'];
        coefficient = JsonConverters.toDouble(json['coefficient']);
        rtp = JsonConverters.toDouble(json['rtp']);
        threshold = JsonConverters.toDouble(json['threshold']);
        balance = JsonConverters.toDouble(json['balance']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'name': name,
        'coefficient': coefficient,
        'rtp': rtp,
        'threshold': threshold,
        'balance': balance
    };

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

class RaceOutcomeRecap implements IConvertible
{
    int id = 0;
    double coef = 0;
    int winCount = 0;
    double win = 0;
    bool isWin;
    String? results;

    RaceOutcomeRecap({this.id,this.coef,this.winCount,this.win,this.isWin,this.results});
    RaceOutcomeRecap.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        coef = JsonConverters.toDouble(json['coef']);
        winCount = json['winCount'];
        win = JsonConverters.toDouble(json['win']);
        isWin = json['isWin'];
        results = json['results'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'coef': coef,
        'winCount': winCount,
        'win': win,
        'isWin': isWin,
        'results': results
    };

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

class RoundOutcome implements IConvertible
{
    List<RaceOutcomeRecap>? raceOutcomeRecaps;
    double stake = 0;
    double winnings = 0;
    double balance = 0;
    double returnToPlayer = 0;

    RoundOutcome({this.raceOutcomeRecaps,this.stake,this.winnings,this.balance,this.returnToPlayer});
    RoundOutcome.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        raceOutcomeRecaps = JsonConverters.fromJson(json['raceOutcomeRecaps'],'List<RaceOutcomeRecap>',context!);
        stake = JsonConverters.toDouble(json['stake']);
        winnings = JsonConverters.toDouble(json['winnings']);
        balance = JsonConverters.toDouble(json['balance']);
        returnToPlayer = JsonConverters.toDouble(json['returnToPlayer']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'raceOutcomeRecaps': JsonConverters.toJson(raceOutcomeRecaps,'List<RaceOutcomeRecap>',context!),
        'stake': stake,
        'winnings': winnings,
        'balance': balance,
        'returnToPlayer': returnToPlayer
    };

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

class JackpotInfo implements IConvertible
{
    bool isGiven;
    String? id;
    String? slipId;
    String? jpId;
    double amount = 0;
    String? locationId;
    String? locationName;
    String? addressLine;
    double amountAccumulated = 0;

    JackpotInfo({this.isGiven,this.id,this.slipId,this.jpId,this.amount,this.locationId,this.locationName,this.addressLine,this.amountAccumulated});
    JackpotInfo.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        isGiven = json['isGiven'];
        id = json['id'];
        slipId = json['slipId'];
        jpId = json['jpId'];
        amount = JsonConverters.toDouble(json['amount']);
        locationId = json['locationId'];
        locationName = json['locationName'];
        addressLine = json['addressLine'];
        amountAccumulated = JsonConverters.toDouble(json['amountAccumulated']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'isGiven': isGiven,
        'id': id,
        'slipId': slipId,
        'jpId': jpId,
        'amount': amount,
        'locationId': locationId,
        'locationName': locationName,
        'addressLine': addressLine,
        'amountAccumulated': amountAccumulated
    };

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

class Race implements IConvertible
{
    String? id;
    String? sequence;
    List<Pool>? inputAccumulation;
    List<Pool>? outputAccumulation;
    RoundOutcome? outcome;
    JackpotInfo? jackpotInfo;

    Race({this.id,this.sequence,this.inputAccumulation,this.outputAccumulation,this.outcome,this.jackpotInfo});
    Race.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        sequence = json['sequence'];
        inputAccumulation = JsonConverters.fromJson(json['inputAccumulation'],'List<Pool>',context!);
        outputAccumulation = JsonConverters.fromJson(json['outputAccumulation'],'List<Pool>',context!);
        outcome = JsonConverters.fromJson(json['outcome'],'RoundOutcome',context!);
        jackpotInfo = JsonConverters.fromJson(json['jackpotInfo'],'JackpotInfo',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'sequence': sequence,
        'inputAccumulation': JsonConverters.toJson(inputAccumulation,'List<Pool>',context!),
        'outputAccumulation': JsonConverters.toJson(outputAccumulation,'List<Pool>',context!),
        'outcome': JsonConverters.toJson(outcome,'RoundOutcome',context!),
        'jackpotInfo': JsonConverters.toJson(jackpotInfo,'JackpotInfo',context!)
    };

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

class GetRace implements IConvertible
{
    String? id;

    GetRace({this.id});
    GetRace.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        return this;
    }

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

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

TypeContext _ctx = TypeContext(library: 'grh1.api.bettor.webhop.biz', types: <String, TypeInfo> {
    'Pool': TypeInfo(TypeOf.Class, create:() => Pool()),
    'RaceOutcomeRecap': TypeInfo(TypeOf.Class, create:() => RaceOutcomeRecap()),
    'RoundOutcome': TypeInfo(TypeOf.Class, create:() => RoundOutcome()),
    'List<RaceOutcomeRecap>': TypeInfo(TypeOf.Class, create:() => <RaceOutcomeRecap>[]),
    'JackpotInfo': TypeInfo(TypeOf.Class, create:() => JackpotInfo()),
    'Race': TypeInfo(TypeOf.Class, create:() => Race()),
    'List<Pool>': TypeInfo(TypeOf.Class, create:() => <Pool>[]),
    'GetRace': TypeInfo(TypeOf.Class, create:() => GetRace()),
});

Dart GetRace DTOs

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

HTTP + JSV

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

POST /rounds/race HTTP/1.1 
Host: grh1.api.bettor.webhop.biz 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	id: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	id: String,
	sequence: String,
	inputAccumulation: 
	[
		{
			id: 0,
			name: String,
			amount: 0
		}
	],
	outputAccumulation: 
	[
		{
			id: 0,
			name: String,
			amount: 0
		}
	],
	outcome: 
	{
		raceOutcomeRecaps: 
		[
			{
				id: 0,
				coef: 0,
				winCount: 0,
				win: 0,
				isWin: False,
				results: String
			}
		],
		stake: 0,
		winnings: 0,
		balance: 0,
		returnToPlayer: 0
	},
	jackpotInfo: 
	{
		isGiven: False,
		id: String,
		slipId: String,
		jpId: String,
		amount: 0,
		locationId: String,
		locationName: String,
		addressLine: String,
		amountAccumulated: 0
	}
}