UNPKG

shipstation-node

Version:
162 lines (161 loc) 5.7 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Stores = void 0; const BaseResource_1 = require("../../BaseResource"); class Stores extends BaseResource_1.BaseResource { constructor(shipstation) { super(shipstation, 'stores'); } /** * [Official Documentation](https://www.shipstation.com/docs/api/stores/get-store/) * * This Get Store API call uses the `storeId` property to retrieve information related to a specific store. * * To find the `storeId` for a specific store and also to see the list of stores installed in your account, make a * [List Stores call](https://www.shipstation.com/docs/api/stores/list/). * * @param storeId Unique identifier for the store. * * @returns The store details. */ async get(storeId) { return this.shipstation.request({ url: `${this.baseUrl}/${storeId}`, method: 'GET' }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/stores/list/) * * Retrieve the list of installed stores on the account with this API call. * * @param params The parameters for the request. * * @returns The list of stores. */ async list(params) { return this.shipstation.request({ params, url: this.baseUrl, method: 'GET' }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/stores/list-marketplaces/) * * Lists the marketplaces that can be integrated with ShipStation. * * @returns The list of marketplaces. */ async listMarketplaces() { return this.shipstation.request({ url: `${this.baseUrl}/marketplaces`, method: 'GET' }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/stores/deactivate/) * * Deactivates the specified store. * * **Requirements:** * - You'll need a `storeId` to make this API call. * - To find the `storeId` for a specific store and also to see the list of stores installed in your account, make a * [List Stores call](https://www.shipstation.com/docs/api/stores/list/). * * @param storeId ID of the store to deactivate. * * @returns The status of the deactivate operation. */ async deactivate(storeId) { return this.shipstation.request({ url: `${this.baseUrl}/deactivate`, method: 'POST', data: { storeId } }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/stores/get-refresh-status/) * * Retrieves the refresh status of a given store. * * **Requirements:** * - You'll need a `storeId` to make this API call. * - To find the `storeId` for a specific store and also to see the list of stores installed in your account, make a * [List Stores call](https://www.shipstation.com/docs/api/stores/list/). * * @param storeId Specifies the store whose status will be retrieved. * * @returns The refresh rate data of the store. */ async getRefreshRate(storeId) { return this.shipstation.request({ url: `${this.baseUrl}/getrefreshstatus`, method: 'GET', params: { storeId } }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/stores/reactivate/) * * Reactivates the specified store. * * **Requirements:** * - You'll need a `storeId` to make this API call. * - To find the `storeId` for a specific store and also to see the list of stores installed in your account, make a * [List Stores call](https://www.shipstation.com/docs/api/stores/list/). * * @param storeId ID of the store to reactivate. * * @returns The status of the reactivate operation. */ async reactivate(storeId) { return this.shipstation.request({ url: `${this.baseUrl}/reactivate`, method: 'POST', data: { storeId } }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/stores/refresh/) * * Initiates a store refresh. * * To find the `storeId` for a specific store and also to see the list of stores installed in your account, make a * [List Stores call](https://www.shipstation.com/docs/api/stores/list/). * * @param params The parameters for the request. * * @returns The status of the refresh operation. */ async refresh(params) { return this.shipstation.request({ url: `${this.baseUrl}/refresh`, method: 'POST', params }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/stores/update/) * * Updates an existing store. This call does not currently support partial updates. The entire resource must be * provided in the body of the request. * * This PUT call uses the `storeId` property to update information related to a specific store. * * To find the `storeId` for a specific store and also to see the list of stores installed in your account, make a * [List Stores call](https://www.shipstation.com/docs/api/stores/list/). * * @param storeId Unique identifier for the store * * @returns The newly updated store. */ async update(storeId, data) { return this.shipstation.request({ url: `${this.baseUrl}/${storeId}`, method: 'PUT', data }); } } exports.Stores = Stores;