Expandable
public protocol Expandable
A type that is represented in the Spotify Web API by both simplified
and full
versions.
Types that conform to this protocol provide a set of convenience methods to retrieve the full version of a simplified SpotifyKit type, and are required to have a URL providing the API endpoint to the full details of the item.
These types also implement an isSimplified
property, a Boolean value indicating whether an instance of this type represents a simplified
version of the full
Spotify object.
-
A link to the Web API endpoint providing full details of the item. Required.
Declaration
Swift
var url: URL { get }
-
A boolean value indicating whether this instance represents a
simplified
version of thefull
Spotify object (i.e., all values unique to the full object arenil
).Declaration
Swift
var isSimplified: Bool { get }
-
makeAllPropertiesRequest()
Default implementation -
getAllProperties(completion:)
Default implementationPerforms a request for the detailed version of the item.
If the given item already contains the requested properties, this method will do nothing and the provided callback handler will not be executed.
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.Default Implementation
Declaration
Swift
func getAllProperties(completion handler: @escaping (Self?, Error?) -> Void)
Parameters
handler
The callback handler for this request, providing the detailed item if successful, or an error identifying if and why the request or the decoding failed if unsuccessful.