@openmeter/client 1.0.0-beta-ff701a7f5839 → 1.0.0-beta-e00163c4b8a0

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.
@@ -916,6 +916,9 @@ export const booleanFieldFilter = z
916
916
  export const notificationChannelType = z
917
917
  .enum(['webhook'])
918
918
  .describe('The type of a notification channel. Currently the only supported channel type is `webhook`; the domain model anticipates additional channel types (e.g. email, Slack) in the future, so this is modeled as an enum rather than a boolean/constant even though it has a single member today.');
919
+ export const notificationBalanceThresholdType = z
920
+ .enum(['balance_value', 'usage_percentage', 'usage_value'])
921
+ .describe('What a balance threshold is measured against.');
919
922
  export const notificationEventType = z
920
923
  .enum([
921
924
  'entitlements.balance.threshold',
@@ -950,9 +953,6 @@ export const notificationEventDeliveryAttemptResponse = z
950
953
  .describe('The URL the event was delivered to. Only set for webhook channels.'),
951
954
  })
952
955
  .describe('The response the recipient returned for a delivery attempt. For webhook channels this is the HTTP response.');
953
- export const notificationBalanceThresholdType = z
954
- .enum(['balance_value', 'usage_percentage', 'usage_value'])
955
- .describe('What a balance threshold is measured against.');
956
956
  export const queryFilterInteger = z
957
957
  .object({
958
958
  eq: z
@@ -1666,6 +1666,11 @@ export const updateResourceReference = z
1666
1666
  id: ulid,
1667
1667
  })
1668
1668
  .describe('TaxCode reference.');
1669
+ export const notificationChannelReference = z
1670
+ .object({
1671
+ id: ulid,
1672
+ })
1673
+ .describe('NotificationChannel reference.');
1669
1674
  export const notificationEventFeatureReference = z
1670
1675
  .object({
1671
1676
  id: ulid,
@@ -2808,6 +2813,12 @@ export const updateBillingNotificationChannelRequest = z
2808
2813
  .describe('Secret used to sign outgoing webhook payloads so recipients can verify their authenticity. If omitted on create, a secret is generated automatically by the delivery provider. This is a sensitive credential returned in responses (unlike most secrets) specifically so clients can retrieve a server-generated value and verify webhook signatures; handle it with the same care as any other credential.'),
2809
2814
  })
2810
2815
  .describe("Request body for updating a notification channel. Updates replace the channel's mutable state rather than merging it: `type`, `name`, and `url` must always be provided, and omitting `disabled`, `labels`, or `custom_headers` resets them to their defaults (enabled, no labels, no custom headers). `signing_secret` is the one exception: omitting it keeps the channel's current signing secret instead of clearing the credential.");
2816
+ export const notificationBalanceThreshold = z
2817
+ .object({
2818
+ type: notificationBalanceThresholdType,
2819
+ value: z.number().describe('The threshold value.'),
2820
+ })
2821
+ .describe('A balance threshold of a notification rule. Crossing it generates an `entitlements.balance.threshold` event.');
2811
2822
  export const notificationRuleReference = z
2812
2823
  .object({
2813
2824
  id: ulid,
@@ -2822,12 +2833,6 @@ export const notificationEventDeliveryAttempt = z
2822
2833
  timestamp: dateTime,
2823
2834
  })
2824
2835
  .describe('A single delivery attempt to a channel.');
2825
- export const notificationBalanceThreshold = z
2826
- .object({
2827
- type: notificationBalanceThresholdType,
2828
- value: z.number().describe('The threshold value.'),
2829
- })
2830
- .describe('A balance threshold of a notification rule. Crossing it generates an `entitlements.balance.threshold` event.');
2831
2836
  export const appCustomerData = z
2832
2837
  .object({
2833
2838
  stripe: appCustomerDataStripe
@@ -3239,6 +3244,158 @@ export const updateTaxCodeConfig = z
3239
3244
  code: updateResourceReference.optional(),
3240
3245
  })
3241
3246
  .describe('Tax configuration for a billable resource. Applies a tax code and tax behavior to the resulting invoice line items. When not set, the applicable default is used: the billing profile default tax configuration, then the organization default tax code.');
