@openmeter/client 1.0.0-beta.235 → 1.0.0-beta.236

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.
@@ -283,6 +283,14 @@ export interface SubscriptionEditUnscheduleEdit {
283
283
  * "mesh", "kic", or "\_".
284
284
  */
285
285
  export type UpdateLabels = Record<string, string>;
286
+ /**
287
+ * Request to reconcile the app's webhook events with the latest supported event
288
+ * set.
289
+ */
290
+ export interface AppReconcileWebhookEventsActionRequest {
291
+ /** The action to execute. */
292
+ actionType: 'reconcile_webhook_events';
293
+ }
286
294
  /** Model for installing an app from the catalog with an API key. */
287
295
  export interface InstallAppStripeWithApiKey {
288
296
  /** Type of the app. */
@@ -309,15 +317,15 @@ export interface InstallAppSandbox {
309
317
  */
310
318
  createBillingProfile: boolean;
311
319
  }
312
- /** Base model for installing an app from the catalog. */
320
+ /** Model for installing an External Invoicing app from the catalog. */
313
321
  export interface InstallAppExternalInvoicing {
314
322
  /** Type of the app. */
315
323
  type: 'external_invoicing';
316
324
  /** Name of the app. */
317
325
  name: string;
318
326
  /**
319
- * If true, a billing profile will be created for the app. The Stripe app will be
320
- * also set as the default billing profile if the current default is a Sandbox app.
327
+ * If true, creates the Auto Collection preset with an OpenMeter supplier in the US
328
+ * (postal code 94114), without replacing the default profile.
321
329
  */
322
330
  createBillingProfile: boolean;
323
331
  }
@@ -416,6 +424,23 @@ export interface EntitlementAccessQueryRequestFeatures {
416
424
  /** List of feature keys to evaluate access for. */
417
425
  keys: string[];
418
426
  }
427
+ /**
428
+ * The response the recipient returned for a delivery attempt. For webhook channels
429
+ * this is the HTTP response.
430
+ */
431
+ export interface NotificationEventDeliveryAttemptResponse {
432
+ /**
433
+ * The HTTP status code returned by the recipient. Absent when no response was
434
+ * received.
435
+ */
436
+ statusCode?: number;
437
+ /** The response body returned by the recipient. Empty when no body was received. */
438
+ body: string;
439
+ /** How long the delivery attempt took, in milliseconds. */
440
+ durationMs: bigint;
441
+ /** The URL the event was delivered to. Only set for webhook channels. */
442
+ url?: string;
443
+ }
419
444
  /**
420
445
  * A query filter for an integer attribute. Operators are mutually exclusive, only
421
446
  * one operator is allowed at a time.
@@ -1037,6 +1062,33 @@ export interface ChargeReference {
1037
1062
  export interface UpdateResourceReference {
1038
1063
  id: string;
1039
1064
  }
1065
+ /** NotificationChannel reference. */
1066
+ export interface NotificationChannelReference {
1067
+ id: string;
1068
+ }
1069
+ /** A reference to the feature of an entitlement notification event. */
1070
+ export interface NotificationEventFeatureReference {
1071
+ /** The unique identifier of the feature. */
1072
+ id: string;
1073
+ /** The immutable key of the feature. */
1074
+ key: string;
1075
+ }
1076
+ /** A reference to the invoice of an invoice notification event. */
1077
+ export interface NotificationEventInvoiceReference {
1078
+ /** The unique identifier of the invoice. */
1079
+ id: string;
1080
+ /** The human-readable invoice number. */
1081
+ number: string;
1082
+ }
1083
+ /** Request body for resending a notification event. */
1084
+ export interface ResendBillingNotificationEventRequest {
1085
+ /**
1086
+ * The channels to resend the event to. When omitted or empty, the event is resent
1087
+ * to every enabled channel of the rule. Channels not targeted by the rule or
1088
+ * disabled are rejected.
1089
+ */
1090
+ channels?: string[];
1091
+ }
1040
1092
  /** Customer reference. */
1041
1093
  export interface BillingCustomerReference {
1042
1094
  /** The ID of the customer. */
@@ -2150,6 +2202,13 @@ export interface AppCapability {
2150
2202
  /** Description of the capability. */
2151
2203
  description: string;
2152
2204
  }
2205
+ /** An action the operator should take on an installed app. */
2206
+ export interface AppAction {
2207
+ /** The action type. */
2208
+ type: 'reconcile_webhook_events';
2209
+ /** Human readable explanation of why the action is needed. */
2210
+ description: string;
2211
+ }
2153
2212
  /** AppStripe update request. */
2154
2213
  export interface UpdateAppStripeRequest {
2155
2214
  /**
@@ -2429,6 +2488,34 @@ export interface UpdateBillingNotificationChannelRequest {
2429
2488
  */
2430
2489
  signingSecret?: string;
2431
2490
  }
2491
+ /**
2492
+ * A balance threshold of a notification rule. Crossing it generates an
2493
+ * `entitlements.balance.threshold` event.
2494
+ */
2495
+ export interface NotificationBalanceThreshold {
2496
+ /** What the threshold value is measured against. */
2497
+ type: 'balance_value' | 'usage_percentage' | 'usage_value';
2498
+ /** The threshold value. */
2499
+ value: number;
2500
+ }
2501
+ /** A reference to the notification rule that generated an event. */
2502
+ export interface NotificationRuleReference {
2503
+ /** The unique identifier of the rule. */
2504
+ id: string;
2505
+ /** The type of event the rule generates. */
2506
+ type: 'entitlements.balance.threshold' | 'entitlements.reset' | 'invoice.created' | 'invoice.updated';
2507
+ /** The user-provided name of the rule. */
2508
+ name: string;
2509
+ }
2510
+ /** A single delivery attempt to a channel. */
2511
+ export interface NotificationEventDeliveryAttempt {
2512
+ /** The delivery state reached by this attempt. */
2513
+ state: 'success' | 'failed' | 'sending' | 'pending' | 'resending';
2514
+ /** The response returned by the recipient. */
2515
+ response: NotificationEventDeliveryAttemptResponse;
2516
+ /** When the attempt was made. */
2517
+ timestamp: Date;
2518
+ }
2432
2519
  /** App customer data. */
2433
2520
  export interface AppCustomerData {
2434
2521
  /**
@@ -3061,6 +3148,170 @@ export interface UpdateTaxCodeConfig {
3061
3148
  /** Tax code applied to the invoice line item. */
3062
3149
  code?: UpdateResourceReference;
3063
3150
  }
3151
+ /** A rule that generates an event when an entitlement usage period is reset. */
3152
+ export interface NotificationRuleEntitlementReset {
3153
+ id: string;
3154
+ /**
3155
+ * Display name of the resource.
3156
+ *
3157
+ * Between 1 and 256 characters.
3158
+ */
3159
+ name: string;
3160
+ labels?: Labels;
3161
+ /** An ISO-8601 timestamp representation of entity creation date. */
3162
+ createdAt: Date;
3163
+ /** An ISO-8601 timestamp representation of entity last update date. */
3164
+ updatedAt: Date;
3165
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3166
+ deletedAt?: Date;
3167
+ /** The type of event the rule generates. Immutable after creation. */
3168
+ type: 'entitlements.reset';
3169
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3170
+ disabled: boolean;
3171
+ /**
3172
+ * The channels the rule delivers its events to. At least one and at most five
3173
+ * channels are required. Responses omit channels that have since been disabled or
3174
+ * deleted.
3175
+ */
3176
+ channels: NotificationChannelReference[];
3177
+ /**
3178
+ * The features the rule applies to. When omitted, the rule applies to every
3179
+ * feature.
3180
+ */
3181
+ features?: FeatureReference[];
3182
+ }
3183
+ /** A rule that generates an event when an invoice is created. */
3184
+ export interface NotificationRuleInvoiceCreated {
3185
+ id: string;
3186
+ /**
3187
+ * Display name of the resource.
3188
+ *
3189
+ * Between 1 and 256 characters.
3190
+ */
3191
+ name: string;
3192
+ labels?: Labels;
3193
+ /** An ISO-8601 timestamp representation of entity creation date. */
3194
+ createdAt: Date;
3195
+ /** An ISO-8601 timestamp representation of entity last update date. */
3196
+ updatedAt: Date;
3197
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3198
+ deletedAt?: Date;
3199
+ /** The type of event the rule generates. Immutable after creation. */
3200
+ type: 'invoice.created';
3201
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3202
+ disabled: boolean;
3203
+ /**
3204
+ * The channels the rule delivers its events to. At least one and at most five
3205
+ * channels are required. Responses omit channels that have since been disabled or
3206
+ * deleted.
3207
+ */
3208
+ channels: NotificationChannelReference[];
3209
+ }
3210
+ /** A rule that generates an event when an invoice is updated. */
3211
+ export interface NotificationRuleInvoiceUpdated {
3212
+ id: string;
3213
+ /**
3214
+ * Display name of the resource.
3215
+ *
3216
+ * Between 1 and 256 characters.
3217
+ */
3218
+ name: string;
3219
+ labels?: Labels;
3220
+ /** An ISO-8601 timestamp representation of entity creation date. */
3221
+ createdAt: Date;
3222
+ /** An ISO-8601 timestamp representation of entity last update date. */
3223
+ updatedAt: Date;
3224
+ /** An ISO-8601 timestamp representation of entity deletion date. */
3225
+ deletedAt?: Date;
3226
+ /** The type of event the rule generates. Immutable after creation. */
3227
+ type: 'invoice.updated';
3228
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3229
+ disabled: boolean;
3230
+ /**
3231
+ * The channels the rule delivers its events to. At least one and at most five
3232
+ * channels are required. Responses omit channels that have since been disabled or
3233
+ * deleted.
3234
+ */
3235
+ channels: NotificationChannelReference[];
3236
+ }
3237
+ /** Request body for an entitlement reset rule. */
3238
+ export interface NotificationRuleEntitlementResetRequest {
3239
+ /**
3240
+ * Display name of the resource.
3241
+ *
3242
+ * Between 1 and 256 characters.
3243
+ */
3244
+ name: string;
3245
+ labels?: Labels;
3246
+ /** The type of event the rule generates. Immutable after creation. */
3247
+ type: 'entitlements.reset';
3248
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3249
+ disabled: boolean;
3250
+ /**
3251
+ * The channels the rule delivers its events to. At least one and at most five
3252
+ * channels are required. Responses omit channels that have since been disabled or
3253
+ * deleted.
3254
+ */
3255
+ channels: NotificationChannelReference[];
3256
+ /**
3257
+ * The features the rule applies to. When omitted, the rule applies to every
3258
+ * feature.
3259
+ */
3260
+ features?: FeatureReference[];
3261
+ }
3262
+ /** Request body for an invoice created rule. */
3263
+ export interface NotificationRuleInvoiceCreatedRequest {
3264
+ /**
3265
+ * Display name of the resource.
3266
+ *
3267
+ * Between 1 and 256 characters.
3268
+ */
3269
+ name: string;
3270
+ labels?: Labels;
3271
+ /** The type of event the rule generates. Immutable after creation. */
3272
+ type: 'invoice.created';
3273
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3274
+ disabled: boolean;
3275
+ /**
3276
+ * The channels the rule delivers its events to. At least one and at most five
3277
+ * channels are required. Responses omit channels that have since been disabled or
3278
+ * deleted.
3279
+ */
3280
+ channels: NotificationChannelReference[];
3281
+ }
3282
+ /** Request body for an invoice updated rule. */
3283
+ export interface NotificationRuleInvoiceUpdatedRequest {
3284
+ /**
3285
+ * Display name of the resource.
3286
+ *
3287
+ * Between 1 and 256 characters.
3288
+ */
3289
+ name: string;
3290
+ labels?: Labels;
3291
+ /** The type of event the rule generates. Immutable after creation. */
3292
+ type: 'invoice.updated';
3293
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
3294
+ disabled: boolean;
3295
+ /**
3296
+ * The channels the rule delivers its events to. At least one and at most five
3297
+ * channels are required. Responses omit channels that have since been disabled or
3298
+ * deleted.
3299
+ */
3300
+ channels: NotificationChannelReference[];
3301
+ }
3302
+ /** The invoice an invoice notification event refers to. */
3303
+ export interface NotificationEventInvoiceData {
3304
+ /** The invoice the event was generated for. */
3305
+ invoice: NotificationEventInvoiceReference;
3306
+ /** The identifier of the customer the invoice was issued to. */
3307
+ customerId?: string;
3308
+ /** The currency the invoice is denominated in. */
3309
+ currency: string;
3310
+ /** The status of the invoice at the time the event was generated. */
3311
+ status: string;
3312
+ /** The invoice total, including taxes, at the time the event was generated. */
3313
+ total: string;
3314
+ }
3064
3315
  /** Filter options for listing ingested events. */
3065
3316
  export interface ListEventsParamsFilter {
3066
3317
  /** Filter events by ID. */
@@ -3152,6 +3403,57 @@ export interface ListNotificationChannelsParamsFilter {
3152
3403
  createdAt?: DateTimeFieldFilter;
3153
3404
  updatedAt?: DateTimeFieldFilter;
3154
3405
  }
3406
+ /** Filter options for listing notification rules. */
3407
+ export interface ListNotificationRulesParamsFilter {
3408
+ id?: UlidFieldFilter;
3409
+ name?: StringFieldFilter;
3410
+ type?: StringFieldFilterExact;
3411
+ disabled?: BooleanFieldFilter;
3412
+ createdAt?: DateTimeFieldFilter;
3413
+ updatedAt?: DateTimeFieldFilter;
3414
+ /**
3415
+ * Filter by an assigned channel. Matches rules that deliver to at least one of the
3416
+ * given channels. Only `eq` and `oeq` are supported.
3417
+ */
3418
+ channelId?: UlidFieldFilter;
3419
+ }
3420
+ /** Filter options for listing notification events. */
3421
+ export interface ListNotificationEventsParamsFilter {
3422
+ id?: UlidFieldFilter;
3423
+ type?: StringFieldFilterExact;
3424
+ createdAt?: DateTimeFieldFilter;
3425
+ ruleId?: UlidFieldFilter;
3426
+ /**
3427
+ * Filter by a channel of the generating rule. Matches events whose rule targets at
3428
+ * least one of the given channels. Only `eq` and `oeq` are supported.
3429
+ */
3430
+ channelId?: UlidFieldFilter;
3431
+ /**
3432
+ * Filter by delivery state. Matches events where delivery to at least one channel
3433
+ * is in one of the given states. Only `eq` and `oeq` are supported.
3434
+ */
3435
+ deliveryStatus?: StringFieldFilterExact;
3436
+ /**
3437
+ * Filter by the key of the subject the event refers to. Events without a subject
3438
+ * never match, not even with `neq`.
3439
+ */
3440
+ subjectKey?: StringFieldFilterExact;
3441
+ /**
3442
+ * Filter by the id of the subject the event refers to. Events without a subject
3443
+ * never match, not even with `neq`.
3444
+ */
3445
+ subjectId?: UlidFieldFilter;
3446
+ /**
3447
+ * Filter by the key of the feature the event refers to. Events without a feature
3448
+ * never match, not even with `neq`.
3449
+ */
3450
+ featureKey?: StringFieldFilterExact;
3451
+ /**
3452
+ * Filter by the id of the feature the event refers to. Events without a feature
3453
+ * never match, not even with `neq`.
3454
+ */
3455
+ featureId?: UlidFieldFilter;
3456
+ }
3155
3457
  /** Resource filters. */
3156
3458
  export interface ResourceFilters {
3157
3459
  name?: StringFieldFilter;
@@ -4096,6 +4398,91 @@ export interface NotificationChannelPagePaginatedResponse {
4096
4398
  data: NotificationChannel[];
4097
4399
  meta: PaginatedMeta;
4098
4400
  }
4401
+ /**
4402
+ * A rule that generates an event when an entitlement balance crosses one of its
4403
+ * thresholds.
4404
+ */
4405
+ export interface NotificationRuleBalanceThreshold {
4406
+ id: string;
4407
+ /**
4408
+ * Display name of the resource.
4409
+ *
4410
+ * Between 1 and 256 characters.
4411
+ */
4412
+ name: string;
4413
+ labels?: Labels;
4414
+ /** An ISO-8601 timestamp representation of entity creation date. */
4415
+ createdAt: Date;
4416
+ /** An ISO-8601 timestamp representation of entity last update date. */
4417
+ updatedAt: Date;
4418
+ /** An ISO-8601 timestamp representation of entity deletion date. */
4419
+ deletedAt?: Date;
4420
+ /** The type of event the rule generates. Immutable after creation. */
4421
+ type: 'entitlements.balance.threshold';
4422
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
4423
+ disabled: boolean;
4424
+ /**
4425
+ * The channels the rule delivers its events to. At least one and at most five
4426
+ * channels are required. Responses omit channels that have since been disabled or
4427
+ * deleted.
4428
+ */
4429
+ channels: NotificationChannelReference[];
4430
+ /** The thresholds that generate an event when crossed. */
4431
+ thresholds: NotificationBalanceThreshold[];
4432
+ /**
4433
+ * The features the rule applies to. When omitted, the rule applies to every
4434
+ * feature.
4435
+ */
4436
+ features?: FeatureReference[];
4437
+ }
4438
+ /** Request body for a balance threshold rule. */
4439
+ export interface NotificationRuleBalanceThresholdRequest {
4440
+ /**
4441
+ * Display name of the resource.
4442
+ *
4443
+ * Between 1 and 256 characters.
4444
+ */
4445
+ name: string;
4446
+ labels?: Labels;
4447
+ /** The type of event the rule generates. Immutable after creation. */
4448
+ type: 'entitlements.balance.threshold';
4449
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
4450
+ disabled: boolean;
4451
+ /**
4452
+ * The channels the rule delivers its events to. At least one and at most five
4453
+ * channels are required. Responses omit channels that have since been disabled or
4454
+ * deleted.
4455
+ */
4456
+ channels: NotificationChannelReference[];
4457
+ /** The thresholds that generate an event when crossed. */
4458
+ thresholds: NotificationBalanceThreshold[];
4459
+ /**
4460
+ * The features the rule applies to. When omitted, the rule applies to every
4461
+ * feature.
4462
+ */
4463
+ features?: FeatureReference[];
4464
+ }
4465
+ /**
4466
+ * The delivery status of a notification event for one channel of the generating
4467
+ * rule.
4468
+ */
4469
+ export interface NotificationEventDeliveryStatus {
4470
+ /** The identifier of the channel this delivery status belongs to. */
4471
+ channelId: string;
4472
+ /** The current delivery state. */
4473
+ state: 'success' | 'failed' | 'sending' | 'pending' | 'resending';
4474
+ /** The reason for the last state change. Empty for successful deliveries. */
4475
+ reason: string;
4476
+ /** When the delivery state was last updated. */
4477
+ updatedAt: Date;
4478
+ /**
4479
+ * When the next delivery attempt is scheduled. Absent when no further attempts
4480
+ * will be made.
4481
+ */
4482
+ nextAttempt?: Date;
4483
+ /** The delivery attempts made so far, most recent first. */
4484
+ attempts: NotificationEventDeliveryAttempt[];
4485
+ }
4099
4486
  /** Billing customer data. */
4100
4487
  export interface CustomerData {
4101
4488
  /**
@@ -4163,6 +4550,37 @@ export interface ListCustomerEntitlementAccessResponseData {
4163
4550
  /** The list of entitlement access results. */
4164
4551
  data: EntitlementValueResult[];
4165
4552
  }
4553
+ /** The entities and threshold a balance threshold event refers to. */
4554
+ export interface NotificationEventBalanceThresholdData {
4555
+ /** The identifier of the entitlement that triggered the event. */
4556
+ entitlementId: string;
4557
+ /** The feature the entitlement grants access to. */
4558
+ feature: NotificationEventFeatureReference;
4559
+ /** The key of the subject the entitlement belongs to. */
4560
+ subjectKey: string;
4561
+ /** The identifier of the customer the subject belongs to, if any. */
4562
+ customerId?: string;
4563
+ /** The entitlement value at the time the event was generated. */
4564
+ value: EntitlementValueResult;
4565
+ /** The threshold the balance crossed. */
4566
+ threshold: NotificationBalanceThreshold;
4567
+ }
4568
+ /**
4569
+ * The entitlement, feature, and subject an entitlement notification event refers
4570
+ * to.
4571
+ */
4572
+ export interface NotificationEventEntitlementData {
4573
+ /** The identifier of the entitlement that triggered the event. */
4574
+ entitlementId: string;
4575
+ /** The feature the entitlement grants access to. */
4576
+ feature: NotificationEventFeatureReference;
4577
+ /** The key of the subject the entitlement belongs to. */
4578
+ subjectKey: string;
4579
+ /** The identifier of the customer the subject belongs to, if any. */
4580
+ customerId?: string;
4581
+ /** The entitlement value at the time the event was generated. */
4582
+ value: EntitlementValueResult;
4583
+ }
4166
4584
  /**
4167
4585
  * Graduated tiered price.
4168
4586
  *
@@ -4400,6 +4818,28 @@ export interface PlanAddonPagePaginatedResponse {
4400
4818
  data: PlanAddon[];
4401
4819
  meta: PaginatedMeta;
4402
4820
  }
4821
+ /** An invoice created notification event payload. */
4822
+ export interface NotificationEventInvoiceCreatedPayload {
4823
+ /** The identifier of the event the payload belongs to. */
4824
+ id: string;
4825
+ /** The type of the event. */
4826
+ type: 'invoice.created';
4827
+ /** When the event was generated. */
4828
+ timestamp: Date;
4829
+ /** The invoice the event refers to. */
4830
+ data: NotificationEventInvoiceData;
4831
+ }
4832
+ /** An invoice updated notification event payload. */
4833
+ export interface NotificationEventInvoiceUpdatedPayload {
4834
+ /** The identifier of the event the payload belongs to. */
4835
+ id: string;
4836
+ /** The type of the event. */
4837
+ type: 'invoice.updated';
4838
+ /** When the event was generated. */
4839
+ timestamp: Date;
4840
+ /** The invoice the event refers to. */
4841
+ data: NotificationEventInvoiceData;
4842
+ }
4403
4843
  /** Cursor paginated response. */
4404
4844
  export interface IngestedEventPaginatedResponse {
4405
4845
  data: IngestedEvent[];
@@ -4684,6 +5124,11 @@ export interface AppStripe {
4684
5124
  definition: AppCatalogItem;
4685
5125
  /** Status of the app connection. */
4686
5126
  status: 'ready' | 'unauthorized';
5127
+ /**
5128
+ * Actions the operator should take to bring the app up to date. Omitted when no
5129
+ * action is required.
5130
+ */
5131
+ actions?: AppAction[];
4687
5132
  /** The Stripe account ID associated with the connected Stripe account. */
4688
5133
  accountId: string;
4689
5134
  /** Indicates whether the app is connected to a live Stripe account. */
@@ -4719,6 +5164,11 @@ export interface AppSandbox {
4719
5164
  definition: AppCatalogItem;
4720
5165
  /** Status of the app connection. */
4721
5166
  status: 'ready' | 'unauthorized';
5167
+ /**
5168
+ * Actions the operator should take to bring the app up to date. Omitted when no
5169
+ * action is required.
5170
+ */
5171
+ actions?: AppAction[];
4722
5172
  }
4723
5173
  /**
4724
5174
  * External Invoicing app enables integration with third-party invoicing or payment
@@ -4766,6 +5216,11 @@ export interface AppExternalInvoicing {
4766
5216
  definition: AppCatalogItem;
4767
5217
  /** Status of the app connection. */
4768
5218
  status: 'ready' | 'unauthorized';
5219
+ /**
5220
+ * Actions the operator should take to bring the app up to date. Omitted when no
5221
+ * action is required.
5222
+ */
5223
+ actions?: AppAction[];
4769
5224
  /**
4770
5225
  * Enable draft synchronization hook.
4771
5226
  *
@@ -4824,6 +5279,11 @@ export interface InstalledAppStripe {
4824
5279
  definition: AppCatalogItem;
4825
5280
  /** Status of the app connection. */
4826
5281
  status: 'ready' | 'unauthorized';
5282
+ /**
5283
+ * Actions the operator should take to bring the app up to date. Omitted when no
5284
+ * action is required.
5285
+ */
5286
+ actions?: AppAction[];
4827
5287
  /** The Stripe account ID associated with the connected Stripe account. */
4828
5288
  accountId: string;
4829
5289
  /** Indicates whether the app is connected to a live Stripe account. */
@@ -4861,6 +5321,11 @@ export interface InstalledAppSandbox {
4861
5321
  definition: AppCatalogItem;
4862
5322
  /** Status of the app connection. */
4863
5323
  status: 'ready' | 'unauthorized';
5324
+ /**
5325
+ * Actions the operator should take to bring the app up to date. Omitted when no
5326
+ * action is required.
5327
+ */
5328
+ actions?: AppAction[];
4864
5329
  /** Default capabilities of the installed app. */
4865
5330
  defaultForCapabilityTypes: ('report_usage' | 'report_events' | 'calculate_tax' | 'invoice_customers' | 'collect_payments')[];
4866
5331
  }
@@ -4892,6 +5357,11 @@ export interface InstalledAppExternalInvoicing {
4892
5357
  definition: AppCatalogItem;
4893
5358
  /** Status of the app connection. */
4894
5359
  status: 'ready' | 'unauthorized';
5360
+ /**
5361
+ * Actions the operator should take to bring the app up to date. Omitted when no
5362
+ * action is required.
5363
+ */
5364
+ actions?: AppAction[];
4895
5365
  /**
4896
5366
  * Enable draft synchronization hook.
4897
5367
  *
@@ -5001,6 +5471,28 @@ export interface EntitlementAccessQueryResult {
5001
5471
  */
5002
5472
  updatedAt: Date;
5003
5473
  }
5474
+ /** A balance threshold notification event payload. */
5475
+ export interface NotificationEventBalanceThresholdPayload {
5476
+ /** The identifier of the event the payload belongs to. */
5477
+ id: string;
5478
+ /** The type of the event. */
5479
+ type: 'entitlements.balance.threshold';
5480
+ /** When the event was generated. */
5481
+ timestamp: Date;
5482
+ /** The entities and threshold the event refers to. */
5483
+ data: NotificationEventBalanceThresholdData;
5484
+ }
5485
+ /** An entitlement reset notification event payload. */
5486
+ export interface NotificationEventResetPayload {
5487
+ /** The identifier of the event the payload belongs to. */
5488
+ id: string;
5489
+ /** The type of the event. */
5490
+ type: 'entitlements.reset';
5491
+ /** When the event was generated. */
5492
+ timestamp: Date;
5493
+ /** The entities the event refers to. */
5494
+ data: NotificationEventEntitlementData;
5495
+ }
5004
5496
  /** A capability or billable dimension offered by a provider. */
5005
5497
  export interface Feature {
5006
5498
  id: string;
@@ -5411,6 +5903,11 @@ export interface EntitlementAccessQueryResponse {
5411
5903
  */
5412
5904
  meta: CursorMeta;
5413
5905
  }
5906
+ /** Page paginated response. */
5907
+ export interface NotificationRulePagePaginatedResponse {
5908
+ data: NotificationRule[];
5909
+ meta: PaginatedMeta;
5910
+ }
5414
5911
  /** A rate card defines the pricing and entitlement of a feature or service. */
5415
5912
  export interface RateCard {
5416
5913
  /**
@@ -5653,6 +6150,25 @@ export interface ProfileApps {
5653
6150
  /** The payment app used for this workflow. */
5654
6151
  payment: App;
5655
6152
  }
6153
+ /**
6154
+ * A notification event records that a notification rule fired and tracks the
6155
+ * delivery of its payload to each channel of the rule. Events are created by the
6156
+ * system and cannot be modified.
6157
+ */
6158
+ export interface NotificationEvent {
6159
+ /** The unique identifier of the event. */
6160
+ id: string;
6161
+ /** The type of the event. */
6162
+ type: 'entitlements.balance.threshold' | 'entitlements.reset' | 'invoice.created' | 'invoice.updated';
6163
+ /** When the event was generated. */
6164
+ createdAt: Date;
6165
+ /** The rule that generated the event. */
6166
+ rule: NotificationRuleReference;
6167
+ /** The delivery status of the event, one entry per channel of the rule. */
6168
+ deliveryStatus: NotificationEventDeliveryStatus[];
6169
+ /** The payload delivered to the channels. */
6170
+ payload: NotificationEventPayload;
6171
+ }
5656
6172
  /** A subscription item pins a rate card to a cadence within a subscription phase. */
5657
6173
  export interface SubscriptionItem {
5658
6174
  /** The unique identifier of the subscription item instance. */
@@ -6090,6 +6606,11 @@ export interface ChargeRealization {
6090
6606
  */
6091
6607
  detailedLines?: ChargeRealizationDetailedLine[];
6092
6608
  }
6609
+ /** Page paginated response. */
6610
+ export interface NotificationEventPagePaginatedResponse {
6611
+ data: NotificationEvent[];
6612
+ meta: PaginatedMeta;
6613
+ }
6093
6614
  /**
6094
6615
  * A subscription phase groups the rate cards in effect for a segment of the
6095
6616
  * subscription's lifetime. Analogous to plan phases.
@@ -7058,6 +7579,8 @@ export type SubscriptionCreateTiming = 'immediate' | Date;
7058
7579
  * returned.
7059
7580
  */
7060
7581
  export type SubscriptionEditTiming = 'immediate' | 'next_billing_cycle' | Date;
7582
+ /** Request to execute an operator action on an installed app. */
7583
+ export type AppActionRequest = AppReconcileWebhookEventsActionRequest;
7061
7584
  /** Request to install an app from the catalog. */
7062
7585
  export type InstallAppRequest = InstallAppStripeWithApiKey | InstallAppSandbox | InstallAppExternalInvoicing;
7063
7586
  /** Payment settings for a billing workflow. */
@@ -7110,6 +7633,17 @@ export type Entitlement = EntitlementMetered | EntitlementStatic | EntitlementBo
7110
7633
  * arrears items).
7111
7634
  */
7112
7635
  export type WorkflowCollectionAlignment = WorkflowCollectionAlignmentSubscription | WorkflowCollectionAlignmentAnchored;
7636
+ /**
7637
+ * A notification rule selects the type of event to generate, the conditions
7638
+ * specific to that type, and the channels to deliver the events to.
7639
+ */
7640
+ export type NotificationRule = NotificationRuleBalanceThreshold | NotificationRuleEntitlementReset | NotificationRuleInvoiceCreated | NotificationRuleInvoiceUpdated;
7641
+ /**
7642
+ * Request body for creating or updating a notification rule. Updates replace the
7643
+ * rule's mutable state: omitting `disabled`, `labels`, or `features` resets them
7644
+ * to their defaults. The `type` must match the existing rule on update.
7645
+ */
7646
+ export type NotificationRuleRequest = NotificationRuleBalanceThresholdRequest | NotificationRuleEntitlementResetRequest | NotificationRuleInvoiceCreatedRequest | NotificationRuleInvoiceUpdatedRequest;
7113
7647
  /** Price. */
7114
7648
  export type Price = PriceFree | PriceFlat | PriceUnit | PriceGraduated | PriceVolume;
7115
7649
  /**
@@ -7127,6 +7661,8 @@ export type CreateEntitlementRequest = CreateEntitlementMeteredRequest | CreateE
7127
7661
  export type App = AppStripe | AppSandbox | AppExternalInvoicing;
7128
7662
  /** Response of the app install. */
7129
7663
  export type BillingInstallAppResponse = InstalledAppStripe | InstalledAppSandbox | InstalledAppExternalInvoicing;
7664
+ /** The payload delivered to the channels, discriminated by the event type. */
7665
+ export type NotificationEventPayload = NotificationEventBalanceThresholdPayload | NotificationEventResetPayload | NotificationEventInvoiceCreatedPayload | NotificationEventInvoiceUpdatedPayload;
7130
7666
  /** Feature or reference. */
7131
7667
  export type FeatureOrReference = Feature | FeatureReference;
7132
7668
  /** ChargeRealizationInvoice or reference. */
@@ -7612,6 +8148,157 @@ export interface UpdateBillingNotificationChannelRequestInput {
7612
8148
  */
7613
8149
  signingSecret?: string;
7614
8150
  }
8151
+ /** A rule that generates an event when an entitlement usage period is reset. */
8152
+ export interface NotificationRuleEntitlementResetInput {
8153
+ id: string;
8154
+ /**
8155
+ * Display name of the resource.
8156
+ *
8157
+ * Between 1 and 256 characters.
8158
+ */
8159
+ name: string;
8160
+ labels?: Labels;
8161
+ /** An ISO-8601 timestamp representation of entity creation date. */
8162
+ createdAt: Date;
8163
+ /** An ISO-8601 timestamp representation of entity last update date. */
8164
+ updatedAt: Date;
8165
+ /** An ISO-8601 timestamp representation of entity deletion date. */
8166
+ deletedAt?: Date;
8167
+ /** The type of event the rule generates. Immutable after creation. */
8168
+ type: 'entitlements.reset';
8169
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
8170
+ disabled?: boolean;
8171
+ /**
8172
+ * The channels the rule delivers its events to. At least one and at most five
8173
+ * channels are required. Responses omit channels that have since been disabled or
8174
+ * deleted.
8175
+ */
8176
+ channels: NotificationChannelReference[];
8177
+ /**
8178
+ * The features the rule applies to. When omitted, the rule applies to every
8179
+ * feature.
8180
+ */
8181
+ features?: FeatureReference[];
8182
+ }
8183
+ /** A rule that generates an event when an invoice is created. */
8184
+ export interface NotificationRuleInvoiceCreatedInput {
8185
+ id: string;
8186
+ /**
8187
+ * Display name of the resource.
8188
+ *
8189
+ * Between 1 and 256 characters.
8190
+ */
8191
+ name: string;
8192
+ labels?: Labels;
8193
+ /** An ISO-8601 timestamp representation of entity creation date. */
8194
+ createdAt: Date;
8195
+ /** An ISO-8601 timestamp representation of entity last update date. */
8196
+ updatedAt: Date;
8197
+ /** An ISO-8601 timestamp representation of entity deletion date. */
8198
+ deletedAt?: Date;
8199
+ /** The type of event the rule generates. Immutable after creation. */
8200
+ type: 'invoice.created';
8201
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
8202
+ disabled?: boolean;
8203
+ /**
8204
+ * The channels the rule delivers its events to. At least one and at most five
8205
+ * channels are required. Responses omit channels that have since been disabled or
8206
+ * deleted.
8207
+ */
8208
+ channels: NotificationChannelReference[];
8209
+ }
8210
+ /** A rule that generates an event when an invoice is updated. */
8211
+ export interface NotificationRuleInvoiceUpdatedInput {
8212
+ id: string;
8213
+ /**
8214
+ * Display name of the resource.
8215
+ *
8216
+ * Between 1 and 256 characters.
8217
+ */
8218
+ name: string;
8219
+ labels?: Labels;
8220
+ /** An ISO-8601 timestamp representation of entity creation date. */
8221
+ createdAt: Date;
8222
+ /** An ISO-8601 timestamp representation of entity last update date. */
8223
+ updatedAt: Date;
8224
+ /** An ISO-8601 timestamp representation of entity deletion date. */
8225
+ deletedAt?: Date;
8226
+ /** The type of event the rule generates. Immutable after creation. */
8227
+ type: 'invoice.updated';
8228
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
8229
+ disabled?: boolean;
8230
+ /**
8231
+ * The channels the rule delivers its events to. At least one and at most five
8232
+ * channels are required. Responses omit channels that have since been disabled or
8233
+ * deleted.
8234
+ */
8235
+ channels: NotificationChannelReference[];
8236
+ }
8237
+ /** Request body for an entitlement reset rule. */
8238
+ export interface NotificationRuleEntitlementResetRequestInput {
8239
+ /**
8240
+ * Display name of the resource.
8241
+ *
8242
+ * Between 1 and 256 characters.
8243
+ */
8244
+ name: string;
8245
+ labels?: Labels;
8246
+ /** The type of event the rule generates. Immutable after creation. */
8247
+ type: 'entitlements.reset';
8248
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
8249
+ disabled?: boolean;
8250
+ /**
8251
+ * The channels the rule delivers its events to. At least one and at most five
8252
+ * channels are required. Responses omit channels that have since been disabled or
8253
+ * deleted.
8254
+ */
8255
+ channels: NotificationChannelReference[];
8256
+ /**
8257
+ * The features the rule applies to. When omitted, the rule applies to every
8258
+ * feature.
8259
+ */
8260
+ features?: FeatureReference[];
8261
+ }
8262
+ /** Request body for an invoice created rule. */
8263
+ export interface NotificationRuleInvoiceCreatedRequestInput {
8264
+ /**
8265
+ * Display name of the resource.
8266
+ *
8267
+ * Between 1 and 256 characters.
8268
+ */
8269
+ name: string;
8270
+ labels?: Labels;
8271
+ /** The type of event the rule generates. Immutable after creation. */
8272
+ type: 'invoice.created';
8273
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
8274
+ disabled?: boolean;
8275
+ /**
8276
+ * The channels the rule delivers its events to. At least one and at most five
8277
+ * channels are required. Responses omit channels that have since been disabled or
8278
+ * deleted.
8279
+ */
8280
+ channels: NotificationChannelReference[];
8281
+ }
8282
+ /** Request body for an invoice updated rule. */
8283
+ export interface NotificationRuleInvoiceUpdatedRequestInput {
8284
+ /**
8285
+ * Display name of the resource.
8286
+ *
8287
+ * Between 1 and 256 characters.
8288
+ */
8289
+ name: string;
8290
+ labels?: Labels;
8291
+ /** The type of event the rule generates. Immutable after creation. */
8292
+ type: 'invoice.updated';
8293
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
8294
+ disabled?: boolean;
8295
+ /**
8296
+ * The channels the rule delivers its events to. At least one and at most five
8297
+ * channels are required. Responses omit channels that have since been disabled or
8298
+ * deleted.
8299
+ */
8300
+ channels: NotificationChannelReference[];
8301
+ }
7615
8302
  /** An ingested metering event with ingestion metadata. */
7616
8303
  export interface IngestedEventInput {
7617
8304
  /** The original event ingested. */
@@ -7813,6 +8500,70 @@ export interface NotificationChannelPagePaginatedResponseInput {
7813
8500
  data: NotificationChannelInput[];
7814
8501
  meta: PaginatedMeta;
7815
8502
  }
8503
+ /**
8504
+ * A rule that generates an event when an entitlement balance crosses one of its
8505
+ * thresholds.
8506
+ */
8507
+ export interface NotificationRuleBalanceThresholdInput {
8508
+ id: string;
8509
+ /**
8510
+ * Display name of the resource.
8511
+ *
8512
+ * Between 1 and 256 characters.
8513
+ */
8514
+ name: string;
8515
+ labels?: Labels;
8516
+ /** An ISO-8601 timestamp representation of entity creation date. */
8517
+ createdAt: Date;
8518
+ /** An ISO-8601 timestamp representation of entity last update date. */
8519
+ updatedAt: Date;
8520
+ /** An ISO-8601 timestamp representation of entity deletion date. */
8521
+ deletedAt?: Date;
8522
+ /** The type of event the rule generates. Immutable after creation. */
8523
+ type: 'entitlements.balance.threshold';
8524
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
8525
+ disabled?: boolean;
8526
+ /**
8527
+ * The channels the rule delivers its events to. At least one and at most five
8528
+ * channels are required. Responses omit channels that have since been disabled or
8529
+ * deleted.
8530
+ */
8531
+ channels: NotificationChannelReference[];
8532
+ /** The thresholds that generate an event when crossed. */
8533
+ thresholds: NotificationBalanceThreshold[];
8534
+ /**
8535
+ * The features the rule applies to. When omitted, the rule applies to every
8536
+ * feature.
8537
+ */
8538
+ features?: FeatureReference[];
8539
+ }
8540
+ /** Request body for a balance threshold rule. */
8541
+ export interface NotificationRuleBalanceThresholdRequestInput {
8542
+ /**
8543
+ * Display name of the resource.
8544
+ *
8545
+ * Between 1 and 256 characters.
8546
+ */
8547
+ name: string;
8548
+ labels?: Labels;
8549
+ /** The type of event the rule generates. Immutable after creation. */
8550
+ type: 'entitlements.balance.threshold';
8551
+ /** Whether the rule is disabled. Disabled rules do not generate events. */
8552
+ disabled?: boolean;
8553
+ /**
8554
+ * The channels the rule delivers its events to. At least one and at most five
8555
+ * channels are required. Responses omit channels that have since been disabled or
8556
+ * deleted.
8557
+ */
8558
+ channels: NotificationChannelReference[];
8559
+ /** The thresholds that generate an event when crossed. */
8560
+ thresholds: NotificationBalanceThreshold[];
8561
+ /**
8562
+ * The features the rule applies to. When omitted, the rule applies to every
8563
+ * feature.
8564
+ */
8565
+ features?: FeatureReference[];
8566
+ }
7816
8567
  /** Purchase and payment terms of the grant. */
7817
8568
  export interface CreateCreditGrantPurchaseInput {
7818
8569
  /**
@@ -8408,6 +9159,11 @@ export interface ChargeRealizationInvoiceInput {
8408
9159
  /** Workflow configuration snapshot captured at invoice creation time. */
8409
9160
  workflow: InvoiceWorkflowSettingsInput;
8410
9161
  }
9162
+ /** Page paginated response. */
9163
+ export interface NotificationRulePagePaginatedResponseInput {
9164
+ data: NotificationRuleInput[];
9165
+ meta: PaginatedMeta;
9166
+ }
8411
9167
  /** A rate card defines the pricing and entitlement of a feature or service. */
8412
9168
  export interface RateCardInput {
8413
9169
  /**
@@ -9912,6 +10668,17 @@ export type UpdateBillingWorkflowPaymentSettingsInput = UpdateBillingWorkflowPay
9912
10668
  export type RateCardEntitlementInput = RateCardMeteredEntitlementInput | RateCardStaticEntitlement | RateCardBooleanEntitlement;
9913
10669
  /** An entitlement grants a customer access to a feature. */
9914
10670
  export type EntitlementInput = EntitlementMeteredInput | EntitlementStatic | EntitlementBoolean;
10671
+ /**
10672
+ * A notification rule selects the type of event to generate, the conditions
10673
+ * specific to that type, and the channels to deliver the events to.
10674
+ */
10675
+ export type NotificationRuleInput = NotificationRuleBalanceThresholdInput | NotificationRuleEntitlementResetInput | NotificationRuleInvoiceCreatedInput | NotificationRuleInvoiceUpdatedInput;
10676
+ /**
10677
+ * Request body for creating or updating a notification rule. Updates replace the
10678
+ * rule's mutable state: omitting `disabled`, `labels`, or `features` resets them
10679
+ * to their defaults. The `type` must match the existing rule on update.
10680
+ */
10681
+ export type NotificationRuleRequestInput = NotificationRuleBalanceThresholdRequestInput | NotificationRuleEntitlementResetRequestInput | NotificationRuleInvoiceCreatedRequestInput | NotificationRuleInvoiceUpdatedRequestInput;
9915
10682
  /** Entitlement create request. */
9916
10683
  export type CreateEntitlementRequestInput = CreateEntitlementMeteredRequestInput | CreateEntitlementStaticRequest | CreateEntitlementBooleanRequest;
9917
10684
  /** ChargeRealizationInvoice or reference. */