-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { RandomEndpoints } from '../constants'; | ||
import { Anime, Character, JikanResponse, Manga } from '../models'; | ||
import { BaseClient } from './base.client'; | ||
|
||
/** | ||
* **Random Client** | ||
* | ||
* Client used to access the Random Endpoints: | ||
* | ||
* See also: [Jikan Documentation](https://docs.api.jikan.moe/) | ||
*/ | ||
export class RandomClient extends BaseClient { | ||
/** | ||
* Get random anime | ||
*/ | ||
public async getRandomAnime(): Promise<JikanResponse<Anime>> { | ||
return this.getResource<JikanResponse<Anime>>(RandomEndpoints.randomAnime); | ||
} | ||
|
||
/** | ||
* Get random manga | ||
*/ | ||
public async getRandomManga(): Promise<JikanResponse<Manga>> { | ||
return this.getResource(RandomEndpoints.randomManga); | ||
} | ||
|
||
/** | ||
* Get random character | ||
*/ | ||
public async getRandomCharacters(): Promise< | ||
JikanResponse<Omit<Character, 'anime' | 'manga' | 'voices'>> | ||
> { | ||
return this.getResource(RandomEndpoints.randomManga); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const RandomEndpoints = { | ||
randomAnime: '/random/anime', | ||
randomManga: '/random/manga', | ||
randomCharacters: '/random/characters', | ||
} as const; |