@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
41 lines (39 loc) • 1.54 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/adjustments.ts
var Adjustments = class _Adjustments extends ApiResource {
static TYPE = "adjustments";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _Adjustments.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _Adjustments.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _Adjustments.TYPE } : id, options);
}
async versions(adjustmentId, params, options) {
const _adjustmentId = adjustmentId.id || adjustmentId;
return this.resources.fetch({ type: "versions" }, `adjustments/${_adjustmentId}/versions`, params, options);
}
async event_stores(adjustmentId, params, options) {
const _adjustmentId = adjustmentId.id || adjustmentId;
return this.resources.fetch({ type: "event_stores" }, `adjustments/${_adjustmentId}/event_stores`, params, options);
}
isAdjustment(resource) {
return resource.type && resource.type === _Adjustments.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _Adjustments.TYPE;
}
};
var instance = new Adjustments();
var adjustments_default = instance;
export { adjustments_default };
//# sourceMappingURL=chunk-WK3SIZUG.js.map
//# sourceMappingURL=chunk-WK3SIZUG.js.map