diff options
| author | Fuwn <[email protected]> | 2024-03-03 00:34:41 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-03-03 00:34:41 -0800 |
| commit | 4b0be7c8817fa9f207543fe874c8c849ce6d7977 (patch) | |
| tree | fa7d3d12b910dfcd06aa842f60c620e542e77b20 /src/lib/Data | |
| parent | feat(badges): remove back to profile (diff) | |
| download | due.moe-4b0be7c8817fa9f207543fe874c8c849ce6d7977.tar.xz due.moe-4b0be7c8817fa9f207543fe874c8c849ce6d7977.zip | |
feat(girls): senpy integration
Diffstat (limited to 'src/lib/Data')
| -rw-r--r-- | src/lib/Data/senpy.ts | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/Data/senpy.ts b/src/lib/Data/senpy.ts new file mode 100644 index 00000000..b3d79826 --- /dev/null +++ b/src/lib/Data/senpy.ts @@ -0,0 +1,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; |