| GET | /checkaccount | Check account limit and remaining account amount |
|---|
import Foundation
import ServiceStack
public class CheckAccount : ApiServiceRequest, ILogRequest
{
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 ApiServiceRequest : IServiceRequest, IHasApiKey, Codable
{
/**
* The API Key required for authentication
*/
// @ApiMember(DataType="string", Description="The API Key required for authentication", IsRequired=true)
public var apiKey:String
required public init(){}
}
public class CheckAccountResponse : ApiServiceResponse
{
/**
* The total monthly limit for account payments, will be negative if there is no limit
*/
// @ApiMember(Description="The total monthly limit for account payments, will be negative if there is no limit")
public var accountLimit:Double
/**
* The amount that can still be used this month, will be negative if there is no account limit
*/
// @ApiMember(Description="The amount that can still be used this month, will be negative if there is no account limit")
public var accountRemaining:Double
/**
* Shows if this account is allowed to place real orders or quotes
*/
// @ApiMember(Description="Shows if this account is allowed to place real orders or quotes")
public var allowDataProcessing:Bool
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case accountLimit
case accountRemaining
case allowDataProcessing
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
accountLimit = try container.decodeIfPresent(Double.self, forKey: .accountLimit)
accountRemaining = try container.decodeIfPresent(Double.self, forKey: .accountRemaining)
allowDataProcessing = try container.decodeIfPresent(Bool.self, forKey: .allowDataProcessing)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if accountLimit != nil { try container.encode(accountLimit, forKey: .accountLimit) }
if accountRemaining != nil { try container.encode(accountRemaining, forKey: .accountRemaining) }
if allowDataProcessing != nil { try container.encode(allowDataProcessing, forKey: .allowDataProcessing) }
}
}
public class ApiServiceResponse : IServiceResponse, Codable
{
/**
* Information about the response.
*/
// @ApiMember(Description="Information about the response.", IsRequired=true)
public var Description:String
/**
* Heading or summary of the response.
*/
// @ApiMember(Description="Heading or summary of the response.", IsRequired=true)
public var heading:String
/**
* Did the intended operation for this response complete successfully?
*/
// @ApiMember(DataType="boolean", Description="Did the intended operation for this response complete successfully?", IsRequired=true)
public var wasSuccessful:Bool
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /checkaccount HTTP/1.1 Host: 1fetch.api.client.prod.86degrees.com Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length
{"AccountLimit":0,"AccountRemaining":0,"AllowDataProcessing":false,"Description":"String","Heading":"String","WasSuccessful":false}