@commercelayer/sdk
Version: 
Commerce Layer Javascript SDK
45 lines (43 loc) • 1.85 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/shipping_zones.ts
var ShippingZones = class _ShippingZones extends ApiResource {
  static TYPE = "shipping_zones";
  async create(resource, params, options) {
    return this.resources.create({ ...resource, type: _ShippingZones.TYPE }, params, options);
  }
  async update(resource, params, options) {
    return this.resources.update({ ...resource, type: _ShippingZones.TYPE }, params, options);
  }
  async delete(id, options) {
    await this.resources.delete(typeof id === "string" ? { id, type: _ShippingZones.TYPE } : id, options);
  }
  async attachments(shippingZoneId, params, options) {
    const _shippingZoneId = shippingZoneId.id || shippingZoneId;
    return this.resources.fetch({ type: "attachments" }, `shipping_zones/${_shippingZoneId}/attachments`, params, options);
  }
  async versions(shippingZoneId, params, options) {
    const _shippingZoneId = shippingZoneId.id || shippingZoneId;
    return this.resources.fetch({ type: "versions" }, `shipping_zones/${_shippingZoneId}/versions`, params, options);
  }
  async event_stores(shippingZoneId, params, options) {
    const _shippingZoneId = shippingZoneId.id || shippingZoneId;
    return this.resources.fetch({ type: "event_stores" }, `shipping_zones/${_shippingZoneId}/event_stores`, params, options);
  }
  isShippingZone(resource) {
    return resource.type && resource.type === _ShippingZones.TYPE;
  }
  relationship(id) {
    return super.relationshipOneToOne(id);
  }
  relationshipToMany(...ids) {
    return super.relationshipOneToMany(...ids);
  }
  type() {
    return _ShippingZones.TYPE;
  }
};
var instance = new ShippingZones();
var shipping_zones_default = instance;
export { shipping_zones_default };
//# sourceMappingURL=chunk-F3UMNXXH.js.map
//# sourceMappingURL=chunk-F3UMNXXH.js.map