@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
37 lines (35 loc) • 1.32 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/attachments.ts
var Attachments = class _Attachments extends 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;
export { attachments_default };
//# sourceMappingURL=chunk-KIB4XYWP.js.map
//# sourceMappingURL=chunk-KIB4XYWP.js.map