Greyhounds.WebApi

<back to all web services

GetFeed

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

class RoundStatus
{
    static const RoundStatus Pending = const RoundStatus._(0);
    static const RoundStatus InProgress = const RoundStatus._(1);
    static const RoundStatus Ended = const RoundStatus._(2);

    final int _value;
    const RoundStatus._(this._value);
    int get value => _value;
    static List<RoundStatus> get values => const [Pending,InProgress,Ended];
}

class RTPStrategies
{
    static const RTPStrategies RNG = const RTPStrategies._(0);
    static const RTPStrategies Default = const RTPStrategies._(1);

    final int _value;
    const RTPStrategies._(this._value);
    int get value => _value;
    static List<RTPStrategies> get values => const [RNG,Default];
}

class RoundConfiguration implements IConvertible
{
    int countdownDurationInSeconds = 0;
    int raceDurationInSeconds = 0;
    int resultsDurationInSeconds = 0;
    RTPStrategies rtpStrategy;

    RoundConfiguration({this.countdownDurationInSeconds,this.raceDurationInSeconds,this.resultsDurationInSeconds,this.rtpStrategy});
    RoundConfiguration.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        countdownDurationInSeconds = json['countdownDurationInSeconds'];
        raceDurationInSeconds = json['raceDurationInSeconds'];
        resultsDurationInSeconds = json['resultsDurationInSeconds'];
        rtpStrategy = JsonConverters.fromJson(json['rtpStrategy'],'RTPStrategies',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'countdownDurationInSeconds': countdownDurationInSeconds,
        'raceDurationInSeconds': raceDurationInSeconds,
        'resultsDurationInSeconds': resultsDurationInSeconds,
        'rtpStrategy': JsonConverters.toJson(rtpStrategy,'RTPStrategies',context!)
    };

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

class OutcomeStatus
{
    static const OutcomeStatus Unknown = const OutcomeStatus._(0);
    static const OutcomeStatus Lost = const OutcomeStatus._(1);
    static const OutcomeStatus Won = const OutcomeStatus._(2);
    static const OutcomeStatus Void = const OutcomeStatus._(3);

    final int _value;
    const OutcomeStatus._(this._value);
    int get value => _value;
    static List<OutcomeStatus> get values => const [Unknown,Lost,Won,Void];
}

class Outcome implements IConvertible
{
    int id = 0;
    double odds = 0;
    OutcomeStatus status;

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

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        odds = JsonConverters.toDouble(json['odds']);
        status = JsonConverters.fromJson(json['status'],'OutcomeStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'odds': odds,
        'status': JsonConverters.toJson(status,'OutcomeStatus',context!)
    };

    getTypeName() => "Outcome";
    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 Stages
{
    static const Stages None = const Stages._(0);
    static const Stages Countdown = const Stages._(1);
    static const Stages Processing = const Stages._(2);
    static const Stages Race = const Stages._(3);
    static const Stages Results = const Stages._(4);

    final int _value;
    const Stages._(this._value);
    int get value => _value;
    static List<Stages> get values => const [None,Countdown,Processing,Race,Results];
}

class RoundProgress implements IConvertible
{
    Stages stage;
    int step = 0;
    int steps = 0;
    DateTime utcTimestamp = DateTime(0);

    RoundProgress({this.stage,this.step,this.steps,this.utcTimestamp});
    RoundProgress.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        stage = JsonConverters.fromJson(json['stage'],'Stages',context!);
        step = json['step'];
        steps = json['steps'];
        utcTimestamp = JsonConverters.fromJson(json['utcTimestamp'],'DateTime',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'stage': JsonConverters.toJson(stage,'Stages',context!),
        'step': step,
        'steps': steps,
        'utcTimestamp': JsonConverters.toJson(utcTimestamp,'DateTime',context!)
    };

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

class Round implements IConvertible
{
    String? id;
    DateTime createdAt = DateTime(0);
    DateTime updatedAt = DateTime(0);
    RoundStatus status;
    RoundConfiguration? configuration;
    Map<int,Outcome?>? odds;
    JackpotInfo? jackpotInfo;
    String? sequence;
    RoundProgress? progress;
    bool isLocked;
    bool isCalculated;

