Song

public class Song

Represents a song object on SCM, typically received from the song endpoint

  • id

    Song ID in SCM

    Declaration

    Swift

    public let id: String
  • Song title

    Declaration

    Swift

    public let title: String
  • Uploader username

    Declaration

    Swift

    public let uploader: String
  • Declaration

    Swift

    public let secLength: UInt
  • Availability to download

    Declaration

    Swift

    public let canDownload: Bool
  • Downloads count

    Declaration

    Swift

    public let downloadCount: UInt
  • Looping information about song

    Declaration

    Swift

    public var loop: SongLoopInformation { get }
  • Song audio sample rate in Hz

    Declaration

    Swift

    public var sampleRate: UInt { get }
  • The ID of the game the song originates from

    Declaration

    Swift

    public var gameId: String { get }
  • Game the song belongs to

    Declaration

    Swift

    public var game: Game { get }
  • Initialize a song object

    Throws

    SCMError.httpRequestError in case of request failure

    Throws

    SCMError.otherApiError in case the client did not understand the response

    Throws

    SCMError.objectNotFoundError in case the requested song does not exist

    Declaration

    Swift

    public init(_ id: String) throws

    Parameters

    id

    ID of the requested song on SCM

  • Undocumented

    Declaration

    Swift

    public init(id: String, title: String, secLength: UInt, uploader: String, canDownload: Bool, downloadCount: UInt)
  • Undocumented

    Declaration

    Swift

    public init(id: String, title: String, secLength: UInt, uploader: String, canDownload: Bool, downloadCount: UInt, gameId: String)
  • Download song in needed format

    Declaration

    Swift

    public func download(inFormat format: SongFileType) -> Result<Data, SCMError>

    Parameters

    format

    The format needed to download

    Return Value

    Result which is Data of the requested song file on success, SCMError on failure