UNPKG

shipstation-node

Version:
106 lines (105 loc) 3.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Carriers = void 0; const BaseResource_1 = require("../../BaseResource"); class Carriers extends BaseResource_1.BaseResource { constructor(shipstation) { super(shipstation, 'carriers'); } /** * [Official Documentation](https://www.shipstation.com/docs/api/carriers/get/) * * Retrieves the shipping carrier account details for the specified `carrierCode`. Use this method to determine a * carrier's account balance. * * To find a specific `carrierCode`, make an API Call to [list the carriers](https://www.shipstation.com/docs/api/carriers/list/) * associated with your account. * * @param carrierCode The code of the carrier to retrieve. * * @returns The carrier details. */ async get(carrierCode) { return this.shipstation.request({ url: this.baseUrl, method: 'GET', params: { carrierCode } }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/carriers/list/) * * List all shipping providers connected to this account. * * @returns A list of carriers. */ async list() { return this.shipstation.request({ url: this.baseUrl, method: 'GET' }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/carriers/add-funds/) * * **Requires approval from apisupport@shipstation.com before use...** * * Adds funds to a carrier account using the payment information on file. * * **Requirements:** * - You'll need a `carrierCode` to make this API call. * - To find a specific `carrierCode`, make an API call to * [list the carriers](https://www.shipstation.com/docs/api/carriers/list/) associated with your account. * * @param carrierCode The carrier to add funds to. * @param amount The dollar amount to add to the account. The minimum value that can be added is $10.00. The maximum value is $10,000.00. * * @returns The updated carrier details. */ async addFunds(carrierCode, amount) { return this.shipstation.request({ url: `${this.baseUrl}/addfunds`, method: 'POST', data: { carrierCode, amount } }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/carriers/list-packages/) * * Retrieves a list of packages for the specified carrier. * * To find a specific `carrierCode`, make an API Call to * [list the carriers](https://www.shipstation.com/docs/api/carriers/list/) associated with your account. * * @param carrierCode The carrier's code * * @returns A list of packages. */ async listPackages(carrierCode) { return this.shipstation.request({ url: `${this.baseUrl}/listpackages`, method: 'GET', params: { carrierCode } }); } /** * [Official Documentation](https://www.shipstation.com/docs/api/carriers/list-packages/) * * Retrieves the list of available shipping services provided by the specified carrier. * * To find a specific `carrierCode`, make an API Call to * [list the carriers](https://www.shipstation.com/docs/api/carriers/list/) associated with your account. * * @param carrierCode The carrier's code * * @returns A list of services. */ async listServices(carrierCode) { return this.shipstation.request({ url: `${this.baseUrl}/listservices`, method: 'GET', params: { carrierCode } }); } } exports.Carriers = Carriers;