@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
71 lines (70 loc) • 2.27 kB
JavaScript
;
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 = "v5.0.1";
class Subscriptions extends OpenApi_1.default {
getVersion() {
return this.version ? this.version : VERSION;
}
setVersion(version) {
this.version = version;
return this;
}
getUrlSegment() {
return "subscriptionsapi/";
}
constructor(authToken) {
super(authToken);
this.version = "";
}
/**
* Use this endpoint to load a page of Subscriptions.
*
* @see https://apis.e-conomic.com/#Subscriptions..tag/Subscriptions/operation/GetAllSubscriptions
*
* @param {number} cursorValue
* @returns {Promise<HttpResponse>}
*/
getAll(cursorValue = 0) {
const requestObj = {
method: "get",
url: `${this.getUrlSegment()}${this.getVersion()}/subscriptions?cursor=${cursorValue}`,
};
return this._httpRequest(requestObj);
}
/**
* This endpoint is to load a page of Subscriptions.
*
* @see https://apis.e-conomic.com/#Subscriptions..tag/Subscriptions/operation/GetPageOfSubscriptions
*
* @param {number} offset
* @param {number} limit
* @returns {Promise<HttpResponse>}
*/
get(offset = 0, limit = 100) {
const requestObj = {
method: "get",
url: `${this.getUrlSegment()}${this.getVersion()}/subscriptions/paged?skippages=${offset}&pagesize=${limit}`,
};
return this._httpRequest(requestObj);
}
/**
* This endpoint is to load a single Subscription by number.
*
* @see https://apis.e-conomic.com/#Subscriptions..tag/Subscriptions/operation/GetSubscriptionById
*
* @param {number} id
* @returns {Promise<HttpResponse>}
*/
getFor(id) {
const requestObj = {
method: "get",
url: `${this.getUrlSegment()}${this.getVersion()}/subscriptions/${id}`,
};
return this._httpRequest(requestObj);
}
}
exports.default = Subscriptions;