3247
+ export const notificationRuleEntitlementReset = z
3248
+ .object({
3249
+ id: ulid,
3250
+ name: z
3251
+ .string()
3252
+ .min(1)
3253
+ .max(256)
3254
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3255
+ labels: labels.optional(),
3256
+ createdAt: dateTime,
3257
+ updatedAt: dateTime,
3258
+ deletedAt: dateTime.optional(),
3259
+ type: z
3260
+ .literal('entitlements.reset')
3261
+ .describe('The type of event the rule generates. Immutable after creation.'),
3262
+ disabled: z
3263
+ .boolean()
3264
+ .optional()
3265
+ .default(false)
3266
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
3267
+ channels: z
3268
+ .array(notificationChannelReference)
3269
+ .max(5)
3270
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
3271
+ features: z
3272
+ .array(featureReference)
3273
+ .optional()
3274
+ .describe('The features the rule applies to. When omitted, the rule applies to every feature.'),
3275
+ })
3276
+ .describe('A rule that generates an event when an entitlement usage period is reset.');
3277
+ export const notificationRuleInvoiceCreated = z
3278
+ .object({
3279
+ id: ulid,
3280
+ name: z
3281
+ .string()
3282
+ .min(1)
3283
+ .max(256)
3284
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3285
+ labels: labels.optional(),
3286
+ createdAt: dateTime,
3287
+ updatedAt: dateTime,
3288
+ deletedAt: dateTime.optional(),
3289
+ type: z
3290
+ .literal('invoice.created')
3291
+ .describe('The type of event the rule generates. Immutable after creation.'),
3292
+ disabled: z
3293
+ .boolean()
3294
+ .optional()
3295
+ .default(false)
3296
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
3297
+ channels: z
3298
+ .array(notificationChannelReference)
3299
+ .max(5)
3300
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
3301
+ })
3302
+ .describe('A rule that generates an event when an invoice is created.');
3303
+ export const notificationRuleInvoiceUpdated = z
3304
+ .object({
3305
+ id: ulid,
3306
+ name: z
3307
+ .string()
3308
+ .min(1)
3309
+ .max(256)
3310
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3311
+ labels: labels.optional(),
3312
+ createdAt: dateTime,
3313
+ updatedAt: dateTime,
3314
+ deletedAt: dateTime.optional(),
3315
+ type: z
3316
+ .literal('invoice.updated')
3317
+ .describe('The type of event the rule generates. Immutable after creation.'),
3318
+ disabled: z
3319
+ .boolean()
3320
+ .optional()
3321
+ .default(false)
3322
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
3323
+ channels: z
3324
+ .array(notificationChannelReference)
3325
+ .max(5)
3326
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
3327
+ })
3328
+ .describe('A rule that generates an event when an invoice is updated.');
3329
+ export const notificationRuleEntitlementResetRequest = z
3330
+ .object({
3331
+ name: z
3332
+ .string()
3333
+ .min(1)
3334
+ .max(256)
3335
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3336
+ labels: labels.optional(),
3337
+ type: z
3338
+ .literal('entitlements.reset')
3339
+ .describe('The type of event the rule generates. Immutable after creation.'),
3340
+ disabled: z
3341
+ .boolean()
3342
+ .optional()
3343
+ .default(false)
3344
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
3345
+ channels: z
3346
+ .array(notificationChannelReference)
3347
+ .max(5)
3348
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
3349
+ features: z
3350
+ .array(featureReference)
3351
+ .optional()
3352
+ .describe('The features the rule applies to. When omitted, the rule applies to every feature.'),
3353
+ })
3354
+ .describe('Request body for an entitlement reset rule.');
3355
+ export const notificationRuleInvoiceCreatedRequest = z
3356
+ .object({
3357
+ name: z
3358
+ .string()
3359
+ .min(1)
3360
+ .max(256)
3361
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3362
+ labels: labels.optional(),
3363
+ type: z
3364
+ .literal('invoice.created')
3365
+ .describe('The type of event the rule generates. Immutable after creation.'),
3366
+ disabled: z
3367
+ .boolean()
3368
+ .optional()
3369
+ .default(false)
3370
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
3371
+ channels: z
3372
+ .array(notificationChannelReference)
3373
+ .max(5)
3374
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
3375
+ })
3376
+ .describe('Request body for an invoice created rule.');
3377
+ export const notificationRuleInvoiceUpdatedRequest = z
3378
+ .object({
3379
+ name: z
3380
+ .string()
3381
+ .min(1)
3382
+ .max(256)
3383
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
3384
+ labels: labels.optional(),
3385
+ type: z
3386
+ .literal('invoice.updated')
3387
+ .describe('The type of event the rule generates. Immutable after creation.'),
3388
+ disabled: z
3389
+ .boolean()
3390
+ .optional()
3391
+ .default(false)
3392
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
3393
+ channels: z
3394
+ .array(notificationChannelReference)
3395
+ .max(5)
3396
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
3397
+ })
3398
+ .describe('Request body for an invoice updated rule.');
3242
3399
  export const notificationEventInvoiceData = z
