Class: Spotted::Resources::Playlists::Followers

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Followers

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 Followers.

Parameters:



87
88
89
# File 'lib/spotted/resources/playlists/followers.rb', line 87

def initialize(client:)
  @client = client
end

Instance Method Details

#check(playlist_id, ids: nil, request_options: {}) ⇒ Array<Boolean>

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

Check to see if the current user is following a specified playlist.

Parameters:

  • playlist_id (String)

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

  • ids (String)

    Deprecated A single item list containing current user’s [Spotify Username](/

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

Returns:

  • (Array<Boolean>)

See Also:



23
24
25
26
27
28
29
30
31
32
# File 'lib/spotted/resources/playlists/followers.rb', line 23

def check(playlist_id, params = {})
  parsed, options = Spotted::Playlists::FollowerCheckParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["playlists/%1$s/followers/contains", playlist_id],
    query: parsed,
    model: Spotted::Internal::Type::ArrayOf[Spotted::Internal::Type::Boolean],
    options: options
  )
end

#follow(playlist_id, paths_request_body_content_application_json_schema_properties_published: nil, request_options: {}) ⇒ nil

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

Add the current user as a follower of a playlist.

Parameters:

  • playlist_id (String)

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

  • paths_request_body_content_application_json_schema_properties_published (Boolean)

    Defaults to ‘true`. If `true` the playlist will be included in user’s public pla

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

Returns:

  • (nil)

See Also:



50
51
52
53
54
55
56
57
58
59
# File 'lib/spotted/resources/playlists/followers.rb', line 50

def follow(playlist_id, params = {})
  parsed, options = Spotted::Playlists::FollowerFollowParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["playlists/%1$s/followers", playlist_id],
    body: parsed,
    model: NilClass,
    options: options
  )
end

#unfollow(playlist_id, request_options: {}) ⇒ nil

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

Remove the current user as a follower of a playlist.

Parameters:

  • playlist_id (String)

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

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

Returns:

  • (nil)

See Also:



75
76
77
78
79
80
81
82
# File 'lib/spotted/resources/playlists/followers.rb', line 75

def unfollow(playlist_id, params = {})
  @client.request(
    method: :delete,
    path: ["playlists/%1$s/followers", playlist_id],
    model: NilClass,
    options: params[:request_options]
  )
end