File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -74,4 +74,21 @@ export default class ArtistFetcher extends Fetcher {
7474 offset : offset
7575 } )
7676 }
77+
78+ /**
79+ * Fetch related artists
80+ *
81+ * @param {number } [limit] - The size for one page.
82+ * @param {number } [offset] - The offset index for first element.
83+ * @return {Promise }
84+ * @example api.artistFetcher.setArtistID('Cnv_K6i5Ft4y41SxLy').fetchRelatedArtists()
85+ * @see https://docs-en.kkbox.codes/v1.1/reference#artists-artist_id-relatedartists
86+ */
87+ fetchRelatedArtists ( limit = undefined , offset = undefined ) {
88+ return this . http . get ( ENDPOINT + this . artist_id + '/related-artists' , {
89+ territory : this . territory ,
90+ limit : limit ,
91+ offset : offset
92+ } )
93+ }
7794}
Original file line number Diff line number Diff line change @@ -218,6 +218,12 @@ describe('Api Begin to Test', () => {
218218 artistFetcher . fetchTopTracks ( ) . then ( response => response . status . should . be . exactly ( 200 ) , reject => should . not . exists ( reject ) )
219219 } )
220220 } )
221+
222+ describe ( '#fetchRelatedArtists()' , ( ) => {
223+ it ( 'should response status 200' , ( done ) => {
224+ artistFetcher . fetchRelatedArtists ( ) . then ( response => response . status . should . be . exactly ( 200 ) , reject => should . not . exists ( reject ) )
225+ } )
226+ } )
221227 } )
222228
223229 describe ( 'Artist fetch album tests' , ( ) => {
You can’t perform that action at this time.
0 commit comments