@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.46 kB
JavaScript
"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.0.1";
class SupplierGroups extends OpenApi_1.default {
getVersion() {
return this.version ? this.version : VERSION;
}
setVersion(version) {
this.version = version;
return this;
}
getUrlSegment() {
return "suppliersapi/";
}
constructor(authToken) {
super(authToken);
this.version = "";
}
/**
*
* @see https://apis.e-conomic.com/#Suppliers..tag/Groups/operation/GetNumberOfGroups
* @param {number} cursorValue
* @returns {Promise<HttpResponse>}
*/
count() {
const requestObj = {
method: "get",
url: `${this.getUrlSegment()}${this.getVersion()}/Groups/count`,
};
return this._httpRequest(requestObj);
}
/**
* Get all supplier groups
*
* @see https://apis.e-conomic.com/#Suppliers..tag/Groups/operation/GetAllGroups
* @param {number} cursorValue
* @returns {Promise<HttpResponse<AllSupplierGroups>>}
*/
getAll(cursorValue = 0) {
const requestObj = {
method: "get",
url: `${this.getUrlSegment()}${this.getVersion()}/Groups?cursor=${cursorValue}`,
};
return this._httpRequest(requestObj);
}
/**
* This endpoint is to load a page of Supplier Groups.
*
* @see https://apis.e-conomic.com/#Suppliers..tag/Groups/operation/GetPageOfGroups
*
* @param {number} offset
* @param {number} limit
* @returns {Promise<HttpResponse>}
*/
get(skipPages = 0, limit = 100) {
const requestObj = {
method: "get",
url: `${this.getUrlSegment()}${this.getVersion()}/Groups/paged?skippages=${skipPages}&pagesize=${limit}`,
};
return this._httpRequest(requestObj);
}
/**
* Get single supplier group.
*
* @see https://apis.e-conomic.com/#Suppliers..tag/Groups/operation/GetGroupById
*
* @param {number} id
* @returns {Promise<HttpResponse>}
*/
getFor(id) {
const requestObj = {
method: "get",
url: `${this.getUrlSegment()}${this.getVersion()}/Groups/${id}`,
};
return this._httpRequest(requestObj);
}
/**
* Create a new supplier group
*
* @see https://apis.e-conomic.com/#Suppliers..tag/Groups/operation/CreateGroup
* @param {SupplierGroup} SupplierGroup
* @returns {Promise<HttpResponse>}
*/
create(data) {
const requestObj = {
method: "post",
url: `${this.getUrlSegment()}${this.getVersion()}/Groups`,
data: data,
};
return this._httpRequest(requestObj);
}
/**
* supplier group update
*
* @see https://apis.e-conomic.com/#Suppliers..tag/Groups/operation/UpdateGroupById
* @param {SupplierGroup} data
* @returns {Promise<HttpResponse>}
*/
update(data) {
const requestObj = {
method: "put",
url: `${this.getUrlSegment()}${this.getVersion()}/Groups`,
data: data,
};
return this._httpRequest(requestObj);
}
}
exports.default = SupplierGroups;