    Round({this.id,this.createdAt,this.updatedAt,this.status,this.configuration,this.odds,this.jackpotInfo,this.sequence,this.progress,this.isLocked,this.isCalculated});
    Round.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        createdAt = JsonConverters.fromJson(json['createdAt'],'DateTime',context!);
        updatedAt = JsonConverters.fromJson(json['updatedAt'],'DateTime',context!);
        status = JsonConverters.fromJson(json['status'],'RoundStatus',context!);
        configuration = JsonConverters.fromJson(json['configuration'],'RoundConfiguration',context!);
        odds = JsonConverters.fromJson(json['odds'],'Map<int,Outcome?>',context!);
        jackpotInfo = JsonConverters.fromJson(json['jackpotInfo'],'JackpotInfo',context!);
        sequence = json['sequence'];
        progress = JsonConverters.fromJson(json['progress'],'RoundProgress',context!);
        isLocked = json['isLocked'];
        isCalculated = json['isCalculated'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'createdAt': JsonConverters.toJson(createdAt,'DateTime',context!),
        'updatedAt': JsonConverters.toJson(updatedAt,'DateTime',context!),
        'status': JsonConverters.toJson(status,'RoundStatus',context!),
        'configuration': JsonConverters.toJson(configuration,'RoundConfiguration',context!),
        'odds': JsonConverters.toJson(odds,'Map<int,Outcome?>',context!),
        'jackpotInfo': JsonConverters.toJson(jackpotInfo,'JackpotInfo',context!),
        'sequence': sequence,
        'progress': JsonConverters.toJson(progress,'RoundProgress',context!),
        'isLocked': isLocked,
        'isCalculated': isCalculated
    };

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

class Feed implements IConvertible
{
    String? id;
    Round? round;
    JackpotInfo? lastJackpotInfo;

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

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        round = JsonConverters.fromJson(json['round'],'Round',context!);
        lastJackpotInfo = JsonConverters.fromJson(json['lastJackpotInfo'],'JackpotInfo',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'round': JsonConverters.toJson(round,'Round',context!),
        'lastJackpotInfo': JsonConverters.toJson(lastJackpotInfo,'JackpotInfo',context!)
    };

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

class GetFeed implements IConvertible
{
    GetFeed();
    GetFeed.fromJson(Map<String, dynamic> json) : super();
    fromMap(Map<String, dynamic> json) {
        return this;
    }

    Map<String, dynamic> toJson() => {};
    getTypeName() => "GetFeed";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'grh1.api.bettor.webhop.biz', types: <String, TypeInfo> {
    'RoundStatus': TypeInfo(TypeOf.Enum, enumValues:RoundStatus.values),
    'RTPStrategies': TypeInfo(TypeOf.Enum, enumValues:RTPStrategies.values),
    'RoundConfiguration': TypeInfo(TypeOf.Class, create:() => RoundConfiguration()),
    'OutcomeStatus': TypeInfo(TypeOf.Enum, enumValues:OutcomeStatus.values),
    'Outcome': TypeInfo(TypeOf.Class, create:() => Outcome()),
    'JackpotInfo': TypeInfo(TypeOf.Class, create:() => JackpotInfo()),
    'Stages': TypeInfo(TypeOf.Enum, enumValues:Stages.values),
    'RoundProgress': TypeInfo(TypeOf.Class, create:() => RoundProgress()),
    'Round': TypeInfo(TypeOf.Class, create:() => Round()),
    'Map<int,Outcome?>': TypeInfo(TypeOf.Class, create:() => Map<int,Outcome?>()),
    'Feed': TypeInfo(TypeOf.Class, create:() => Feed()),
    'GetFeed': TypeInfo(TypeOf.Class, create:() => GetFeed()),
});

Dart GetFeed DTOs

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

HTTP + CSV

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

POST /feed HTTP/1.1 
Host: grh1.api.bettor.webhop.biz 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"id":"String","round":{"id":"String","createdAt":"0001-01-01T00:00:00.0000000Z","updatedAt":"0001-01-01T00:00:00.0000000Z","status":0,"configuration":{"countdownDurationInSeconds":0,"raceDurationInSeconds":0,"resultsDurationInSeconds":0,"rtpStrategy":0},"odds":{"0":{"id":0,"odds":0,"status":0}},"jackpotInfo":{"isGiven":false,"id":"String","slipId":"String","jpId":"String","amount":0,"locationId":"String","locationName":"String","addressLine":"String","amountAccumulated":0},"sequence":"String","progress":{"stage":0,"step":0,"steps":0,"utcTimestamp":"0001-01-01T00:00:00.0000000Z"},"isLocked":false,"isCalculated":false},"lastJackpotInfo":{"isGiven":false,"id":"String","slipId":"String","jpId":"String","amount":0,"locationId":"String","locationName":"String","addressLine":"String","amountAccumulated":0}}