UNPKG

@commercelayer/sdk

Version:
67 lines (64 loc) 2.67 kB
'use strict'; var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs'); // src/resources/stores.ts var Stores = class _Stores extends chunkU22VLCMN_cjs.ApiResource { static TYPE = "stores"; async create(resource, params, options) { return this.resources.create({ ...resource, type: _Stores.TYPE }, params, options); } async update(resource, params, options) { return this.resources.update({ ...resource, type: _Stores.TYPE }, params, options); } async delete(id, options) { await this.resources.delete(typeof id === "string" ? { id, type: _Stores.TYPE } : id, options); } async market(storeId, params, options) { const _storeId = storeId.id || storeId; return this.resources.fetch({ type: "markets" }, `stores/${_storeId}/market`, params, options); } async merchant(storeId, params, options) { const _storeId = storeId.id || storeId; return this.resources.fetch({ type: "merchants" }, `stores/${_storeId}/merchant`, params, options); } async stock_location(storeId, params, options) { const _storeId = storeId.id || storeId; return this.resources.fetch({ type: "stock_locations" }, `stores/${_storeId}/stock_location`, params, options); } async orders(storeId, params, options) { const _storeId = storeId.id || storeId; return this.resources.fetch({ type: "orders" }, `stores/${_storeId}/orders`, params, options); } async payment_methods(storeId, params, options) { const _storeId = storeId.id || storeId; return this.resources.fetch({ type: "payment_methods" }, `stores/${_storeId}/payment_methods`, params, options); } async events(storeId, params, options) { const _storeId = storeId.id || storeId; return this.resources.fetch({ type: "events" }, `stores/${_storeId}/events`, params, options); } async versions(storeId, params, options) { const _storeId = storeId.id || storeId; return this.resources.fetch({ type: "versions" }, `stores/${_storeId}/versions`, params, options); } async event_stores(storeId, params, options) { const _storeId = storeId.id || storeId; return this.resources.fetch({ type: "event_stores" }, `stores/${_storeId}/event_stores`, params, options); } isStore(resource) { return resource.type && resource.type === _Stores.TYPE; } relationship(id) { return super.relationshipOneToOne(id); } relationshipToMany(...ids) { return super.relationshipOneToMany(...ids); } type() { return _Stores.TYPE; } }; var instance = new Stores(); var stores_default = instance; exports.stores_default = stores_default; //# sourceMappingURL=chunk-HUDH634O.cjs.map //# sourceMappingURL=chunk-HUDH634O.cjs.map