Album

public protocol Album

A type representing a Spotify album.

The Album protocol serves as the base protocol to which all Spotify album types conform. Its requirements include properties for both simplified and full versions of a Spotify album. See the Spotify Web API Object Model for more details.

  • The type of album. See SKAlbumType for possible values.

    Declaration

    Swift

    var albumType: SKAlbumType { get }
  • The artists of the album. Each artist includes a link in url to more detailed information about the artist.

    Note

    This property is not guaranteed to be included in every album, and thus may be nil when retrieving albums from particular API endpoints.

    Declaration

    Swift

    var artists: [SKArtist]? { get }
  • The markets in which the album is available: ISO 3166-1 alpha-2 country codes. Note that an album is considered available in a market when at least 1 of its tracks is available in that market.

    This property may be nil if the API request already specified a specific market from which to retrieve the album.

    Declaration

    Swift

    var availableMarkets: [String]? { get }
  • Known external URLs for this album. See external URL object for more details.

    Declaration

    Swift

    var externalURLs: [String : URL] { get }
  • id

    The Spotify ID for the album.

    Declaration

    Swift

    var id: String { get }
  • The cover art for the album in various sizes, widest first.

    Declaration

    Swift

    var images: [SKImage] { get }
  • The name of the album. In case of an album takedown, the value may be an empty string.

    Declaration

    Swift

    var name: String { get }
  • uri

    The Spotify URI for the album.

    Declaration

    Swift

    var uri: String { get }
  • url

    A link to the Web API endpoint providing full details of the album.

    Declaration

    Swift

    var url: URL { get }
  • The copyright statements of the album.

    Declaration

    Swift

    var copyrights: [SKCopyright]? { get }
  • Known external IDs for the album.

    Declaration

    Swift

    var externalIDs: [String : String]? { get }
  • A list of the genres used to classify the album. For example: "Prog Rock", "Post-Grunge". (If not yet classified, the array is empty.)

    Declaration

    Swift

    var genres: [String]? { get }
  • The label for the album.

    Declaration

    Swift

    var label: String? { get }
  • The popularity of the album. The value will be between 0 and 100, with 100 being the most popular. The popularity is calculated from the popularity of the album’s individual tracks.

    Declaration

    Swift

    var popularity: Int? { get }
  • The date the album was first released, for example "1981-12-15". Depending on the precision, the date may have been returned as "1981" or "1981-12". The precision for this value is provided by the releaseDatePrecision property.

    Declaration

    Swift

    var releaseDate: Date? { get }
  • The precision with which releaseDate value is known. See DatePrecision for possible values.

    Declaration

    Swift

    var releaseDatePrecision: SKDatePrecision? { get }
  • The tracks of the album.

    Declaration

    Swift

    var tracks: Page<SKTrack>? { get }
  • Creates and returns the request used to get the current album’s tracks.

    Declaration

    Swift

    public func makeTracksRequest(locale: Locale?, page: Pagination?) -> SKRequest

    Parameters

    locale

    The locale-specific storefront/market from which to request.

    page

    The parameters for paginating the results, specifying the index and number of items to return. If no parameters are supplied, the request will return the default number of items beginning with first item.

    Return Value

    An SKRequest instance with which to perform the API request.

  • Gets Spotify catalog information about the current album’s tracks.

    Note

    This method uses the SPTAuth default instance session to authenticate the underlying request. If this session does not contain a valid access token, the request will result in an error.

    Declaration

    Swift

    public func getTracks(for locale: Locale? = SKCatalog.local.locale, page: Pagination? = nil, completion handler: @escaping (Page<SKTrack>?, Error?) -> Void)

    Parameters

    locale

    The locale-specific storefront/market from which to request. The default value is the locale for the shared SKCatalog instance, which by default represents the user’s region settings at the time the method is called.

    page

    The parameters for paginating the results, specifying the index and number of items to return. If no parameters are supplied, the request will return the default number of items beginning with first item. The default value is nil.

    handler

    The callback handler for the request. The parameters for this handler are:

    • tracks: A paginated collection of simplified tracks, if available.
    • error: An error identifying if and why the request failed, or nil if the request was successful.