UNPKG

@commercelayer/sdk

Version:
52 lines (50 loc) 2.33 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/easypost_pickups.ts var EasypostPickups = class _EasypostPickups extends ApiResource { static TYPE = "easypost_pickups"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _EasypostPickups.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _EasypostPickups.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _EasypostPickups.TYPE } : id, options); } async shipment(easypostPickupId, params, options) { const _easypostPickupId = easypostPickupId.id || easypostPickupId; return this.resources.fetch({ type: "shipments" }, `easypost_pickups/${_easypostPickupId}/shipment`, params, options); } async parcels(easypostPickupId, params, options) { const _easypostPickupId = easypostPickupId.id || easypostPickupId; return this.resources.fetch({ type: "parcels" }, `easypost_pickups/${_easypostPickupId}/parcels`, params, options); } async events(easypostPickupId, params, options) { const _easypostPickupId = easypostPickupId.id || easypostPickupId; return this.resources.fetch({ type: "events" }, `easypost_pickups/${_easypostPickupId}/events`, params, options); } async event_stores(easypostPickupId, params, options) { const _easypostPickupId = easypostPickupId.id || easypostPickupId; return this.resources.fetch({ type: "event_stores" }, `easypost_pickups/${_easypostPickupId}/event_stores`, params, options); } async _purchase(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _EasypostPickups.TYPE, _purchase: true }, params, options); } isEasypostPickup(resource) { return resource.type && resource.type === _EasypostPickups.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _EasypostPickups.TYPE; } }; var instance = new EasypostPickups(); var easypost_pickups_default = instance; export { easypost_pickups_default }; //# sourceMappingURL=chunk-QB7GGVK7.js.map //# sourceMappingURL=chunk-QB7GGVK7.js.map