@openmeter/client 1.0.0-beta-91c742cf435f → 1.0.0-beta-940352b52249

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,43 @@ 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 notificationEventType = z
920
+ .enum([
921
+ 'entitlements.balance.threshold',
922
+ 'entitlements.reset',
923
+ 'invoice.created',
924
+ 'invoice.updated',
925
+ ])
926
+ .describe('The type of a notification event. It determines which payload variant the event carries.');
927
+ export const notificationEventDeliveryState = z
928
+ .enum(['success', 'failed', 'sending', 'pending', 'resending'])
929
+ .describe('The delivery state of a notification event for a single channel.');
930
+ export const notificationEventDeliveryAttemptResponse = z
931
+ .object({
932
+ statusCode: z
933
+ .number()
934
+ .int()
935
+ .gte(-2147483648)
936
+ .lte(2147483647)
937
+ .optional()
938
+ .describe('The HTTP status code returned by the recipient. Absent when no response was received.'),
939
+ body: z
940
+ .string()
941
+ .describe('The response body returned by the recipient. Empty when no body was received.'),
942
+ durationMs: z.coerce
943
+ .bigint()
944
+ .gte(-9223372036854775808n)
945
+ .lte(9223372036854775807n)
946
+ .describe('How long the delivery attempt took, in milliseconds.'),
947
+ url: z
948
+ .string()
949
+ .optional()
950
+ .describe('The URL the event was delivered to. Only set for webhook channels.'),
951
+ })
952
+ .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.');
919
956
  export const queryFilterInteger = z
920
957
  .object({
921
958
  eq: z
@@ -1629,6 +1666,26 @@ export const updateResourceReference = z
1629
1666
  id: ulid,
1630
1667
  })
1631
1668
  .describe('TaxCode reference.');
1669
+ export const notificationEventFeatureReference = z
1670
+ .object({
1671
+ id: ulid,
1672
+ key: z.string().describe('The immutable key of the feature.'),
1673
+ })
1674
+ .describe('A reference to the feature of an entitlement notification event.');
1675
+ export const notificationEventInvoiceReference = z
1676
+ .object({
1677
+ id: ulid,
1678
+ number: z.string().describe('The human-readable invoice number.'),
1679
+ })
1680
+ .describe('A reference to the invoice of an invoice notification event.');
1681
+ export const resendBillingNotificationEventRequest = z
1682
+ .object({
1683
+ channels: z
1684
+ .array(ulid)
1685
+ .optional()
1686
+ .describe('The channels to resend the event to. When omitted or empty, the event is resent to every enabled channel of the rule. Channels not targeted by the rule or disabled are rejected.'),
1687
+ })
1688
+ .describe('Request body for resending a notification event.');
1632
1689
  export const billingCustomerReference = z
1633
1690
  .object({
1634
1691
  id: ulid,
@@ -2751,6 +2808,26 @@ export const updateBillingNotificationChannelRequest = z
2751
2808
  .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.'),
2752
2809
  })
2753
2810
  .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.");
2811
+ export const notificationRuleReference = z
2812
+ .object({
2813
+ id: ulid,
2814
+ type: notificationEventType,
2815
+ name: z.string().describe('The user-provided name of the rule.'),
2816
+ })
2817
+ .describe('A reference to the notification rule that generated an event.');
2818
+ export const notificationEventDeliveryAttempt = z
2819
+ .object({
2820
+ state: notificationEventDeliveryState,
2821
+ response: notificationEventDeliveryAttemptResponse,
2822
+ timestamp: dateTime,
2823
+ })
2824
+ .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.');
2754
2831
  export const appCustomerData = z
2755
2832
  .object({
2756
2833
  stripe: appCustomerDataStripe
@@ -3162,6 +3239,17 @@ export const updateTaxCodeConfig = z
3162
3239
  code: updateResourceReference.optional(),
3163
3240
  })
3164
3241
  .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.');
3242
+ export const notificationEventInvoiceData = z
3243
+ .object({
3244
+ invoice: notificationEventInvoiceReference,
3245
+ customerId: ulid.optional(),
3246
+ currency: currencyCode,
3247
+ status: z
3248
+ .string()
3249
+ .describe('The status of the invoice at the time the event was generated.'),
3250
+ total: numeric,
3251
+ })
3252
+ .describe('The invoice an invoice notification event refers to.');
3165
3253
  export const listEventsParamsFilter = z
