UNPKG

ctan

Version:

CTAN (Comprehensive TeX Archive Network) API client for Node.js

71 lines (70 loc) 3.02 kB
"use strict"; var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); var client_exports = {}; __export(client_exports, { Client: () => Client }); module.exports = __toCommonJS(client_exports); var import_client_base = require("../../client-base.js"); var import_mixin = require("../search/mixin.js"); var schemas = __toESM(require("./schemas.js")); class Client extends import_client_base.ClientBase { constructor(base) { super(base); } async authors(params, config) { return await this.get(`/json/2.0/authors`, (0, import_client_base.buildParams)(params, ["key"]), schemas.Authors, config); } async author(key, params, config) { return await this.get(`/json/2.0/author/${key}`, (0, import_client_base.buildParams)(params, ["ref"]), schemas.Authors.items, config); } async topics(params, config) { return await this.get("/json/2.0/topics", (0, import_client_base.buildParams)(params, ["key"]), schemas.Topics, config); } async topic(key, params, config) { return await this.get(`/json/2.0/topic/${key}`, (0, import_client_base.buildParams)(params, ["ref"]), schemas.Topic, config); } async packages(params, config) { return await this.get("/json/2.0/packages", (0, import_client_base.buildParams)(params, ["key"]), schemas.Packages, config); } async pkg(key, params, config) { const urlparams = (0, import_client_base.buildParams)(params, ["drop", "keep-url"]); urlparams.delete("drop"); return await this.get(`/json/2.0/pkg/${key}`, urlparams, schemas.Package, config); } async licenses(params, config) { return await this.get("/json/2.0/licenses", (0, import_client_base.buildParams)(params, ["key"]), schemas.Licenses, config); } async version(config) { return await this.get("/json/2.0/version", null, schemas.ApiVersion, config); } } (() => { import_mixin.Searchable.mixin(Client); })(); // Annotate the CommonJS export names for ESM import in node: 0 && (module.exports = { Client });