@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
49 lines (47 loc) • 1.93 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/merchants.ts
var Merchants = class _Merchants extends ApiResource {
static TYPE = "merchants";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _Merchants.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _Merchants.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _Merchants.TYPE } : id, options);
}
async address(merchantId, params, options) {
const _merchantId = merchantId.id || merchantId;
return this.resources.fetch({ type: "addresses" }, `merchants/${_merchantId}/address`, params, options);
}
async attachments(merchantId, params, options) {
const _merchantId = merchantId.id || merchantId;
return this.resources.fetch({ type: "attachments" }, `merchants/${_merchantId}/attachments`, params, options);
}
async versions(merchantId, params, options) {
const _merchantId = merchantId.id || merchantId;
return this.resources.fetch({ type: "versions" }, `merchants/${_merchantId}/versions`, params, options);
}
async event_stores(merchantId, params, options) {
const _merchantId = merchantId.id || merchantId;
return this.resources.fetch({ type: "event_stores" }, `merchants/${_merchantId}/event_stores`, params, options);
}
isMerchant(resource) {
return resource.type && resource.type === _Merchants.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _Merchants.TYPE;
}
};
var instance = new Merchants();
var merchants_default = instance;
export { merchants_default };
//# sourceMappingURL=chunk-WO4S2ZUQ.js.map
//# sourceMappingURL=chunk-WO4S2ZUQ.js.map