3166
3254
  .object({
3167
3255
  id: stringFieldFilter.optional(),
@@ -3212,6 +3300,20 @@ export const listNotificationChannelsParamsFilter = z
3212
3300
  updatedAt: dateTimeFieldFilter.optional(),
3213
3301
  })
3214
3302
  .describe('Filter options for listing notification channels.');
3303
+ export const listNotificationEventsParamsFilter = z
3304
+ .object({
3305
+ id: ulidFieldFilter.optional(),
3306
+ type: stringFieldFilterExact.optional(),
3307
+ createdAt: dateTimeFieldFilter.optional(),
3308
+ ruleId: ulidFieldFilter.optional(),
3309
+ channelId: ulidFieldFilter.optional(),
3310
+ deliveryStatus: stringFieldFilterExact.optional(),
3311
+ subjectKey: stringFieldFilterExact.optional(),
3312
+ subjectId: ulidFieldFilter.optional(),
3313
+ featureKey: stringFieldFilterExact.optional(),
3314
+ featureId: ulidFieldFilter.optional(),
3315
+ })
3316
+ .describe('Filter options for listing notification events.');
3215
3317
  export const resourceFilters = z
3216
3318
  .object({
3217
3319
  name: stringFieldFilter.optional(),
@@ -3907,6 +4009,20 @@ export const notificationChannelPagePaginatedResponse = z
3907
4009
  meta: paginatedMeta,
3908
4010
  })
3909
4011
  .describe('Page paginated response.');
4012
+ export const notificationEventDeliveryStatus = z
4013
+ .object({
4014
+ channelId: ulid,
4015
+ state: notificationEventDeliveryState,
4016
+ reason: z
4017
+ .string()
4018
+ .describe('The reason for the last state change. Empty for successful deliveries.'),
4019
+ updatedAt: dateTime,
4020
+ nextAttempt: dateTime.optional(),
4021
+ attempts: z
4022
+ .array(notificationEventDeliveryAttempt)
4023
+ .describe('The delivery attempts made so far, most recent first.'),
4024
+ })
4025
+ .describe('The delivery status of a notification event for one channel of the generating rule.');
3910
4026
  export const customerData = z
3911
4027
  .object({
3912
4028
  billingProfile: profileReference.optional(),
@@ -3950,6 +4066,29 @@ export const listCustomerEntitlementAccessResponseData = z
3950
4066
  .describe('The list of entitlement access results.'),
3951
4067
  })
3952
4068
  .describe('List customer entitlement access response data.');
4069
+ export const notificationEventBalanceThresholdData = z
4070
+ .object({
4071
+ entitlementId: ulid,
4072
+ feature: notificationEventFeatureReference,
4073
+ subjectKey: z
4074
+ .string()
4075
+ .describe('The key of the subject the entitlement belongs to.'),
4076
+ customerId: ulid.optional(),
4077
+ value: entitlementValueResult,
4078
+ threshold: notificationBalanceThreshold,
4079
+ })
4080
+ .describe('The entities and threshold a balance threshold event refers to.');
4081
+ export const notificationEventEntitlementData = z
4082
+ .object({
4083
+ entitlementId: ulid,
4084
+ feature: notificationEventFeatureReference,
4085
+ subjectKey: z
4086
+ .string()
4087
+ .describe('The key of the subject the entitlement belongs to.'),
4088
+ customerId: ulid.optional(),
4089
+ value: entitlementValueResult,
4090
+ })
4091
+ .describe('The entitlement, feature, and subject an entitlement notification event refers to.');
3953
4092
  export const priceGraduated = z
3954
4093
  .object({
3955
4094
  type: z.literal('graduated').describe('The type of the price.'),
@@ -4083,6 +4222,22 @@ export const planAddonPagePaginatedResponse = z
4083
4222
  meta: paginatedMeta,
4084
4223
  })
4085
4224
  .describe('Page paginated response.');
4225
+ export const notificationEventInvoiceCreatedPayload = z
4226
+ .object({
4227
+ id: ulid,
4228
+ type: z.literal('invoice.created').describe('The type of the event.'),
4229
+ timestamp: dateTime,
4230
+ data: notificationEventInvoiceData,
4231
+ })
4232
+ .describe('An invoice created notification event payload.');
4233
+ export const notificationEventInvoiceUpdatedPayload = z
4234
+ .object({
4235
+ id: ulid,
4236
+ type: z.literal('invoice.updated').describe('The type of the event.'),
4237
+ timestamp: dateTime,
4238
+ data: notificationEventInvoiceData,
4239
+ })
4240
+ .describe('An invoice updated notification event payload.');
4086
4241
  export const ingestedEventPaginatedResponse = z
