blob: 8c4f675f5606a94a66f5293d884b907e6ae7016b (
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
|
const senpyAPI = "https://api.senpy.club/v2";
export interface SenpyRandomImage {
language: string;
image: string;
}
class Senpy {
static async getImages(language: string): Promise<string[]> {
language = language.replace("#", "%23");
const response = await fetch(`${senpyAPI}/language/${language}`);
return await response.json();
}
static async getLanguages(): Promise<string[]> {
const response = await fetch(`${senpyAPI}/languages`);
return await response.json();
}
static async getRandomImage(): Promise<SenpyRandomImage> {
const response = await fetch(`${senpyAPI}/random`);
return await response.json();
}
}
export default Senpy;
|