Class: Spotted::Resources::Me::Following

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Following

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

Parameters:



113
114
115
# File 'lib/spotted/resources/me/following.rb', line 113

def initialize(client:)
  @client = client
end

Instance Method Details

#bulk_retrieve(after: nil, limit: nil, type: :artist, request_options: {}) ⇒ Spotted::Models::Me::FollowingBulkRetrieveResponse

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

Get the current user’s followed artists.

Parameters:

  • after (String)

    The last artist ID retrieved from the previous request.

  • limit (Integer)

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

  • type (Symbol, :artist)

    The ID type: currently only ‘artist` is supported.

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

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/spotted/resources/me/following.rb', line 25

def bulk_retrieve(params)
  parsed, options = Spotted::Me::FollowingBulkRetrieveParams.dump_request(params)
  @client.request(
    method: :get,
    path: "me/following",
    query: parsed,
    model: Spotted::Models::Me::FollowingBulkRetrieveResponse,
    options: options
  )
end

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

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

Check to see if the current user is following one or more artists or other Spotify users.

Parameters:

Returns:

  • (Array<Boolean>)

See Also:



53
54
55
56
57
58
59
60
61
62
# File 'lib/spotted/resources/me/following.rb', line 53

def check(params)
  parsed, options = Spotted::Me::FollowingCheckParams.dump_request(params)
  @client.request(
    method: :get,
    path: "me/following/contains",
    query: parsed,
    model: Spotted::Internal::Type::ArrayOf[Spotted::Internal::Type::Boolean],
    options: options
  )
end

#follow(ids:, request_options: {}) ⇒ nil

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

Add the current user as a follower of one or more artists or other Spotify users.

Parameters:

  • ids (Array<String>)

    A JSON array of the artist or user [Spotify IDs](/documentation/web-api/concepts

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

Returns:

  • (nil)

See Also:



79
80
81
82
# File 'lib/spotted/resources/me/following.rb', line 79

def follow(params)
  parsed, options = Spotted::Me::FollowingFollowParams.dump_request(params)
  @client.request(method: :put, path: "me/following", body: parsed, model: NilClass, options: options)
end

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

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

Remove the current user as a follower of one or more artists or other Spotify users.

Parameters:

  • ids (Array<String>)

    A JSON array of the artist or user [Spotify IDs](/documentation/web-api/concepts

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

Returns:

  • (nil)

See Also:



99
100
101
102
103
104
105
106
107
108
# File 'lib/spotted/resources/me/following.rb', line 99

def unfollow(params = {})
  parsed, options = Spotted::Me::FollowingUnfollowParams.dump_request(params)
  @client.request(
    method: :delete,
    path: "me/following",
    body: parsed,
    model: NilClass,
    options: options
  )
end