shipstation-node
Version:
Unofficial Node.js wrapper for the ShipStation API
81 lines (80 loc) • 2.49 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PackagePickups = void 0;
const BaseResource_1 = require("../../BaseResource");
/**
* [Official Documentation](https://docs.shipstation.com/openapi/package_pickups)
*
* Scheduled pickups and manage pickup requests for supported carriers.
*/
class PackagePickups extends BaseResource_1.BaseResource {
constructor(shipstation) {
super(shipstation, 'pickups');
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/package_pickups/get_pickup_by_id)
*
* Get Pickup By ID
*
* @param pickupId Pickup Resource ID (>= 4 characters)
* @example "pik_3YcKU5zdtJuCqoeNwyqqbW"
*
* @returns Package pickup details
*/
async getById(pickupId) {
return this.shipstation.request({
url: `${this.baseUrl}/${pickupId}`,
method: 'GET'
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/package_pickups/list_scheduled_pickups)
*
* List all pickups that have been scheduled for this carrier
*
* @param options List package pickups options
*
* @returns List of package pickups
*/
async listScheduled(options) {
return this.shipstation.request({
url: this.baseUrl,
method: 'GET',
params: options
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/package_pickups/schedule_pickup)
*
* Schedule a package pickup with a carrier
*
* @param labelIds Label IDs that will be included in the pickup request
* @example ["se-28529731"]
*
* @returns Scheduled package pickup details
*/
async schedule(data) {
return this.shipstation.request({
url: this.baseUrl,
method: 'POST',
data
});
}
/**
* [Official Documentation](https://docs.shipstation.com/openapi/package_pickups/delete_scheduled_pickup)
*
* Delete a previously-scheduled pickup by ID
*
* @param pickupId Pickup Resource ID (>= 4 characters)
* @example "pik_3YcKU5zdtJuCqoeNwyqqbW"
*
* @returns Deleted package pickup ID
*/
async deleteScheduled(pickupId) {
return this.shipstation.request({
url: `${this.baseUrl}/${pickupId}`,
method: 'DELETE'
});
}
}
exports.PackagePickups = PackagePickups;