| All Verbs | /qry/wins/recent |
|---|
import Foundation
import ServiceStack
public class GetRecentWins : Codable
{
required public init(){}
}
public class RecentWins : Codable
{
public var id:String
public var wins:[Win]
public var maxSize:Int
public var threshold:Double
required public init(){}
}
public class Win : Codable
{
public var id:Int
public var sId:Int
public var bettor:Ref
public var origin:Origin
public var placedAt:Date
public var roundId:Int
public var content:String
public var stake:Double
public var outcome:BetOutcome
public var amount:Double
public var processingStatus:BetProcessingStatus
public var validity:BetValidity
public var results:[String:String]
public var payload:[String:String]
required public init(){}
}
public class Ref : Codable
{
public var id:String
public var val:String
required public init(){}
}
public class Origin : Codable
{
public var application:BettingApp
public var ip:String
public var organization:RefEx
public var region:Ref
public var locationGroup:Ref
public var location:RefEx
public var device:RefEx
public var clerk:Ref
required public init(){}
}
public class BettingApp : Codable
{
public var name:String
public var version: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 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 enum BetOutcome : Int, Codable
{
case Unknown = 0
case Lost = 1
case Won = 2
case Void = 3
}
public enum BetProcessingStatus : Int, Codable
{
case Open = 0
case Closed = 1
}
public enum BetValidity : Int, Codable
{
case Valid = 0
case Canceled = 1
case Void = 2
case Reverted = 3
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /qry/wins/recent HTTP/1.1
Host: s4w2.api.bettor.cc
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
id: String,
wins:
[
{
id: 0,
sId: 0,
bettor:
{
id: String,
val: String
},
origin:
{
application:
{
name: String,
version: String
},
ip: String,
organization:
{
data:
{
String: String
},
id: String,
val: String
},
region:
{
id: String,
val: String
},
locationGroup:
{
id: String,
val: String
},
location:
{
data:
{
String: String
},
id: String,
val: String
},
device:
{
data:
{
String: String
},
id: String,
val: String
},
clerk:
{
id: String,
val: String
}
},
placedAt: 0001-01-01,
roundId: 0,
content: String,
stake: 0,
outcome: 0,
amount: 0,
processingStatus: 0,
validity: 0,
results:
{
String: String
},
payload:
{
String: String
}
}
],
maxSize: 0,
threshold: 0
}