@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
49 lines (46 loc) • 1.79 kB
JavaScript
;
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/links.ts
var Links = class _Links extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "links";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _Links.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _Links.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _Links.TYPE } : id, options);
}
async events(linkId, params, options) {
const _linkId = linkId.id || linkId;
return this.resources.fetch({ type: "events" }, `links/${_linkId}/events`, params, options);
}
async event_stores(linkId, params, options) {
const _linkId = linkId.id || linkId;
return this.resources.fetch({ type: "event_stores" }, `links/${_linkId}/event_stores`, params, options);
}
async _disable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Links.TYPE, _disable: true }, params, options);
}
async _enable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Links.TYPE, _enable: true }, params, options);
}
isLink(resource) {
return resource.type && resource.type === _Links.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _Links.TYPE;
}
};
var instance = new Links();
var links_default = instance;
exports.links_default = links_default;
//# sourceMappingURL=chunk-T5AO4445.cjs.map
//# sourceMappingURL=chunk-T5AO4445.cjs.map