Skip to content

Commit 923ffb1

Browse files
authored
Add function overloading for typings in getUserPlaylists - Fixes #135 (#156)
1 parent 0fa940e commit 923ffb1

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

src/typings/spotify-web-api.d.ts

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -368,19 +368,37 @@ declare namespace SpotifyWebApi {
368368
getUser(userId: string, options?: Object, callback?: ResultsCallback<SpotifyApi.UserProfileResponse>) : Promise<SpotifyApi.UserProfileResponse>;
369369

370370
/**
371-
* Fetches a list of the current user's playlists.
371+
* Fetches a list of a user's playlists.
372372
* See [Get a List of a User's Playlists](https://developer.spotify.com/web-api/get-list-users-playlists/) on
373373
* the Spotify Developer site for more information about the endpoint.
374374
*
375-
* @param {string} userId An optional id of the user. If you know the Spotify URI it is easy
376-
* to find the id (e.g. spotify:user:<here_is_the_id>). If not provided, the id of the user that granted
377-
* the permissions will be used.
375+
* @param {string} userId The id for the owner of the playlists. If you know the Spotify URI it is easy
376+
* to find the id (e.g. spotify:user:<here_is_the_id>).
378377
* @param {Object} options A JSON object with options that can be passed
379378
* @param {function(Object,Object)} callback An optional callback that receives 2 parameters. The first
380379
* one is the error object (null if no error), and the second is the value if the request succeeded.
381380
* @return {Object} Null if a callback is provided, a `Promise` object otherwise
382381
*/
383-
getUserPlaylists(userId?: string, options?: Object, callback?: ResultsCallback<SpotifyApi.ListOfUsersPlaylistsResponse>) : Promise<SpotifyApi.ListOfUsersPlaylistsResponse>;
382+
getUserPlaylists(
383+
userId: string,
384+
options?: Object,
385+
callback?: ResultsCallback<SpotifyApi.ListOfUsersPlaylistsResponse>
386+
): Promise<SpotifyApi.ListOfUsersPlaylistsResponse>;
387+
388+
/**
389+
* Fetches a list of the playlists owned by the user who granted the access token's playlists
390+
* See [Get a List of a User's Playlists](https://developer.spotify.com/web-api/get-list-users-playlists/) on
391+
* the Spotify Developer site for more information about the endpoint.
392+
*
393+
* @param {Object} options A JSON object with options that can be passed
394+
* @param {function(Object,Object)} callback An optional callback that receives 2 parameters. The first
395+
* one is the error object (null if no error), and the second is the value if the request succeeded.
396+
* @return {Object} Null if a callback is provided, a `Promise` object otherwise
397+
*/
398+
getUserPlaylists(
399+
options?: Object,
400+
callback?: ResultsCallback<SpotifyApi.ListOfUsersPlaylistsResponse>
401+
): Promise<SpotifyApi.ListOfUsersPlaylistsResponse>;
384402

385403
/**
386404
* Fetches a specific playlist.
@@ -751,7 +769,7 @@ declare namespace SpotifyWebApi {
751769
getCategoryPlaylists(categoryId: string, options?: Object, callback?: ResultsCallback<SpotifyApi.CategoryPlaylistsReponse>) : Promise<SpotifyApi.CategoryPlaylistsReponse>;
752770

753771
// the search method added to allow access to it in typescript
754-
772+
755773
/**
756774
* Get Spotify catalog information about artists, albums, tracks or playlists that match a keyword string.
757775
* See [Search for an Item](https://developer.spotify.com/web-api/search-item/) on
@@ -820,7 +838,7 @@ declare namespace SpotifyWebApi {
820838
searchPlaylists(query: string, options?: SpotifyApi.SearchForItemParameterObject, callback?: ResultsCallback<SpotifyApi.PlaylistSearchResponse>) : Promise<SpotifyApi.PlaylistSearchResponse>;
821839

822840
/**
823-
* Get audio feature information for a single track identified by its unique Spotify ID.
841+
* Get audio feature information for a single track identified by its unique Spotify ID.
824842
* See [Get Audio Analysis for a Track](https://developer.spotify.com/documentation/web-api/https://developer.spotify.com/documentation/web-api/reference/tracks/get-audio-analysis/) on
825843
* the Spotify Developer site for more information about the endpoint.
826844
* @param {string} trackId The id of the track. If you know the Spotify URI it is easy
@@ -876,7 +894,7 @@ declare namespace SpotifyWebApi {
876894
* @return {Object} Null if a callback is provided, a `Promise` object otherwise
877895
*/
878896
getAvailableGenreSeeds(callback?: ResultsCallback<SpotifyApi.AvailableGenreSeedsResponse>) : Promise<SpotifyApi.AvailableGenreSeedsResponse>;
879-
897+
880898
/**
881899
* Get information about a user’s available devices.
882900
* See [Get a User’s Available Devices](https://developer.spotify.com/web-api/get-a-users-available-devices/) on

0 commit comments

Comments
 (0)