UNPKG

shipstation-node

Version:
67 lines (66 loc) 2.19 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Products = void 0; const BaseResource_1 = require("../../BaseResource"); class Products extends BaseResource_1.BaseResource { constructor(shipstation) { super(shipstation, 'products'); } /** * [Official Documentation](https://www.shipstation.com/docs/api/products/get-product/) * * **Requirements:** * - You'll need a `productId` to make this API call. * - Find a list of products for this account (`productId`) by a * [List Products call](https://www.shipstation.com/docs/api/products/list/). * * @param productId The system-generated identifier for the Product. * * @returns The product. */ async get(productId) { return this.shipstation.request({ url: `${this.baseUrl}/${productId}`, method: 'GET' }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/products/list/) * * Obtains a list of products that match the specified criteria. * * @param params The parameters for the request. * * @returns The list of products. */ async list(params) { return this.shipstation.request({ url: this.baseUrl, method: 'GET', params }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/products/update/) * * Updates an existing product. This call does not currently support partial updates. The entire resource must be * provided in the body of the request. * * **Requirements:** * - You'll need a `productId` to make this API call. * - Find a list of products for this account (`productId`) by a * [List Products call](https://www.shipstation.com/docs/api/products/list/). * * @param data The product data. * * @returns The status of the update operation. */ async update(data) { return this.shipstation.request({ url: `${this.baseUrl}/${data.productId}`, method: 'PUT', data }); } } exports.Products = Products;