@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
51 lines (48 loc) • 2.22 kB
JavaScript
var chunkU22VLCMN_cjs = require('./chunk-U22VLCMN.cjs');
// src/resources/carrier_accounts.ts
var CarrierAccounts = class _CarrierAccounts extends chunkU22VLCMN_cjs.ApiResource {
static TYPE = "carrier_accounts";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _CarrierAccounts.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _CarrierAccounts.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _CarrierAccounts.TYPE } : id, options);
}
async market(carrierAccountId, params, options) {
const _carrierAccountId = carrierAccountId.id || carrierAccountId;
return this.resources.fetch({ type: "markets" }, `carrier_accounts/${_carrierAccountId}/market`, params, options);
}
async attachments(carrierAccountId, params, options) {
const _carrierAccountId = carrierAccountId.id || carrierAccountId;
return this.resources.fetch({ type: "attachments" }, `carrier_accounts/${_carrierAccountId}/attachments`, params, options);
}
async versions(carrierAccountId, params, options) {
const _carrierAccountId = carrierAccountId.id || carrierAccountId;
return this.resources.fetch({ type: "versions" }, `carrier_accounts/${_carrierAccountId}/versions`, params, options);
}
async event_stores(carrierAccountId, params, options) {
const _carrierAccountId = carrierAccountId.id || carrierAccountId;
return this.resources.fetch({ type: "event_stores" }, `carrier_accounts/${_carrierAccountId}/event_stores`, params, options);
}
isCarrierAccount(resource) {
return resource.type && resource.type === _CarrierAccounts.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _CarrierAccounts.TYPE;
}
};
var instance = new CarrierAccounts();
var carrier_accounts_default = instance;
exports.carrier_accounts_default = carrier_accounts_default;
//# sourceMappingURL=chunk-TFJYQUEH.cjs.map
//# sourceMappingURL=chunk-TFJYQUEH.cjs.map
;