SKCategory

public struct SKCategory : JSONDecodable

A Spotify category representing the genres and moods available in the Spotify catalog.

See also

The Web API Category object.
  • url

    A link to the Web API endpoint returning full details of the category.

    Declaration

    Swift

    public let url: URL
  • The category icon, in various sizes.

    Declaration

    Swift

    public let icons: [SKImage]
  • id

    The Spotify category ID of the category.

    Declaration

    Swift

    public let id: String
  • The name of the category.

    Declaration

    Swift

    public let name: String
  • Creates and returns the request used to get playlists for the current category.

    Declaration

    Swift

    public func makePlaylistsRequest(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 a list of Spotify playlists tagged with the current category.

    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 getPlaylists(for locale: Locale? = SKCatalog.local.locale, page: Pagination? = nil, completion handler: @escaping (Page<SKPlaylist>?, 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:

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