Greyhounds.WebApi

<back to all web services

ConfigureAccumulator

The following routes are available for this service:
POST/configure/accumulator
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 LocationOptimizationLevel
{
    static const LocationOptimizationLevel None = const LocationOptimizationLevel._(0);
    static const LocationOptimizationLevel Low = const LocationOptimizationLevel._(1);
    static const LocationOptimizationLevel Medium = const LocationOptimizationLevel._(2);
    static const LocationOptimizationLevel High = const LocationOptimizationLevel._(3);

    final int _value;
    const LocationOptimizationLevel._(this._value);
    int get value => _value;
    static List<LocationOptimizationLevel> get values => const [None,Low,Medium,High];
}

class ThresholdInterval implements IConvertible
{
    double start = 0;
    double end = 0;

    ThresholdInterval({this.start,this.end});
    ThresholdInterval.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        start = JsonConverters.toDouble(json['start']);
        end = JsonConverters.toDouble(json['end']);
        return this;
    }

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

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

class AccumulatorConfiguration implements IConvertible
{
    String? id;
    List<Pool>? pools;
    double prevalentStake = 0;
    LocationOptimizationLevel locationOptimizationLevel;
    ThresholdInterval? jackPotThresholdInterval;

    AccumulatorConfiguration({this.id,this.pools,this.prevalentStake,this.locationOptimizationLevel,this.jackPotThresholdInterval});
    AccumulatorConfiguration.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        pools = JsonConverters.fromJson(json['pools'],'List<Pool>',context!);
        prevalentStake = JsonConverters.toDouble(json['prevalentStake']);
        locationOptimizationLevel = JsonConverters.fromJson(json['locationOptimizationLevel'],'LocationOptimizationLevel',context!);
        jackPotThresholdInterval = JsonConverters.fromJson(json['jackPotThresholdInterval'],'ThresholdInterval',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'pools': JsonConverters.toJson(pools,'List<Pool>',context!),
        'prevalentStake': prevalentStake,
        'locationOptimizationLevel': JsonConverters.toJson(locationOptimizationLevel,'LocationOptimizationLevel',context!),
        'jackPotThresholdInterval': JsonConverters.toJson(jackPotThresholdInterval,'ThresholdInterval',context!)
    };

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

class ConfigureAccumulator implements IConvertible
{
    String? id;
    AccumulatorConfiguration? configuration;

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

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

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

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

TypeContext _ctx = TypeContext(library: 'grh1.api.bettor.webhop.biz', types: <String, TypeInfo> {
    'Pool': TypeInfo(TypeOf.Class, create:() => Pool()),
    'LocationOptimizationLevel': TypeInfo(TypeOf.Enum, enumValues:LocationOptimizationLevel.values),
    'ThresholdInterval': TypeInfo(TypeOf.Class, create:() => ThresholdInterval()),
    'AccumulatorConfiguration': TypeInfo(TypeOf.Class, create:() => AccumulatorConfiguration()),
    'List<Pool>': TypeInfo(TypeOf.Class, create:() => <Pool>[]),
    'ConfigureAccumulator': TypeInfo(TypeOf.Class, create:() => ConfigureAccumulator()),
});

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

<ConfigureAccumulator xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Greyhounds.WebApi.ServiceModel">
  <Configuration>
    <JackPotThresholdInterval>
      <End>0</End>
      <Start>0</Start>
    </JackPotThresholdInterval>
    <LocationOptimizationLevel>None</LocationOptimizationLevel>
    <Pools>
      <AccumulatorConfiguration.Pool>
        <Id>0</Id>
        <Name>String</Name>
        <RTP>0</RTP>
      </AccumulatorConfiguration.Pool>
    </Pools>
    <PrevalentStake>0</PrevalentStake>
  </Configuration>
  <Id>String</Id>
</ConfigureAccumulator>
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>