From 03f2c8e35ba70c9d9496fd5ad5403520f7ebdc53 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Sun, 20 Mar 2022 01:28:42 -0700 Subject: feat: 0.1.0 :star: --- src/datasources/senpy.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/datasources/senpy.js (limited to 'src/datasources/senpy.js') 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 domain instead of the custom domain + * because worker intercommunication still isn't a thing... + * + * Tracking: + */ + 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}`); + } +}; -- cgit v1.2.3