3243
3400
  .object({
3244
3401
  invoice: notificationEventInvoiceReference,
@@ -3300,6 +3457,17 @@ export const listNotificationChannelsParamsFilter = z
3300
3457
  updatedAt: dateTimeFieldFilter.optional(),
3301
3458
  })
3302
3459
  .describe('Filter options for listing notification channels.');
3460
+ export const listNotificationRulesParamsFilter = z
3461
+ .object({
3462
+ id: ulidFieldFilter.optional(),
3463
+ name: stringFieldFilter.optional(),
3464
+ type: stringFieldFilterExact.optional(),
3465
+ disabled: booleanFieldFilter.optional(),
3466
+ createdAt: dateTimeFieldFilter.optional(),
3467
+ updatedAt: dateTimeFieldFilter.optional(),
3468
+ channelId: ulidFieldFilter.optional(),
3469
+ })
3470
+ .describe('Filter options for listing notification rules.');
3303
3471
  export const listNotificationEventsParamsFilter = z
3304
3472
  .object({
3305
3473
  id: ulidFieldFilter.optional(),
@@ -4009,6 +4177,72 @@ export const notificationChannelPagePaginatedResponse = z
4009
4177
  meta: paginatedMeta,
4010
4178
  })
4011
4179
  .describe('Page paginated response.');
4180
+ export const notificationRuleBalanceThreshold = z
4181
+ .object({
4182
+ id: ulid,
4183
+ name: z
4184
+ .string()
4185
+ .min(1)
4186
+ .max(256)
4187
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
4188
+ labels: labels.optional(),
4189
+ createdAt: dateTime,
4190
+ updatedAt: dateTime,
4191
+ deletedAt: dateTime.optional(),
4192
+ type: z
4193
+ .literal('entitlements.balance.threshold')
4194
+ .describe('The type of event the rule generates. Immutable after creation.'),
4195
+ disabled: z
4196
+ .boolean()
4197
+ .optional()
4198
+ .default(false)
4199
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
4200
+ channels: z
4201
+ .array(notificationChannelReference)
4202
+ .max(5)
4203
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
4204
+ thresholds: z
4205
+ .array(notificationBalanceThreshold)
4206
+ .min(1)
4207
+ .max(10)
4208
+ .describe('The thresholds that generate an event when crossed.'),
4209
+ features: z
4210
+ .array(featureReference)
4211
+ .optional()
4212
+ .describe('The features the rule applies to. When omitted, the rule applies to every feature.'),
4213
+ })
4214
+ .describe('A rule that generates an event when an entitlement balance crosses one of its thresholds.');
4215
+ export const notificationRuleBalanceThresholdRequest = z
4216
+ .object({
4217
+ name: z
4218
+ .string()
4219
+ .min(1)
4220
+ .max(256)
4221
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
4222
+ labels: labels.optional(),
4223
+ type: z
4224
+ .literal('entitlements.balance.threshold')
4225
+ .describe('The type of event the rule generates. Immutable after creation.'),
4226
+ disabled: z
4227
+ .boolean()
4228
+ .optional()
4229
+ .default(false)
4230
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
4231
+ channels: z
4232
+ .array(notificationChannelReference)
4233
+ .max(5)
4234
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
4235
+ thresholds: z
4236
+ .array(notificationBalanceThreshold)
4237
+ .min(1)
4238
+ .max(10)
4239
+ .describe('The thresholds that generate an event when crossed.'),
4240
+ features: z
4241
+ .array(featureReference)
4242
+ .optional()
4243
+ .describe('The features the rule applies to. When omitted, the rule applies to every feature.'),
4244
+ })
4245
+ .describe('Request body for a balance threshold rule.');
4012
4246
  export const notificationEventDeliveryStatus = z
4013
4247
  .object({
4014
4248
  channelId: ulid,
@@ -4689,6 +4923,22 @@ export const entitlementAccessQueryResult = z
4689
4923
  updatedAt: dateTime,
4690
4924
  })
4691
4925
  .describe('Access evaluation result for a single resolved customer.');
