GET | /filterResults | Returns paginated filtered data based on the requested filters. |
---|
import Foundation
import ServiceStack
public class FilterDataRequest : BasicResourceLibraryRequest
{
public var workoutCategoryId:String?
public var bitwiseLevel:Int?
public var bitwiseDuration:Int?
public var bitwiseInstructor:UInt64?
public var offset:String?
public var limit:String?
public var digitalFitness:Bool?
public var topicId:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case workoutCategoryId
case bitwiseLevel
case bitwiseDuration
case bitwiseInstructor
case offset
case limit
case digitalFitness
case topicId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
workoutCategoryId = try container.decodeIfPresent(String.self, forKey: .workoutCategoryId)
bitwiseLevel = try container.decodeIfPresent(Int.self, forKey: .bitwiseLevel)
bitwiseDuration = try container.decodeIfPresent(Int.self, forKey: .bitwiseDuration)
bitwiseInstructor = try container.decodeIfPresent(UInt64.self, forKey: .bitwiseInstructor)
offset = try container.decodeIfPresent(String.self, forKey: .offset)
limit = try container.decodeIfPresent(String.self, forKey: .limit)
digitalFitness = try container.decodeIfPresent(Bool.self, forKey: .digitalFitness)
topicId = try container.decodeIfPresent(String.self, forKey: .topicId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if workoutCategoryId != nil { try container.encode(workoutCategoryId, forKey: .workoutCategoryId) }
if bitwiseLevel != nil { try container.encode(bitwiseLevel, forKey: .bitwiseLevel) }
if bitwiseDuration != nil { try container.encode(bitwiseDuration, forKey: .bitwiseDuration) }
if bitwiseInstructor != nil { try container.encode(bitwiseInstructor, forKey: .bitwiseInstructor) }
if offset != nil { try container.encode(offset, forKey: .offset) }
if limit != nil { try container.encode(limit, forKey: .limit) }
if digitalFitness != nil { try container.encode(digitalFitness, forKey: .digitalFitness) }
if topicId != nil { try container.encode(topicId, forKey: .topicId) }
}
}
public class BasicResourceLibraryRequest : Codable
{
public var resourceLibraryMemberId:Int?
required public init(){}
}
public class FilterDataResponse : Codable
{
public var filterResults:FilterResult?
required public init(){}
}
public class FilterResult : Codable
{
public var id:String?
public var categoryName:String?
public var itemCount:Int?
public var resourceItems:[ResourceCard] = []
required public init(){}
}
public class ResourceCard : Codable
{
public var id:String?
public var title:String?
public var Description:String?
public var descriptionSummary:String?
public var type:String?
public var content:String?
public var isComplete:Bool?
public var isFavorite:Bool?
public var isImplicitlyComplete:Bool?
public var mediaPath:String?
public var isConfirmable:Bool?
public var isWcagCompliant:Bool?
public var duration:String?
public var preview:String?
public var calories:Int?
public var instructor:String?
public var thumbnail:String?
public var difficulty:String?
public var tags:[Tag] = []
public var subtitles:String?
public var screenshots:[ScreenshotItem] = []
public var drmEncrypted:Bool?
required public init(){}
}
public class Tag : Codable
{
public var id:String?
public var title:String?
required public init(){}
}
public class ScreenshotItem : Codable
{
public var largeFilepathS3:String?
public var thumbFilepathS3:String?
public var order:Double?
public var Description:String?
required public init(){}
}
To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json
To embed the response in a jsonp callback, append ?callback=myCallback
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /filterResults HTTP/1.1 Host: resourcelibrary.api.ashcompanies.com Accept: application/json
HTTP/1.1 200 OK Content-Type: application/json Content-Length: length {"filterResults":{"id":"String","categoryName":"String","itemCount":0,"resourceItems":null}}