UNPKG

@commercelayer/sdk

Version:
101 lines (98 loc) 4.71 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/markets.ts var Markets = class _Markets extends chunkU22VLCMN_cjs.ApiResource { static TYPE = "markets"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _Markets.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _Markets.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _Markets.TYPE } : id, options); } async merchant(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "merchants" }, `markets/${_marketId}/merchant`, params, options); } async price_list(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "price_lists" }, `markets/${_marketId}/price_list`, params, options); } async base_price_list(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "price_lists" }, `markets/${_marketId}/base_price_list`, params, options); } async inventory_model(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "inventory_models" }, `markets/${_marketId}/inventory_model`, params, options); } async subscription_model(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "subscription_models" }, `markets/${_marketId}/subscription_model`, params, options); } async discount_engine(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "discount_engines" }, `markets/${_marketId}/discount_engine`, params, options); } async customer_group(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "customer_groups" }, `markets/${_marketId}/customer_group`, params, options); } async geocoder(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "geocoders" }, `markets/${_marketId}/geocoder`, params, options); } async default_shipping_method(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "shipping_methods" }, `markets/${_marketId}/default_shipping_method`, params, options); } async default_payment_method(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "payment_methods" }, `markets/${_marketId}/default_payment_method`, params, options); } async stores(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "stores" }, `markets/${_marketId}/stores`, params, options); } async price_list_schedulers(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "price_list_schedulers" }, `markets/${_marketId}/price_list_schedulers`, params, options); } async attachments(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "attachments" }, `markets/${_marketId}/attachments`, params, options); } async versions(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "versions" }, `markets/${_marketId}/versions`, params, options); } async event_stores(marketId, params, options) { const _marketId = marketId.id || marketId; return this.resources.fetch({ type: "event_stores" }, `markets/${_marketId}/event_stores`, params, options); } async _disable(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Markets.TYPE, _disable: true }, params, options); } async _enable(id, params, options) { return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _Markets.TYPE, _enable: true }, params, options); } isMarket(resource) { return resource.type && resource.type === _Markets.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _Markets.TYPE; } }; var instance = new Markets(); var markets_default = instance; exports.markets_default = markets_default; //# sourceMappingURL=chunk-I73TW24N.cjs.map //# sourceMappingURL=chunk-I73TW24N.cjs.map