Greyhounds.WebApi

<back to all web services

FindStimulations

The following routes are available for this service:
All Verbs/stimulations
import Foundation
import ServiceStack

public class FindStimulations : PaginatedQuery
{
    public var targetQry:String
    public var prizeQry:String
    public var status:StimulationStatus?
    public var periodFrom:Date
    public var periodTo:Date

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

    private enum CodingKeys : String, CodingKey {
        case targetQry
        case prizeQry
        case status
        case periodFrom
        case periodTo
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        targetQry = try container.decodeIfPresent(String.self, forKey: .targetQry)
        prizeQry = try container.decodeIfPresent(String.self, forKey: .prizeQry)
        status = try container.decodeIfPresent(StimulationStatus.self, forKey: .status)
        periodFrom = try container.decodeIfPresent(Date.self, forKey: .periodFrom)
        periodTo = try container.decodeIfPresent(Date.self, forKey: .periodTo)
    }

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

public class PaginatedQuery : Codable
{
    public var currentPage:Int
    public var pageSize:Int

    required public init(){}
}

public enum StimulationStatus : Int, Codable
{
    case Pending = 0
    case Canceled = 1
    case Executed = 2
    case Rejected = 3
}

public class PaginatedResult<T : Codable> : Codable
{
    public var data:[RoundStats]
    public var currentPage:Int
    public var pageSize:Int
    public var totalItems:Int
    public var totalPages:Int

    required public init(){}
}

public class RoundStats : Codable
{
    public var id:String
    public var createdAt:Date
    public var status:RoundStatus
    public var canceledCount:Int
    public var canceledAmount:Double
    public var betCount:Int
    public var stakeAmount:Double
    public var winningsAmount:Double
    public var balanceAmount:Double
    public var balancePct:Double

    required public init(){}
}

public enum RoundStatus : Int, Codable
{
    case Pending = 0
    case InProgress = 1
    case Ended = 2
}


Swift FindStimulations DTOs

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

HTTP + JSV

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

POST /stimulations HTTP/1.1 
Host: grh1.api.bettor.webhop.biz 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	targetQry: String,
	prizeQry: String,
	status: 0,
	periodFrom: 0001-01-01,
	periodTo: 0001-01-01,
	currentPage: 0,
	pageSize: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	data: 
	[
		{
			id: String,
			scheduledAt: 0001-01-01,
			scheduledBy: String,
			target: 
			{
				id: String,
				value: String
			},
			pool: 
			{
				id: 0,
				name: String
			},
			cancellationInfo: 
			{
				canceledBy: String,
				canceledAt: 0001-01-01
			},
			confirmationInfo: 
			{
				confirmedAt: 0001-01-01,
				slipId: String,
				betId: String,
				amountAwarded: 0
			},
			status: 0,
			failInfo: 
			{
				failures: 
				{
					String: String
				},
				lastFailAt: 0001-01-01,
				failureCount: 0
			}
		}
	],
	currentPage: 0,
	pageSize: 0,
	totalItems: 0,
	totalPages: 0
}