diff options
| author | Fuwn <[email protected]> | 2022-03-20 01:28:42 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2022-03-20 01:28:42 -0700 |
| commit | 03f2c8e35ba70c9d9496fd5ad5403520f7ebdc53 (patch) | |
| tree | 568e508aff6db6325719abcb2c601520264c5de4 /src/datasources | |
| download | graphql-api-03f2c8e35ba70c9d9496fd5ad5403520f7ebdc53.tar.xz graphql-api-03f2c8e35ba70c9d9496fd5ad5403520f7ebdc53.zip | |
feat: 0.1.0 :star:
Diffstat (limited to 'src/datasources')
| -rw-r--r-- | src/datasources/senpy.js | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/datasources/senpy.js b/src/datasources/senpy.js new file mode 100644 index 0000000..1d9ba2a --- /dev/null +++ b/src/datasources/senpy.js @@ -0,0 +1,27 @@ +const { RESTDataSource } = require("apollo-datasource-rest"); + +module.exports = class SenpyAPI extends RESTDataSource { + constructor() { + super(); + + /** + * We have to use the <workers.dev> domain instead of the custom domain + * because worker intercommunication still isn't a thing... + * + * Tracking: <https://community.cloudflare.com/t/issue-with-worker-to-worker-https-request/94472> + */ + this.baseURL = "https://senpy-club-api-worker.fuwn.workers.dev/v2/"; + } + + async getRandom() { + return this.get("random"); + } + + async getLanguages() { + return this.get("languages"); + } + + async getLanguage(language) { + return this.get(`language/${language}`); + } +}; |