@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
55 lines (52 loc) • 2.52 kB
JavaScript
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/customer_addresses.ts
var CustomerAddresses = class _CustomerAddresses extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "customer_addresses";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _CustomerAddresses.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _CustomerAddresses.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _CustomerAddresses.TYPE } : id, options);
}
async customer(customerAddressId, params, options) {
const _customerAddressId = customerAddressId.id || customerAddressId;
return this.resources.fetch({ type: "customers" }, `customer_addresses/${_customerAddressId}/customer`, params, options);
}
async address(customerAddressId, params, options) {
const _customerAddressId = customerAddressId.id || customerAddressId;
return this.resources.fetch({ type: "addresses" }, `customer_addresses/${_customerAddressId}/address`, params, options);
}
async events(customerAddressId, params, options) {
const _customerAddressId = customerAddressId.id || customerAddressId;
return this.resources.fetch({ type: "events" }, `customer_addresses/${_customerAddressId}/events`, params, options);
}
async versions(customerAddressId, params, options) {
const _customerAddressId = customerAddressId.id || customerAddressId;
return this.resources.fetch({ type: "versions" }, `customer_addresses/${_customerAddressId}/versions`, params, options);
}
async event_stores(customerAddressId, params, options) {
const _customerAddressId = customerAddressId.id || customerAddressId;
return this.resources.fetch({ type: "event_stores" }, `customer_addresses/${_customerAddressId}/event_stores`, params, options);
}
isCustomerAddress(resource) {
return resource.type && resource.type === _CustomerAddresses.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _CustomerAddresses.TYPE;
}
};
var instance = new CustomerAddresses();
var customer_addresses_default = instance;
exports.customer_addresses_default = customer_addresses_default;
//# sourceMappingURL=chunk-PA43CMMI.cjs.map
//# sourceMappingURL=chunk-PA43CMMI.cjs.map
;