@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
44 lines (41 loc) • 1.6 kB
JavaScript
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/events.ts
var Events = class _Events extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "events";
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _Events.TYPE }, params, options);
}
async webhooks(eventId, params, options) {
const _eventId = eventId.id || eventId;
return this.resources.fetch({ type: "webhooks" }, `events/${_eventId}/webhooks`, params, options);
}
async last_event_callbacks(eventId, params, options) {
const _eventId = eventId.id || eventId;
return this.resources.fetch({ type: "event_callbacks" }, `events/${_eventId}/last_event_callbacks`, params, options);
}
async event_stores(eventId, params, options) {
const _eventId = eventId.id || eventId;
return this.resources.fetch({ type: "event_stores" }, `events/${_eventId}/event_stores`, params, options);
}
async _trigger(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Events.TYPE, _trigger: true }, params, options);
}
isEvent(resource) {
return resource.type && resource.type === _Events.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _Events.TYPE;
}
};
var instance = new Events();
var events_default = instance;
exports.events_default = events_default;
//# sourceMappingURL=chunk-RHG3UVET.cjs.map
//# sourceMappingURL=chunk-RHG3UVET.cjs.map
;