myanimelist-wrapper
Version:
A comprehensive TypeScript wrapper for the Jikan API v4 (unofficial MyAnimeList API)
172 lines • 4.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AnimeEndpoint = void 0;
class AnimeEndpoint {
constructor(client) {
this.client = client;
}
/**
* Get anime by ID
* @param id Anime ID
* @returns Promise with anime data
*/
async getById(id) {
return this.client.request(`/anime/${id}`);
}
/**
* Get anime characters and voice actors
* @param id Anime ID
* @returns Promise with anime characters data
*/
async getCharacters(id) {
return this.client.request(`/anime/${id}/characters`);
}
/**
* Get anime staff
* @param id Anime ID
* @returns Promise with anime staff data
*/
async getStaff(id) {
return this.client.request(`/anime/${id}/staff`);
}
/**
* Get anime episodes
* @param id Anime ID
* @param page Page number
* @returns Promise with anime episodes data
*/
async getEpisodes(id, page) {
return this.client.request(`/anime/${id}/episodes`, {
page,
});
}
/**
* Get anime episode by ID
* @param animeId Anime ID
* @param episodeId Episode ID
* @returns Promise with anime episode data
*/
async getEpisodeById(animeId, episodeId) {
return this.client.request(`/anime/${animeId}/episodes/${episodeId}`);
}
/**
* Get anime news
* @param id Anime ID
* @param page Page number
* @returns Promise with anime news data
*/
async getNews(id, page) {
return this.client.request(`/anime/${id}/news`, { page });
}
/**
* Get anime forum topics
* @param id Anime ID
* @param filter Filter topics (all, episode, other)
* @returns Promise with anime forum data
*/
async getForum(id, filter) {
return this.client.request(`/anime/${id}/forum`, { filter });
}
/**
* Get anime videos
* @param id Anime ID
* @returns Promise with anime videos data
*/
async getVideos(id) {
return this.client.request(`/anime/${id}/videos`);
}
/**
* Get anime pictures
* @param id Anime ID
* @returns Promise with anime pictures data
*/
async getPictures(id) {
return this.client.request(`/anime/${id}/pictures`);
}
/**
* Get anime statistics
* @param id Anime ID
* @returns Promise with anime statistics data
*/
async getStatistics(id) {
return this.client.request(`/anime/${id}/statistics`);
}
/**
* Get more anime info
* @param id Anime ID
* @returns Promise with more anime info
*/
async getMoreInfo(id) {
return this.client.request(`/anime/${id}/moreinfo`);
}
/**
* Get anime recommendations
* @param id Anime ID
* @returns Promise with anime recommendations data
*/
async getRecommendations(id) {
return this.client.request(`/anime/${id}/recommendations`);
}
/**
* Get anime user updates
* @param id Anime ID
* @param page Page number
* @returns Promise with anime user updates data
*/
async getUserUpdates(id, page) {
return this.client.request(`/anime/${id}/userupdates`, { page });
}
/**
* Get anime reviews
* @param id Anime ID
* @param page Page number
* @returns Promise with anime reviews data
*/
async getReviews(id, page) {
return this.client.request(`/anime/${id}/reviews`, {
page,
});
}
/**
* Get anime relations
* @param id Anime ID
* @returns Promise with anime relations data
*/
async getRelations(id) {
return this.client.request(`/anime/${id}/relations`);
}
/**
* Get anime themes
* @param id Anime ID
* @returns Promise with anime themes data
*/
async getThemes(id) {
return this.client.request(`/anime/${id}/themes`);
}
/**
* Get anime external links
* @param id Anime ID
* @returns Promise with anime external links data
*/
async getExternal(id) {
return this.client.request(`/anime/${id}/external`);
}
/**
* Get anime streaming links
* @param id Anime ID
* @returns Promise with anime streaming links data
*/
async getStreaming(id) {
return this.client.request(`/anime/${id}/streaming`);
}
/**
* Search for anime
* @param params Search parameters
* @returns Promise with anime search results
*/
async search(params) {
return this.client.request("/anime", params);
}
}
exports.AnimeEndpoint = AnimeEndpoint;
//# sourceMappingURL=anime.js.map