@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
88 lines (85 loc) • 4.75 kB
JavaScript
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/shipping_methods.ts
var ShippingMethods = class _ShippingMethods extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "shipping_methods";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _ShippingMethods.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _ShippingMethods.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _ShippingMethods.TYPE } : id, options);
}
async market(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "markets" }, `shipping_methods/${_shippingMethodId}/market`, params, options);
}
async shipping_zone(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "shipping_zones" }, `shipping_methods/${_shippingMethodId}/shipping_zone`, params, options);
}
async shipping_category(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "shipping_categories" }, `shipping_methods/${_shippingMethodId}/shipping_category`, params, options);
}
async stock_location(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "stock_locations" }, `shipping_methods/${_shippingMethodId}/stock_location`, params, options);
}
async delivery_lead_time_for_shipment(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "delivery_lead_times" }, `shipping_methods/${_shippingMethodId}/delivery_lead_time_for_shipment`, params, options);
}
async shipping_method_tiers(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "shipping_method_tiers" }, `shipping_methods/${_shippingMethodId}/shipping_method_tiers`, params, options);
}
async shipping_weight_tiers(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "shipping_weight_tiers" }, `shipping_methods/${_shippingMethodId}/shipping_weight_tiers`, params, options);
}
async attachments(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "attachments" }, `shipping_methods/${_shippingMethodId}/attachments`, params, options);
}
async notifications(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "notifications" }, `shipping_methods/${_shippingMethodId}/notifications`, params, options);
}
async versions(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "versions" }, `shipping_methods/${_shippingMethodId}/versions`, params, options);
}
async event_stores(shippingMethodId, params, options) {
const _shippingMethodId = shippingMethodId.id || shippingMethodId;
return this.resources.fetch({ type: "event_stores" }, `shipping_methods/${_shippingMethodId}/event_stores`, params, options);
}
async _disable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _ShippingMethods.TYPE, _disable: true }, params, options);
}
async _enable(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _ShippingMethods.TYPE, _enable: true }, params, options);
}
async _reset_circuit(id, params, options) {
return this.resources.update({ id: typeof id === "string" ? id : id.id, type: _ShippingMethods.TYPE, _reset_circuit: true }, params, options);
}
isShippingMethod(resource) {
return resource.type && resource.type === _ShippingMethods.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _ShippingMethods.TYPE;
}
};
var instance = new ShippingMethods();
var shipping_methods_default = instance;
exports.shipping_methods_default = shipping_methods_default;
//# sourceMappingURL=chunk-LZXPO7K6.cjs.map
//# sourceMappingURL=chunk-LZXPO7K6.cjs.map
;