@commercelayer/sdk
Version:
Commerce Layer Javascript SDK
49 lines (47 loc) • 2.28 kB
JavaScript
import { ApiResource } from './chunk-XKERR6OR.js';
// src/resources/gift_card_recipients.ts
var GiftCardRecipients = class _GiftCardRecipients extends ApiResource {
static TYPE = "gift_card_recipients";
async create(resource, params, options) {
return this.resources.create({ ...resource, type: _GiftCardRecipients.TYPE }, params, options);
}
async update(resource, params, options) {
return this.resources.update({ ...resource, type: _GiftCardRecipients.TYPE }, params, options);
}
async delete(id, options) {
await this.resources.delete(typeof id === "string" ? { id, type: _GiftCardRecipients.TYPE } : id, options);
}
async customer(giftCardRecipientId, params, options) {
const _giftCardRecipientId = giftCardRecipientId.id || giftCardRecipientId;
return this.resources.fetch({ type: "customers" }, `gift_card_recipients/${_giftCardRecipientId}/customer`, params, options);
}
async event_stores(giftCardRecipientId, params, options) {
const _giftCardRecipientId = giftCardRecipientId.id || giftCardRecipientId;
return this.resources.fetch({ type: "event_stores" }, `gift_card_recipients/${_giftCardRecipientId}/event_stores`, params, options);
}
async attachments(giftCardRecipientId, params, options) {
const _giftCardRecipientId = giftCardRecipientId.id || giftCardRecipientId;
return this.resources.fetch({ type: "attachments" }, `gift_card_recipients/${_giftCardRecipientId}/attachments`, params, options);
}
async versions(giftCardRecipientId, params, options) {
const _giftCardRecipientId = giftCardRecipientId.id || giftCardRecipientId;
return this.resources.fetch({ type: "versions" }, `gift_card_recipients/${_giftCardRecipientId}/versions`, params, options);
}
isGiftCardRecipient(resource) {
return resource.type && resource.type === _GiftCardRecipients.TYPE;
}
relationship(id) {
return super.relationshipOneToOne(id);
}
relationshipToMany(...ids) {
return super.relationshipOneToMany(...ids);
}
type() {
return _GiftCardRecipients.TYPE;
}
};
var instance = new GiftCardRecipients();
var gift_card_recipients_default = instance;
export { gift_card_recipients_default };
//# sourceMappingURL=chunk-6EIS4TN3.js.map
//# sourceMappingURL=chunk-6EIS4TN3.js.map