shipstation-node
Version:
Unofficial Node.js wrapper for the ShipStation API
90 lines (89 loc) • 2.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Carriers = void 0;
const BaseResource_1 = require("../../BaseResource");
/**
* [Official Documentation](https://docs.shipstation.com/openapi/carriers)
*
* Retreive useful details about the carriers connected to your accounts, including carrier IDs, service IDs, advanced
* options, and available carrier package types.
*/
class Carriers extends BaseResource_1.BaseResource {
constructor(shipstation) {
super(shipstation, 'carriers');
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/carriers/get_carrier_by_id)
*
* Retrive details about a specific carrier by its carrier id.
*
* @param carrierId [1-25] characters `^se(-[a-z0-9]+)+$`
*
* @returns Carrier details
*/
async getById(carrierId) {
return this.shipstation.request({
url: `${this.baseUrl}/${carrierId}`,
method: 'GET'
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/carriers/list_carriers)
*
* List all carriers that have been added to this account.
*
* @returns A list of carriers
*/
async list() {
return this.shipstation.request({
url: this.baseUrl,
method: 'GET'
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/carriers/get_carrier_options)
*
* Get a list of the options available for a specific carriers.
*
* @param carrierId [1-25] characters `^se(-[a-z0-9]+)+$`
*
* @returns A list of options for the carrier
*/
async getOptions(carrierId) {
return this.shipstation.request({
url: `${this.baseUrl}/${carrierId}/options`,
method: 'GET'
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/carriers/list_carrier_services)
*
* List the services associated with a specific carrier id.
*
* @param carrierId [1-25] characters `^se(-[a-z0-9]+)+$`
*
* @returns A list of services for the carrier
*/
async listServices(carrierId) {
return this.shipstation.request({
url: `${this.baseUrl}/${carrierId}/services`,
method: 'GET'
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/carriers/list_carrier_services)
*
* List the package types associated with a specific carrier.
*
* @param carrierId [1-25] characters `^se(-[a-z0-9]+)+$`
*
* @returns A list of package types for the carrier
*/
async listPackageTypes(carrierId) {
return this.shipstation.request({
url: `${this.baseUrl}/${carrierId}/packages`,
method: 'GET'
});
}
}
exports.Carriers = Carriers;