@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.
- package/README.md +9 -0
- package/dist/funcs/notifications.d.ts +29 -1
- package/dist/funcs/notifications.js +102 -0
- package/dist/index.d.ts +1 -1
- package/dist/lib/version.d.ts +1 -1
- package/dist/lib/version.js +1 -1
- package/dist/models/operations/notifications.d.ts +42 -1
- package/dist/models/schemas.d.ts +2220 -35
- package/dist/models/schemas.js +455 -0
- package/dist/models/types.d.ts +240 -0
- package/dist/sdk/internal.d.ts +46 -0
- package/dist/sdk/internal.js +58 -0
- package/package.json +1 -1
package/dist/models/types.d.ts
CHANGED
|
@@ -424,6 +424,23 @@ export interface EntitlementAccessQueryRequestFeatures {
|
|
|
424
424
|
/** List of feature keys to evaluate access for. */
|
|
425
425
|
keys: string[];
|
|
426
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
|
+
}
|
|
427
444
|
/**
|
|
428
445
|
* A query filter for an integer attribute. Operators are mutually exclusive, only
|
|
429
446
|
* one operator is allowed at a time.
|
|
@@ -1045,6 +1062,29 @@ export interface ChargeReference {
|
|
|
1045
1062
|
export interface UpdateResourceReference {
|
|
1046
1063
|
id: string;
|
|
1047
1064
|
}
|
|
1065
|
+
/** A reference to the feature of an entitlement notification event. */
|
|
1066
|
+
export interface NotificationEventFeatureReference {
|
|
1067
|
+
/** The unique identifier of the feature. */
|
|
1068
|
+
id: string;
|
|
1069
|
+
/** The immutable key of the feature. */
|
|
1070
|
+
key: string;
|
|
1071
|
+
}
|
|
1072
|
+
/** A reference to the invoice of an invoice notification event. */
|
|
1073
|
+
export interface NotificationEventInvoiceReference {
|
|
1074
|
+
/** The unique identifier of the invoice. */
|
|
1075
|
+
id: string;
|
|
1076
|
+
/** The human-readable invoice number. */
|
|
1077
|
+
number: string;
|
|
1078
|
+
}
|
|
1079
|
+
/** Request body for resending a notification event. */
|
|
1080
|
+
export interface ResendBillingNotificationEventRequest {
|
|
1081
|
+
/**
|
|
1082
|
+
* The channels to resend the event to. When omitted or empty, the event is resent
|
|
1083
|
+
* to every enabled channel of the rule. Channels not targeted by the rule or
|
|
1084
|
+
* disabled are rejected.
|
|
1085
|
+
*/
|
|
1086
|
+
channels?: string[];
|
|
1087
|
+
}
|
|
1048
1088
|
/** Customer reference. */
|
|
1049
1089
|
export interface BillingCustomerReference {
|
|
1050
1090
|
/** The ID of the customer. */
|
|
@@ -2444,6 +2484,34 @@ export interface UpdateBillingNotificationChannelRequest {
|
|
|
2444
2484
|
*/
|
|
2445
2485
|
signingSecret?: string;
|
|
2446
2486
|
}
|
|
2487
|
+
/** A reference to the notification rule that generated an event. */
|
|
2488
|
+
export interface NotificationRuleReference {
|
|
2489
|
+
/** The unique identifier of the rule. */
|
|
2490
|
+
id: string;
|
|
2491
|
+
/** The type of event the rule generates. */
|
|
2492
|
+
type: 'entitlements.balance.threshold' | 'entitlements.reset' | 'invoice.created' | 'invoice.updated';
|
|
2493
|
+
/** The user-provided name of the rule. */
|
|
2494
|
+
name: string;
|
|
2495
|
+
}
|
|
2496
|
+
/** A single delivery attempt to a channel. */
|
|
2497
|
+
export interface NotificationEventDeliveryAttempt {
|
|
2498
|
+
/** The delivery state reached by this attempt. */
|
|
2499
|
+
state: 'success' | 'failed' | 'sending' | 'pending' | 'resending';
|
|
2500
|
+
/** The response returned by the recipient. */
|
|
2501
|
+
response: NotificationEventDeliveryAttemptResponse;
|
|
2502
|
+
/** When the attempt was made. */
|
|
2503
|
+
timestamp: Date;
|
|
2504
|
+
}
|
|
2505
|
+
/**
|
|
2506
|
+
* A balance threshold of a notification rule. Crossing it generates an
|
|
2507
|
+
* `entitlements.balance.threshold` event.
|
|
2508
|
+
*/
|
|
2509
|
+
export interface NotificationBalanceThreshold {
|
|
2510
|
+
/** What the threshold value is measured against. */
|
|
2511
|
+
type: 'balance_value' | 'usage_percentage' | 'usage_value';
|
|
2512
|
+
/** The threshold value. */
|
|
2513
|
+
value: number;
|
|
2514
|
+
}
|
|
2447
2515
|
/** App customer data. */
|
|
2448
2516
|
export interface AppCustomerData {
|
|
2449
2517
|
/**
|
|
@@ -3076,6 +3144,19 @@ export interface UpdateTaxCodeConfig {
|
|
|
3076
3144
|
/** Tax code applied to the invoice line item. */
|
|
3077
3145
|
code?: UpdateResourceReference;
|
|
3078
3146
|
}
|
|
3147
|
+
/** The invoice an invoice notification event refers to. */
|
|
3148
|
+
export interface NotificationEventInvoiceData {
|
|
3149
|
+
/** The invoice the event was generated for. */
|
|
3150
|
+
invoice: NotificationEventInvoiceReference;
|
|
3151
|
+
/** The identifier of the customer the invoice was issued to. */
|
|
3152
|
+
customerId?: string;
|
|
3153
|
+
/** The currency the invoice is denominated in. */
|
|
3154
|
+
currency: string;
|
|
3155
|
+
/** The status of the invoice at the time the event was generated. */
|
|
3156
|
+
status: string;
|
|
3157
|
+
/** The invoice total, including taxes, at the time the event was generated. */
|
|
3158
|
+
total: string;
|
|
3159
|
+
}
|
|
3079
3160
|
/** Filter options for listing ingested events. */
|
|
3080
3161
|
export interface ListEventsParamsFilter {
|
|
3081
3162
|
/** Filter events by ID. */
|
|
@@ -3167,6 +3248,43 @@ export interface ListNotificationChannelsParamsFilter {
|
|
|
3167
3248
|
createdAt?: DateTimeFieldFilter;
|
|
3168
3249
|
updatedAt?: DateTimeFieldFilter;
|
|
3169
3250
|
}
|
|
3251
|
+
/** Filter options for listing notification events. */
|
|
3252
|
+
export interface ListNotificationEventsParamsFilter {
|
|
3253
|
+
id?: UlidFieldFilter;
|
|
3254
|
+
type?: StringFieldFilterExact;
|
|
3255
|
+
createdAt?: DateTimeFieldFilter;
|
|
3256
|
+
ruleId?: UlidFieldFilter;
|
|
3257
|
+
/**
|
|
3258
|
+
* Filter by a channel of the generating rule. Matches events whose rule targets at
|
|
3259
|
+
* least one of the given channels. Only `eq` and `oeq` are supported.
|
|
3260
|
+
*/
|
|
3261
|
+
channelId?: UlidFieldFilter;
|
|
3262
|
+
/**
|
|
3263
|
+
* Filter by delivery state. Matches events where delivery to at least one channel
|
|
3264
|
+
* is in one of the given states. Only `eq` and `oeq` are supported.
|
|
3265
|
+
*/
|
|
3266
|
+
deliveryStatus?: StringFieldFilterExact;
|
|
3267
|
+
/**
|
|
3268
|
+
* Filter by the key of the subject the event refers to. Events without a subject
|
|
3269
|
+
* never match, not even with `neq`.
|
|
3270
|
+
*/
|
|
3271
|
+
subjectKey?: StringFieldFilterExact;
|
|
3272
|
+
/**
|
|
3273
|
+
* Filter by the id of the subject the event refers to. Events without a subject
|
|
3274
|
+
* never match, not even with `neq`.
|
|
3275
|
+
*/
|
|
3276
|
+
subjectId?: UlidFieldFilter;
|
|
3277
|
+
/**
|
|
3278
|
+
* Filter by the key of the feature the event refers to. Events without a feature
|
|
3279
|
+
* never match, not even with `neq`.
|
|
3280
|
+
*/
|
|
3281
|
+
featureKey?: StringFieldFilterExact;
|
|
3282
|
+
/**
|
|
3283
|
+
* Filter by the id of the feature the event refers to. Events without a feature
|
|
3284
|
+
* never match, not even with `neq`.
|
|
3285
|
+
*/
|
|
3286
|
+
featureId?: UlidFieldFilter;
|
|
3287
|
+
}
|
|
3170
3288
|
/** Resource filters. */
|
|
3171
3289
|
export interface ResourceFilters {
|
|
3172
3290
|
name?: StringFieldFilter;
|
|
@@ -4111,6 +4229,27 @@ export interface NotificationChannelPagePaginatedResponse {
|
|
|
4111
4229
|
data: NotificationChannel[];
|
|
4112
4230
|
meta: PaginatedMeta;
|
|
4113
4231
|
}
|
|
4232
|
+
/**
|
|
4233
|
+
* The delivery status of a notification event for one channel of the generating
|
|
4234
|
+
* rule.
|
|
4235
|
+
*/
|
|
4236
|
+
export interface NotificationEventDeliveryStatus {
|
|
4237
|
+
/** The identifier of the channel this delivery status belongs to. */
|
|
4238
|
+
channelId: string;
|
|
4239
|
+
/** The current delivery state. */
|
|
4240
|
+
state: 'success' | 'failed' | 'sending' | 'pending' | 'resending';
|
|
4241
|
+
/** The reason for the last state change. Empty for successful deliveries. */
|
|
4242
|
+
reason: string;
|
|
4243
|
+
/** When the delivery state was last updated. */
|
|
4244
|
+
updatedAt: Date;
|
|
4245
|
+
/**
|
|
4246
|
+
* When the next delivery attempt is scheduled. Absent when no further attempts
|
|
4247
|
+
* will be made.
|
|
4248
|
+
*/
|
|
4249
|
+
nextAttempt?: Date;
|
|
4250
|
+
/** The delivery attempts made so far, most recent first. */
|
|
4251
|
+
attempts: NotificationEventDeliveryAttempt[];
|
|
4252
|
+
}
|
|
4114
4253
|
/** Billing customer data. */
|
|
4115
4254
|
export interface CustomerData {
|
|
4116
4255
|
/**
|
|
@@ -4178,6 +4317,37 @@ export interface ListCustomerEntitlementAccessResponseData {
|
|
|
4178
4317
|
/** The list of entitlement access results. */
|
|
4179
4318
|
data: EntitlementValueResult[];
|
|
4180
4319
|
}
|
|
4320
|
+
/** The entities and threshold a balance threshold event refers to. */
|
|
4321
|
+
export interface NotificationEventBalanceThresholdData {
|
|
4322
|
+
/** The identifier of the entitlement that triggered the event. */
|
|
4323
|
+
entitlementId: string;
|
|
4324
|
+
/** The feature the entitlement grants access to. */
|
|
4325
|
+
feature: NotificationEventFeatureReference;
|
|
4326
|
+
/** The key of the subject the entitlement belongs to. */
|
|
4327
|
+
subjectKey: string;
|
|
4328
|
+
/** The identifier of the customer the subject belongs to, if any. */
|
|
4329
|
+
customerId?: string;
|
|
4330
|
+
/** The entitlement value at the time the event was generated. */
|
|
4331
|
+
value: EntitlementValueResult;
|
|
4332
|
+
/** The threshold the balance crossed. */
|
|
4333
|
+
threshold: NotificationBalanceThreshold;
|
|
4334
|
+
}
|
|
4335
|
+
/**
|
|
4336
|
+
* The entitlement, feature, and subject an entitlement notification event refers
|
|
4337
|
+
* to.
|
|
4338
|
+
*/
|
|
4339
|
+
export interface NotificationEventEntitlementData {
|
|
4340
|
+
/** The identifier of the entitlement that triggered the event. */
|
|
4341
|
+
entitlementId: string;
|
|
4342
|
+
/** The feature the entitlement grants access to. */
|
|
4343
|
+
feature: NotificationEventFeatureReference;
|
|
4344
|
+
/** The key of the subject the entitlement belongs to. */
|
|
4345
|
+
subjectKey: string;
|
|
4346
|
+
/** The identifier of the customer the subject belongs to, if any. */
|
|
4347
|
+
customerId?: string;
|
|
4348
|
+
/** The entitlement value at the time the event was generated. */
|
|
4349
|
+
value: EntitlementValueResult;
|
|
4350
|
+
}
|
|
4181
4351
|
/**
|
|
4182
4352
|
* Graduated tiered price.
|
|
4183
4353
|
*
|
|
@@ -4415,6 +4585,28 @@ export interface PlanAddonPagePaginatedResponse {
|
|
|
4415
4585
|
data: PlanAddon[];
|
|
4416
4586
|
meta: PaginatedMeta;
|
|
4417
4587
|
}
|
|
4588
|
+
/** An invoice created notification event payload. */
|
|
4589
|
+
export interface NotificationEventInvoiceCreatedPayload {
|
|
4590
|
+
/** The identifier of the event the payload belongs to. */
|
|
4591
|
+
id: string;
|
|
4592
|
+
/** The type of the event. */
|
|
4593
|
+
type: 'invoice.created';
|
|
4594
|
+
/** When the event was generated. */
|
|
4595
|
+
timestamp: Date;
|
|
4596
|
+
/** The invoice the event refers to. */
|
|
4597
|
+
data: NotificationEventInvoiceData;
|
|
4598
|
+
}
|
|
4599
|
+
/** An invoice updated notification event payload. */
|
|
4600
|
+
export interface NotificationEventInvoiceUpdatedPayload {
|
|
4601
|
+
/** The identifier of the event the payload belongs to. */
|
|
4602
|
+
id: string;
|
|
4603
|
+
/** The type of the event. */
|
|
4604
|
+
type: 'invoice.updated';
|
|
4605
|
+
/** When the event was generated. */
|
|
4606
|
+
timestamp: Date;
|
|
4607
|
+
/** The invoice the event refers to. */
|
|
4608
|
+
data: NotificationEventInvoiceData;
|
|
4609
|
+
}
|
|
4418
4610
|
/** Cursor paginated response. */
|
|
4419
4611
|
export interface IngestedEventPaginatedResponse {
|
|
4420
4612
|
data: IngestedEvent[];
|
|
@@ -5046,6 +5238,28 @@ export interface EntitlementAccessQueryResult {
|
|
|
5046
5238
|
*/
|
|
5047
5239
|
updatedAt: Date;
|
|
5048
5240
|
}
|
|
5241
|
+
/** A balance threshold notification event payload. */
|
|
5242
|
+
export interface NotificationEventBalanceThresholdPayload {
|
|
5243
|
+
/** The identifier of the event the payload belongs to. */
|
|
5244
|
+
id: string;
|
|
5245
|
+
/** The type of the event. */
|
|
5246
|
+
type: 'entitlements.balance.threshold';
|
|
5247
|
+
/** When the event was generated. */
|
|
5248
|
+
timestamp: Date;
|
|
5249
|
+
/** The entities and threshold the event refers to. */
|
|
5250
|
+
data: NotificationEventBalanceThresholdData;
|
|
5251
|
+
}
|
|
5252
|
+
/** An entitlement reset notification event payload. */
|
|
5253
|
+
export interface NotificationEventResetPayload {
|
|
5254
|
+
/** The identifier of the event the payload belongs to. */
|
|
5255
|
+
id: string;
|
|
5256
|
+
/** The type of the event. */
|
|
5257
|
+
type: 'entitlements.reset';
|
|
5258
|
+
/** When the event was generated. */
|
|
5259
|
+
timestamp: Date;
|
|
5260
|
+
/** The entities the event refers to. */
|
|
5261
|
+
data: NotificationEventEntitlementData;
|
|
5262
|
+
}
|
|
5049
5263
|
/** A capability or billable dimension offered by a provider. */
|
|
5050
5264
|
export interface Feature {
|
|
5051
5265
|
id: string;
|
|
@@ -5698,6 +5912,25 @@ export interface ProfileApps {
|
|
|
5698
5912
|
/** The payment app used for this workflow. */
|
|
5699
5913
|
payment: App;
|
|
5700
5914
|
}
|
|
5915
|
+
/**
|
|
5916
|
+
* A notification event records that a notification rule fired and tracks the
|
|
5917
|
+
* delivery of its payload to each channel of the rule. Events are created by the
|
|
5918
|
+
* system and cannot be modified.
|
|
5919
|
+
*/
|
|
5920
|
+
export interface NotificationEvent {
|
|
5921
|
+
/** The unique identifier of the event. */
|
|
5922
|
+
id: string;
|
|
5923
|
+
/** The type of the event. */
|
|
5924
|
+
type: 'entitlements.balance.threshold' | 'entitlements.reset' | 'invoice.created' | 'invoice.updated';
|
|
5925
|
+
/** When the event was generated. */
|
|
5926
|
+
createdAt: Date;
|
|
5927
|
+
/** The rule that generated the event. */
|
|
5928
|
+
rule: NotificationRuleReference;
|
|
5929
|
+
/** The delivery status of the event, one entry per channel of the rule. */
|
|
5930
|
+
deliveryStatus: NotificationEventDeliveryStatus[];
|
|
5931
|
+
/** The payload delivered to the channels. */
|
|
5932
|
+
payload: NotificationEventPayload;
|
|
5933
|
+
}
|
|
5701
5934
|
/** A subscription item pins a rate card to a cadence within a subscription phase. */
|
|
5702
5935
|
export interface SubscriptionItem {
|
|
5703
5936
|
/** The unique identifier of the subscription item instance. */
|
|
@@ -6135,6 +6368,11 @@ export interface ChargeRealization {
|
|
|
6135
6368
|
*/
|
|
6136
6369
|
detailedLines?: ChargeRealizationDetailedLine[];
|
|
6137
6370
|
}
|
|
6371
|
+
/** Page paginated response. */
|
|
6372
|
+
export interface NotificationEventPagePaginatedResponse {
|
|
6373
|
+
data: NotificationEvent[];
|
|
6374
|
+
meta: PaginatedMeta;
|
|
6375
|
+
}
|
|
6138
6376
|
/**
|
|
6139
6377
|
* A subscription phase groups the rate cards in effect for a segment of the
|
|
6140
6378
|
* subscription's lifetime. Analogous to plan phases.
|
|
@@ -7174,6 +7412,8 @@ export type CreateEntitlementRequest = CreateEntitlementMeteredRequest | CreateE
|
|
|
7174
7412
|
export type App = AppStripe | AppSandbox | AppExternalInvoicing;
|
|
7175
7413
|
/** Response of the app install. */
|
|
7176
7414
|
export type BillingInstallAppResponse = InstalledAppStripe | InstalledAppSandbox | InstalledAppExternalInvoicing;
|
|
7415
|
+
/** The payload delivered to the channels, discriminated by the event type. */
|
|
7416
|
+
export type NotificationEventPayload = NotificationEventBalanceThresholdPayload | NotificationEventResetPayload | NotificationEventInvoiceCreatedPayload | NotificationEventInvoiceUpdatedPayload;
|
|
7177
7417
|
/** Feature or reference. */
|
|
7178
7418
|
export type FeatureOrReference = Feature | FeatureReference;
|
|
7179
7419
|
/** ChargeRealizationInvoice or reference. */
|
package/dist/sdk/internal.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ import { type Client } from '../core.js';
|
|
|
2
2
|
import { type RequestOptions } from '../lib/types.js';
|
|
3
3
|
import type { CreateSubscriptionAddonRequest, CreateSubscriptionAddonResponse, UpdateSubscriptionAddonRequest, UpdateSubscriptionAddonResponse } from '../models/operations/subscriptions.js';
|
|
4
4
|
import type { ExecuteAppActionRequest, ExecuteAppActionResponse } from '../models/operations/apps.js';
|
|
5
|
+
import type { ListNotificationEventsRequest, ListNotificationEventsResponse, GetNotificationEventRequest, GetNotificationEventResponse, ResendNotificationEventRequest, ResendNotificationEventResponse } from '../models/operations/notifications.js';
|
|
6
|
+
import type { NotificationEvent } from '../models/types.js';
|
|
5
7
|
/**
|
|
6
8
|
* Operations marked internal in the API definition. They are not part of
|
|
7
9
|
* the customer surface: they may require additional permissions, and they
|
|
@@ -14,6 +16,8 @@ export declare class Internal {
|
|
|
14
16
|
get subscriptions(): InternalSubscriptions;
|
|
15
17
|
private _apps?;
|
|
16
18
|
get apps(): InternalApps;
|
|
19
|
+
private _notifications?;
|
|
20
|
+
get notifications(): InternalNotifications;
|
|
17
21
|
}
|
|
18
22
|
export declare class InternalSubscriptions {
|
|
19
23
|
private readonly _client;
|
|
@@ -50,3 +54,45 @@ export declare class InternalApps {
|
|
|
50
54
|
*/
|
|
51
55
|
executeAction(request: ExecuteAppActionRequest, options?: RequestOptions): Promise<ExecuteAppActionResponse>;
|
|
52
56
|
}
|
|
57
|
+
export declare class InternalNotifications {
|
|
58
|
+
private readonly _client;
|
|
59
|
+
constructor(_client: Client);
|
|
60
|
+
/**
|
|
61
|
+
* List notification events
|
|
62
|
+
*
|
|
63
|
+
* List all notification events.
|
|
64
|
+
*
|
|
65
|
+
* GET /openmeter/notification/events
|
|
66
|
+
*/
|
|
67
|
+
listEvents(request?: ListNotificationEventsRequest, options?: RequestOptions): Promise<ListNotificationEventsResponse>;
|
|
68
|
+
/**
|
|
69
|
+
* List notification events
|
|
70
|
+
*
|
|
71
|
+
* List all notification events.
|
|
72
|
+
*
|
|
73
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
74
|
+
*
|
|
75
|
+
* GET /openmeter/notification/events
|
|
76
|
+
*/
|
|
77
|
+
listEventsAll(request?: ListNotificationEventsRequest, options?: RequestOptions): AsyncIterable<NotificationEvent>;
|
|
78
|
+
/**
|
|
79
|
+
* Get notification event
|
|
80
|
+
*
|
|
81
|
+
* Get a notification event by id.
|
|
82
|
+
*
|
|
83
|
+
* GET /openmeter/notification/events/{notificationEventId}
|
|
84
|
+
*/
|
|
85
|
+
getEvent(request: GetNotificationEventRequest, options?: RequestOptions): Promise<GetNotificationEventResponse>;
|
|
86
|
+
/**
|
|
87
|
+
* Resend notification event
|
|
88
|
+
*
|
|
89
|
+
* Resend a notification event to the channels of the rule that generated it.
|
|
90
|
+
*
|
|
91
|
+
* Delivery is asynchronous: the request marks the selected channels for redelivery
|
|
92
|
+
* and returns immediately. Channels whose delivery is still pending or already
|
|
93
|
+
* being resent are left untouched.
|
|
94
|
+
*
|
|
95
|
+
* POST /openmeter/notification/events/{notificationEventId}/resend
|
|
96
|
+
*/
|
|
97
|
+
resendEvent(request: ResendNotificationEventRequest, options?: RequestOptions): Promise<ResendNotificationEventResponse>;
|
|
98
|
+
}
|
package/dist/sdk/internal.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// Code generated by @openmeter/typespec-typescript. DO NOT EDIT.
|
|
2
2
|
import { unwrap } from '../lib/types.js';
|
|
3
|
+
import { paginatePages } from '../lib/paginate.js';
|
|
3
4
|
import { createSubscriptionAddon, updateSubscriptionAddon, } from '../funcs/subscriptions.js';
|
|
4
5
|
import { executeAppAction } from '../funcs/apps.js';
|
|
6
|
+
import { listNotificationEvents, getNotificationEvent, resendNotificationEvent, } from '../funcs/notifications.js';
|
|
5
7
|
/**
|
|
6
8
|
* Operations marked internal in the API definition. They are not part of
|
|
7
9
|
* the customer surface: they may require additional permissions, and they
|
|
@@ -20,6 +22,10 @@ export class Internal {
|
|
|
20
22
|
get apps() {
|
|
21
23
|
return (this._apps ??= new InternalApps(this._client));
|
|
22
24
|
}
|
|
25
|
+
_notifications;
|
|
26
|
+
get notifications() {
|
|
27
|
+
return (this._notifications ??= new InternalNotifications(this._client));
|
|
28
|
+
}
|
|
23
29
|
}
|
|
24
30
|
export class InternalSubscriptions {
|
|
25
31
|
_client;
|
|
@@ -66,3 +72,55 @@ export class InternalApps {
|
|
|
66
72
|
return unwrap(await executeAppAction(this._client, request, options));
|
|
67
73
|
}
|
|
68
74
|
}
|
|
75
|
+
export class InternalNotifications {
|
|
76
|
+
_client;
|
|
77
|
+
constructor(_client) {
|
|
78
|
+
this._client = _client;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* List notification events
|
|
82
|
+
*
|
|
83
|
+
* List all notification events.
|
|
84
|
+
*
|
|
85
|
+
* GET /openmeter/notification/events
|
|
86
|
+
*/
|
|
87
|
+
async listEvents(request, options) {
|
|
88
|
+
return unwrap(await listNotificationEvents(this._client, request, options));
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* List notification events
|
|
92
|
+
*
|
|
93
|
+
* List all notification events.
|
|
94
|
+
*
|
|
95
|
+
* Iterates every item across all pages, fetching more as the returned iterable is consumed.
|
|
96
|
+
*
|
|
97
|
+
* GET /openmeter/notification/events
|
|
98
|
+
*/
|
|
99
|
+
listEventsAll(request, options) {
|
|
100
|
+
return paginatePages((req, opts) => listNotificationEvents(this._client, req, opts), request ?? {}, options);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get notification event
|
|
104
|
+
*
|
|
105
|
+
* Get a notification event by id.
|
|
106
|
+
*
|
|
107
|
+
* GET /openmeter/notification/events/{notificationEventId}
|
|
108
|
+
*/
|
|
109
|
+
async getEvent(request, options) {
|
|
110
|
+
return unwrap(await getNotificationEvent(this._client, request, options));
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Resend notification event
|
|
114
|
+
*
|
|
115
|
+
* Resend a notification event to the channels of the rule that generated it.
|
|
116
|
+
*
|
|
117
|
+
* Delivery is asynchronous: the request marks the selected channels for redelivery
|
|
118
|
+
* and returns immediately. Channels whose delivery is still pending or already
|
|
119
|
+
* being resent are left untouched.
|
|
120
|
+
*
|
|
121
|
+
* POST /openmeter/notification/events/{notificationEventId}/resend
|
|
122
|
+
*/
|
|
123
|
+
async resendEvent(request, options) {
|
|
124
|
+
return unwrap(await resendNotificationEvent(this._client, request, options));
|
|
125
|
+
}
|
|
126
|
+
}
|