Skip to content

Commit

Permalink
feat: markets API
Browse files Browse the repository at this point in the history
  • Loading branch information
noook committed Jul 19, 2023
1 parent 814e543 commit 113f763
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/api/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { $Fetch } from 'ofetch'
import { Headers, ofetch } from 'ofetch'
import { AlbumsApi, ArtistsApi, CategoriesApi, GenresApi, PlayerApi, PlaylistsApi, SearchApi, UsersApi } from '.'
import { AlbumsApi, ArtistsApi, CategoriesApi, GenresApi, MarketsApi, PlayerApi, PlaylistsApi, SearchApi, UsersApi } from '.'

export class SpotifyClient {
private token: null | string = null
Expand All @@ -22,6 +22,7 @@ export class SpotifyClient {
this.artists = new ArtistsApi(this.$fetch)
this.categories = new CategoriesApi(this.$fetch)
this.genres = new GenresApi(this.$fetch)
this.markets = new MarketsApi(this.$fetch)
this.player = new PlayerApi(this.$fetch)
this.playlists = new PlaylistsApi(this.$fetch)
this.search = new SearchApi(this.$fetch)
Expand All @@ -42,6 +43,8 @@ export class SpotifyClient {

public genres: GenresApi

public markets: MarketsApi

public player: PlayerApi

public playlists: PlaylistsApi
Expand Down
1 change: 1 addition & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export * from './albums'
export * from './artists'
export * from './categories'
export * from './genres'
export * from './markets'
export * from './player'
export * from './playlists'
export * from './search'
Expand Down
8 changes: 8 additions & 0 deletions src/api/markets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import type { GetMarketsResults } from '../types'
import { ApiPart } from './api.part'

export class MarketsApi extends ApiPart {
public getMarkets(): Promise<GetMarketsResults> {
return this.$fetch<GetMarketsResults>('/markets')
}
}
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export * from './artist'
export * from './album'
export * from './categories'
export * from './episode'
export * from './markets'
export * from './player'
export * from './playlist'
export * from './search'
Expand Down
3 changes: 3 additions & 0 deletions src/types/markets.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface GetMarketsResults {
markets: string[]
}

0 comments on commit 113f763

Please sign in to comment.