4087
4242
  .object({
4088
4243
  data: z.array(ingestedEvent),
@@ -4534,6 +4689,24 @@ export const entitlementAccessQueryResult = z
4534
4689
  updatedAt: dateTime,
4535
4690
  })
4536
4691
  .describe('Access evaluation result for a single resolved customer.');
4692
+ export const notificationEventBalanceThresholdPayload = z
4693
+ .object({
4694
+ id: ulid,
4695
+ type: z
4696
+ .literal('entitlements.balance.threshold')
4697
+ .describe('The type of the event.'),
4698
+ timestamp: dateTime,
4699
+ data: notificationEventBalanceThresholdData,
4700
+ })
4701
+ .describe('A balance threshold notification event payload.');
4702
+ export const notificationEventResetPayload = z
4703
+ .object({
4704
+ id: ulid,
4705
+ type: z.literal('entitlements.reset').describe('The type of the event.'),
4706
+ timestamp: dateTime,
4707
+ data: notificationEventEntitlementData,
4708
+ })
4709
+ .describe('An entitlement reset notification event payload.');
4537
4710
  export const price = z
4538
4711
  .discriminatedUnion('type', [
4539
4712
  priceFree,
@@ -4801,6 +4974,14 @@ export const entitlementAccessQueryResponse = z
4801
4974
  meta: cursorMeta,
4802
4975
  })
4803
4976
  .describe('Response of the entitlement access query.');
4977
+ export const notificationEventPayload = z
4978
+ .discriminatedUnion('type', [
4979
+ notificationEventBalanceThresholdPayload,
4980
+ notificationEventResetPayload,
4981
+ notificationEventInvoiceCreatedPayload,
4982
+ notificationEventInvoiceUpdatedPayload,
4983
+ ])
4984
+ .describe('The payload delivered to the channels, discriminated by the event type.');
4804
4985
  export const rateCard = z
4805
4986
  .object({
4806
4987
  name: z
@@ -4940,6 +5121,18 @@ export const profileApps = z
4940
5121
  payment: app,
4941
5122
  })
4942
5123
  .describe('Applications used by a billing profile.');
5124
+ export const notificationEvent = z
5125
+ .object({
5126
+ id: ulid,
5127
+ type: notificationEventType,
5128
+ createdAt: dateTime,
5129
+ rule: notificationRuleReference,
5130
+ deliveryStatus: z
5131
+ .array(notificationEventDeliveryStatus)
5132
+ .describe('The delivery status of the event, one entry per channel of the rule.'),
5133
+ payload: notificationEventPayload,
5134
+ })
5135
+ .describe('A notification event records that a notification rule fired and tracks the delivery of its payload to each channel of the rule. Events are created by the system and cannot be modified.');
4943
5136
  export const subscriptionItem = z
4944
5137
  .object({
4945
5138
  id: ulid,
@@ -5202,6 +5395,12 @@ export const chargeRealization = z
5202
5395
  .describe('The detailed (rated) lines produced by the realization run. Requires the `realization.detailed_lines` expand.'),
5203
5396
  })
5204
5397
  .describe("A realization run of a charge. `totals` and `detailed_lines` are only populated with the `realization.totals` and `realization.detailed_lines` expands, respectively, since computing them requires re-deriving the run's rated breakdown. `invoice` is an ID reference unless the `realization.invoice` expand is used, which resolves it to the invoice header of the run's booked line: the invoice entity without its `lines` and without the `customer` snapshot (the charge itself already identifies the customer).");
5398
+ export const notificationEventPagePaginatedResponse = z
5399
+ .object({
5400
+ data: z.array(notificationEvent),
5401
+ meta: paginatedMeta,
5402
+ })
5403
+ .describe('Page paginated response.');
5205
5404
  export const subscriptionPhase = z
