blob: 869ec97016437f2943cda51364fca8b024c915cd (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
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 getBoysRandom() {
return this.get("boys/random");
}
async getLanguages() {
return this.get("languages");
}
async getBoysLanguages() {
return this.get("boys/languages");
}
async getLanguage(language) {
return this.get(`language/${language}`);
}
async getBoysLanguage(language) {
return this.get(`boys/language/${language}`);
}
async getMe() {
return this.get("me");
}
};
|