@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
62 lines (61 loc) • 1.96 kB
TypeScript
import { HttpResponse } from "../../types/Http.type";
import RestApi from "../RestApi";
import { AuthToken } from "../../types/Economic.type";
import { EconomicResponse, Pagination } from "../../types/Economic.type";
export type Unit = {
unitNumber: number;
name: string;
products: string;
self: string;
};
export type CreateUnit = Pick<Unit, "name">;
export type UpdateUnit = Pick<Unit, "name">;
export default class Units extends RestApi {
/**
* @constructor
*/
constructor(props: AuthToken);
getUrl(): string;
/**
* Get collection of units.
*
* @see https://restdocs.e-conomic.com/#units
* @param {number} offset
* @param {number} limit
* @returns {Promise<HttpResponse>}
*/
get(skipPages?: number, limit?: number): Promise<HttpResponse<EconomicResponse<Unit[], Pagination, any>>>;
/**
* Get a specific unit.
*
* @see https://restdocs.e-conomic.com/#get-units
* @param {number} unitNumber
* @returns {Promise<HttpResponse>}
*/
getFor(unitNumber: number): Promise<HttpResponse<Unit>>;
/**
* Create a new unit.
*
* @see https://restdocs.e-conomic.com/#post-units
* @param {CreateUnit} unitData
* @returns {Promise<HttpResponse<Unit>>}
*/
createUnit(unitData: CreateUnit): Promise<HttpResponse<Unit>>;
/**
* Update an existing unit.
*
* @see https://restdocs.e-conomic.com/#put-units-unitnumber
* @param {number} unitNumber
* @param {UpdateUnit} unitData
* @returns {Promise<HttpResponse<Supplier>>}
*/
updateUnit(unitNumber: number, unitData: UpdateUnit): Promise<HttpResponse<any>>;
/**
* Delete an existing unit.
*
* @see https://restdocs.e-conomic.com/#delete-units-unitnumber
* @param {number} unitNumber
* @returns {Promise<HttpResponse<void>>}
*/
deleteUnit(unitNumber: number): Promise<HttpResponse<void>>;
}