UNPKG

@commercelayer/sdk

Version:
51 lines (48 loc) 1.99 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/merchants.ts var Merchants = class _Merchants extends chunkU22VLCMN_cjs.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; exports.merchants_default = merchants_default; //# sourceMappingURL=chunk-EAR4AXVU.cjs.map //# sourceMappingURL=chunk-EAR4AXVU.cjs.map