tmdbrjs
Version:
A TypeScript wrapper for The Movie Database (TMDB) API
161 lines • 6.11 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const apiURL_1 = __importDefault(require("../utils/apiURL"));
const BaseService_1 = require("../utils/BaseService");
class Tv extends BaseService_1.BaseService {
async getPopular(page) {
const url = new apiURL_1.default('tv/popular');
if (page) {
url.appendParam('page', page.toString());
}
const response = await this.apiClient.get(url.toString());
return response;
}
async getTopRated(page) {
const url = new apiURL_1.default('tv/top_rated');
if (page) {
url.appendParam('page', page.toString());
}
const response = await this.apiClient.get(url.toString());
return response;
}
async getAiringToday(page) {
const url = new apiURL_1.default('tv/airing_today');
if (page) {
url.appendParam('page', page.toString());
}
const response = await this.apiClient.get(url.toString());
return response;
}
async getOnTheAir(page) {
const url = new apiURL_1.default('tv/on_the_air');
if (page) {
url.appendParam('page', page.toString());
}
const response = await this.apiClient.get(url.toString());
return response;
}
async getLatest() {
const response = await this.apiClient.get('tv/latest');
return response;
}
async getById(id, options) {
return this.getByIdWithAppendToResponse('tv/{id}', id, options);
}
async getCredits(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/credits`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getAggregateCredits(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/aggregate_credits`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getExternalIds(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/external_ids`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getImages(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/images`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getVideos(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/videos`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getReviews(id, page) {
const url = new apiURL_1.default(`tv/${id.toString()}/reviews`);
if (page) {
url.appendParam('page', page.toString());
}
const response = await this.apiClient.get(url.toString());
return response;
}
async getSimilar(id, page) {
const url = new apiURL_1.default(`tv/${id.toString()}/similar`);
if (page) {
url.appendParam('page', page.toString());
}
const response = await this.apiClient.get(url.toString());
return response;
}
async getRecommendations(id, page) {
const url = new apiURL_1.default(`tv/${id.toString()}/recommendations`);
if (page) {
url.appendParam('page', page.toString());
}
const response = await this.apiClient.get(url.toString());
return response;
}
async getKeywords(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/keywords`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getTranslations(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/translations`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getContentRatings(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/content_ratings`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getWatchProviders(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/watch/providers`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getAlternativeTitles(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/alternative_titles`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getEpisodeGroups(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/episode_groups`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getScreenedTheatrically(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/screened_theatrically`);
const response = await this.apiClient.get(url.toString());
return response;
}
async getLists(id, page) {
const url = new apiURL_1.default(`tv/${id.toString()}/lists`);
if (page) {
url.appendParam('page', page.toString());
}
const response = await this.apiClient.get(url.toString());
return response;
}
async getChanges(id, startDate, endDate, page) {
const url = new apiURL_1.default(`tv/${id.toString()}/changes`);
if (startDate) {
url.appendParam('start_date', startDate);
}
if (endDate) {
url.appendParam('end_date', endDate);
}
if (page) {
url.appendParam('page', page.toString());
}
const response = await this.apiClient.get(url.toString());
return response;
}
async getAccountStates(id) {
const url = new apiURL_1.default(`tv/${id.toString()}/account_states`);
const response = await this.apiClient.get(url.toString());
return response;
}
}
exports.default = Tv;
//# sourceMappingURL=tv.js.map