Last active
June 19, 2018 20:54
-
-
Save martijnwalraven/0259c54d92f4394affea076377203b24 to your computer and use it in GitHub Desktop.
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
class MoviesAPI extends RESTDataSource { | |
baseURL = 'https://movies-api.example.com'; | |
async getMovie(id: string) { | |
return this.get(`movies/${id}`); | |
} | |
async getMostViewedMovies(limit: number = 10) { | |
const data = await this.get('movies', { | |
per_page: limit, | |
order_by: 'most_viewed', | |
}); | |
return data.results; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment