UNPKG

@commercelayer/sdk

Version:
48 lines (46 loc) 1.85 kB
import { ApiResource } from './chunk-XKERR6OR.js'; // src/resources/cleanups.ts var Cleanups = class _Cleanups extends ApiResource { static TYPE = "cleanups"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _Cleanups.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _Cleanups.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _Cleanups.TYPE } : id, options); } async events(cleanupId, params, options) { const _cleanupId = cleanupId.id || cleanupId; return this.resources.fetch({ type: "events" }, `cleanups/${_cleanupId}/events`, params, options); } async versions(cleanupId, params, options) { const _cleanupId = cleanupId.id || cleanupId; return this.resources.fetch({ type: "versions" }, `cleanups/${_cleanupId}/versions`, params, options); } async event_stores(cleanupId, params, options) { const _cleanupId = cleanupId.id || cleanupId; return this.resources.fetch({ type: "event_stores" }, `cleanups/${_cleanupId}/event_stores`, params, options); } async _interrupt(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Cleanups.TYPE, _interrupt: true }, params, options); } isCleanup(resource) { return resource.type && resource.type === _Cleanups.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _Cleanups.TYPE; } }; var instance = new Cleanups(); var cleanups_default = instance; export { cleanups_default }; //# sourceMappingURL=chunk-E2EVY45K.js.map //# sourceMappingURL=chunk-E2EVY45K.js.map