@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
68 lines (66 loc) • 3.51 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/stock_reservations.ts
var StockReservations = class _StockReservations extends ApiResource {
static TYPE = "stock_reservations";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _StockReservations.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _StockReservations.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _StockReservations.TYPE } : id, options);
}
async line_item(stockReservationId, params, options) {
const _stockReservationId = stockReservationId.id || stockReservationId;
return this.resources.fetch({ type: "line_items" }, `stock_reservations/${_stockReservationId}/line_item`, params, options);
}
async order(stockReservationId, params, options) {
const _stockReservationId = stockReservationId.id || stockReservationId;
return this.resources.fetch({ type: "orders" }, `stock_reservations/${_stockReservationId}/order`, params, options);
}
async stock_line_item(stockReservationId, params, options) {
const _stockReservationId = stockReservationId.id || stockReservationId;
return this.resources.fetch({ type: "stock_line_items" }, `stock_reservations/${_stockReservationId}/stock_line_item`, params, options);
}
async stock_transfer(stockReservationId, params, options) {
const _stockReservationId = stockReservationId.id || stockReservationId;
return this.resources.fetch({ type: "stock_transfers" }, `stock_reservations/${_stockReservationId}/stock_transfer`, params, options);
}
async stock_item(stockReservationId, params, options) {
const _stockReservationId = stockReservationId.id || stockReservationId;
return this.resources.fetch({ type: "stock_items" }, `stock_reservations/${_stockReservationId}/stock_item`, params, options);
}
async reserved_stock(stockReservationId, params, options) {
const _stockReservationId = stockReservationId.id || stockReservationId;
return this.resources.fetch({ type: "reserved_stocks" }, `stock_reservations/${_stockReservationId}/reserved_stock`, params, options);
}
async sku(stockReservationId, params, options) {
const _stockReservationId = stockReservationId.id || stockReservationId;
return this.resources.fetch({ type: "skus" }, `stock_reservations/${_stockReservationId}/sku`, params, options);
}
async event_stores(stockReservationId, params, options) {
const _stockReservationId = stockReservationId.id || stockReservationId;
return this.resources.fetch({ type: "event_stores" }, `stock_reservations/${_stockReservationId}/event_stores`, params, options);
}
async _pending(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _StockReservations.TYPE, _pending: true }, params, options);
}
isStockReservation(resource) {
return resource.type && resource.type === _StockReservations.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _StockReservations.TYPE;
}
};
var instance = new StockReservations();
var stock_reservations_default = instance;
export { stock_reservations_default };
//# sourceMappingURL=chunk-43SLAYP5.js.map
//# sourceMappingURL=chunk-43SLAYP5.js.map