Greyhounds.WebApi

<back to all web services

ConfigureGame

The following routes are available for this service:
POST/configure/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 ConfigureGame implements IConvertible
{
    String? id;
    GameConfiguration? configuration;

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

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

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

    getTypeName() => "ConfigureGame";
    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()),
    'ConfigureGame': TypeInfo(TypeOf.Class, create:() => ConfigureGame()),
});

Dart ConfigureGame 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 /configure/game HTTP/1.1 
Host: grh1.api.bettor.webhop.biz 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<ConfigureGame xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Greyhounds.WebApi.ServiceModel">
  <Configuration>
    <QueueSize>0</QueueSize>
    <RTPStrategy>RNG</RTPStrategy>
    <RoundConfiguration>
      <CountdownDurationInSeconds>0</CountdownDurationInSeconds>
      <RaceDurationInSeconds>0</RaceDurationInSeconds>
      <ResultsDurationInSeconds>0</ResultsDurationInSeconds>
    </RoundConfiguration>
  </Configuration>
  <Id>String</Id>
</ConfigureGame>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ResponseStatus xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <ErrorCode>String</ErrorCode>
  <Message>String</Message>
  <StackTrace>String</StackTrace>
  <Errors>
    <ResponseError>
      <ErrorCode>String</ErrorCode>
      <FieldName>String</FieldName>
      <Message>String</Message>
      <Meta xmlns:d4p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
        <d4p1:KeyValueOfstringstring>
          <d4p1:Key>String</d4p1:Key>
          <d4p1:Value>String</d4p1:Value>
        </d4p1:KeyValueOfstringstring>
      </Meta>
    </ResponseError>
  </Errors>
  <Meta xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
    <d2p1:KeyValueOfstringstring>
      <d2p1:Key>String</d2p1:Key>
      <d2p1:Value>String</d2p1:Value>
    </d2p1:KeyValueOfstringstring>
  </Meta>
</ResponseStatus>