shipstation-node
Version:
Unofficial Node.js wrapper for the ShipStation API
68 lines (67 loc) • 2.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Manifests = void 0;
const BaseResource_1 = require("../../BaseResource");
/**
* [Official Documentation](https://docs.shipstation.com/openapi/manifests)
*
* A manifest is a document that provides a list of the day's shipments. It typically contains a barcode that allows the
* pickup driver to scan a single document to register all shipments, rather than scanning each shipment individually.
*/
class Manifests extends BaseResource_1.BaseResource {
constructor(shipstation) {
super(shipstation, 'manifests');
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/manifests/list_manifests)
*
* Similar to querying shipments, we allow you to query manifests since there will likely be a large number over a
* long period of time.
*
* @param params Options for listing the manifests
*
* @returns A list of manifests
*/
async list(params) {
return this.shipstation.request({
url: this.baseUrl,
method: 'GET',
params
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/manifests/get_manifest_by_id)
*
* Get Manifest By Id
*
* @param manifestId [1-25] characters `^se(-[a-z0-9]+)+$`
*
* @example "se-28529731"
*
* @returns A manifest
*/
async getById(manifestId) {
return this.shipstation.request({
url: `${this.baseUrl}/${manifestId}`,
method: 'GET'
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/manifests/create_manifest)
*
* Each ShipStation manifest is created for a specific warehouse, so you'll need to provide the warehouse_id rather
* than the ship_from address. You can create a warehouse for each location that you want to create manifests for.
*
* @param params Data for creating a manifest
*
* @returns A manifest
*/
async create(data) {
return this.shipstation.request({
url: this.baseUrl,
method: 'POST',
data
});
}
}
exports.Manifests = Manifests;