Class: Spotted::Resources::Me::Player::Queue

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Queue

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

Parameters:



58
59
60
# File 'lib/spotted/resources/me/player/queue.rb', line 58

def initialize(client:)
  @client = client
end

Instance Method Details

#add(uri: , device_id: nil, request_options: {}) ⇒ nil

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

Add an item to be played next in the user’s current playback queue. This API only works for users who have Spotify Premium. The order of execution is not guaranteed when you use this API with other Player API endpoints.

Parameters:

  • uri (String)

    The uri of the item to add to the queue. Must be a track or an episode uri.

  • device_id (String)

    The id of the device this command is targeting. If

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

Returns:

  • (nil)

See Also:



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

def add(params)
  parsed, options = Spotted::Me::Player::QueueAddParams.dump_request(params)
  @client.request(
    method: :post,
    path: "me/player/queue",
    query: parsed,
    model: NilClass,
    options: options
  )
end

#get(request_options: {}) ⇒ Spotted::Models::Me::Player::QueueGetResponse

Get the list of objects that make up the user’s queue.

Parameters:

Returns:

See Also:



46
47
48
49
50
51
52
53
# File 'lib/spotted/resources/me/player/queue.rb', line 46

def get(params = {})
  @client.request(
    method: :get,
    path: "me/player/queue",
    model: Spotted::Models::Me::Player::QueueGetResponse,
    options: params[:request_options]
  )
end