From 4d82a03863bdf49f8dc462468e3ca565c07acf1b Mon Sep 17 00:00:00 2001 From: RemixDev Date: Thu, 22 Apr 2021 10:30:52 +0200 Subject: [PATCH] Added empty object as options default --- deezer/api.js | 114 +++++++++++++++++++++++----------------------- deezer/gw.js | 18 ++++---- package-lock.json | 4 +- package.json | 2 +- 4 files changed, 69 insertions(+), 69 deletions(-) diff --git a/deezer/api.js b/deezer/api.js index 5b652f7..e531bd9 100644 --- a/deezer/api.js +++ b/deezer/api.js @@ -66,19 +66,19 @@ class API{ return this.get_album(`upc:${upc}`) } - get_album_comments(album_id, options){ + get_album_comments(album_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`album/${album_id}/comments`, {index, limit}) } - get_album_fans(album_id, options){ + get_album_fans(album_id, options={}){ const index = options.index || 0 const limit = options.limit || 100 return this.api_call(`album/${album_id}/fans`, {index, limit}) } - get_album_tracks(album_id, options){ + get_album_tracks(album_id, options={}){ const index = options.index || 0 const limit = options.limit || -1 return this.api_call(`album/${album_id}/tracks`, {index, limit}) @@ -88,79 +88,79 @@ class API{ return this.api_call(`artist/${artist_id}`) } - get_artist_top(artist_id, options){ + get_artist_top(artist_id, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`artist/${artist_id}/top`, {index, limit}) } - get_artist_albums(artist_id, options){ + get_artist_albums(artist_id, options={}){ const index = options.index || 0 const limit = options.limit || -1 return this.api_call(`artist/${artist_id}/albums`, {index, limit}) } - get_artist_comments(artist_id, options){ + get_artist_comments(artist_id, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`artist/${artist_id}/comments`, {index, limit}) } - get_artist_fans(artist_id, options){ + get_artist_fans(artist_id, options={}){ const index = options.index || 0 const limit = options.limit || 100 return this.api_call(`artist/${artist_id}/fans`, {index, limit}) } - get_artist_related(artist_id, options){ + get_artist_related(artist_id, options={}){ const index = options.index || 0 const limit = options.limit || 20 return this.api_call(`artist/${artist_id}/related`, {index, limit}) } - get_artist_radio(artist_id, options){ + get_artist_radio(artist_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`artist/${artist_id}/radio`, {index, limit}) } - get_artist_playlists(artist_id, options){ + get_artist_playlists(artist_id, options={}){ const index = options.index || 0 const limit = options.limit || -1 return this.api_call(`artist/${artist_id}/playlists`, {index, limit}) } - get_chart(genre_id=0, options){ + get_chart(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`chart/${genre_id}`, {index, limit}) } - get_chart_tracks(genre_id=0, options){ + get_chart_tracks(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`chart/${genre_id}/tracks`, {index, limit}) } - get_chart_albums(genre_id=0, options){ + get_chart_albums(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`chart/${genre_id}/albums`, {index, limit}) } - get_chart_artists(genre_id=0, options){ + get_chart_artists(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`chart/${genre_id}/artists`, {index, limit}) } - get_chart_playlists(genre_id=0, options){ + get_chart_playlists(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`chart/${genre_id}/playlists`, {index, limit}) } - get_chart_podcasts(genre_id=0, options){ + get_chart_podcasts(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`chart/${genre_id}/podcasts`, {index, limit}) @@ -170,7 +170,7 @@ class API{ return this.api_call(`comment/${comment_id}`) } - get_editorials(options){ + get_editorials(options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call('editorial', {index, limit}) @@ -180,25 +180,25 @@ class API{ return this.api_call(`editorial/${genre_id}`) } - get_editorial_selection(genre_id=0, options){ + get_editorial_selection(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`editorial/${genre_id}/selection`, {index, limit}) } - get_editorial_charts(genre_id=0, options){ + get_editorial_charts(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`editorial/${genre_id}/charts`, {index, limit}) } - get_editorial_releases(genre_id=0, options){ + get_editorial_releases(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`editorial/${genre_id}/releases`, {index, limit}) } - get_genres(options){ + get_genres(options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call('genre', {index, limit}) @@ -208,13 +208,13 @@ class API{ return this.api_call(`genre/${genre_id}`) } - get_genre_artists(genre_id=0, options){ + get_genre_artists(genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`genre/${genre_id}/artists`, {index, limit}) } - get_genre_radios( genre_id=0, options){ + get_genre_radios( genre_id=0, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`genre/${genre_id}/radios`, {index, limit}) @@ -232,49 +232,49 @@ class API{ return this.api_call(`playlist/${playlist_id}`) } - get_playlist_comments(album_id, options){ + get_playlist_comments(album_id, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call(`playlist/${album_id}/comments`, {index, limit}) } - get_playlist_fans(album_id, options){ + get_playlist_fans(album_id, options={}){ const index = options.index || 0 const limit = options.limit || 100 return this.api_call(`playlist/${album_id}/fans`, {index, limit}) } - get_playlist_tracks(album_id, options){ + get_playlist_tracks(album_id, options={}){ const index = options.index || 0 const limit = options.limit || -1 return this.api_call(`playlist/${album_id}/tracks`, {index, limit}) } - get_playlist_radio(album_id, options){ + get_playlist_radio(album_id, options={}){ const index = options.index || 0 const limit = options.limit || 100 return this.api_call(`playlist/${album_id}/radio`, {index, limit}) } - get_radios(options){ + get_radios(options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call('radio', {index, limit}) } - get_radios_genres(options){ + get_radios_genres(options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call('radio/genres', {index, limit}) } - get_radios_top(options){ + get_radios_top(options={}){ const index = options.index || 0 const limit = options.limit || 50 return this.api_call('radio/top', {index, limit}) } - get_radios_lists(options){ + get_radios_lists(options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call('radio/lists', {index, limit}) @@ -284,7 +284,7 @@ class API{ return this.api_call(`radio/${radio_id}`) } - get_radio_tracks(radio_id, options){ + get_radio_tracks(radio_id, options={}){ const index = options.index || 0 const limit = options.limit || 40 return this.api_call(`radio/${radio_id}/tracks`, {index, limit}) @@ -303,7 +303,7 @@ class API{ return query.trim() } - _generate_search_args(query, options){ + _generate_search_args(query, options={}){ const strict = options.strict || false const order = options.order || SearchOrder.RANKING const index = options.index || 0 @@ -314,43 +314,43 @@ class API{ return args } - search(query, options){ - const args = this._generate_search_args(query, options) + search(query, options={}){ + const args = this._generate_search_args(query, options={}) return this.api_call('search', args) } - advanced_search(filters, options){ + advanced_search(filters, options={}){ const query = this._generate_search_advanced_query(filters) - return this.search(query, options) + return this.search(query, options={}) } - search_album(query, options){ - const args = this._generate_search_args(query, options) + search_album(query, options={}){ + const args = this._generate_search_args(query, options={}) return this.api_call('search/album', args) } - search_artist(query, options){ - const args = this._generate_search_args(query, options) + search_artist(query, options={}){ + const args = this._generate_search_args(query, options={}) return this.api_call('search/artist', args) } - search_playlist(query, options){ - const args = this._generate_search_args(query, options) + search_playlist(query, options={}){ + const args = this._generate_search_args(query, options={}) return this.api_call('search/playlist', args) } - search_radio(query, options){ - const args = this._generate_search_args(query, options) + search_radio(query, options={}){ + const args = this._generate_search_args(query, options={}) return this.api_call('search/radio', args) } - search_track(query, options){ - const args = this._generate_search_args(query, options) + search_track(query, options={}){ + const args = this._generate_search_args(query, options={}) return this.api_call('search/track', args) } - search_user(query, options){ - const args = this._generate_search_args(query, options) + search_user(query, options={}){ + const args = this._generate_search_args(query, options={}) return this.api_call('search/user', args) } @@ -366,49 +366,49 @@ class API{ return this.api_call(`user/${user_id}`) } - get_user_albums(user_id, options){ + get_user_albums(user_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`user/${user_id}/albums`, {index, limit}) } - get_user_artists(user_id, options){ + get_user_artists(user_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`user/${user_id}/artists`, {index, limit}) } - get_user_flow(user_id, options){ + get_user_flow(user_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`user/${user_id}/flow`, {index, limit}) } - get_user_following(user_id, options){ + get_user_following(user_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`user/${user_id}/followings`, {index, limit}) } - get_user_followers(user_id, options){ + get_user_followers(user_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`user/${user_id}/followers`, {index, limit}) } - get_user_playlists(user_id, options){ + get_user_playlists(user_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`user/${user_id}/playlists`, {index, limit}) } - get_user_radios(user_id, options){ + get_user_radios(user_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`user/${user_id}/radios`, {index, limit}) } - get_user_tracks(user_id, options){ + get_user_tracks(user_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call(`user/${user_id}/tracks`, {index, limit}) diff --git a/deezer/gw.js b/deezer/gw.js index d6c16d9..60dd8b7 100644 --- a/deezer/gw.js +++ b/deezer/gw.js @@ -76,7 +76,7 @@ class GW{ return this.api_call('deezer.getUserData') } - get_user_profile_page(user_id, tab, options){ + get_user_profile_page(user_id, tab, options={}){ const limit = options.limit || 10 return this.api_call('deezer.pageProfile', {user_id, tab, nb: limit}) } @@ -149,7 +149,7 @@ class GW{ }) } - async get_artist_top_tracks(art_id, options){ + async get_artist_top_tracks(art_id, options={}){ const limit = options.limit || 100 let tracks_array = [] let body = await this.api_call('artist.getTopTrack', {art_id, nb: limit}) @@ -160,7 +160,7 @@ class GW{ return tracks_array } - get_artist_discography(art_id, options){ + get_artist_discography(art_id, options={}){ const index = options.index || 0 const limit = options.limit || 25 return this.api_call('album.getDiscography', { @@ -320,7 +320,7 @@ class GW{ }) } - search_music(query, type, options){ + search_music(query, type, options={}){ const index = options.index || 0 const limit = options.limit || 10 return this.api_call('search.music', { @@ -334,7 +334,7 @@ class GW{ // Extra calls - async get_artist_discography_tabs(art_id, options){ + async get_artist_discography_tabs(art_id, options={}){ const limit = options.limit || 100 let index = 0 let releases = [] @@ -389,7 +389,7 @@ class GW{ return body } - async get_user_playlists(user_id, options){ + async get_user_playlists(user_id, options={}){ const limit = options.limit || 25 let user_profile_page = await this.get_user_profile_page(user_id, 'playlists', limit) let blog_name = user_profile_page.DATA.USER.BLOG_NAME || "Unknown" @@ -401,7 +401,7 @@ class GW{ return result } - async get_user_albums(user_id, options){ + async get_user_albums(user_id, options={}){ const limit = options.limit || 25 let data = await this.get_user_profile_page(user_id, 'albums', limit).TAB.albums.data let result = [] @@ -411,7 +411,7 @@ class GW{ return result } - async get_user_artists(user_id, options){ + async get_user_artists(user_id, options={}){ const limit = options.limit || 25 let data = this.get_user_profile_page(user_id, 'artists', limit).TAB.artists.data let result = [] @@ -421,7 +421,7 @@ class GW{ return result } - async get_user_tracks(user_id, options){ + async get_user_tracks(user_id, options={}){ const limit = options.limit || 25 let data = this.get_user_profile_page(user_id, 'loved', limit).TAB.loved.data let result = [] diff --git a/package-lock.json b/package-lock.json index 8795824..f9f5eb2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { "name": "deezer-js", - "version": "0.0.6", + "version": "0.0.7", "lockfileVersion": 2, "requires": true, "packages": { "": { - "version": "0.0.6", + "version": "0.0.7", "license": "GPL-3.0-or-later", "dependencies": { "got": "^11.8.2", diff --git a/package.json b/package.json index 1d8bf54..55dec52 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "deezer-js", - "version": "0.0.6", + "version": "0.0.7", "description": "A wrapper for all Deezer's APIs", "main": "deezer/index.js", "scripts": {