better-trakt
Version:
A Trakt.tv client with native Typescript support and quality of life features
47 lines • 1.73 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.Languages = void 0;
const utils_1 = require("../utils");
/**
* Languages api namespace
*/
class Languages {
constructor(config) {
this.config = {
apiUrl: `${config.apiUrl}/languages`,
client: config.client,
};
}
/**
* Get a list of all movie langauges, including names and codes.
* @returns
*/
listMovies() {
return this.listLanguages(this.config, 'movies');
}
/**
* Get a list of all show langauges, including names and codes.
* @returns
*/
listShows() {
return this.listLanguages(this.config, 'shows');
}
listLanguages({ client, apiUrl }, type) {
return __awaiter(this, void 0, void 0, function* () {
const url = `${apiUrl}/${type}`;
const response = yield (0, utils_1.fetch)(client, url);
return response;
});
}
}
exports.Languages = Languages;
//# sourceMappingURL=index.js.map