Betting.WebApi

<back to all web services

OpenLocation

Requires Authentication
The following routes are available for this service:
POST/cmd/locations
import Foundation
import ServiceStack

public class OpenLocation : Codable
{
    public var id:String
    public var name:String
    public var organization:RefEx
    public var region:Ref
    public var group:Ref
    public var address:Address
    public var devices:[Device]
    public var productInstances:[ProductInstanceRef]
    public var locale:Locale
    public var integrationsData:[String:String]

    required public init(){}
}

public class RefEx : Ref
{
    public var data:RecordDictionary<String, String>

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case data
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        data = try container.decodeIfPresent(RecordDictionary<String, String>.self, forKey: .data)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if data != nil { try container.encode(data, forKey: .data) }
    }
}

public class Ref : Codable
{
    public var id:String
    public var val:String

    required public init(){}
}

public class RecordDictionary<TKey : Codable, TVal : Codable> : List<TKey:TVal>
{
    required public init(){ super.init() }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
    }
}

public class Address : Codable
{
    public var street:String
    public var city:String
    public var state:String
    public var postalCode:String
    public var country:Ref
    public var gps:GPSCoordinates
    public var data:RecordDictionary<String, String>

    required public init(){}
}

public class GPSCoordinates : Codable
{
    public var lat:Double
    public var lng:Double

    required public init(){}
}

public class Device : Codable
{
    public var id:String
    public var name:String
    public var isActive:Bool
    public var type:DeviceType
    public var integrationsData:RecordDictionary<String, String>

    required public init(){}
}

public enum DeviceType : Int, Codable
{
    case ClerkServicedKiosk = 0
    case PersonalOnline = 1
    case SelfServiceKiosk = 2
    case Unknown = -1
}

public class ProductInstanceRef : Codable
{
    public var id:String
    public var name:String
    public var title:String
    public var product:ProductReference

    required public init(){}
}

public class ProductReference : Codable
{
    public var id:String
    public var value:String
    public var category:String
    public var productProvider:Ref

    required public init(){}
}

public class Locale : Codable
{
    public var timeZone:Ref
    public var currency:Ref
    public var language:Ref

    required public init(){}
}


Swift OpenLocation DTOs

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

HTTP + OTHER

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

POST /cmd/locations HTTP/1.1 
Host: api.sbbet.ath.cx 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"id":"String","name":"String","organization":{"data":{"String":"String"},"id":"String","val":"String"},"region":{"id":"String","val":"String"},"group":{"id":"String","val":"String"},"address":{"street":"String","city":"String","state":"String","postalCode":"String","country":{"id":"String","val":"String"},"gps":{"lat":0,"lng":0},"data":{"String":"String"}},"devices":[{"id":"String","name":"String","isActive":false,"type":0,"integrationsData":{"String":"String"}}],"productInstances":[{"id":"String","name":"String","title":"String","product":{"id":"String","value":"String","category":"String","productProvider":{"id":"String","val":"String"}}}],"locale":{"timeZone":{"id":"String","val":"String"},"currency":{"id":"String","val":"String"},"language":{"id":"String","val":"String"}},"integrationsData":{"String":"String"}}
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"}}