@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
39 lines (36 loc) • 1.38 kB
JavaScript
;
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/attachments.ts
var Attachments = class _Attachments extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "attachments";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _Attachments.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _Attachments.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _Attachments.TYPE } : id, options);
}
async event_stores(attachmentId, params, options) {
const _attachmentId = attachmentId.id || attachmentId;
return this.resources.fetch({ type: "event_stores" }, `attachments/${_attachmentId}/event_stores`, params, options);
}
isAttachment(resource) {
return resource.type && resource.type === _Attachments.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _Attachments.TYPE;
}
};
var instance = new Attachments();
var attachments_default = instance;
exports.attachments_default = attachments_default;
//# sourceMappingURL=chunk-UTFSZHUD.cjs.map
//# sourceMappingURL=chunk-UTFSZHUD.cjs.map