| POST | /cmd/organizations |
|---|
import 'package:servicestack/servicestack.dart';
class Ref implements IConvertible
{
String id = "";
String val = "";
Ref({this.id="",this.val=""});
Ref.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'] ?? "";
val = json['val'] ?? "";
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'val': val
};
getTypeName() => "Ref";
TypeContext? context = _ctx;
}
class GPSCoordinates implements IConvertible
{
double lat = 0;
double lng = 0;
GPSCoordinates({this.lat=0,this.lng=0});
GPSCoordinates.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
lat = JsonConverters.toDouble(json['lat']) ?? 0;
lng = JsonConverters.toDouble(json['lng']) ?? 0;
return this;
}
Map<String, dynamic> toJson() => {
'lat': lat,
'lng': lng
};
getTypeName() => "GPSCoordinates";
TypeContext? context = _ctx;
}
class Address implements IConvertible
{
String street = "";
String city = "";
String state = "";
String postalCode = "";
Ref? country;
GPSCoordinates? gps;
RecordDictionary<String,String>? data;
Address({this.street="",this.city="",this.state="",this.postalCode="",this.country,this.gps,this.data});
Address.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
street = json['street'] ?? "";
city = json['city'] ?? "";
state = json['state'] ?? "";
postalCode = json['postalCode'] ?? "";
country = JsonConverters.fromJson(json['country'],'Ref',context!);
gps = JsonConverters.fromJson(json['gps'],'GPSCoordinates',context!);
data = JsonConverters.fromJson(json['data'],'RecordDictionary<String,String>',context!);
return this;
}
Map<String, dynamic> toJson() => {
'street': street,
'city': city,
'state': state,
'postalCode': postalCode,
'country': JsonConverters.toJson(country,'Ref',context!),
'gps': JsonConverters.toJson(gps,'GPSCoordinates',context!),
'data': JsonConverters.toJson(data,'RecordDictionary<String,String>',context!)
};
getTypeName() => "Address";
TypeContext? context = _ctx;
}
class Locale implements IConvertible
{
Ref? timeZone;
Ref? currency;
Ref? language;
Locale({this.timeZone,this.currency,this.language});
Locale.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
timeZone = JsonConverters.fromJson(json['timeZone'],'Ref',context!);
currency = JsonConverters.fromJson(json['currency'],'Ref',context!);
language = JsonConverters.fromJson(json['language'],'Ref',context!);
return this;
}
Map<String, dynamic> toJson() => {
'timeZone': JsonConverters.toJson(timeZone,'Ref',context!),
'currency': JsonConverters.toJson(currency,'Ref',context!),
'language': JsonConverters.toJson(language,'Ref',context!)
};
getTypeName() => "Locale";
TypeContext? context = _ctx;
}
class WinningsExpirationPolicy implements IConvertible
{
bool? enabled;
Duration? interval;
WinningsExpirationPolicy({this.enabled,this.interval});
WinningsExpirationPolicy.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
enabled = json['enabled'];
interval = JsonConverters.fromJson(json['interval'],'Duration',context!);
return this;
}
Map<String, dynamic> toJson() => {
'enabled': enabled,
'interval': JsonConverters.toJson(interval,'Duration',context!)
};
getTypeName() => "WinningsExpirationPolicy";
TypeContext? context = _ctx;
}
class OrganizationNature
{
static const OrganizationNature FirstParty = const OrganizationNature._(1);
static const OrganizationNature Partner = const OrganizationNature._(2);
final int _value;
const OrganizationNature._(this._value);
int get value => _value;
static List<OrganizationNature> get values => const [FirstParty,Partner];
}
class IntegrationConnection implements IConvertible
{
String? url;
String? credentialsRef;
IntegrationConnection({this.url,this.credentialsRef});
IntegrationConnection.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
url = json['url'];
credentialsRef = json['credentialsRef'];
return this;
}
Map<String, dynamic> toJson() => {
'url': url,
'credentialsRef': credentialsRef
};
getTypeName() => "IntegrationConnection";
TypeContext? context = _ctx;
}
class IntegrationInstance implements IConvertible
{
String? id;
String? integrationId;
IntegrationConnection? wallet;
IntegrationConnection? partnerApi;
bool? slipForwardingEnabled;
IntegrationInstance({this.id,this.integrationId,this.wallet,this.partnerApi,this.slipForwardingEnabled});
IntegrationInstance.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
integrationId = json['integrationId'];
wallet = JsonConverters.fromJson(json['wallet'],'IntegrationConnection',context!);
partnerApi = JsonConverters.fromJson(json['partnerApi'],'IntegrationConnection',context!);
slipForwardingEnabled = json['slipForwardingEnabled'];
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'integrationId': integrationId,
'wallet': JsonConverters.toJson(wallet,'IntegrationConnection',context!),
'partnerApi': JsonConverters.toJson(partnerApi,'IntegrationConnection',context!),
'slipForwardingEnabled': slipForwardingEnabled
};
getTypeName() => "IntegrationInstance";
TypeContext? context = _ctx;
}
class OrganizationIntegrations implements IConvertible
{
IntegrationInstance? firstParty;
IntegrationInstance? partner;
OrganizationIntegrations({this.firstParty,this.partner});
OrganizationIntegrations.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
firstParty = JsonConverters.fromJson(json['firstParty'],'IntegrationInstance',context!);
partner = JsonConverters.fromJson(json['partner'],'IntegrationInstance',context!);
return this;
}
Map<String, dynamic> toJson() => {
'firstParty': JsonConverters.toJson(firstParty,'IntegrationInstance',context!),
'partner': JsonConverters.toJson(partner,'IntegrationInstance',context!)
};
getTypeName() => "OrganizationIntegrations";
TypeContext? context = _ctx;
}
class WalletPayoutMode
{
static const WalletPayoutMode RealTime = const WalletPayoutMode._(0);
static const WalletPayoutMode BatchPayout = const WalletPayoutMode._(1);
final int _value;
const WalletPayoutMode._(this._value);
int get value => _value;
static List<WalletPayoutMode> get values => const [RealTime,BatchPayout];
}
class PayoutPolicy implements IConvertible
{
WalletPayoutMode? selfService;
WalletPayoutMode? personal;
PayoutPolicy({this.selfService,this.personal});
PayoutPolicy.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
selfService = JsonConverters.fromJson(json['selfService'],'WalletPayoutMode',context!);
personal = JsonConverters.fromJson(json['personal'],'WalletPayoutMode',context!);
return this;
}
Map<String, dynamic> toJson() => {
'selfService': JsonConverters.toJson(selfService,'WalletPayoutMode',context!),
'personal': JsonConverters.toJson(personal,'WalletPayoutMode',context!)
};
getTypeName() => "PayoutPolicy";
TypeContext? context = _ctx;
}
class RegisterOrganization implements IConvertible
{
String? id;
String? name;
Address? address;
Locale? locale;
RecordDictionary<String,String>? integrationsData;
WinningsExpirationPolicy? winningsExpirationPolicy;
OrganizationNature? nature;
OrganizationIntegrations? integrations;
PayoutPolicy? payoutPolicy;
RegisterOrganization({this.id,this.name,this.address,this.locale,this.integrationsData,this.winningsExpirationPolicy,this.nature,this.integrations,this.payoutPolicy});
RegisterOrganization.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
address = JsonConverters.fromJson(json['address'],'Address',context!);
locale = JsonConverters.fromJson(json['locale'],'Locale',context!);
integrationsData = JsonConverters.fromJson(json['integrationsData'],'RecordDictionary<String,String>',context!);
winningsExpirationPolicy = JsonConverters.fromJson(json['winningsExpirationPolicy'],'WinningsExpirationPolicy',context!);
nature = JsonConverters.fromJson(json['nature'],'OrganizationNature',context!);
integrations = JsonConverters.fromJson(json['integrations'],'OrganizationIntegrations',context!);
payoutPolicy = JsonConverters.fromJson(json['payoutPolicy'],'PayoutPolicy',context!);
return this;
}
Map<String, dynamic> toJson() => {
'id': id,
'name': name,
'address': JsonConverters.toJson(address,'Address',context!),
'locale': JsonConverters.toJson(locale,'Locale',context!),
'integrationsData': JsonConverters.toJson(integrationsData,'RecordDictionary<String,String>',context!),
'winningsExpirationPolicy': JsonConverters.toJson(winningsExpirationPolicy,'WinningsExpirationPolicy',context!),
'nature': JsonConverters.toJson(nature,'OrganizationNature',context!),
'integrations': JsonConverters.toJson(integrations,'OrganizationIntegrations',context!),
'payoutPolicy': JsonConverters.toJson(payoutPolicy,'PayoutPolicy',context!)
};
getTypeName() => "RegisterOrganization";
TypeContext? context = _ctx;
}
class RecordDictionary<TKey,TVal> extends Map<TKey,TVal?> implements IConvertible
{
RecordDictionary();
RecordDictionary.fromJson(Map<String, dynamic> json) : super.fromJson(json);
fromMap(Map<String, dynamic> json) {
super.fromMap(json);
return this;
}
Map<String, dynamic> toJson() => super.toJson();
getTypeName() => "RecordDictionary<$TKey,$TVal>";
TypeContext? context = _ctx;
}
TypeContext _ctx = TypeContext(library: 'api.bettor.webhop.biz', types: <String, TypeInfo> {
'Ref': TypeInfo(TypeOf.Class, create:() => Ref()),
'GPSCoordinates': TypeInfo(TypeOf.Class, create:() => GPSCoordinates()),
'Address': TypeInfo(TypeOf.Class, create:() => Address()),
'RecordDictionary<String,String>': TypeInfo(TypeOf.Class, create:() => RecordDictionary<String,String>()),
'Locale': TypeInfo(TypeOf.Class, create:() => Locale()),
'WinningsExpirationPolicy': TypeInfo(TypeOf.Class, create:() => WinningsExpirationPolicy()),
'OrganizationNature': TypeInfo(TypeOf.Enum, enumValues:OrganizationNature.values),
'IntegrationConnection': TypeInfo(TypeOf.Class, create:() => IntegrationConnection()),
'IntegrationInstance': TypeInfo(TypeOf.Class, create:() => IntegrationInstance()),
'OrganizationIntegrations': TypeInfo(TypeOf.Class, create:() => OrganizationIntegrations()),
'WalletPayoutMode': TypeInfo(TypeOf.Enum, enumValues:WalletPayoutMode.values),
'PayoutPolicy': TypeInfo(TypeOf.Class, create:() => PayoutPolicy()),
'RegisterOrganization': TypeInfo(TypeOf.Class, create:() => RegisterOrganization()),
'RecordDictionary<TKey,TVal>': TypeInfo(TypeOf.GenericDef,create:() => RecordDictionary()),
});
Dart RegisterOrganization DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /cmd/organizations HTTP/1.1
Host: api.bettor.webhop.biz
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length
{"id":"String","name":"String","address":{"street":"String","city":"String","state":"String","postalCode":"String","country":{"id":"String","val":"String"},"gps":{"lat":0,"lng":0},"data":{"String":"String"}},"locale":{"timeZone":{"id":"String","val":"String"},"currency":{"id":"String","val":"String"},"language":{"id":"String","val":"String"}},"integrationsData":{"String":"String"},"winningsExpirationPolicy":{"enabled":false,"interval":"PT0S"},"nature":0,"integrations":{"firstParty":{"id":"String","integrationId":"String","wallet":{"url":"String","credentialsRef":"String"},"partnerApi":{"url":"String","credentialsRef":"String"},"slipForwardingEnabled":false},"partner":{"id":"String","integrationId":"String","wallet":{"url":"String","credentialsRef":"String"},"partnerApi":{"url":"String","credentialsRef":"String"},"slipForwardingEnabled":false}},"payoutPolicy":{"selfService":0,"personal":0}}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length
{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}}