-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
32 additions
and
216 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ const config: CodegenConfig = { | |
}, | ||
}; | ||
|
||
export default config; | ||
export default config; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ export type DataSourceContext = { | |
dataSources: { | ||
spotifyAPI: SpotifyAPI; | ||
}; | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { RESTDataSource } from "@apollo/datasource-rest"; | ||
|
||
export class SpotifyAPI extends RESTDataSource { | ||
baseURL = "https://spotify-demo-api-fe224840a08c.herokuapp.com/v1/"; | ||
|
||
async getFeaturedPlaylists() { | ||
const { playlists = [] } = await this.get("browse/featured-playlists"); | ||
const { items = [] } = playlists; | ||
return items; | ||
} | ||
|
||
addItemsToPlaylist(input: { playlistId: string; uris: string[] }) { | ||
const { playlistId, uris } = input; | ||
return this.post(`playlists/${playlistId}/tracks`, { | ||
params: { | ||
uris: uris.join(","), | ||
}, | ||
}); | ||
} | ||
|
||
getPlaylist(playlistId: string) { | ||
return this.get(`playlists/${playlistId}`); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,4 +24,4 @@ async function startApolloServer() { | |
`); | ||
} | ||
|
||
startApolloServer(); | ||
startApolloServer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,4 +30,4 @@ export type AddItemsToPlaylistPayloadModel = { | |
success: boolean; | ||
message: string; | ||
playlistId: string; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -50,4 +50,4 @@ export const resolvers: Resolvers = { | |
return durationMs; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,4 +53,4 @@ export const typeDefs = gql` | |
"The URI for the track, usually a Spotify link." | ||
uri: String! | ||
} | ||
`; | ||
`; |