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

113 lines (112 loc) 3.57 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 = "v1.1.0"; class ProductGroups extends OpenApi_1.default { getVersion() { return this.version ? this.version : VERSION; } setVersion(version) { this.version = version; return this; } getUrlSegment() { return "productsapi/"; } constructor(authToken) { super(authToken); this.version = ""; } /** * * @see https://apis.e-conomic.com/#Products..tag/ProductGroups/operation/GetNumberOfProductGroups * @param {number} cursorValue * @returns {Promise<HttpResponse>} */ count() { const requestObj = { method: "get", url: `${this.getUrlSegment()}${this.getVersion()}/productgroups/count`, }; return this._httpRequest(requestObj); } /** * Get all product groups * * @see https://apis.e-conomic.com/#Products..tag/ProductGroups/operation/GetAllProductGroups * @param {number} cursorValue * @returns {Promise<HttpResponse<AllProductGroups>>} */ getAll(cursorValue = 0) { const requestObj = { method: "get", url: `${this.getUrlSegment()}${this.getVersion()}/productgroups?cursor=${cursorValue}`, }; return this._httpRequest(requestObj); } /** * This endpoint is to load a page of Employee Groups. * * @see https://apis.e-conomic.com/#Products..tag/ProductGroups/operation/GetPageOfProductGroups * * @param {number} offset * @param {number} limit * @returns {Promise<HttpResponse>} */ get(skipPages = 0, limit = 100) { const requestObj = { method: "get", url: `${this.getUrlSegment()}${this.getVersion()}/productgroups/paged?skippages=${skipPages}&pagesize=${limit}`, }; return this._httpRequest(requestObj); } /** * Get single product group. * * @see https://apis.e-conomic.com/#Products..tag/ProductGroups/operation/GetProductGroupById * * @param {number} id * @returns {Promise<HttpResponse>} */ getFor(id) { const requestObj = { method: "get", url: `${this.getUrlSegment()}${this.getVersion()}/productgroups/${id}`, }; return this._httpRequest(requestObj); } /** * Create a new product group * * @see https://apis.e-conomic.com/#Projects..tag/Employee-groups/operation/CreateEmployeeGroup * @param {ProductGroup} employeeGroup * @returns {Promise<HttpResponse>} */ create(data) { const requestObj = { method: "post", url: `${this.getUrlSegment()}${this.getVersion()}/productgroups`, data: data, }; return this._httpRequest(requestObj); } /** * Product group update * * @see https://apis.e-conomic.com/#Products..tag/ProductGroups/operation/GetAllProductGroups * @param {ProductGroup} data * @returns {Promise<HttpResponse>} */ update(data) { const requestObj = { method: "put", url: `${this.getUrlSegment()}${this.getVersion()}/productgroups`, data: data, }; return this._httpRequest(requestObj); } } exports.default = ProductGroups;