Skip to content

Commit 07d2ee3

Browse files
authored
Add locale param for more endpoints (#1005)
* Add market and locale param for PlayerGetQueue * Add locale param for UsersTopItemsRequest
1 parent 6117406 commit 07d2ee3

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

SpotifyAPI.Web/Clients/Interfaces/IPlayerClient.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,5 +234,16 @@ public interface IPlayerClient
234234
/// </remarks>
235235
/// <returns></returns>
236236
Task<QueueResponse> GetQueue(CancellationToken cancel = default);
237+
238+
/// <summary>
239+
/// Get the list of objects that make up the user's queue.
240+
/// </summary>
241+
/// <param name="request">The request-model which contains required and optional parameters.</param>
242+
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
243+
/// <remarks>
244+
/// https://developer.spotify.com/documentation/web-api/reference/#/operations/get-queue
245+
/// </remarks>
246+
/// <returns></returns>
247+
Task<QueueResponse> GetQueue(PlayerGetQueueRequest request, CancellationToken cancel = default);
237248
}
238249
}

SpotifyAPI.Web/Clients/PlayerClient.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ public Task<QueueResponse> GetQueue(CancellationToken cancel = default)
2323
return API.Get<QueueResponse>(URLs.PlayerQueue(), cancel);
2424
}
2525

26+
public Task<QueueResponse> GetQueue(PlayerGetQueueRequest request, CancellationToken cancel = default)
27+
{
28+
Ensure.ArgumentNotNull(request, nameof(request));
29+
30+
return API.Get<QueueResponse>(URLs.PlayerQueue(), request.BuildQueryParams(), cancel);
31+
}
32+
2633
public Task<DeviceResponse> GetAvailableDevices(CancellationToken cancel = default)
2734
{
2835
return API.Get<DeviceResponse>(URLs.PlayerDevices(), cancel);
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
namespace SpotifyAPI.Web
2+
{
3+
public class PlayerGetQueueRequest : RequestParams
4+
{
5+
/// <summary>
6+
/// An ISO 3166-1 alpha-2 country code or the string from_token.
7+
/// Provide this parameter if you want to apply Track Relinking.
8+
/// </summary>
9+
/// <value></value>
10+
[QueryParam("market")]
11+
public string? Market { get; set; }
12+
13+
/// <summary>
14+
/// The desired language, consisting of an ISO 639-1 language code and an ISO 3166-1 alpha-2 country code,
15+
/// joined by an underscore. For example: es_MX, meaning "Spanish (Mexico)".
16+
/// Provide this parameter if you want the category strings returned in a particular language.
17+
/// Note that, if locale is not supplied, or if the specified language is not available,
18+
/// the category strings returned will be in the Spotify default language (American English).
19+
/// </summary>
20+
/// <value></value>
21+
[QueryParam("locale")]
22+
public string? Locale { get; set; }
23+
}
24+
}

SpotifyAPI.Web/Models/Request/UsersTopItemsRequest.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ public UsersTopItemsRequest(TimeRange timeRange)
3434
[QueryParam("offset")]
3535
public int? Offset { get; set; }
3636

37+
/// <summary>
38+
/// The desired language, consisting of an ISO 639-1 language code and an ISO 3166-1 alpha-2 country code,
39+
/// joined by an underscore. For example: es_MX, meaning "Spanish (Mexico)".
40+
/// Provide this parameter if you want the category strings returned in a particular language.
41+
/// Note that, if locale is not supplied, or if the specified language is not available,
42+
/// the category strings returned will be in the Spotify default language (American English).
43+
/// </summary>
44+
/// <value></value>
45+
[QueryParam("locale")]
46+
public string? Locale { get; set; }
47+
3748
}
3849
public enum TimeRange
3950
{

0 commit comments

Comments
 (0)