GET | /workoutCategories | Use to get workout categories list |
---|
import Foundation
import ServiceStack
public class WorkoutCategoriesRequest : BasicResourceLibraryRequest
{
public var workoutCategories:[WorkoutCategory] = []
public var workoutCategoryId:String?
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case workoutCategories
case workoutCategoryId
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
workoutCategories = try container.decodeIfPresent([WorkoutCategory].self, forKey: .workoutCategories) ?? []
workoutCategoryId = try container.decodeIfPresent(String.self, forKey: .workoutCategoryId)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if workoutCategories.count > 0 { try container.encode(workoutCategories, forKey: .workoutCategories) }
if workoutCategoryId != nil { try container.encode(workoutCategoryId, forKey: .workoutCategoryId) }
}
}
public class BasicResourceLibraryRequest : Codable
{
public var resourceLibraryMemberId:Int?
required public init(){}
}
public class WorkoutCategory : Codable
{
public var id:String?
public var name:String?
public var workoutCategoryImage:String?
public var resourceItems:[ResourceItem] = []
required public init(){}
}
public class ResourceItem : ResourceCard
{
public var content:String?
public var credit:String?
public var references:String?
public var disclaimer:String?
public var headerImage:String?
public var origin:String?
public var originId:String?
public var tags:[Tag] = []
public var categories:[Category] = []
public var index:Int?
public var activityLevel:String?
public var activityDetails:String?
public var transcript:String?
public var isArchived:Bool?
public var activities:[ActivityItem] = []
public var seriesItems:[SeriesItem] = []
public var videoId:String?
public var focus:String?
public var series:String?
public var seriesUrl:String?
public var category:String?
public var equipments:[String] = []
public var durationRange:String?
public var providerName:String?
public var uploadDate:String?
public var completionDate:Date?
public var level:String?
public var bodyFocus:String?
public var altMediaPaths:AltMediaPaths?
public var subtitles:String?
public var drmEncrypted:Bool?
public var screenshots:[ScreenshotItem] = []
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case content
case credit
case references
case disclaimer
case headerImage
case origin
case originId
case tags
case categories
case index
case activityLevel
case activityDetails
case transcript
case isArchived
case activities
case seriesItems
case videoId
case focus
case series
case seriesUrl
case category
case equipments
case durationRange
case providerName
case uploadDate
case completionDate
case level
case bodyFocus
case altMediaPaths
case subtitles
case drmEncrypted
case screenshots
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
content = try container.decodeIfPresent(String.self, forKey: .content)
credit = try container.decodeIfPresent(String.self, forKey: .credit)
references = try container.decodeIfPresent(String.self, forKey: .references)
disclaimer = try container.decodeIfPresent(String.self, forKey: .disclaimer)
headerImage = try container.decodeIfPresent(String.self, forKey: .headerImage)
origin = try container.decodeIfPresent(String.self, forKey: .origin)
originId = try container.decodeIfPresent(String.self, forKey: .originId)
tags = try container.decodeIfPresent([Tag].self, forKey: .tags) ?? []
categories = try container.decodeIfPresent([Category].self, forKey: .categories) ?? []
index = try container.decodeIfPresent(Int.self, forKey: .index)
activityLevel = try container.decodeIfPresent(String.self, forKey: .activityLevel)
activityDetails = try container.decodeIfPresent(String.self, forKey: .activityDetails)
transcript = try container.decodeIfPresent(String.self, forKey: .transcript)
isArchived = try container.decodeIfPresent(Bool.self, forKey: .isArchived)
activities = try container.decodeIfPresent([ActivityItem].self, forKey: .activities) ?? []
seriesItems = try container.decodeIfPresent([SeriesItem].self, forKey: .seriesItems) ?? []
videoId = try container.decodeIfPresent(String.self, forKey: .videoId)
focus = try container.decodeIfPresent(String.self, forKey: .focus)
series = try container.decodeIfPresent(String.self, forKey: .series)
seriesUrl = try container.decodeIfPresent(String.self, forKey: .seriesUrl)
category = try container.decodeIfPresent(String.self, forKey: .category)
equipments = try container.decodeIfPresent([String].self, forKey: .equipments) ?? []
durationRange = try container.decodeIfPresent(String.self, forKey: .durationRange)
providerName = try container.decodeIfPresent(String.self, forKey: .providerName)
uploadDate = try container.decodeIfPresent(String.self, forKey: .uploadDate)
completionDate = try container.decodeIfPresent(Date.self, forKey: .completionDate)
level = try container.decodeIfPresent(String.self, forKey: .level)
bodyFocus = try container.decodeIfPresent(String.self, forKey: .bodyFocus)
altMediaPaths = try container.decodeIfPresent(AltMediaPaths.self, forKey: .altMediaPaths)
subtitles = try container.decodeIfPresent(String.self, forKey: .subtitles)
drmEncrypted = try container.decodeIfPresent(Bool.self, forKey: .drmEncrypted)
screenshots = try container.decodeIfPresent([ScreenshotItem].self, forKey: .screenshots) ?? []
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if content != nil { try container.encode(content, forKey: .content) }
if credit != nil { try container.encode(credit, forKey: .credit) }
if references != nil { try container.encode(references, forKey: .references) }
if disclaimer != nil { try container.encode(disclaimer, forKey: .disclaimer) }
if headerImage != nil { try container.encode(headerImage, forKey: .headerImage) }
if origin != nil { try container.encode(origin, forKey: .origin) }
if originId != nil { try container.encode(originId, forKey: .originId) }
if tags.count > 0 { try container.encode(tags, forKey: .tags) }
if categories.count > 0 { try container.encode(categories, forKey: .categories) }
if index != nil { try container.encode(index, forKey: .index) }
if activityLevel != nil { try container.encode(activityLevel, forKey: .activityLevel) }
if activityDetails != nil { try container.encode(activityDetails, forKey: .activityDetails) }
if transcript != nil { try container.encode(transcript, forKey: .transcript) }
if isArchived != nil { try container.encode(isArchived, forKey: .isArchived) }
if activities.count > 0 { try container.encode(activities, forKey: .activities) }
if seriesItems.count > 0 { try container.encode(seriesItems, forKey: .seriesItems) }
if videoId != nil { try container.encode(videoId, forKey: .videoId) }
if focus != nil { try container.encode(focus, forKey: .focus) }
if series != nil { try container.encode(series, forKey: .series) }
if seriesUrl != nil { try container.encode(seriesUrl, forKey: .seriesUrl) }
if category != nil { try container.encode(category, forKey: .category) }
if equipments.count > 0 { try container.encode(equipments, forKey: .equipments) }
if durationRange != nil { try container.encode(durationRange, forKey: .durationRange) }
if providerName != nil { try container.encode(providerName, forKey: .providerName) }
if uploadDate != nil { try container.encode(uploadDate, forKey: .uploadDate) }
if completionDate != nil { try container.encode(completionDate, forKey: .completionDate) }
if level != nil { try container.encode(level, forKey: .level) }
if bodyFocus != nil { try container.encode(bodyFocus, forKey: .bodyFocus) }
if altMediaPaths != nil { try container.encode(altMediaPaths, forKey: .altMediaPaths) }
if subtitles != nil { try container.encode(subtitles, forKey: .subtitles) }
if drmEncrypted != nil { try container.encode(drmEncrypted, forKey: .drmEncrypted) }
if screenshots.count > 0 { try container.encode(screenshots, forKey: .screenshots) }
}
}
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(){}
}
public class Category : Codable
{
public var id:String?
public var subtopicItems:[SubTopic] = []
public var resourceItems:[ResourceItem] = []
public var title:String?
public var isVisible:String?
public var resourceCount:Int?
required public init(){}
}
public class SubTopic : Codable
{
public var id:String?
public var title:String?
public var resourceCount:Int?
public var resourceItems:[ResourceItem] = []
required public init(){}
}
public class ActivityItem : Codable
{
public var name:String?
public var id:String?
required public init(){}
}
public class SeriesItem : Codable
{
public var id:String?
public var title:String?
required public init(){}
}
public class AltMediaPaths : Codable
{
public var webm:String?
public var ogv:String?
public var mp4Low:String?
public var mp4High:String?
required public init(){}
}
public class WorkoutCategoriesResponse : Codable
{
public var workoutCategories:[WorkoutCategory] = []
public var meta:Meta?
required public init(){}
}
public class Meta : Codable
{
public var resourceCount:Int?
public var title:String?
required public init(){}
}
Swift WorkoutCategoriesRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /workoutCategories HTTP/1.1 Host: resourcelibrary.api.ashcompanies.com Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <WorkoutCategoriesResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ASH.ResourceLibrary.Interfaces.ServiceModels"> <Meta xmlns:d2p1="http://schemas.datacontract.org/2004/07/ASH.ResourceLibrary.Interfaces.Models"> <d2p1:ResourceCount>0</d2p1:ResourceCount> <d2p1:Title>String</d2p1:Title> </Meta> <WorkoutCategories xmlns:d2p1="http://schemas.datacontract.org/2004/07/ASH.ResourceLibrary.Interfaces.Models"> <d2p1:WorkoutCategory> <d2p1:Id>String</d2p1:Id> <d2p1:Name>String</d2p1:Name> <d2p1:ResourceItems i:nil="true" /> <d2p1:WorkoutCategoryImage>String</d2p1:WorkoutCategoryImage> </d2p1:WorkoutCategory> </WorkoutCategories> </WorkoutCategoriesResponse>