5206
5405
  .object({
5207
5406
  id: ulid,
@@ -6723,6 +6922,33 @@ export const updateNotificationChannelResponse = notificationChannel;
6723
6922
  export const deleteNotificationChannelPathParams = z.object({
6724
6923
  notificationChannelId: ulid,
6725
6924
  });
6925
+ export const listNotificationEventsQueryParams = z.object({
6926
+ page: z
6927
+ .object({
6928
+ size: z.coerce
6929
+ .number()
6930
+ .int()
6931
+ .optional()
6932
+ .describe('The number of items to include per page.'),
6933
+ number: z.coerce.number().int().optional().describe('The page number.'),
6934
+ })
6935
+ .optional()
6936
+ .describe('Determines which page of the collection to retrieve.'),
6937
+ sort: sortQuery.optional(),
6938
+ filter: listNotificationEventsParamsFilter.optional(),
6939
+ });
6940
+ export const listNotificationEventsResponse = z.object({
6941
+ data: z.array(notificationEvent),
6942
+ meta: paginatedMeta,
6943
+ });
6944
+ export const getNotificationEventPathParams = z.object({
6945
+ notificationEventId: ulid,
6946
+ });
6947
+ export const getNotificationEventResponse = notificationEvent;
6948
+ export const resendNotificationEventPathParams = z.object({
6949
+ notificationEventId: ulid,
6950
+ });
6951
+ export const resendNotificationEventBody = resendBillingNotificationEventRequest;
6726
6952
  export const labelsWire = z
6727
6953
  .record(z.string(), z.string())
6728
6954
  .describe('Labels store metadata of an entity that can be used for filtering an entity list or for searching across entity types. Keys must be of length 1-63 characters, and cannot start with "kong", "konnect", "mesh", "kic", or "\\_".');
@@ -7632,6 +7858,43 @@ export const booleanFieldFilterWire = z
7632
7858
  export const notificationChannelTypeWire = z
7633
7859
  .enum(['webhook'])
7634
7860
  .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.');
7861
+ export const notificationEventTypeWire = z
7862
+ .enum([
7863
+ 'entitlements.balance.threshold',
7864
+ 'entitlements.reset',
7865
+ 'invoice.created',
7866
+ 'invoice.updated',
7867
+ ])
7868
+ .describe('The type of a notification event. It determines which payload variant the event carries.');
7869
+ export const notificationEventDeliveryStateWire = z
7870
+ .enum(['success', 'failed', 'sending', 'pending', 'resending'])
7871
+ .describe('The delivery state of a notification event for a single channel.');
7872
+ export const notificationEventDeliveryAttemptResponseWire = z
7873
+ .strictObject({
7874
+ status_code: z
7875
+ .number()
7876
+ .int()
7877
+ .gte(-2147483648)
7878
+ .lte(2147483647)
7879
+ .optional()
7880
+ .describe('The HTTP status code returned by the recipient. Absent when no response was received.'),
7881
+ body: z
7882
+ .string()
7883
+ .describe('The response body returned by the recipient. Empty when no body was received.'),
7884
+ duration_ms: z.coerce
7885
+ .bigint()
7886
+ .gte(-9223372036854775808n)
7887
+ .lte(9223372036854775807n)
7888
+ .describe('How long the delivery attempt took, in milliseconds.'),
7889
+ url: z
7890
+ .string()
7891
+ .optional()
7892
+ .describe('The URL the event was delivered to. Only set for webhook channels.'),
7893
+ })
7894
+ .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.');
7635
7898
  export const queryFilterIntegerWire = z
7636
7899
  .strictObject({
7637
7900
  eq: z
@@ -8344,6 +8607,26 @@ export const updateResourceReferenceWire = z
8344
8607
  id: ulidWire,
8345
8608
  })
8346
8609
  .describe('TaxCode reference.');
8610
+ export const notificationEventFeatureReferenceWire = z
8611
+ .strictObject({
8612
+ id: ulidWire,
8613
+ key: z.string().describe('The immutable key of the feature.'),
8614
+ })
8615
+ .describe('A reference to the feature of an entitlement notification event.');
8616
+ export const notificationEventInvoiceReferenceWire = z
8617
+ .strictObject({
8618
+ id: ulidWire,
8619
+ number: z.string().describe('The human-readable invoice number.'),
8620
+ })
8621
+ .describe('A reference to the invoice of an invoice notification event.');
8622
+ export const resendBillingNotificationEventRequestWire = z
8623
+ .strictObject({
8624
+ channels: z
8625
+ .array(ulidWire)
8626
+ .optional()
8627
+ .describe('The channels to resend the event to. When omitted or empty, the event is resent to every enabled channel of the rule. Channels not targeted by the rule or disabled are rejected.'),
8628
+ })
8629
+ .describe('Request body for resending a notification event.');
8347
8630
  export const billingCustomerReferenceWire = z
8348
8631
  .strictObject({
8349
8632
  id: ulidWire,
@@ -9444,6 +9727,26 @@ export const updateBillingNotificationChannelRequestWire = z
9444
9727
  .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.'),
9445
9728
  })
9446
9729
  .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.");
9730
+ export const notificationRuleReferenceWire = z
9731
+ .strictObject({
9732
+ id: ulidWire,
9733
+ type: notificationEventTypeWire,
9734
+ name: z.string().describe('The user-provided name of the rule.'),
9735
+ })
9736
+ .describe('A reference to the notification rule that generated an event.');
9737
+ export const notificationEventDeliveryAttemptWire = z
9738
+ .strictObject({
9739
+ state: notificationEventDeliveryStateWire,
9740
+ response: notificationEventDeliveryAttemptResponseWire,
9741
+ timestamp: dateTimeWire,
9742
+ })
9743
+ .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.');
9447
9750
  export const appCustomerDataWire = z
9448
9751
  .strictObject({
9449
9752
  stripe: appCustomerDataStripeWire
@@ -9855,6 +10158,17 @@ export const updateTaxCodeConfigWire = z
9855
10158
  code: updateResourceReferenceWire.optional(),
9856
10159
  })
9857
10160
  .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.');
10161
+ export const notificationEventInvoiceDataWire = z
10162
+ .strictObject({
10163
+ invoice: notificationEventInvoiceReferenceWire,
10164
+ customer_id: ulidWire.optional(),
10165
+ currency: currencyCodeWire,
10166
+ status: z
10167
+ .string()
10168
+ .describe('The status of the invoice at the time the event was generated.'),
10169
+ total: numericWire,
10170
+ })
10171
+ .describe('The invoice an invoice notification event refers to.');
9858
10172
  export const listEventsParamsFilterWire = z
9859
10173
  .strictObject({
9860
10174
  id: stringFieldFilterWire.optional(),
@@ -9905,6 +10219,20 @@ export const listNotificationChannelsParamsFilterWire = z
9905
10219
  updated_at: dateTimeFieldFilterWire.optional(),
9906
10220
  })
9907
10221
  .describe('Filter options for listing notification channels.');
10222
+ export const listNotificationEventsParamsFilterWire = z
10223
+ .strictObject({
10224
+ id: ulidFieldFilterWire.optional(),
10225
+ type: stringFieldFilterExactWire.optional(),
10226
+ created_at: dateTimeFieldFilterWire.optional(),
10227
+ rule_id: ulidFieldFilterWire.optional(),
10228
+ channel_id: ulidFieldFilterWire.optional(),
10229
+ delivery_status: stringFieldFilterExactWire.optional(),
10230
+ subject_key: stringFieldFilterExactWire.optional(),
10231
+ subject_id: ulidFieldFilterWire.optional(),
10232
+ feature_key: stringFieldFilterExactWire.optional(),
10233
+ feature_id: ulidFieldFilterWire.optional(),
10234
+ })
10235
+ .describe('Filter options for listing notification events.');
9908
10236
  export const resourceFiltersWire = z
9909
10237
  .strictObject({
9910
10238
  name: stringFieldFilterWire.optional(),
@@ -10599,6 +10927,20 @@ export const notificationChannelPagePaginatedResponseWire = z
10599
10927
  meta: paginatedMetaWire,
10600
10928
  })
10601
10929
  .describe('Page paginated response.');
10930
+ export const notificationEventDeliveryStatusWire = z
10931
+ .strictObject({
10932
+ channel_id: ulidWire,
10933
+ state: notificationEventDeliveryStateWire,
10934
+ reason: z
10935
+ .string()
10936
+ .describe('The reason for the last state change. Empty for successful deliveries.'),
10937
+ updated_at: dateTimeWire,
10938
+ next_attempt: dateTimeWire.optional(),
10939
+ attempts: z
10940
+ .array(notificationEventDeliveryAttemptWire)
10941
+ .describe('The delivery attempts made so far, most recent first.'),
10942
+ })
10943
+ .describe('The delivery status of a notification event for one channel of the generating rule.');
10602
10944
  export const customerDataWire = z
10603
10945
  .strictObject({
10604
10946
  billing_profile: profileReferenceWire.optional(),
@@ -10642,6 +10984,29 @@ export const listCustomerEntitlementAccessResponseDataWire = z
10642
10984
  .describe('The list of entitlement access results.'),
10643
10985
  })
10644
10986
  .describe('List customer entitlement access response data.');
10987
+ export const notificationEventBalanceThresholdDataWire = z
10988
+ .strictObject({
10989
+ entitlement_id: ulidWire,
10990
+ feature: notificationEventFeatureReferenceWire,
10991
+ subject_key: z
10992
+ .string()
10993
+ .describe('The key of the subject the entitlement belongs to.'),
10994
+ customer_id: ulidWire.optional(),
10995
+ value: entitlementValueResultWire,
10996
+ threshold: notificationBalanceThresholdWire,
10997
+ })
10998
+ .describe('The entities and threshold a balance threshold event refers to.');
10999
+ export const notificationEventEntitlementDataWire = z
11000
+ .strictObject({
11001
+ entitlement_id: ulidWire,
11002
+ feature: notificationEventFeatureReferenceWire,
11003
+ subject_key: z
11004
+ .string()
11005
+ .describe('The key of the subject the entitlement belongs to.'),
11006
+ customer_id: ulidWire.optional(),
11007
+ value: entitlementValueResultWire,
11008
+ })
11009
+ .describe('The entitlement, feature, and subject an entitlement notification event refers to.');
10645
11010
  export const priceGraduatedWire = z
10646
11011
  .strictObject({
10647
11012
  type: z.literal('graduated').describe('The type of the price.'),
@@ -10774,6 +11139,22 @@ export const planAddonPagePaginatedResponseWire = z
10774
11139
  meta: paginatedMetaWire,
10775
11140
  })
10776
11141
  .describe('Page paginated response.');
11142
+ export const notificationEventInvoiceCreatedPayloadWire = z
11143
+ .strictObject({
11144
+ id: ulidWire,
11145
+ type: z.literal('invoice.created').describe('The type of the event.'),
11146
+ timestamp: dateTimeWire,
11147
+ data: notificationEventInvoiceDataWire,
11148
+ })
11149
+ .describe('An invoice created notification event payload.');
11150
+ export const notificationEventInvoiceUpdatedPayloadWire = z
11151
+ .strictObject({
11152
+ id: ulidWire,
11153
+ type: z.literal('invoice.updated').describe('The type of the event.'),
11154
+ timestamp: dateTimeWire,
11155
+ data: notificationEventInvoiceDataWire,
11156
+ })
11157
+ .describe('An invoice updated notification event payload.');
10777
11158
  export const ingestedEventPaginatedResponseWire = z
10778
11159
  .strictObject({
10779
11160
  data: z.array(ingestedEventWire),
@@ -11219,6 +11600,24 @@ export const entitlementAccessQueryResultWire = z
11219
11600
  updated_at: dateTimeWire,
11220
11601
  })
11221
11602
  .describe('Access evaluation result for a single resolved customer.');
11603
+ export const notificationEventBalanceThresholdPayloadWire = z
11604
+ .strictObject({
11605
+ id: ulidWire,
11606
+ type: z
11607
+ .literal('entitlements.balance.threshold')
11608
+ .describe('The type of the event.'),
11609
+ timestamp: dateTimeWire,
11610
+ data: notificationEventBalanceThresholdDataWire,
11611
+ })
11612
+ .describe('A balance threshold notification event payload.');
11613
+ export const notificationEventResetPayloadWire = z
11614
+ .strictObject({
11615
+ id: ulidWire,
11616
+ type: z.literal('entitlements.reset').describe('The type of the event.'),
11617
+ timestamp: dateTimeWire,
11618
+ data: notificationEventEntitlementDataWire,
11619
+ })
11620
+ .describe('An entitlement reset notification event payload.');
11222
11621
  export const priceWire = z
11223
11622
  .discriminatedUnion('type', [
11224
11623
  priceFreeWire,
@@ -11489,6 +11888,14 @@ export const entitlementAccessQueryResponseWire = z
11489
11888
  meta: cursorMetaWire,
11490
11889
  })
11491
11890
  .describe('Response of the entitlement access query.');
11891
+ export const notificationEventPayloadWire = z
11892
+ .discriminatedUnion('type', [
11893
+ notificationEventBalanceThresholdPayloadWire,
11894
+ notificationEventResetPayloadWire,
11895
+ notificationEventInvoiceCreatedPayloadWire,
11896
+ notificationEventInvoiceUpdatedPayloadWire,
11897
+ ])
11898
+ .describe('The payload delivered to the channels, discriminated by the event type.');
11492
11899
  export const rateCardWire = z
11493
11900
  .strictObject({
11494
11901
  name: z
@@ -11628,6 +12035,18 @@ export const profileAppsWire = z
11628
12035
  payment: appWire,
11629
12036
  })
11630
12037
  .describe('Applications used by a billing profile.');
12038
+ export const notificationEventWire = z
12039
+ .strictObject({
12040
+ id: ulidWire,
12041
+ type: notificationEventTypeWire,
12042
+ created_at: dateTimeWire,
12043
+ rule: notificationRuleReferenceWire,
12044
+ delivery_status: z
12045
+ .array(notificationEventDeliveryStatusWire)
12046
+ .describe('The delivery status of the event, one entry per channel of the rule.'),
12047
+ payload: notificationEventPayloadWire,
12048
+ })
12049
+ .describe('A notification event records that a notification rule fired and tracks the delivery of its payload to each channel of the rule. Events are created by the system and cannot be modified.');
11631
12050
  export const subscriptionItemWire = z
11632
12051
  .strictObject({
11633
12052
  id: ulidWire,
@@ -11889,6 +12308,12 @@ export const chargeRealizationWire = z
11889
12308
  .describe('The detailed (rated) lines produced by the realization run. Requires the `realization.detailed_lines` expand.'),
11890
12309
  })
11891
12310
  .describe("A realization run of a charge. `totals` and `detailed_lines` are only populated with the `realization.totals` and `realization.detailed_lines` expands, respectively, since computing them requires re-deriving the run's rated breakdown. `invoice` is an ID reference unless the `realization.invoice` expand is used, which resolves it to the invoice header of the run's booked line: the invoice entity without its `lines` and without the `customer` snapshot (the charge itself already identifies the customer).");
12311
+ export const notificationEventPagePaginatedResponseWire = z
12312
+ .strictObject({
12313
+ data: z.array(notificationEventWire),
12314
+ meta: paginatedMetaWire,
12315
+ })
12316
+ .describe('Page paginated response.');
11892
12317
  export const subscriptionPhaseWire = z
11893
12318
  .strictObject({
11894
12319
  id: ulidWire,
@@ -13470,3 +13895,33 @@ export const updateNotificationChannelResponseWire = notificationChannelWire;
13470
13895
  export const deleteNotificationChannelPathParamsWire = z.object({
13471
13896
  notificationChannelId: ulidWire,
13472
13897
  });
13898
+ export const listNotificationEventsQueryParamsWire = z.object({
13899
+ page: z
13900
+ .strictObject({
13901
+ size: z.coerce
13902
+ .number()
13903
+ .int()
13904
+ .optional()
13905
+ .describe('The number of items to include per page.'),
13906
+ number: z.coerce.number().int().optional().describe('The page number.'),
13907
+ })
13908
+ .optional()
13909
+ .describe('Determines which page of the collection to retrieve.'),
13910
+ sort: z
13911
+ .string()
13912
+ .optional()
13913
+ .describe('Sort notification events returned in the response. Supported sort attributes are: - `created_at` (default) - `id` - `type` The `asc` suffix is optional as the default sort order is ascending. The `desc` suffix is used to specify a descending order. Without a `sort` parameter, events are returned newest first.'),
13914
+ filter: listNotificationEventsParamsFilterWire.optional(),
13915
+ });
13916
+ export const listNotificationEventsResponseWire = z.strictObject({
13917
+ data: z.array(notificationEventWire),
13918
+ meta: paginatedMetaWire,
13919
+ });
13920
+ export const getNotificationEventPathParamsWire = z.object({
13921
+ notificationEventId: ulidWire,
13922
+ });
13923
+ export const getNotificationEventResponseWire = notificationEventWire;
13924
+ export const resendNotificationEventPathParamsWire = z.object({
13925
+ notificationEventId: ulidWire,
13926
+ });
13927
+ export const resendNotificationEventBodyWire = resendBillingNotificationEventRequestWire;