ASH.ResourceLibrary.WebApi

<back to all web services

ResourceChangeRequest

Requires Authentication
The following routes are available for this service:
PUT/resourceItems/{ResourceId}Use to modify Resource
import Foundation
import ServiceStack

public class ResourceChangeRequest : BasicResourceLibraryRequest
{
    public var resourceId:String?
    public var resourceItem:ResourceItem?
    public var uncompletedByMemberId:Int?

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case resourceId
        case resourceItem
        case uncompletedByMemberId
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        resourceId = try container.decodeIfPresent(String.self, forKey: .resourceId)
        resourceItem = try container.decodeIfPresent(ResourceItem.self, forKey: .resourceItem)
        uncompletedByMemberId = try container.decodeIfPresent(Int.self, forKey: .uncompletedByMemberId)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if resourceId != nil { try container.encode(resourceId, forKey: .resourceId) }
        if resourceItem != nil { try container.encode(resourceItem, forKey: .resourceItem) }
        if uncompletedByMemberId != nil { try container.encode(uncompletedByMemberId, forKey: .uncompletedByMemberId) }
    }
}

public class BasicResourceLibraryRequest : Codable
{
    public var resourceLibraryMemberId:Int?

    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 ResourceItemResponse : Codable
{
    public var resourceItem:ResourceItem?

    required public init(){}
}


Swift ResourceChangeRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv

HTTP + CSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

PUT /resourceItems/{ResourceId} HTTP/1.1 
Host: resourcelibrary.api.ashcompanies.com 
Accept: text/csv
Content-Type: text/csv
Content-Length: length

{"resourceId":"String","resourceItem":{"content":"String","credit":"String","references":"String","disclaimer":"String","headerImage":"String","origin":"String","originId":"String","tags":[{"id":"String","title":"String"}],"categories":[{"id":"String","subtopicItems":null,"resourceItems":null,"title":"String","isVisible":"String","resourceCount":0}],"index":0,"activityLevel":"String","activityDetails":"String","transcript":"String","isArchived":false,"activities":[{"name":"String","id":"String"}],"seriesItems":[{"id":"String","title":"String"}],"videoId":"String","focus":"String","series":"String","seriesUrl":"String","category":"String","equipments":["String"],"durationRange":"String","providerName":"String","uploadDate":"String","completionDate":"0001-01-01T00:00:00.0000000","level":"String","bodyFocus":"String","altMediaPaths":{"webm":"String","ogv":"String","mp4Low":"String","mp4High":"String"},"subtitles":"String","drmEncrypted":false,"screenshots":[{"largeFilepathS3":"String","thumbFilepathS3":"String","order":0,"description":"String"}],"id":"String","title":"String","description":"String","descriptionSummary":"String","type":"String","isComplete":false,"isFavorite":false,"isImplicitlyComplete":false,"mediaPath":"String","isConfirmable":false,"isWcagCompliant":false,"duration":"String","preview":"String","calories":0,"instructor":"String","thumbnail":"String","difficulty":"String"},"uncompletedByMemberId":0,"resourceLibraryMemberId":0}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"resourceItem":{"content":"String","credit":"String","references":"String","disclaimer":"String","headerImage":"String","origin":"String","originId":"String","tags":[{"id":"String","title":"String"}],"categories":[{"id":"String","subtopicItems":null,"resourceItems":null,"title":"String","isVisible":"String","resourceCount":0}],"index":0,"activityLevel":"String","activityDetails":"String","transcript":"String","isArchived":false,"activities":[{"name":"String","id":"String"}],"seriesItems":[{"id":"String","title":"String"}],"videoId":"String","focus":"String","series":"String","seriesUrl":"String","category":"String","equipments":["String"],"durationRange":"String","providerName":"String","uploadDate":"String","completionDate":"0001-01-01T00:00:00.0000000","level":"String","bodyFocus":"String","altMediaPaths":{"webm":"String","ogv":"String","mp4Low":"String","mp4High":"String"},"subtitles":"String","drmEncrypted":false,"screenshots":[{"largeFilepathS3":"String","thumbFilepathS3":"String","order":0,"description":"String"}],"id":"String","title":"String","description":"String","descriptionSummary":"String","type":"String","isComplete":false,"isFavorite":false,"isImplicitlyComplete":false,"mediaPath":"String","isConfirmable":false,"isWcagCompliant":false,"duration":"String","preview":"String","calories":0,"instructor":"String","thumbnail":"String","difficulty":"String"}}