UNPKG

@commercelayer/sdk

Version:
50 lines (47 loc) 1.91 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/cleanups.ts var Cleanups = class _Cleanups extends chunkU22VLCMN_cjs.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; exports.cleanups_default = cleanups_default; //# sourceMappingURL=chunk-UEQ3CRVM.cjs.map //# sourceMappingURL=chunk-UEQ3CRVM.cjs.map