4926
+ export const notificationRule = z
4927
+ .discriminatedUnion('type', [
4928
+ notificationRuleBalanceThreshold,
4929
+ notificationRuleEntitlementReset,
4930
+ notificationRuleInvoiceCreated,
4931
+ notificationRuleInvoiceUpdated,
4932
+ ])
4933
+ .describe('A notification rule selects the type of event to generate, the conditions specific to that type, and the channels to deliver the events to.');
4934
+ export const notificationRuleRequest = z
4935
+ .discriminatedUnion('type', [
4936
+ notificationRuleBalanceThresholdRequest,
4937
+ notificationRuleEntitlementResetRequest,
4938
+ notificationRuleInvoiceCreatedRequest,
4939
+ notificationRuleInvoiceUpdatedRequest,
4940
+ ])
4941
+ .describe("Request body for creating or updating a notification rule. Updates replace the rule's mutable state: omitting `disabled`, `labels`, or `features` resets them to their defaults. The `type` must match the existing rule on update.");
4692
4942
  export const notificationEventBalanceThresholdPayload = z
4693
4943
  .object({
4694
4944
  id: ulid,
@@ -4974,6 +5224,12 @@ export const entitlementAccessQueryResponse = z
4974
5224
  meta: cursorMeta,
4975
5225
  })
4976
5226
  .describe('Response of the entitlement access query.');
5227
+ export const notificationRulePagePaginatedResponse = z
5228
+ .object({
5229
+ data: z.array(notificationRule),
5230
+ meta: paginatedMeta,
5231
+ })
5232
+ .describe('Page paginated response.');
4977
5233
  export const notificationEventPayload = z
