Package com.adamratzman.spotify.models

Types

AbstractPagingObject
Link copied to clipboard
common
abstract class AbstractPagingObject<T : Any, Z : AbstractPagingObject<T, Z>> : PagingObjectBase<T, Z> , List<T?>
The offset-based paging object is a container for a set of objects.
Album
Link copied to clipboard
common
data class Album(albumTypeString: String, availableMarketsString: List<String>, externalIdsString: Map<String, String>, externalUrlsString: Map<String, String>, href: String, id: String, uri: AlbumUri, artists: List<SimpleArtist>, copyrights: List<SpotifyCopyright>, genres: List<String>, images: List<SpotifyImage>, label: String, name: String, popularity: Int, releaseDateString: String, releaseDatePrecision: String, tracks: PagingObject<SimpleTrack>, type: String, totalTracks: Int, restrictions: Restrictions?) : CoreObject
Represents an Album on Spotify
AlbumResultType
Link copied to clipboard
common
enum AlbumResultType : Enum<AlbumResultType>
Album search type
AlbumUri
Link copied to clipboard
common
class AlbumUri(input: String) : ImmutableCollectionUri
Represents a Spotify Album URI, parsed from either a Spotify ID or taken from an endpoint.
AlbumUriSerializer
Link copied to clipboard
common
object AlbumUriSerializer : KSerializer<AlbumUri>
Artist
Link copied to clipboard
common
data class Artist(externalUrlsString: Map<String, String>, href: String, id: String, uri: ArtistUri, followers: Followers, genres: List<String>, images: List<SpotifyImage>, name: String, popularity: Int, type: String) : CoreObject
Represents an Artist (distinct from a regular user) on Spotify
ArtistUri
Link copied to clipboard
common
class ArtistUri(input: String) : SpotifyUri
Represents a Spotify Artist URI, parsed from either a Spotify ID or taken from an endpoint.
ArtistUriSerializer
Link copied to clipboard
common
object ArtistUriSerializer : KSerializer<ArtistUri>
AudioAnalysis
Link copied to clipboard
common
data class AudioAnalysis(bars: List<TimeInterval>, beats: List<TimeInterval>, meta: AudioAnalysisMeta, sections: List<AudioSection>, segments: List<AudioSegment>, tatums: List<TimeInterval>, track: TrackAnalysis)
The Audio Analysis endpoint provides low-level audio analysis for all of the tracks in the Spotify catalog.
AudioAnalysisMeta
Link copied to clipboard
common
data class AudioAnalysisMeta(analyzerVersion: String, platform: String, detailedStatus: String, statusCode: Int?, timestamp: Long, analysisTime: Float, inputProcess: String)
Information about the analysis run
AudioFeatures
Link copied to clipboard
common
data class AudioFeatures(acousticness: Float, analysisUrl: String, danceability: Float, durationMs: Int, energy: Float, id: String, instrumentalness: Float, key: Int, liveness: Float, loudness: Float, mode: Int, speechiness: Float, tempo: Float, timeSignature: Int, trackHref: String, type: String, uri: PlayableUri, valence: Float)
General attributes of a Track
AudioSection
Link copied to clipboard
common
data class AudioSection(start: Float, duration: Float, confidence: Float, loudness: Float, tempo: Float?, tempoConfidence: Float?, key: Int, keyConfidence: Float?, mode: Int?, modeConfidence: Float?, timeSignature: Int, timeSignatureConfidence: Float)
Sections are defined by large variations in rhythm or timbre, e.g.
AudioSegment
Link copied to clipboard
common
data class AudioSegment(start: Float?, duration: Float, confidence: Float?, loudnessStart: Float, loudnessMaxTime: Float?, loudnessMax: Float, loudnessEnd: Float?, pitches: List<Float>, timbre: List<Float>)
Audio segments attempts to subdivide a song into many segments, with each segment containing a roughly consistent sound throughout its duration.
AuthenticationError
Link copied to clipboard
common
data class AuthenticationError(error: String, description: String)
An exception during the authentication process
CollectionUri
Link copied to clipboard
common
sealed class CollectionUri : SpotifyUri
CollectionUriSerializer
Link copied to clipboard
common
object CollectionUriSerializer : KSerializer<CollectionUri>
Context
Link copied to clipboard
common
data class Context(externalUrlsString: Map<String, String>)
Puts an object in-context by linking to other related endpoints
CopyrightType
Link copied to clipboard
common
enum CopyrightType : Enum<CopyrightType> , ResultEnum
Copyright statement type of an Album
CoreObject
Link copied to clipboard
common
abstract class CoreObject : Identifiable
Represents a core Spotify object such as a Track or Album
CurrentlyPlayingContext
Link copied to clipboard
common
data class CurrentlyPlayingContext(timestamp: Long, device: Device, progressMs: Int?, isPlaying: Boolean, track: Track?, shuffleState: Boolean, repeatStateString: String, context: Context?)
Information about the current playback
CurrentlyPlayingObject
Link copied to clipboard
common
data class CurrentlyPlayingObject(context: PlayHistoryContext?, timestamp: Long, progressMs: Int?, isPlaying: Boolean, track: Track, currentlyPlayingTypeString: String, actions: PlaybackActions)
Information about the currently playing track and context
CurrentlyPlayingType
Link copied to clipboard
common
enum CurrentlyPlayingType : Enum<CurrentlyPlayingType> , ResultEnum
The object type of the currently playing item
Cursor
Link copied to clipboard
common
data class Cursor(before: String?, after: String?)
The cursor to use as key to find the next (or previous) page of items.
CursorBasedPagingObject
Link copied to clipboard
common
data class CursorBasedPagingObject<T : Any>(href: String, items: List<T>, limit: Int, next: String?, cursor: Cursor, total: Int, offset: Int, previous: String?) : PagingObjectBase<T, CursorBasedPagingObject<T>>
The cursor-based paging object is a container for a set of objects.
Device
Link copied to clipboard
common
data class Device(id: String?, isActive: Boolean, isPrivateSession: Boolean, isRestricted: Boolean, name: String, typeString: String, volumePercent: Int) : IdentifiableNullable
A device which is connected to the Spotify user
DeviceType
Link copied to clipboard
common
enum DeviceType : Enum<DeviceType>
Electronic type of registered Spotify device
DisallowablePlaybackAction
Link copied to clipboard
common
data class DisallowablePlaybackAction(action: PlaybackAction, disallowed: Boolean)
Maps a playback action to whether the user is disallowed from doing it
Episode
Link copied to clipboard
common
data class Episode(audioPreviewUrl: String?, description: String?, durationMs: Int, explicit: Boolean, externalUrlsString: Map<String, String>, href: String, id: String, images: List<SpotifyImage>, isExternallyHosted: Boolean, isPlayable: Boolean, language: String?, showLanguagesPrivate: List<String>, name: String, releaseDateString: String, releaseDatePrecisionString: String, resumePoint: ResumePoint?, show: SimpleShow, type: String, uri: EpisodeUri) : CoreObject
An episode (podcast) on Spotify
EpisodeUri
Link copied to clipboard
common
class EpisodeUri(input: String) : PlayableUri
EpisodeUriSerializer
Link copied to clipboard
common
object EpisodeUriSerializer : KSerializer<EpisodeUri>
ErrorObject
Link copied to clipboard
common
data class ErrorObject(status: Int, message: String, reason: String?)
An endpoint exception from Spotify
ErrorResponse
Link copied to clipboard
common
data class ErrorResponse(error: ErrorObject, exception: Exception?)
Wraps around ErrorObject.
ExplicitContentSettings
Link copied to clipboard
common
data class ExplicitContentSettings(filterEnabled: Boolean, filterLocked: Boolean)
ExternalId
Link copied to clipboard
common
class ExternalId(key: String, id: String)
An external id linked to the result object
ExternalUrl
Link copied to clipboard
common
class ExternalUrl(name: String, url: String)
Key/value pair mapping a name to an arbitrary url
FeaturedPlaylists
Link copied to clipboard
common
data class FeaturedPlaylists(message: String, playlists: PagingObject<SimplePlaylist>)
Spotify featured playlists (on the Browse tab)
Followers
Link copied to clipboard
common
data class Followers(href: String?, total: Int)
Information about a Spotify user's followers
Identifiable
Link copied to clipboard
common
abstract class Identifiable : IdentifiableNullable
Represents an identifiable Spotify object such as an Album or Recommendation Seed
IdentifiableNullable
Link copied to clipboard
common
abstract class IdentifiableNullable : NeedsApi
Represents an identifiable Spotify object such as an Album or Recommendation Seed
ImmutableCollectionUri
Link copied to clipboard
common
sealed class ImmutableCollectionUri : CollectionUri
ImmutableCollectionUriSerializer
Link copied to clipboard
common
object ImmutableCollectionUriSerializer : KSerializer<ImmutableCollectionUri>
LinkedTrack
Link copied to clipboard
common
data class LinkedTrack(externalUrlsString: Map<String, String>, href: String, id: String, uri: PlayableUri, type: String) : CoreObject
Represents a relinked track.
LocalTrack
Link copied to clipboard
common
data class LocalTrack(album: SimpleLocalAlbum, artists: List<SimpleLocalArtist>, href: String?, id: String?, discNumber: String?, durationMs: Int?, explicit: Boolean?, isLocal: Boolean, name: String, popularity: Int?, trackNumber: Int?, type: String, uri: LocalTrackUri) : IdentifiableNullable, Playable
Local track object that representing a song uploaded from a client locally
LocalTrackUri
Link copied to clipboard
common
class LocalTrackUri(input: String) : PlayableUri
Represents a Spotify local track URI
LocalTrackUriSerializer
Link copied to clipboard
common
object LocalTrackUriSerializer : KSerializer<LocalTrackUri>
NeedsApi
Link copied to clipboard
common
abstract class NeedsApi
Provide access to the underlying SpotifyApi
NullablePagingObject
Link copied to clipboard
common
class NullablePagingObject<T : Any>(href: String, items: List<T?>, limit: Int, next: String?, offset: Int, previous: String?, total: Int) : AbstractPagingObject<T, NullablePagingObject<T>>
The offset-based nullable paging object is a container for a set of objects.
PagingObject
Link copied to clipboard
common
data class PagingObject<T : Any>(href: String, items: List<T>, limit: Int, next: String?, offset: Int, previous: String?, total: Int) : AbstractPagingObject<T, PagingObject<T>>
The offset-based non-nullable paging object is a container for a set of objects.
PagingObjectBase
Link copied to clipboard
common
abstract class PagingObjectBase<T : Any, Z : PagingObjectBase<T, Z>> : NeedsApi, List<T?>
PagingTraversalType
Link copied to clipboard
common
enum PagingTraversalType : Enum<PagingTraversalType>
Playable
Link copied to clipboard
common
interface Playable
A local track, episode, or track.
PlayableSerializer
Link copied to clipboard
common
object PlayableSerializer : KSerializer<Playable>
PlayableUri
Link copied to clipboard
common
sealed class PlayableUri : SpotifyUri
PlayableUriSerializer
Link copied to clipboard
common
object PlayableUriSerializer : KSerializer<PlayableUri>
PlaybackAction
Link copied to clipboard
common
enum PlaybackAction : Enum<PlaybackAction> , ResultEnum
Action a user takes that will affect current playback
PlaybackActions
Link copied to clipboard
common
data class PlaybackActions(disallowsString: Map<String, Boolean?>)
List of playback actions (pause, resume, etc) which a user is disallowed or allowed to do.
PlayHistory
Link copied to clipboard
common
data class PlayHistory(track: SimpleTrack, playedAt: String, context: PlayHistoryContext?)
Information about a previously-played track
PlayHistoryContext
Link copied to clipboard
common
data class PlayHistoryContext(externalUrlsString: Map<String, String>, href: String, uri: SpotifyUri, type: String)
Context in which a track was played
Playlist
Link copied to clipboard
common
data class Playlist(externalUrlsString: Map<String, String>, href: String, id: String, uri: PlaylistUri, collaborative: Boolean, description: String?, followers: Followers, primaryColor: String?, images: List<SpotifyImage>, name: String, owner: SpotifyPublicUser, public: Boolean?, snapshotIdString: String, tracks: PagingObject<PlaylistTrack>, type: String) : CoreObject
Represents a Playlist on Spotify
PlaylistTrack
Link copied to clipboard
common
data class PlaylistTrack(primaryColor: String?, addedAt: String?, addedBy: SpotifyPublicUser?, isLocal: Boolean?, track: Playable?, videoThumbnail: VideoThumbnail?)
Represents a Spotify track inside a Playlist
PlaylistTrackInfo
Link copied to clipboard
common
data class PlaylistTrackInfo(href: String, total: Int)
A collection containing a link ( href ) to the Web API endpoint where full details of the playlist’s tracks can be retrieved, along with the total number of tracks in the playlist.
PlaylistUri
Link copied to clipboard
common
class PlaylistUri(input: String) : CollectionUri
Represents a Spotify Playlist URI, parsed from either a Spotify ID or taken from an endpoint.
PlaylistUriSerializer
Link copied to clipboard
common
object PlaylistUriSerializer : KSerializer<PlaylistUri>
PodcastEpisodeTrack
Link copied to clipboard
common
data class PodcastEpisodeTrack(album: SimpleAlbum, artists: List<SimpleArtist>, availableMarketsString: List<String>, discNumber: Int, durationMs: Int, episode: Boolean?, explicit: Boolean, externalUrlsString: Map<String, String>, externalIdsString: Map<String, String>, href: String, id: String, isLocal: Boolean?, isPlayable: Boolean, name: String, popularity: Int, previewUrl: String?, track: Boolean?, trackNumber: Int, type: String, uri: PlayableUri, linkedTrack: LinkedTrack?) : RelinkingAvailableResponse, Playable
An episode (podcast) on Spotify
RecommendationResponse
Link copied to clipboard
common
data class RecommendationResponse(seeds: List<RecommendationSeed>, tracks: List<Track>)
RecommendationSeed
Link copied to clipboard
common
data class RecommendationSeed(href: String?, id: String, initialPoolSize: Int, afterFilteringSize: Int, afterRelinkingSize: Int?, type: String) : Identifiable
Seed from which the recommendation was constructed
ReleaseDate
Link copied to clipboard
common
data class ReleaseDate(year: Int, month: Int?, day: Int?)
RelinkingAvailableResponse
Link copied to clipboard
common
abstract class RelinkingAvailableResponse : CoreObject
Represents a response for which a relinked track could be available
RepeatState
Link copied to clipboard
common
enum RepeatState : Enum<RepeatState> , ResultEnum
How and if playback is repeating
Restrictions
Link copied to clipboard
common
data class Restrictions(reason: String)
Contains an explanation of why a track is not available
ResultEnum
Link copied to clipboard
common
interface ResultEnum
Interface that allows easy identifier retrieval for children with an implemented identifier
ResumePoint
Link copied to clipboard
common
data class ResumePoint(fullyPlayed: Boolean, resumePositionMs: Int)
Represents the user’s most recent position in the episode.
SavedAlbum
Link copied to clipboard
common
data class SavedAlbum(addedAt: String, album: Album)
Represents an album saved in a user's library
SavedTrack
Link copied to clipboard
common
data class SavedTrack(addedAt: String, track: Track)
Represents a track saved in a user's library
Show
Link copied to clipboard
common
data class Show(availableMarketsString: List<String>, copyrights: List<SpotifyCopyright>, description: String?, explicit: Boolean, episodes: NullablePagingObject<SimpleEpisode>, externalUrlsString: Map<String, String>, href: String, id: String, images: List<SpotifyImage>, isExternallyHosted: Boolean?, languagesString: List<String>, mediaType: String, name: String, publisher: String, type: String, uri: ShowUri) : CoreObject
Information about a Spotify show, including its episodes
ShowUri
Link copied to clipboard
common
class ShowUri(input: String) : ImmutableCollectionUri
ShowUriSerializer
Link copied to clipboard
common
object ShowUriSerializer : KSerializer<ShowUri>
SimpleAlbum
Link copied to clipboard
common
data class SimpleAlbum(albumTypeString: String, availableMarketsString: List<String>, externalUrlsString: Map<String, String>, href: String, id: String, uri: SpotifyUri, artists: List<SimpleArtist>, images: List<SpotifyImage>, name: String, type: String, restrictions: Restrictions?, releaseDateString: String, releaseDatePrecisionString: String, totalTracks: Int?, albumGroupString: String?) : CoreObject
Simplified Album object that can be used to retrieve a full Album
SimpleArtist
Link copied to clipboard
common
data class SimpleArtist(externalUrlsString: Map<String, String>, href: String, id: String, uri: SpotifyUri, name: String, type: String) : CoreObject
Simplified Artist object that can be used to retrieve a full Artist
SimpleEpisode
Link copied to clipboard
common
data class SimpleEpisode(audioPreviewUrl: String?, description: String?, durationMs: Int, explicit: Boolean, externalUrlsString: Map<String, String>, href: String, id: String, images: List<SpotifyImage>, isExternallyHosted: Boolean, isPlayable: Boolean, language: String?, showLanguagesPrivate: List<String>, name: String, releaseDateString: String, releaseDatePrecisionString: String, resumePoint: ResumePoint?, type: String, uri: SpotifyUri) : CoreObject
A simplified episode (podcast) on Spotify
SimpleLocalAlbum
Link copied to clipboard
common
data class SimpleLocalAlbum(albumType: String?, artists: List<SimpleLocalArtist>, name: String, releaseDate: String?, releaseDatePrecision: String?, type: String)
Local album object that goes with LocalTrack - represents the local album it was obtained from (likely "Local Files")
SimpleLocalArtist
Link copied to clipboard
common
data class SimpleLocalArtist(name: String, type: String)
Local artist object (goes with LocalTrack) representing an artist on a local track
SimplePlaylist
Link copied to clipboard
common
data class SimplePlaylist(externalUrlsString: Map<String, String>, href: String, id: String, uri: SpotifyUri, collaborative: Boolean, images: List<SpotifyImage>, name: String, description: String?, owner: SpotifyPublicUser, primaryColor: String?, public: Boolean?, snapshotIdString: String, tracks: PlaylistTrackInfo, type: String) : CoreObject
Simplified Playlist object that can be used to retrieve a full Playlist
SimpleShow
Link copied to clipboard
common
data class SimpleShow(availableMarketsString: List<String>, externalUrlsString: Map<String, String>, copyrights: List<SpotifyCopyright>, description: String?, explicit: Boolean, href: String, id: String, images: List<SpotifyImage>, isExternallyHosted: Boolean?, languagesString: List<String>, mediaType: String, name: String, publisher: String, type: String, uri: SpotifyUri) : CoreObject
Basic information about a Spotify show
SimpleTrack
Link copied to clipboard
common
data class SimpleTrack(externalUrlsString: Map<String, String>, availableMarketsString: List<String>, externalIdsString: Map<String, String>, href: String, id: String, uri: SpotifyUri, artists: List<SimpleArtist>, discNumber: Int, durationMs: Int, explicit: Boolean, isPlayable: Boolean, linkedTrack: LinkedTrack?, name: String, previewUrl: String?, trackNumber: Int, type: String, isLocal: Boolean?, popularity: Int?, restrictions: Restrictions?) : RelinkingAvailableResponse
Simplified Playlist object that can be used to retrieve a full Playlist
SpotifyCategory
Link copied to clipboard
common
data class SpotifyCategory(href: String, id: String, icons: List<SpotifyImage>, name: String) : Identifiable
Spotify music category
SpotifyCopyright
Link copied to clipboard
common
data class SpotifyCopyright(textString: String, typeString: String)
Describes an album's copyright information
SpotifyImage
Link copied to clipboard
common
data class SpotifyImage(height: Int?, url: String, width: Int?)
A Spotify image
SpotifyPublicUser
Link copied to clipboard
common
data class SpotifyPublicUser(externalUrlsString: Map<String, String>, href: String, id: String, uri: UserUri, displayName: String?, followers: Followers, images: List<SpotifyImage>, type: String) : CoreObject
Public information about a Spotify user
SpotifyRatelimitedException
Link copied to clipboard
common
Thrown when SpotifyApiOptions.retryWhenRateLimited is false and requests have been ratelimited
SpotifySearchResult
Link copied to clipboard
common
data class SpotifySearchResult(albums: PagingObject<SimpleAlbum>?, artists: PagingObject<Artist>?, playlists: PagingObject<SimplePlaylist>?, tracks: PagingObject<Track>?, episodes: NullablePagingObject<SimpleEpisode>?, shows: NullablePagingObject<SimpleShow>?)
SpotifyTrackUri
Link copied to clipboard
common
class SpotifyTrackUri(input: String) : PlayableUri
Represents a Spotify Track URI, parsed from either a Spotify ID or taken from an endpoint.
SpotifyTrackUriSerializer
Link copied to clipboard
common
object SpotifyTrackUriSerializer : KSerializer<SpotifyTrackUri>
SpotifyUri
Link copied to clipboard
common
sealed class SpotifyUri
Represents a Spotify URI, parsed from either a Spotify ID or taken from an endpoint.
SpotifyUriException
Link copied to clipboard
common
class SpotifyUriException(message: String) : SpotifyException.BadRequestException
Exception instantiating or deserializing a uri perceived as invalid
SpotifyUriSerializer
Link copied to clipboard
common
object SpotifyUriSerializer : KSerializer<SpotifyUri>
SpotifyUserInformation
Link copied to clipboard
common
data class SpotifyUserInformation(externalUrlsString: Map<String, String>, href: String, id: String, uri: UserUri, country: String?, displayName: String?, email: String?, followers: Followers, images: List<SpotifyImage>, product: String?, explicitContentSettings: ExplicitContentSettings?, type: String) : CoreObject
Private information about a Spotify user.
TimeInterval
Link copied to clipboard
common
data class TimeInterval(start: Float, duration: Float, confidence: Float)
This is a generic object used to represent various time intervals within Audio Analysis.
Token
Link copied to clipboard
common
data class Token(accessToken: String, tokenType: String, expiresIn: Int, refreshToken: String?, scopeString: String?)
Represents a Spotify Token, retrieved through instantiating a SpotifyApi
TokenValidityResponse
Link copied to clipboard
common
data class TokenValidityResponse(isValid: Boolean, exception: Exception?)
Track
Link copied to clipboard
common
data class Track(externalUrlsString: Map<String, String>, externalIdsString: Map<String, String>, availableMarketsString: List<String>, href: String, id: String, uri: PlayableUri, album: SimpleAlbum, artists: List<SimpleArtist>, isPlayable: Boolean, discNumber: Int, durationMs: Int, explicit: Boolean, linkedTrack: LinkedTrack?, name: String, popularity: Int, previewUrl: String?, trackNumber: Int, type: String, isLocal: Boolean?, restrictions: Restrictions?, episode: Boolean?, track: Boolean?) : RelinkingAvailableResponse, Playable
Represents a music track on Spotify
TrackAnalysis
Link copied to clipboard
common
data class TrackAnalysis(numSamples: Int, duration: Float, sampleMd5: String?, offsetSeconds: Int?, windowSeconds: Int?, analysisSampleRate: Float, analysisChannels: Int, endOfFadeIn: Float, startOfFadeOut: Float, loudness: Float, tempo: Float, tempoConfidence: Float, timeSignature: Int, timeSignatureConfidence: Float, key: Int, keyConfidence: Float, mode: Int?, modeConfidence: Float, codestring: String, codeVersion: Float, echoprintstring: String, echoprintVersion: Float, synchstring: String, synchVersion: Float, rhythmstring: String, rhythmVersion: Float)
General information about the track as a whole
UserUri
Link copied to clipboard
common
class UserUri(input: String) : SpotifyUri
Represents a Spotify User URI, parsed from either a Spotify ID or taken from an endpoint.
UserUriSerializer
Link copied to clipboard
common
object UserUriSerializer : KSerializer<UserUri>
VideoThumbnail
Link copied to clipboard
common
data class VideoThumbnail(url: String?)