Greyhounds.WebApi

<back to all web services

GetGameConfig

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

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 GameConfiguration implements IConvertible
{
    String? id;
    int queueSize = 0;
    RoundConfiguration? roundConfiguration;

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

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        queueSize = json['queueSize'];
        roundConfiguration = JsonConverters.fromJson(json['roundConfiguration'],'RoundConfiguration',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'queueSize': queueSize,
        'roundConfiguration': JsonConverters.toJson(roundConfiguration,'RoundConfiguration',context!)
    };

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

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

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

TypeContext _ctx = TypeContext(library: 'grh1.api.bettor.webhop.biz', types: <String, TypeInfo> {
    'RTPStrategies': TypeInfo(TypeOf.Enum, enumValues:RTPStrategies.values),
    'RoundConfiguration': TypeInfo(TypeOf.Class, create:() => RoundConfiguration()),
    'GameConfiguration': TypeInfo(TypeOf.Class, create:() => GameConfiguration()),
    'GetGameConfig': TypeInfo(TypeOf.Class, create:() => GetGameConfig()),
});

Dart GetGameConfig DTOs

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

HTTP + XML

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

POST /config/game HTTP/1.1 
Host: grh1.api.bettor.webhop.biz 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<GetGameConfig xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Greyhounds.WebApi.ServiceModel" />
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<GameConfiguration xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Greyhounds.ReadModel">
  <Id>String</Id>
  <QueueSize>0</QueueSize>
  <RoundConfiguration>
    <CountdownDurationInSeconds>0</CountdownDurationInSeconds>
    <RTPStrategy>RNG</RTPStrategy>
    <RaceDurationInSeconds>0</RaceDurationInSeconds>
    <ResultsDurationInSeconds>0</ResultsDurationInSeconds>
  </RoundConfiguration>
</GameConfiguration>