chargebee 3.12.0 โ†’ 3.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ### v3.13.0 (2025-09-15)
2
+ * * *
3
+
4
+ ### New Resources:
5
+ * BusinessEntityChange has been added.
6
+ * Product has been added.
7
+ * SalesOrder has been added.
8
+ * UsageReminderInfo has been added.
9
+ * Variant has been added.
10
+
11
+ ### New Enhancement:
12
+ * Content of HostedPages and Events now have a type.
13
+ * WebhookEvent has been added for better type mapping with actual event and webhook content.
14
+
1
15
  ### v3.12.0 (2025-08-19)
2
16
  * * *
3
17
 
package/README.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Chargebee Node.js / TypeScript Client Library
2
2
 
3
- This is the official [Node.js](http://nodejs.org/) library for integrating with Chargebee.
3
+ > [!NOTE]
4
+ > [![Join Discord](https://img.shields.io/badge/Discord-Early%20Access-blue?logo=discord&logoColor=white)](https://discord.gg/S3SXDzXHAg)
5
+ >
6
+ > We are trialing a Discord server for developers building with Chargebee. Limited spots are open on a first-come basis. Join [here](https://discord.gg/S3SXDzXHAg) if interested.
7
+
8
+
9
+ > [!TIP]
10
+ > If you are using [Next.js](https://nextjs.org/) or [Express](https://expressjs.com/), check out [chargebee-init](https://www.npmjs.com/package/chargebee-init) to get started quickly with the adapters for these frameworks. Learn more about it in this [tutorial](https://www.chargebee.com/tutorials/chargebee-init-nextjs-integration/).
11
+
4
12
 
5
13
  - ๐Ÿ“˜ For a complete reference of available APIs, check out our [API Documentation](https://apidocs.chargebee.com/docs/api/?lang=node).
6
14
  - ๐Ÿงช To explore and test API capabilities interactively, head over to our [API Explorer](https://api-explorer.chargebee.com).
7
15
 
8
16
  If you're upgrading from an older version of [`chargebee-typescript`](https://www.npmjs.com/package/chargebee-typescript) or [`chargebee`](https://www.npmjs.com/package/chargebee/v/2.40.0), please refer to the [Migration Guide](https://github.com/chargebee/chargebee-node/wiki/Migration-guide-for-v3).
9
17
 
18
+
10
19
  ## Requirements
11
20
 
12
21
  Node.js 18 or higher.
@@ -209,6 +218,26 @@ try {
209
218
  }
210
219
  ```
211
220
 
221
+ ### Webhook Type Mapping
222
+ To improve type safety and gain better autocompletion when working with webhooks, you can leverage the `WebhookEvent` resource. This allows you to strongly type the event content for a particular webhook event.
223
+
224
+ #### Example
225
+
226
+ ```ts
227
+ import Chargebee, { type WebhookContentType, WebhookEvent } from "chargebee";
228
+
229
+ const result = await chargebeeInstance.event.retrieve("{event-id}");
230
+ const subscripitonActivatedEvent: WebhookEvent<WebhookContentType.SubscriptionActivated> = result.event;
231
+ const subscription = subscripitonActivatedEvent.content.subscription;
232
+ ```
233
+
234
+ #### Notes
235
+
236
+ * `WebhookEvent<T>` provides type hinting for the event payload, making it easier to work with specific event structures.
237
+ * Use the `WebhookContentType` to specify the exact event type (e.g., `SubscriptionCreated`, `InvoiceGenerated`, etc.).
238
+ * This approach ensures you get proper IntelliSense and compile-time checks when accessing event fields.
239
+
240
+
212
241
  ## Feedback
213
242
 
214
243
  If you find any bugs or have any questions / feedback, open an issue in this repository or reach out to us on dx@chargebee.com
@@ -11,7 +11,7 @@ exports.Environment = {
11
11
  hostSuffix: '.chargebee.com',
12
12
  apiPath: '/api/v2',
13
13
  timeout: DEFAULT_TIME_OUT,
14
- clientVersion: 'v3.12.0',
14
+ clientVersion: 'v3.13.0',
15
15
  port: DEFAULT_PORT,
16
16
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
17
17
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
@@ -8,7 +8,7 @@ export const Environment = {
8
8
  hostSuffix: '.chargebee.com',
9
9
  apiPath: '/api/v2',
10
10
  timeout: DEFAULT_TIME_OUT,
11
- clientVersion: 'v3.12.0',
11
+ clientVersion: 'v3.13.0',
12
12
  port: DEFAULT_PORT,
13
13
  timemachineWaitInMillis: DEFAULT_TIME_MACHINE_WAIT,
14
14
  exportWaitInMillis: DEFAULT_EXPORT_WAIT,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chargebee",
3
- "version": "3.12.0",
3
+ "version": "3.13.0",
4
4
  "description": "A library for integrating with Chargebee.",
5
5
  "scripts": {
6
6
  "prepack": "npm install && npm run build",
@@ -11,7 +11,7 @@
11
11
  },
12
12
  "types": "./types/index.d.ts",
13
13
  "keywords": [
14
- "paymetns",
14
+ "payments",
15
15
  "billings",
16
16
  "subscription",
17
17
  "chargebee"
package/types/index.d.ts CHANGED
@@ -6,6 +6,7 @@
6
6
  ///<reference path='./resources/BillingConfiguration.d.ts' />
7
7
  ///<reference path='./resources/Brand.d.ts' />
8
8
  ///<reference path='./resources/BusinessEntity.d.ts' />
9
+ ///<reference path='./resources/BusinessEntityChange.d.ts' />
9
10
  ///<reference path='./resources/BusinessEntityTransfer.d.ts' />
10
11
  ///<reference path='./resources/Card.d.ts' />
11
12
  ///<reference path='./resources/Comment.d.ts' />
@@ -64,6 +65,7 @@
64
65
  ///<reference path='./resources/PortalSession.d.ts' />
65
66
  ///<reference path='./resources/PriceVariant.d.ts' />
66
67
  ///<reference path='./resources/PricingPageSession.d.ts' />
68
+ ///<reference path='./resources/Product.d.ts' />
67
69
  ///<reference path='./resources/PromotionalCredit.d.ts' />
68
70
  ///<reference path='./resources/Purchase.d.ts' />
69
71
  ///<reference path='./resources/Quote.d.ts' />
@@ -75,6 +77,7 @@
75
77
  ///<reference path='./resources/RecordedPurchase.d.ts' />
76
78
  ///<reference path='./resources/ResourceMigration.d.ts' />
77
79
  ///<reference path='./resources/Rule.d.ts' />
80
+ ///<reference path='./resources/SalesOrder.d.ts' />
78
81
  ///<reference path='./resources/SiteMigrationDetail.d.ts' />
79
82
  ///<reference path='./resources/Subscription.d.ts' />
80
83
  ///<reference path='./resources/SubscriptionEntitlement.d.ts' />
@@ -90,8 +93,12 @@
90
93
  ///<reference path='./resources/Usage.d.ts' />
91
94
  ///<reference path='./resources/UsageEvent.d.ts' />
92
95
  ///<reference path='./resources/UsageFile.d.ts' />
96
+ ///<reference path='./resources/UsageReminderInfo.d.ts' />
97
+ ///<reference path='./resources/Variant.d.ts' />
93
98
  ///<reference path='./resources/VirtualBankAccount.d.ts' />
94
99
  ///<reference path='./resources/WebhookEndpoint.d.ts' />
100
+ ///<reference path='./resources/Content.d.ts' />
101
+ ///<reference path='./resources/WebhookEvent.d.ts' />
95
102
 
96
103
  export type Config = {
97
104
  /**
@@ -204,6 +211,7 @@ declare module 'chargebee' {
204
211
  portalSession: PortalSession.PortalSessionResource;
205
212
  priceVariant: PriceVariant.PriceVariantResource;
206
213
  pricingPageSession: PricingPageSession.PricingPageSessionResource;
214
+ product: Product.ProductResource;
207
215
  promotionalCredit: PromotionalCredit.PromotionalCreditResource;
208
216
  purchase: Purchase.PurchaseResource;
209
217
  quote: Quote.QuoteResource;
@@ -220,6 +228,7 @@ declare module 'chargebee' {
220
228
  usage: Usage.UsageResource;
221
229
  usageEvent: UsageEvent.UsageEventResource;
222
230
  usageFile: UsageFile.UsageFileResource;
231
+ variant: Variant.VariantResource;
223
232
  virtualBankAccount: VirtualBankAccount.VirtualBankAccountResource;
224
233
  webhookEndpoint: WebhookEndpoint.WebhookEndpointResource;
225
234
  }
@@ -0,0 +1,16 @@
1
+ ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+
4
+ declare module 'chargebee' {
5
+ export interface BusinessEntityChange {
6
+ id: string;
7
+ business_entity_id: string;
8
+ reason?: 'correction';
9
+ active_from: number;
10
+ active_to?: number;
11
+ resource_type: 'customer' | 'subscription';
12
+ modified_at: number;
13
+ resource_id: string;
14
+ active_resource_id: string;
15
+ }
16
+ }
@@ -0,0 +1,106 @@
1
+ ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+
4
+ declare module 'chargebee' {
5
+ export interface Content {
6
+ addon: Addon;
7
+ address: Address;
8
+ advance_invoice_schedule: AdvanceInvoiceSchedule;
9
+ attached_item: AttachedItem;
10
+ attribute: Attribute;
11
+ billing_configuration: BillingConfiguration;
12
+ brand: Brand;
13
+ business_entity: BusinessEntity;
14
+ business_entity_change: BusinessEntityChange;
15
+ business_entity_transfer: BusinessEntityTransfer;
16
+ card: Card;
17
+ comment: Comment;
18
+ configuration: Configuration;
19
+ contact: Contact;
20
+ contract_term: ContractTerm;
21
+ coupon: Coupon;
22
+ coupon_code: CouponCode;
23
+ coupon_set: CouponSet;
24
+ credit_note: CreditNote;
25
+ credit_note_estimate: CreditNoteEstimate;
26
+ currency: Currency;
27
+ customer: Customer;
28
+ customer_entitlement: CustomerEntitlement;
29
+ differential_price: DifferentialPrice;
30
+ discount: Discount;
31
+ download: Download;
32
+ entitlement: Entitlement;
33
+ entitlement_override: EntitlementOverride;
34
+ estimate: Estimate;
35
+ event: Event;
36
+ export: Export;
37
+ feature: Feature;
38
+ gateway_error_detail: GatewayErrorDetail;
39
+ gift: Gift;
40
+ hierarchy: Hierarchy;
41
+ hosted_page: HostedPage;
42
+ impacted_customer: ImpactedCustomer;
43
+ impacted_item: ImpactedItem;
44
+ impacted_item_price: ImpactedItemPrice;
45
+ impacted_subscription: ImpactedSubscription;
46
+ in_app_subscription: InAppSubscription;
47
+ invoice: Invoice;
48
+ invoice_estimate: InvoiceEstimate;
49
+ item: Item;
50
+ item_entitlement: ItemEntitlement;
51
+ item_family: ItemFamily;
52
+ item_price: ItemPrice;
53
+ metadata: Metadata;
54
+ non_subscription: NonSubscription;
55
+ omnichannel_one_time_order: OmnichannelOneTimeOrder;
56
+ omnichannel_one_time_order_item: OmnichannelOneTimeOrderItem;
57
+ omnichannel_subscription: OmnichannelSubscription;
58
+ omnichannel_subscription_item: OmnichannelSubscriptionItem;
59
+ omnichannel_subscription_item_scheduled_change: OmnichannelSubscriptionItemScheduledChange;
60
+ omnichannel_transaction: OmnichannelTransaction;
61
+ order: Order;
62
+ payment_intent: PaymentIntent;
63
+ payment_reference_number: PaymentReferenceNumber;
64
+ payment_schedule: PaymentSchedule;
65
+ payment_schedule_estimate: PaymentScheduleEstimate;
66
+ payment_schedule_scheme: PaymentScheduleScheme;
67
+ payment_source: PaymentSource;
68
+ payment_voucher: PaymentVoucher;
69
+ plan: Plan;
70
+ portal_session: PortalSession;
71
+ price_variant: PriceVariant;
72
+ pricing_page_session: PricingPageSession;
73
+ product: Product;
74
+ promotional_credit: PromotionalCredit;
75
+ purchase: Purchase;
76
+ quote: Quote;
77
+ quote_line_group: QuoteLineGroup;
78
+ quoted_charge: QuotedCharge;
79
+ quoted_ramp: QuotedRamp;
80
+ quoted_subscription: QuotedSubscription;
81
+ ramp: Ramp;
82
+ recorded_purchase: RecordedPurchase;
83
+ resource_migration: ResourceMigration;
84
+ rule: Rule;
85
+ sales_order: SalesOrder;
86
+ site_migration_detail: SiteMigrationDetail;
87
+ subscription: Subscription;
88
+ subscription_entitlement: SubscriptionEntitlement;
89
+ subscription_entitlements_created_detail: SubscriptionEntitlementsCreatedDetail;
90
+ subscription_entitlements_updated_detail: SubscriptionEntitlementsUpdatedDetail;
91
+ subscription_estimate: SubscriptionEstimate;
92
+ tax_withheld: TaxWithheld;
93
+ third_party_payment_method: ThirdPartyPaymentMethod;
94
+ time_machine: TimeMachine;
95
+ token: Token;
96
+ transaction: Transaction;
97
+ unbilled_charge: UnbilledCharge;
98
+ usage: Usage;
99
+ usage_event: UsageEvent;
100
+ usage_file: UsageFile;
101
+ usage_reminder_info: UsageReminderInfo;
102
+ variant: Variant;
103
+ virtual_bank_account: VirtualBankAccount;
104
+ webhook_endpoint: WebhookEndpoint;
105
+ }
106
+ }
@@ -20,7 +20,212 @@ declare module 'chargebee' {
20
20
  webhooks?: Event.Webhook[];
21
21
  event_type?: EventTypeEnum;
22
22
  api_version?: ApiVersionEnum;
23
- content: any;
23
+ content: SubscriptionPauseScheduledContent &
24
+ CustomerBusinessEntityChangedContent &
25
+ SubscriptionAdvanceInvoiceScheduleAddedContent &
26
+ GiftExpiredContent &
27
+ TaxWithheldDeletedContent &
28
+ UnbilledChargesDeletedContent &
29
+ CouponUpdatedContent &
30
+ OmnichannelSubscriptionItemReactivatedContent &
31
+ OmnichannelSubscriptionItemRenewedContent &
32
+ UnbilledChargesCreatedContent &
33
+ SubscriptionResumedContent &
34
+ OmnichannelOneTimeOrderItemCancelledContent &
35
+ SubscriptionCancelledContent &
36
+ ItemEntitlementsRemovedContent &
37
+ BusinessEntityCreatedContent &
38
+ CouponSetUpdatedContent &
39
+ DifferentialPriceUpdatedContent &
40
+ OmnichannelSubscriptionItemPausedContent &
41
+ EntitlementOverridesRemovedContent &
42
+ SubscriptionActivatedWithBackdatingContent &
43
+ SubscriptionTrialEndReminderContent &
44
+ SubscriptionShippingAddressUpdatedContent &
45
+ VoucherCreateFailedContent &
46
+ GiftClaimedContent &
47
+ CustomerDeletedContent &
48
+ RefundInitiatedContent &
49
+ InvoiceGeneratedWithBackdatingContent &
50
+ AddUsagesReminderContent &
51
+ VoucherCreatedContent &
52
+ RuleUpdatedContent &
53
+ PaymentSchedulesCreatedContent &
54
+ FeatureActivatedContent &
55
+ PaymentSourceLocallyDeletedContent &
56
+ InvoiceGeneratedContent &
57
+ VoucherExpiredContent &
58
+ AuthorizationSucceededContent &
59
+ GiftScheduledContent &
60
+ SubscriptionChangesScheduledContent &
61
+ SubscriptionChangedWithBackdatingContent &
62
+ OmnichannelSubscriptionItemChangedContent &
63
+ GiftUnclaimedContent &
64
+ VirtualBankAccountAddedContent &
65
+ PaymentIntentCreatedContent &
66
+ CreditNoteCreatedWithBackdatingContent &
67
+ ContractTermTerminatedContent &
68
+ ItemFamilyUpdatedContent &
69
+ OrderCreatedContent &
70
+ PriceVariantDeletedContent &
71
+ SubscriptionMovementFailedContent &
72
+ CustomerMovedInContent &
73
+ SubscriptionAdvanceInvoiceScheduleUpdatedContent &
74
+ ItemDeletedContent &
75
+ SubscriptionRampDraftedContent &
76
+ ItemEntitlementsUpdatedContent &
77
+ TokenConsumedContent &
78
+ HierarchyDeletedContent &
79
+ SubscriptionCancellationScheduledContent &
80
+ SubscriptionRenewedContent &
81
+ FeatureUpdatedContent &
82
+ FeatureDeletedContent &
83
+ ItemFamilyCreatedContent &
84
+ OmnichannelSubscriptionItemScheduledChangeRemovedContent &
85
+ OmnichannelSubscriptionItemResumedContent &
86
+ PurchaseCreatedContent &
87
+ EntitlementOverridesUpdatedContent &
88
+ ItemFamilyDeletedContent &
89
+ SubscriptionResumptionScheduledContent &
90
+ FeatureReactivatedContent &
91
+ CouponCodesDeletedContent &
92
+ CardExpiredContent &
93
+ CreditNoteUpdatedContent &
94
+ OmnichannelSubscriptionItemDowngradedContent &
95
+ PriceVariantUpdatedContent &
96
+ PromotionalCreditsDeductedContent &
97
+ SubscriptionRampAppliedContent &
98
+ SubscriptionPausedContent &
99
+ OrderReadyToProcessContent &
100
+ FeatureCreatedContent &
101
+ TransactionDeletedContent &
102
+ CreditNoteCreatedContent &
103
+ OmnichannelSubscriptionItemResubscribedContent &
104
+ RecordPurchaseFailedContent &
105
+ ItemCreatedContent &
106
+ TransactionUpdatedContent &
107
+ MrrUpdatedContent &
108
+ UnbilledChargesInvoicedContent &
109
+ ItemPriceUpdatedContent &
110
+ CouponCodesUpdatedContent &
111
+ VirtualBankAccountUpdatedContent &
112
+ ContractTermCreatedContent &
113
+ SubscriptionChangedContent &
114
+ PaymentFailedContent &
115
+ CreditNoteDeletedContent &
116
+ TaxWithheldRefundedContent &
117
+ ContractTermCompletedContent &
118
+ PaymentSchedulesUpdatedContent &
119
+ OmnichannelSubscriptionItemExpiredContent &
120
+ CardUpdatedContent &
121
+ CustomerCreatedContent &
122
+ SubscriptionRenewalReminderContent &
123
+ OrderDeliveredContent &
124
+ OmnichannelSubscriptionItemCancellationScheduledContent &
125
+ OmnichannelSubscriptionItemGracePeriodExpiredContent &
126
+ CouponCodesAddedContent &
127
+ GiftCancelledContent &
128
+ OrderCancelledContent &
129
+ CouponDeletedContent &
130
+ SubscriptionScheduledChangesRemovedContent &
131
+ PendingInvoiceCreatedContent &
132
+ EntitlementOverridesAutoRemovedContent &
133
+ OmnichannelSubscriptionItemUpgradedContent &
134
+ SubscriptionBusinessEntityChangedContent &
135
+ OmnichannelOneTimeOrderCreatedContent &
136
+ PaymentSourceDeletedContent &
137
+ OmnichannelSubscriptionItemCancelledContent &
138
+ QuoteDeletedContent &
139
+ InvoiceUpdatedContent &
140
+ SubscriptionAdvanceInvoiceScheduleRemovedContent &
141
+ CardDeletedContent &
142
+ OrderReadyToShipContent &
143
+ SubscriptionMovedOutContent &
144
+ PaymentScheduleSchemeCreatedContent &
145
+ BusinessEntityUpdatedContent &
146
+ SubscriptionScheduledResumptionRemovedContent &
147
+ PaymentInitiatedContent &
148
+ FeatureArchivedContent &
149
+ SubscriptionReactivatedWithBackdatingContent &
150
+ OmnichannelSubscriptionImportedContent &
151
+ TokenExpiredContent &
152
+ CardAddedContent &
153
+ CouponCreatedContent &
154
+ RuleDeletedContent &
155
+ ItemPriceEntitlementsUpdatedContent &
156
+ ItemPriceDeletedContent &
157
+ VirtualBankAccountDeletedContent &
158
+ PaymentScheduleSchemeDeletedContent &
159
+ SubscriptionCreatedContent &
160
+ SubscriptionEntitlementsCreatedContent &
161
+ OrderReturnedContent &
162
+ SubscriptionDeletedContent &
163
+ PaymentSourceAddedContent &
164
+ SubscriptionMovedInContent &
165
+ ItemPriceCreatedContent &
166
+ SubscriptionScheduledCancellationRemovedContent &
167
+ PaymentRefundedContent &
168
+ UsageFileIngestedContent &
169
+ DifferentialPriceCreatedContent &
170
+ TransactionCreatedContent &
171
+ PaymentSucceededContent &
172
+ SubscriptionCanceledWithBackdatingContent &
173
+ UnbilledChargesVoidedContent &
174
+ QuoteCreatedContent &
175
+ CouponSetDeletedContent &
176
+ AttachedItemCreatedContent &
177
+ SalesOrderCreatedContent &
178
+ CustomerChangedContent &
179
+ SubscriptionStartedContent &
180
+ SubscriptionActivatedContent &
181
+ PaymentSourceExpiringContent &
182
+ SubscriptionReactivatedContent &
183
+ OrderUpdatedContent &
184
+ SubscriptionScheduledPauseRemovedContent &
185
+ SubscriptionCancellationReminderContent &
186
+ SubscriptionCreatedWithBackdatingContent &
187
+ SubscriptionRampCreatedContent &
188
+ OrderDeletedContent &
189
+ OmnichannelSubscriptionItemPauseScheduledContent &
190
+ GiftUpdatedContent &
191
+ SubscriptionTrialExtendedContent &
192
+ OmnichannelSubscriptionItemGracePeriodStartedContent &
193
+ CardExpiryReminderContent &
194
+ TokenCreatedContent &
195
+ PromotionalCreditsAddedContent &
196
+ SubscriptionRampUpdatedContent &
197
+ CustomerEntitlementsUpdatedContent &
198
+ PaymentSourceExpiredContent &
199
+ CustomerMovedOutContent &
200
+ SubscriptionEntitlementsUpdatedContent &
201
+ OmnichannelSubscriptionItemDunningExpiredContent &
202
+ HierarchyCreatedContent &
203
+ AttachedItemDeletedContent &
204
+ OmnichannelSubscriptionItemScheduledCancellationRemovedContent &
205
+ ItemUpdatedContent &
206
+ CouponSetCreatedContent &
207
+ PaymentIntentUpdatedContent &
208
+ OrderResentContent &
209
+ OmnichannelSubscriptionCreatedContent &
210
+ TaxWithheldRecordedContent &
211
+ PriceVariantCreatedContent &
212
+ DifferentialPriceDeletedContent &
213
+ SubscriptionItemsRenewedContent &
214
+ RuleCreatedContent &
215
+ ContractTermCancelledContent &
216
+ ContractTermRenewedContent &
217
+ InvoiceDeletedContent &
218
+ ItemPriceEntitlementsRemovedContent &
219
+ SalesOrderUpdatedContent &
220
+ OmnichannelSubscriptionItemDunningStartedContent &
221
+ OmnichannelSubscriptionItemChangeScheduledContent &
222
+ PendingInvoiceUpdatedContent &
223
+ QuoteUpdatedContent &
224
+ AttachedItemUpdatedContent &
225
+ PaymentSourceUpdatedContent &
226
+ BusinessEntityDeletedContent &
227
+ AuthorizationVoidedContent &
228
+ SubscriptionRampDeletedContent;
24
229
  origin_user?: string;
25
230
  }
26
231
 
@@ -28,7 +28,7 @@ declare module 'chargebee' {
28
28
  embed: boolean;
29
29
  created_at?: number;
30
30
  expires_at?: number;
31
- content: any;
31
+ content: Content;
32
32
  updated_at?: number;
33
33
  resource_version?: number;
34
34
  checkout_info?: any;
@@ -0,0 +1,135 @@
1
+ ///<reference path='./../core.d.ts'/>
2
+ ///<reference path='./../index.d.ts'/>
3
+ ///<reference path='./filter.d.ts'/>
4
+ declare module 'chargebee' {
5
+ export interface Product {
6
+ id: string;
7
+ name: string;
8
+ external_name: string;
9
+ description?: string;
10
+ has_variant: boolean;
11
+ status: 'active' | 'inactive';
12
+ shippable: boolean;
13
+ sku?: string;
14
+ created_at: number;
15
+ resource_version?: number;
16
+ updated_at?: number;
17
+ deleted: boolean;
18
+ options?: Product.Option[];
19
+ metadata?: any;
20
+ }
21
+
22
+ export namespace Product {
23
+ export class ProductResource {
24
+ create(
25
+ input: CreateInputParam,
26
+ headers?: ChargebeeRequestHeader,
27
+ ): Promise<ChargebeeResponse<CreateResponse>>;
28
+
29
+ retrieve(
30
+ product_id: string,
31
+ headers?: ChargebeeRequestHeader,
32
+ ): Promise<ChargebeeResponse<RetrieveResponse>>;
33
+
34
+ update(
35
+ product_id: string,
36
+ input?: UpdateInputParam,
37
+ headers?: ChargebeeRequestHeader,
38
+ ): Promise<ChargebeeResponse<UpdateResponse>>;
39
+
40
+ delete(
41
+ product_id: string,
42
+ headers?: ChargebeeRequestHeader,
43
+ ): Promise<ChargebeeResponse<DeleteResponse>>;
44
+
45
+ updateOptions(
46
+ product_id: string,
47
+ input: UpdateOptionsInputParam,
48
+ headers?: ChargebeeRequestHeader,
49
+ ): Promise<ChargebeeResponse<UpdateOptionsResponse>>;
50
+
51
+ list(
52
+ input?: ListInputParam,
53
+ headers?: ChargebeeRequestHeader,
54
+ ): Promise<ChargebeeResponse<ListResponse>>;
55
+ }
56
+
57
+ export interface CreateResponse {
58
+ product: Product;
59
+ }
60
+
61
+ export interface RetrieveResponse {
62
+ product: Product;
63
+ }
64
+
65
+ export interface UpdateResponse {
66
+ product: Product;
67
+ }
68
+
69
+ export interface DeleteResponse {
70
+ product: Product;
71
+ }
72
+
73
+ export interface UpdateOptionsResponse {
74
+ product: Product;
75
+ }
76
+
77
+ export interface ListResponse {
78
+ list: { product: Product }[];
79
+ next_offset?: string;
80
+ }
81
+
82
+ export interface Option {
83
+ id?: string;
84
+ name?: string;
85
+ values?: any[];
86
+ default_value?: string;
87
+ type?: 'select';
88
+ }
89
+ // REQUEST PARAMS
90
+ //---------------
91
+
92
+ export interface CreateInputParam {
93
+ name: string;
94
+ external_name: string;
95
+ status: 'active' | 'inactive';
96
+ id?: string;
97
+ description?: string;
98
+ sku?: string;
99
+ metadata?: any;
100
+ shippable?: boolean;
101
+ }
102
+ export interface UpdateInputParam {
103
+ name?: string;
104
+ external_name?: string;
105
+ description?: string;
106
+ status?: 'active' | 'inactive';
107
+ sku?: string;
108
+ shippable?: boolean;
109
+ metadata?: any;
110
+ }
111
+ export interface UpdateOptionsInputParam {
112
+ remove_options?: string[];
113
+ options?: OptionsUpdateOptionsInputParam[];
114
+ }
115
+ export interface ListInputParam {
116
+ limit?: number;
117
+ offset?: string;
118
+ include_deleted?: boolean;
119
+ id?: filter.String;
120
+ name?: filter.String;
121
+ status?: filter.Enum;
122
+ shippable?: filter.Boolean;
123
+ has_variant?: filter.Boolean;
124
+ created_at?: filter.Timestamp;
125
+ updated_at?: filter.Timestamp;
126
+ 'sort_by[asc]'?: string;
127
+ 'sort_by[desc]'?: string;
128
+ }
129
+ export interface OptionsUpdateOptionsInputParam {
130
+ name: string;
131
+ values?: any;
132
+ default_value?: string;
133
+ }
134
+ }
135
+ }