UNPKG

@commercelayer/sdk

Version:
54 lines (51 loc) 2.39 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/easypost_pickups.ts var EasypostPickups = class _EasypostPickups extends chunkU22VLCMN_cjs.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; exports.easypost_pickups_default = easypost_pickups_default; //# sourceMappingURL=chunk-BUHV5UDN.cjs.map //# sourceMappingURL=chunk-BUHV5UDN.cjs.map