GET | /topics/{topicid} | Use to get Resource Library Topic |
---|
import Foundation
import ServiceStack
public class TopicRequest : BasicResourceLibraryRequest
{
public var includeCompletionStatus:Bool?
public var limit:String?
public var offset:String?
public var topicId:String?
public var isMobile:Bool?
/**
* Set it to true if the topic being requested belogs to digital fitness. Don't set it if unsure.
*/
// @ApiMember(Description="Set it to true if the topic being requested belogs to digital fitness. Don't set it if unsure.")
public var digitalFitness:Bool?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case includeCompletionStatus
case limit
case offset
case topicId
case isMobile
case digitalFitness
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
includeCompletionStatus = try container.decodeIfPresent(Bool.self, forKey: .includeCompletionStatus)
limit = try container.decodeIfPresent(String.self, forKey: .limit)
offset = try container.decodeIfPresent(String.self, forKey: .offset)
topicId = try container.decodeIfPresent(String.self, forKey: .topicId)
isMobile = try container.decodeIfPresent(Bool.self, forKey: .isMobile)
digitalFitness = try container.decodeIfPresent(Bool.self, forKey: .digitalFitness)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if includeCompletionStatus != nil { try container.encode(includeCompletionStatus, forKey: .includeCompletionStatus) }
if limit != nil { try container.encode(limit, forKey: .limit) }
if offset != nil { try container.encode(offset, forKey: .offset) }
if topicId != nil { try container.encode(topicId, forKey: .topicId) }
if isMobile != nil { try container.encode(isMobile, forKey: .isMobile) }
if digitalFitness != nil { try container.encode(digitalFitness, forKey: .digitalFitness) }
}
}
public class BasicResourceLibraryRequest : Codable
{
public var resourceLibraryMemberId:Int?
required public init(){}
}
public class TopicResponse : Codable
{
public var topic:TopicLite?
required public init(){}
}
public class TopicLite : Codable
{
public var id:String?
public var subtopicItems:[SubtopicLite] = []
public var resourceItems:[ResourceCard] = []
public var title:String?
public var isVisible:String?
public var resourceCount:Int?
required public init(){}
}
public class SubtopicLite : Codable
{
public var id:String?
public var title:String?
public var resourceCount: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 .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /topics/{topicid} HTTP/1.1 Host: resourcelibrary.api.ashcompanies.com Accept: text/csv
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"topic":{"id":"String","subtopicItems":null,"resourceItems":null,"title":"String","isVisible":"String","resourceCount":0}}