UNPKG

@phasesdk/api-client-for-economic

Version:

e-conomic REST API Library for Node.js is a powerful tool designed to simplify integration with the e-conomic platform for developers building Node.js applications. With this library, developers can effortlessly leverage the full functionality of the e-co

70 lines (69 loc) 2.19 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const OpenApi_1 = __importDefault(require("../../OpenApi")); const VERSION = "v22.0.0"; class Projects extends OpenApi_1.default { getVersion() { return this.version ? this.version : VERSION; } setVersion(version) { this.version = version; return this; } getUrlSegment() { return "api/"; } constructor(authToken) { super(authToken); this.version = ""; } /** * Use this endpoint to retrieve all Projects in bulk. Max number of items returned in a single call is 1000 * * @see https://apis.e-conomic.com/redoc.html#tag/Projects/operation/GetAllProjects * * @returns {Promise<HttpResponse>} */ getAll() { const requestObj = { method: "get", url: `${this.getUrlSegment()}${this.getVersion()}/projects`, }; return this._httpRequest(requestObj); } /** * This endpoint is to load a collection of Projects with pagination. * * @see https://apis.e-conomic.com/#Projects..tag/Projects/operation/GetPageOfProjects * * @param {number} offset * @param {number} limit * @returns {Promise<HttpResponse>} */ get(offset = 0, limit = 100) { const requestObj = { method: "get", url: `${this.getUrlSegment()}${this.getVersion()}/projects/paged?skippages=${offset}&pagesize=${limit}`, }; return this._httpRequest(requestObj); } /** * This endpoint is to load a single Project by id/number. * * @see https://apis.e-conomic.com/redoc.html#tag/Projects/operation/GetProjectById * * @param {number} id * @returns {Promise<HttpResponse>} */ getFor(id) { const requestObj = { method: "get", url: `${this.getUrlSegment()}${this.getVersion()}/projects/${id}`, }; return this._httpRequest(requestObj); } } exports.default = Projects;