Class: Spotted::Resources::Artists

Inherits:
Object
  • Object
show all
Defined in:
lib/spotted/resources/artists.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Artists

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Artists.

Parameters:



145
146
147
# File 'lib/spotted/resources/artists.rb', line 145

def initialize(client:)
  @client = client
end

Instance Method Details

#list(ids: , request_options: {}) ⇒ Spotted::Models::ArtistListResponse

Some parameter documentations has been truncated, see Models::ArtistListParams for more details.

Get Spotify catalog information for several artists based on their Spotify IDs.

Parameters:

  • ids (String)

    A comma-separated list of the [Spotify IDs](/documentation/web-api/concepts/spot

  • request_options (Spotted::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



44
45
46
47
48
49
50
51
52
53
# File 'lib/spotted/resources/artists.rb', line 44

def list(params)
  parsed, options = Spotted::ArtistListParams.dump_request(params)
  @client.request(
    method: :get,
    path: "artists",
    query: parsed,
    model: Spotted::Models::ArtistListResponse,
    options: options
  )
end

#list_albums(id, include_groups: nil, limit: nil, market: nil, offset: nil, request_options: {}) ⇒ Spotted::Internal::CursorURLPage<Spotted::Models::ArtistListAlbumsResponse>

Some parameter documentations has been truncated, see Models::ArtistListAlbumsParams for more details.

Get Spotify catalog information about an artist’s albums.

Parameters:

  • id (String)

    The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) of the artist

  • include_groups (String)

    A comma-separated list of keywords that will be used to filter the response. If

  • limit (Integer)

    The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.

  • market (String)

    An [ISO 3166-1 alpha-2 country code](en.wikipedia.org/wiki/ISO_3166-1_al

  • offset (Integer)

    The index of the first item to return. Default: 0 (the first item). Use with lim

  • request_options (Spotted::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



77
78
79
80
81
82
83
84
85
86
87
# File 'lib/spotted/resources/artists.rb', line 77

def list_albums(id, params = {})
  parsed, options = Spotted::ArtistListAlbumsParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["artists/%1$s/albums", id],
    query: parsed,
    page: Spotted::Internal::CursorURLPage,
    model: Spotted::Models::ArtistListAlbumsResponse,
    options: options
  )
end
Deprecated.

Some parameter documentations has been truncated, see Models::ArtistListRelatedArtistsParams for more details.

Get Spotify catalog information about artists similar to a given artist. Similarity is based on analysis of the Spotify community’s listening history.

Parameters:

  • id (String)

    The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) of the artist

  • request_options (Spotted::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



106
107
108
109
110
111
112
113
# File 'lib/spotted/resources/artists.rb', line 106

def list_related_artists(id, params = {})
  @client.request(
    method: :get,
    path: ["artists/%1$s/related-artists", id],
    model: Spotted::Models::ArtistListRelatedArtistsResponse,
    options: params[:request_options]
  )
end

#list_top_tracks(id, market: nil, request_options: {}) ⇒ Spotted::Models::ArtistListTopTracksResponse

Some parameter documentations has been truncated, see Models::ArtistListTopTracksParams for more details.

Get Spotify catalog information about an artist’s top tracks by country.

Parameters:

Returns:

See Also:



131
132
133
134
135
136
137
138
139
140
# File 'lib/spotted/resources/artists.rb', line 131

def list_top_tracks(id, params = {})
  parsed, options = Spotted::ArtistListTopTracksParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["artists/%1$s/top-tracks", id],
    query: parsed,
    model: Spotted::Models::ArtistListTopTracksResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Spotted::Models::ArtistObject

Some parameter documentations has been truncated, see Models::ArtistRetrieveParams for more details.

Get Spotify catalog information for a single artist identified by their unique Spotify ID.

Parameters:

  • id (String)

    The [Spotify ID](/documentation/web-api/concepts/spotify-uris-ids) of the artist

  • request_options (Spotted::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



21
22
23
24
25
26
27
28
# File 'lib/spotted/resources/artists.rb', line 21

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["artists/%1$s", id],
    model: Spotted::ArtistObject,
    options: params[:request_options]
  )
end