4978
5234
  .discriminatedUnion('type', [
4979
5235
  notificationEventBalanceThresholdPayload,
@@ -6922,6 +7178,43 @@ export const updateNotificationChannelResponse = notificationChannel;
6922
7178
  export const deleteNotificationChannelPathParams = z.object({
6923
7179
  notificationChannelId: ulid,
6924
7180
  });
7181
+ export const listNotificationRulesQueryParams = z.object({
7182
+ page: z
7183
+ .object({
7184
+ size: z.coerce
7185
+ .number()
7186
+ .int()
7187
+ .optional()
7188
+ .describe('The number of items to include per page.'),
7189
+ number: z.coerce.number().int().optional().describe('The page number.'),
7190
+ })
7191
+ .optional()
7192
+ .describe('Determines which page of the collection to retrieve.'),
7193
+ sort: sortQuery.optional(),
7194
+ filter: listNotificationRulesParamsFilter.optional(),
7195
+ });
7196
+ export const listNotificationRulesResponse = z.object({
7197
+ data: z.array(notificationRule),
7198
+ meta: paginatedMeta,
7199
+ });
7200
+ export const createNotificationRuleBody = notificationRuleRequest;
7201
+ export const createNotificationRuleResponse = notificationRule;
7202
+ export const getNotificationRulePathParams = z.object({
7203
+ notificationRuleId: ulid,
7204
+ });
7205
+ export const getNotificationRuleResponse = notificationRule;
7206
+ export const updateNotificationRulePathParams = z.object({
7207
+ notificationRuleId: ulid,
7208
+ });
7209
+ export const updateNotificationRuleBody = notificationRuleRequest;
7210
+ export const updateNotificationRuleResponse = notificationRule;
7211
+ export const deleteNotificationRulePathParams = z.object({
7212
+ notificationRuleId: ulid,
7213
+ });
7214
+ export const testNotificationRulePathParams = z.object({
7215
+ notificationRuleId: ulid,
7216
+ });
7217
+ export const testNotificationRuleResponse = notificationEvent;
6925
7218
  export const listNotificationEventsQueryParams = z.object({
6926
7219
  page: z
6927
7220
  .object({
@@ -7858,6 +8151,9 @@ export const booleanFieldFilterWire = z
7858
8151
  export const notificationChannelTypeWire = z
7859
8152
  .enum(['webhook'])
7860
8153
  .describe('The type of a notification channel. Currently the only supported channel type is `webhook`; the domain model anticipates additional channel types (e.g. email, Slack) in the future, so this is modeled as an enum rather than a boolean/constant even though it has a single member today.');
8154
+ export const notificationBalanceThresholdTypeWire = z
8155
+ .enum(['balance_value', 'usage_percentage', 'usage_value'])
8156
+ .describe('What a balance threshold is measured against.');
7861
8157
  export const notificationEventTypeWire = z
7862
8158
  .enum([
7863
8159
  'entitlements.balance.threshold',
@@ -7892,9 +8188,6 @@ export const notificationEventDeliveryAttemptResponseWire = z
7892
8188
  .describe('The URL the event was delivered to. Only set for webhook channels.'),
7893
8189
  })
7894
8190
  .describe('The response the recipient returned for a delivery attempt. For webhook channels this is the HTTP response.');
7895
- export const notificationBalanceThresholdTypeWire = z
7896
- .enum(['balance_value', 'usage_percentage', 'usage_value'])
7897
- .describe('What a balance threshold is measured against.');
7898
8191
  export const queryFilterIntegerWire = z
7899
8192
  .strictObject({
7900
8193
  eq: z
@@ -8607,6 +8900,11 @@ export const updateResourceReferenceWire = z
8607
8900
  id: ulidWire,
8608
8901
  })
8609
8902
  .describe('TaxCode reference.');
8903
+ export const notificationChannelReferenceWire = z
8904
+ .strictObject({
8905
+ id: ulidWire,
8906
+ })
8907
+ .describe('NotificationChannel reference.');
8610
8908
  export const notificationEventFeatureReferenceWire = z
8611
8909
  .strictObject({
8612
8910
  id: ulidWire,
@@ -9727,6 +10025,12 @@ export const updateBillingNotificationChannelRequestWire = z
9727
10025
  .describe('Secret used to sign outgoing webhook payloads so recipients can verify their authenticity. If omitted on create, a secret is generated automatically by the delivery provider. This is a sensitive credential returned in responses (unlike most secrets) specifically so clients can retrieve a server-generated value and verify webhook signatures; handle it with the same care as any other credential.'),
9728
10026
  })
9729
10027
  .describe("Request body for updating a notification channel. Updates replace the channel's mutable state rather than merging it: `type`, `name`, and `url` must always be provided, and omitting `disabled`, `labels`, or `custom_headers` resets them to their defaults (enabled, no labels, no custom headers). `signing_secret` is the one exception: omitting it keeps the channel's current signing secret instead of clearing the credential.");
10028
+ export const notificationBalanceThresholdWire = z
10029
+ .strictObject({
10030
+ type: notificationBalanceThresholdTypeWire,
10031
+ value: z.number().describe('The threshold value.'),
10032
+ })
10033
+ .describe('A balance threshold of a notification rule. Crossing it generates an `entitlements.balance.threshold` event.');
9730
10034
  export const notificationRuleReferenceWire = z
9731
10035
  .strictObject({
9732
10036
  id: ulidWire,
@@ -9741,12 +10045,6 @@ export const notificationEventDeliveryAttemptWire = z
9741
10045
  timestamp: dateTimeWire,
9742
10046
  })
9743
10047
  .describe('A single delivery attempt to a channel.');
9744
- export const notificationBalanceThresholdWire = z
9745
- .strictObject({
9746
- type: notificationBalanceThresholdTypeWire,
9747
- value: z.number().describe('The threshold value.'),
9748
- })
9749
- .describe('A balance threshold of a notification rule. Crossing it generates an `entitlements.balance.threshold` event.');
9750
10048
  export const appCustomerDataWire = z
9751
10049
  .strictObject({
9752
10050
  stripe: appCustomerDataStripeWire
@@ -10158,6 +10456,152 @@ export const updateTaxCodeConfigWire = z
10158
10456
  code: updateResourceReferenceWire.optional(),
10159
10457
  })
10160
10458
  .describe('Tax configuration for a billable resource. Applies a tax code and tax behavior to the resulting invoice line items. When not set, the applicable default is used: the billing profile default tax configuration, then the organization default tax code.');
10459
+ export const notificationRuleEntitlementResetWire = z
10460
+ .strictObject({
10461
+ id: ulidWire,
10462
+ name: z
10463
+ .string()
10464
+ .min(1)
10465
+ .max(256)
10466
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
10467
+ labels: labelsWire.optional(),
10468
+ created_at: dateTimeWire,
10469
+ updated_at: dateTimeWire,
10470
+ deleted_at: dateTimeWire.optional(),
10471
+ type: z
10472
+ .literal('entitlements.reset')
10473
+ .describe('The type of event the rule generates. Immutable after creation.'),
10474
+ disabled: z
10475
+ .boolean()
10476
+ .optional()
10477
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
10478
+ channels: z
10479
+ .array(notificationChannelReferenceWire)
10480
+ .max(5)
10481
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
10482
+ features: z
10483
+ .array(featureReferenceWire)
10484
+ .optional()
10485
+ .describe('The features the rule applies to. When omitted, the rule applies to every feature.'),
10486
+ })
10487
+ .describe('A rule that generates an event when an entitlement usage period is reset.');
10488
+ export const notificationRuleInvoiceCreatedWire = z
10489
+ .strictObject({
10490
+ id: ulidWire,
10491
+ name: z
10492
+ .string()
10493
+ .min(1)
10494
+ .max(256)
10495
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
10496
+ labels: labelsWire.optional(),
10497
+ created_at: dateTimeWire,
10498
+ updated_at: dateTimeWire,
10499
+ deleted_at: dateTimeWire.optional(),
10500
+ type: z
10501
+ .literal('invoice.created')
10502
+ .describe('The type of event the rule generates. Immutable after creation.'),
10503
+ disabled: z
10504
+ .boolean()
10505
+ .optional()
10506
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
10507
+ channels: z
10508
+ .array(notificationChannelReferenceWire)
10509
+ .max(5)
10510
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
10511
+ })
10512
+ .describe('A rule that generates an event when an invoice is created.');
10513
+ export const notificationRuleInvoiceUpdatedWire = z
10514
+ .strictObject({
10515
+ id: ulidWire,
10516
+ name: z
10517
+ .string()
10518
+ .min(1)
10519
+ .max(256)
10520
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
10521
+ labels: labelsWire.optional(),
10522
+ created_at: dateTimeWire,
10523
+ updated_at: dateTimeWire,
10524
+ deleted_at: dateTimeWire.optional(),
10525
+ type: z
10526
+ .literal('invoice.updated')
10527
+ .describe('The type of event the rule generates. Immutable after creation.'),
10528
+ disabled: z
10529
+ .boolean()
10530
+ .optional()
10531
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
10532
+ channels: z
10533
+ .array(notificationChannelReferenceWire)
10534
+ .max(5)
10535
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
10536
+ })
10537
+ .describe('A rule that generates an event when an invoice is updated.');
10538
+ export const notificationRuleEntitlementResetRequestWire = z
10539
+ .strictObject({
10540
+ name: z
10541
+ .string()
10542
+ .min(1)
10543
+ .max(256)
10544
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
10545
+ labels: labelsWire.optional(),
10546
+ type: z
10547
+ .literal('entitlements.reset')
10548
+ .describe('The type of event the rule generates. Immutable after creation.'),
10549
+ disabled: z
10550
+ .boolean()
10551
+ .optional()
10552
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
10553
+ channels: z
10554
+ .array(notificationChannelReferenceWire)
10555
+ .max(5)
10556
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
10557
+ features: z
10558
+ .array(featureReferenceWire)
10559
+ .optional()
10560
+ .describe('The features the rule applies to. When omitted, the rule applies to every feature.'),
10561
+ })
10562
+ .describe('Request body for an entitlement reset rule.');
10563
+ export const notificationRuleInvoiceCreatedRequestWire = z
10564
+ .strictObject({
10565
+ name: z
10566
+ .string()
10567
+ .min(1)
10568
+ .max(256)
10569
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
10570
+ labels: labelsWire.optional(),
10571
+ type: z
10572
+ .literal('invoice.created')
10573
+ .describe('The type of event the rule generates. Immutable after creation.'),
10574
+ disabled: z
10575
+ .boolean()
10576
+ .optional()
10577
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
10578
+ channels: z
10579
+ .array(notificationChannelReferenceWire)
10580
+ .max(5)
10581
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
10582
+ })
10583
+ .describe('Request body for an invoice created rule.');
10584
+ export const notificationRuleInvoiceUpdatedRequestWire = z
10585
+ .strictObject({
10586
+ name: z
10587
+ .string()
10588
+ .min(1)
10589
+ .max(256)
10590
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
10591
+ labels: labelsWire.optional(),
10592
+ type: z
10593
+ .literal('invoice.updated')
10594
+ .describe('The type of event the rule generates. Immutable after creation.'),
10595
+ disabled: z
10596
+ .boolean()
10597
+ .optional()
10598
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
10599
+ channels: z
10600
+ .array(notificationChannelReferenceWire)
10601
+ .max(5)
10602
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
10603
+ })
10604
+ .describe('Request body for an invoice updated rule.');
10161
10605
  export const notificationEventInvoiceDataWire = z
10162
10606
  .strictObject({
10163
10607
  invoice: notificationEventInvoiceReferenceWire,
@@ -10219,6 +10663,17 @@ export const listNotificationChannelsParamsFilterWire = z
10219
10663
  updated_at: dateTimeFieldFilterWire.optional(),
10220
10664
  })
10221
10665
  .describe('Filter options for listing notification channels.');
10666
+ export const listNotificationRulesParamsFilterWire = z
10667
+ .strictObject({
10668
+ id: ulidFieldFilterWire.optional(),
10669
+ name: stringFieldFilterWire.optional(),
10670
+ type: stringFieldFilterExactWire.optional(),
10671
+ disabled: booleanFieldFilterWire.optional(),
10672
+ created_at: dateTimeFieldFilterWire.optional(),
10673
+ updated_at: dateTimeFieldFilterWire.optional(),
10674
+ channel_id: ulidFieldFilterWire.optional(),
10675
+ })
10676
+ .describe('Filter options for listing notification rules.');
10222
10677
  export const listNotificationEventsParamsFilterWire = z
10223
10678
  .strictObject({
10224
10679
  id: ulidFieldFilterWire.optional(),
@@ -10927,6 +11382,70 @@ export const notificationChannelPagePaginatedResponseWire = z
10927
11382
  meta: paginatedMetaWire,
10928
11383
  })
10929
11384
  .describe('Page paginated response.');
11385
+ export const notificationRuleBalanceThresholdWire = z
11386
+ .strictObject({
11387
+ id: ulidWire,
11388
+ name: z
11389
+ .string()
11390
+ .min(1)
11391
+ .max(256)
11392
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
11393
+ labels: labelsWire.optional(),
11394
+ created_at: dateTimeWire,
11395
+ updated_at: dateTimeWire,
11396
+ deleted_at: dateTimeWire.optional(),
11397
+ type: z
11398
+ .literal('entitlements.balance.threshold')
11399
+ .describe('The type of event the rule generates. Immutable after creation.'),
11400
+ disabled: z
11401
+ .boolean()
11402
+ .optional()
11403
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
11404
+ channels: z
11405
+ .array(notificationChannelReferenceWire)
11406
+ .max(5)
11407
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
11408
+ thresholds: z
11409
+ .array(notificationBalanceThresholdWire)
11410
+ .min(1)
11411
+ .max(10)
11412
+ .describe('The thresholds that generate an event when crossed.'),
11413
+ features: z
11414
+ .array(featureReferenceWire)
11415
+ .optional()
11416
+ .describe('The features the rule applies to. When omitted, the rule applies to every feature.'),
11417
+ })
11418
+ .describe('A rule that generates an event when an entitlement balance crosses one of its thresholds.');
11419
+ export const notificationRuleBalanceThresholdRequestWire = z
11420
+ .strictObject({
11421
+ name: z
11422
+ .string()
11423
+ .min(1)
11424
+ .max(256)
11425
+ .describe('Display name of the resource. Between 1 and 256 characters.'),
11426
+ labels: labelsWire.optional(),
11427
+ type: z
11428
+ .literal('entitlements.balance.threshold')
11429
+ .describe('The type of event the rule generates. Immutable after creation.'),
11430
+ disabled: z
11431
+ .boolean()
11432
+ .optional()
11433
+ .describe('Whether the rule is disabled. Disabled rules do not generate events.'),
11434
+ channels: z
11435
+ .array(notificationChannelReferenceWire)
11436
+ .max(5)
11437
+ .describe('The channels the rule delivers its events to. At least one and at most five channels are required. Responses omit channels that have since been disabled or deleted.'),
11438
+ thresholds: z
11439
+ .array(notificationBalanceThresholdWire)
11440
+ .min(1)
11441
+ .max(10)
11442
+ .describe('The thresholds that generate an event when crossed.'),
11443
+ features: z
11444
+ .array(featureReferenceWire)
11445
+ .optional()
11446
+ .describe('The features the rule applies to. When omitted, the rule applies to every feature.'),
11447
+ })
11448
+ .describe('Request body for a balance threshold rule.');
10930
11449
  export const notificationEventDeliveryStatusWire = z
10931
11450
  .strictObject({
10932
11451
  channel_id: ulidWire,
@@ -11600,6 +12119,22 @@ export const entitlementAccessQueryResultWire = z
11600
12119
  updated_at: dateTimeWire,
11601
12120
  })
11602
12121
  .describe('Access evaluation result for a single resolved customer.');
12122
+ export const notificationRuleWire = z
12123
+ .discriminatedUnion('type', [
12124
+ notificationRuleBalanceThresholdWire,
12125
+ notificationRuleEntitlementResetWire,
12126
+ notificationRuleInvoiceCreatedWire,
12127
+ notificationRuleInvoiceUpdatedWire,
12128
+ ])
12129
+ .describe('A notification rule selects the type of event to generate, the conditions specific to that type, and the channels to deliver the events to.');
12130
+ export const notificationRuleRequestWire = z
12131
+ .discriminatedUnion('type', [
12132
+ notificationRuleBalanceThresholdRequestWire,
12133
+ notificationRuleEntitlementResetRequestWire,
12134
+ notificationRuleInvoiceCreatedRequestWire,
12135
+ notificationRuleInvoiceUpdatedRequestWire,
12136
+ ])
12137
+ .describe("Request body for creating or updating a notification rule. Updates replace the rule's mutable state: omitting `disabled`, `labels`, or `features` resets them to their defaults. The `type` must match the existing rule on update.");
11603
12138
  export const notificationEventBalanceThresholdPayloadWire = z
11604
12139
  .strictObject({
11605
12140
  id: ulidWire,
@@ -11888,6 +12423,12 @@ export const entitlementAccessQueryResponseWire = z
11888
12423
  meta: cursorMetaWire,
11889
12424
  })
11890
12425
  .describe('Response of the entitlement access query.');
12426
+ export const notificationRulePagePaginatedResponseWire = z
12427
+ .strictObject({
12428
+ data: z.array(notificationRuleWire),
12429
+ meta: paginatedMetaWire,
12430
+ })
12431
+ .describe('Page paginated response.');
11891
12432
  export const notificationEventPayloadWire = z
11892
12433
  .discriminatedUnion('type', [
11893
12434
  notificationEventBalanceThresholdPayloadWire,
@@ -13895,6 +14436,46 @@ export const updateNotificationChannelResponseWire = notificationChannelWire;
13895
14436
  export const deleteNotificationChannelPathParamsWire = z.object({
13896
14437
  notificationChannelId: ulidWire,
13897
14438
  });
14439
+ export const listNotificationRulesQueryParamsWire = z.object({
14440
+ page: z
14441
+ .strictObject({
14442
+ size: z.coerce
14443
+ .number()
14444
+ .int()
14445
+ .optional()
14446
+ .describe('The number of items to include per page.'),
14447
+ number: z.coerce.number().int().optional().describe('The page number.'),
14448
+ })
14449
+ .optional()
14450
+ .describe('Determines which page of the collection to retrieve.'),
14451
+ sort: z
14452
+ .string()
14453
+ .optional()
14454
+ .describe('Sort notification rules returned in the response. Supported sort attributes are: - `id` (default) - `type` - `created_at` - `updated_at` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order.'),
14455
+ filter: listNotificationRulesParamsFilterWire.optional(),
14456
+ });
14457
+ export const listNotificationRulesResponseWire = z.strictObject({
14458
+ data: z.array(notificationRuleWire),
14459
+ meta: paginatedMetaWire,
14460
+ });
14461
+ export const createNotificationRuleBodyWire = notificationRuleRequestWire;
14462
+ export const createNotificationRuleResponseWire = notificationRuleWire;
14463
+ export const getNotificationRulePathParamsWire = z.object({
14464
+ notificationRuleId: ulidWire,
14465
+ });
14466
+ export const getNotificationRuleResponseWire = notificationRuleWire;
14467
+ export const updateNotificationRulePathParamsWire = z.object({
14468
+ notificationRuleId: ulidWire,
14469
+ });
14470
+ export const updateNotificationRuleBodyWire = notificationRuleRequestWire;
14471
+ export const updateNotificationRuleResponseWire = notificationRuleWire;
14472
+ export const deleteNotificationRulePathParamsWire = z.object({
14473
+ notificationRuleId: ulidWire,
14474
+ });
14475
+ export const testNotificationRulePathParamsWire = z.object({
14476
+ notificationRuleId: ulidWire,
14477
+ });
14478
+ export const testNotificationRuleResponseWire = notificationEventWire;
13898
14479
  export const listNotificationEventsQueryParamsWire = z.object({
13899
14480
  page: z
13900
14481
  .strictObject({