@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
71 lines (68 loc) • 3.54 kB
JavaScript
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/stock_locations.ts
var StockLocations = class _StockLocations extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "stock_locations";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _StockLocations.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _StockLocations.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _StockLocations.TYPE } : id, options);
}
async address(stockLocationId, params, options) {
const _stockLocationId = stockLocationId.id || stockLocationId;
return this.resources.fetch({ type: "addresses" }, `stock_locations/${_stockLocationId}/address`, params, options);
}
async inventory_stock_locations(stockLocationId, params, options) {
const _stockLocationId = stockLocationId.id || stockLocationId;
return this.resources.fetch({ type: "inventory_stock_locations" }, `stock_locations/${_stockLocationId}/inventory_stock_locations`, params, options);
}
async inventory_return_locations(stockLocationId, params, options) {
const _stockLocationId = stockLocationId.id || stockLocationId;
return this.resources.fetch({ type: "inventory_return_locations" }, `stock_locations/${_stockLocationId}/inventory_return_locations`, params, options);
}
async stock_items(stockLocationId, params, options) {
const _stockLocationId = stockLocationId.id || stockLocationId;
return this.resources.fetch({ type: "stock_items" }, `stock_locations/${_stockLocationId}/stock_items`, params, options);
}
async stock_transfers(stockLocationId, params, options) {
const _stockLocationId = stockLocationId.id || stockLocationId;
return this.resources.fetch({ type: "stock_transfers" }, `stock_locations/${_stockLocationId}/stock_transfers`, params, options);
}
async stores(stockLocationId, params, options) {
const _stockLocationId = stockLocationId.id || stockLocationId;
return this.resources.fetch({ type: "stores" }, `stock_locations/${_stockLocationId}/stores`, params, options);
}
async attachments(stockLocationId, params, options) {
const _stockLocationId = stockLocationId.id || stockLocationId;
return this.resources.fetch({ type: "attachments" }, `stock_locations/${_stockLocationId}/attachments`, params, options);
}
async versions(stockLocationId, params, options) {
const _stockLocationId = stockLocationId.id || stockLocationId;
return this.resources.fetch({ type: "versions" }, `stock_locations/${_stockLocationId}/versions`, params, options);
}
async event_stores(stockLocationId, params, options) {
const _stockLocationId = stockLocationId.id || stockLocationId;
return this.resources.fetch({ type: "event_stores" }, `stock_locations/${_stockLocationId}/event_stores`, params, options);
}
isStockLocation(resource) {
return resource.type && resource.type === _StockLocations.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _StockLocations.TYPE;
}
};
var instance = new StockLocations();
var stock_locations_default = instance;
exports.stock_locations_default = stock_locations_default;
//# sourceMappingURL=chunk-I5VOVSS7.cjs.map
//# sourceMappingURL=chunk-I5VOVSS7.cjs.map
;