| GET | /GetMarketplaceAdRequest | Either Gsid or PCGS is required, not both. |
|---|
import Foundation
import ServiceStack
/**
* Get CDN Marketplace ads
*/
// @Api(Description="Get CDN Marketplace ads")
public class GetMarketplaceAdRequest : Codable
{
public var gsid:Int
public var pcgs:String
public var numberOfItems:Int
required public init(){}
}
public class MarketplaceAdResponse : BaseResponse
{
public var data:[MarketplaceAdItemDto]
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([MarketplaceAdItemDto].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 BaseResponse : Codable
{
public var total:Int
public var opCode:Int
public var errorText:String
public var requestTime:String
public var responseTime:String
public var totalExecutionTime:String
public var cachedResponse:Bool
public var permitAccess:Bool
public var accessDeniedMessage:String
required public init(){}
}
public class MarketplaceAdItemDto : Codable
{
public var title:String
public var isAuction:Bool
public var auctionEnds:Date?
public var buyNowPrice:Double
public var viewItemUrl:String
public var imageUrl:String
required public init(){}
}
Swift GetMarketplaceAdRequest DTOs
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.
GET /GetMarketplaceAdRequest HTTP/1.1 Host: marketingapidev.greysheet.com Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Data:
[
{
Title: String,
IsAuction: False,
AuctionEnds: 0001-01-01,
BuyNowPrice: 0,
ViewItemUrl: String,
ImageUrl: String
}
],
Total: 0,
OpCode: 0,
ErrorText: String,
RequestTime: String,
ResponseTime: String,
TotalExecutionTime: String,
CachedResponse: False,
PermitAccess: False,
AccessDeniedMessage: String
}