@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
54 lines (52 loc) • 2.09 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/voids.ts
var Voids = class _Voids extends ApiResource {
static TYPE = "voids";
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _Voids.TYPE }, params, options);
}
async order(voidId, params, options) {
const _voidId = voidId.id || voidId;
return this.resources.fetch({ type: "orders" }, `voids/${_voidId}/order`, params, options);
}
async attachments(voidId, params, options) {
const _voidId = voidId.id || voidId;
return this.resources.fetch({ type: "attachments" }, `voids/${_voidId}/attachments`, params, options);
}
async events(voidId, params, options) {
const _voidId = voidId.id || voidId;
return this.resources.fetch({ type: "events" }, `voids/${_voidId}/events`, params, options);
}
async versions(voidId, params, options) {
const _voidId = voidId.id || voidId;
return this.resources.fetch({ type: "versions" }, `voids/${_voidId}/versions`, params, options);
}
async event_stores(voidId, params, options) {
const _voidId = voidId.id || voidId;
return this.resources.fetch({ type: "event_stores" }, `voids/${_voidId}/event_stores`, params, options);
}
async reference_authorization(voidId, params, options) {
const _voidId = voidId.id || voidId;
return this.resources.fetch({ type: "authorizations" }, `voids/${_voidId}/reference_authorization`, params, options);
}
async _forward(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Voids.TYPE, _forward: true }, params, options);
}
isVoid(resource) {
return resource.type && resource.type === _Voids.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _Voids.TYPE;
}
};
var instance = new Voids();
var voids_default = instance;
export { voids_default };
//# sourceMappingURL=chunk-LLYWUA5S.js.map
//# sourceMappingURL=chunk-LLYWUA5S.js.map