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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,9 @@
1
1
  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
+ import type { ExecuteAppActionRequest, ExecuteAppActionResponse } from '../models/operations/apps.js';
5
+ import type { ListNotificationRulesRequest, ListNotificationRulesResponse, CreateNotificationRuleRequest, CreateNotificationRuleResponse, GetNotificationRuleRequest, GetNotificationRuleResponse, UpdateNotificationRuleRequest, UpdateNotificationRuleResponse, DeleteNotificationRuleRequest, DeleteNotificationRuleResponse, TestNotificationRuleRequest, TestNotificationRuleResponse, ListNotificationEventsRequest, ListNotificationEventsResponse, GetNotificationEventRequest, GetNotificationEventResponse, ResendNotificationEventRequest, ResendNotificationEventResponse } from '../models/operations/notifications.js';
6
+ import type { NotificationEvent, NotificationRule } from '../models/types.js';
4
7
  /**
5
8
  * Operations marked internal in the API definition. They are not part of
6
9
  * the customer surface: they may require additional permissions, and they
@@ -11,6 +14,10 @@ export declare class Internal {
11
14
  constructor(_client: Client);
12
15
  private _subscriptions?;
13
16
  get subscriptions(): InternalSubscriptions;
17
+ private _apps?;
18
+ get apps(): InternalApps;
19
+ private _notifications?;
20
+ get notifications(): InternalNotifications;
14
21
  }
15
22
  export declare class InternalSubscriptions {
16
23
  private readonly _client;
@@ -34,3 +41,118 @@ export declare class InternalSubscriptions {
34
41
  */
35
42
  updateAddon(request: UpdateSubscriptionAddonRequest, options?: RequestOptions): Promise<UpdateSubscriptionAddonResponse>;
36
43
  }
44
+ export declare class InternalApps {
45
+ private readonly _client;
46
+ constructor(_client: Client);
47
+ /**
48
+ * Execute app action
49
+ *
50
+ * Execute an operator action on an installed app. The action must be listed in the
51
+ * app's `actions`; otherwise the request is rejected.
52
+ *
53
+ * POST /openmeter/apps/{appId}/action
54
+ */
55
+ executeAction(request: ExecuteAppActionRequest, options?: RequestOptions): Promise<ExecuteAppActionResponse>;
56
+ }
57
+ export declare class InternalNotifications {
58
+ private readonly _client;
59
+ constructor(_client: Client);
60
+ /**
61
+ * List notification rules
62
+ *
63
+ * List all notification rules.
64
+ *
65
+ * GET /openmeter/notification/rules
66
+ */
67
+ listRules(request?: ListNotificationRulesRequest, options?: RequestOptions): Promise<ListNotificationRulesResponse>;
68
+ /**
69
+ * List notification rules
70
+ *
71
+ * List all notification rules.
72
+ *
73
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
74
+ *
75
+ * GET /openmeter/notification/rules
76
+ */
77
+ listRulesAll(request?: ListNotificationRulesRequest, options?: RequestOptions): AsyncIterable<NotificationRule>;
78
+ /**
79
+ * Create notification rule
80
+ *
81
+ * Create a notification rule.
82
+ *
83
+ * POST /openmeter/notification/rules
84
+ */
85
+ createRule(request: CreateNotificationRuleRequest, options?: RequestOptions): Promise<CreateNotificationRuleResponse>;
86
+ /**
87
+ * Get notification rule
88
+ *
89
+ * Get a notification rule by id.
90
+ *
91
+ * GET /openmeter/notification/rules/{notificationRuleId}
92
+ */
93
+ getRule(request: GetNotificationRuleRequest, options?: RequestOptions): Promise<GetNotificationRuleResponse>;
94
+ /**
95
+ * Update notification rule
96
+ *
97
+ * Update a notification rule by id.
98
+ *
99
+ * PUT /openmeter/notification/rules/{notificationRuleId}
100
+ */
101
+ updateRule(request: UpdateNotificationRuleRequest, options?: RequestOptions): Promise<UpdateNotificationRuleResponse>;
102
+ /**
103
+ * Delete notification rule
104
+ *
105
+ * Delete a notification rule by id.
106
+ *
107
+ * DELETE /openmeter/notification/rules/{notificationRuleId}
108
+ */
109
+ deleteRule(request: DeleteNotificationRuleRequest, options?: RequestOptions): Promise<DeleteNotificationRuleResponse>;
110
+ /**
111
+ * Test notification rule
112
+ *
113
+ * Test a notification rule by generating an event with sample data and delivering
114
+ * it to the rule's channels. The test event is persisted and listed like any other
115
+ * event.
116
+ *
117
+ * POST /openmeter/notification/rules/{notificationRuleId}/test
118
+ */
119
+ testRule(request: TestNotificationRuleRequest, options?: RequestOptions): Promise<TestNotificationRuleResponse>;
120
+ /**
121
+ * List notification events
122
+ *
123
+ * List all notification events.
124
+ *
125
+ * GET /openmeter/notification/events
126
+ */
127
+ listEvents(request?: ListNotificationEventsRequest, options?: RequestOptions): Promise<ListNotificationEventsResponse>;
128
+ /**
129
+ * List notification events
130
+ *
131
+ * List all notification events.
132
+ *
133
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
134
+ *
135
+ * GET /openmeter/notification/events
136
+ */
137
+ listEventsAll(request?: ListNotificationEventsRequest, options?: RequestOptions): AsyncIterable<NotificationEvent>;
138
+ /**
139
+ * Get notification event
140
+ *
141
+ * Get a notification event by id.
142
+ *
143
+ * GET /openmeter/notification/events/{notificationEventId}
144
+ */
145
+ getEvent(request: GetNotificationEventRequest, options?: RequestOptions): Promise<GetNotificationEventResponse>;
146
+ /**
147
+ * Resend notification event
148
+ *
149
+ * Resend a notification event to the channels of the rule that generated it.
150
+ *
151
+ * Delivery is asynchronous: the request marks the selected channels for redelivery
152
+ * and returns immediately. Channels whose delivery is still pending or already
153
+ * being resent are left untouched.
154
+ *
155
+ * POST /openmeter/notification/events/{notificationEventId}/resend
156
+ */
157
+ resendEvent(request: ResendNotificationEventRequest, options?: RequestOptions): Promise<ResendNotificationEventResponse>;
158
+ }
@@ -1,6 +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';
5
+ import { executeAppAction } from '../funcs/apps.js';
6
+ import { listNotificationRules, createNotificationRule, getNotificationRule, updateNotificationRule, deleteNotificationRule, testNotificationRule, listNotificationEvents, getNotificationEvent, resendNotificationEvent, } from '../funcs/notifications.js';
4
7
  /**
5
8
  * Operations marked internal in the API definition. They are not part of
6
9
  * the customer surface: they may require additional permissions, and they
@@ -15,6 +18,14 @@ export class Internal {
15
18
  get subscriptions() {
16
19
  return (this._subscriptions ??= new InternalSubscriptions(this._client));
17
20
  }
21
+ _apps;
22
+ get apps() {
23
+ return (this._apps ??= new InternalApps(this._client));
24
+ }
25
+ _notifications;
26
+ get notifications() {
27
+ return (this._notifications ??= new InternalNotifications(this._client));
28
+ }
18
29
  }
19
30
  export class InternalSubscriptions {
20
31
  _client;
@@ -44,3 +55,146 @@ export class InternalSubscriptions {
44
55
  return unwrap(await updateSubscriptionAddon(this._client, request, options));
45
56
  }
46
57
  }
58
+ export class InternalApps {
59
+ _client;
60
+ constructor(_client) {
61
+ this._client = _client;
62
+ }
63
+ /**
64
+ * Execute app action
65
+ *
66
+ * Execute an operator action on an installed app. The action must be listed in the
67
+ * app's `actions`; otherwise the request is rejected.
68
+ *
69
+ * POST /openmeter/apps/{appId}/action
70
+ */
71
+ async executeAction(request, options) {
72
+ return unwrap(await executeAppAction(this._client, request, options));
73
+ }
74
+ }
75
+ export class InternalNotifications {
76
+ _client;
77
+ constructor(_client) {
78
+ this._client = _client;
79
+ }
80
+ /**
81
+ * List notification rules
82
+ *
83
+ * List all notification rules.
84
+ *
85
+ * GET /openmeter/notification/rules
86
+ */
87
+ async listRules(request, options) {
88
+ return unwrap(await listNotificationRules(this._client, request, options));
89
+ }
90
+ /**
91
+ * List notification rules
92
+ *
93
+ * List all notification rules.
94
+ *
95
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
96
+ *
97
+ * GET /openmeter/notification/rules
98
+ */
99
+ listRulesAll(request, options) {
100
+ return paginatePages((req, opts) => listNotificationRules(this._client, req, opts), request ?? {}, options);
101
+ }
102
+ /**
103
+ * Create notification rule
104
+ *
105
+ * Create a notification rule.
106
+ *
107
+ * POST /openmeter/notification/rules
108
+ */
109
+ async createRule(request, options) {
110
+ return unwrap(await createNotificationRule(this._client, request, options));
111
+ }
112
+ /**
113
+ * Get notification rule
114
+ *
115
+ * Get a notification rule by id.
116
+ *
117
+ * GET /openmeter/notification/rules/{notificationRuleId}
118
+ */
119
+ async getRule(request, options) {
120
+ return unwrap(await getNotificationRule(this._client, request, options));
121
+ }
122
+ /**
123
+ * Update notification rule
124
+ *
125
+ * Update a notification rule by id.
126
+ *
127
+ * PUT /openmeter/notification/rules/{notificationRuleId}
128
+ */
129
+ async updateRule(request, options) {
130
+ return unwrap(await updateNotificationRule(this._client, request, options));
131
+ }
132
+ /**
133
+ * Delete notification rule
134
+ *
135
+ * Delete a notification rule by id.
136
+ *
137
+ * DELETE /openmeter/notification/rules/{notificationRuleId}
138
+ */
139
+ async deleteRule(request, options) {
140
+ return unwrap(await deleteNotificationRule(this._client, request, options));
141
+ }
142
+ /**
143
+ * Test notification rule
144
+ *
145
+ * Test a notification rule by generating an event with sample data and delivering
146
+ * it to the rule's channels. The test event is persisted and listed like any other
147
+ * event.
148
+ *
149
+ * POST /openmeter/notification/rules/{notificationRuleId}/test
150
+ */
151
+ async testRule(request, options) {
152
+ return unwrap(await testNotificationRule(this._client, request, options));
153
+ }
154
+ /**
155
+ * List notification events
156
+ *
157
+ * List all notification events.
158
+ *
159
+ * GET /openmeter/notification/events
160
+ */
161
+ async listEvents(request, options) {
162
+ return unwrap(await listNotificationEvents(this._client, request, options));
163
+ }
164
+ /**
165
+ * List notification events
166
+ *
167
+ * List all notification events.
168
+ *
169
+ * Iterates every item across all pages, fetching more as the returned iterable is consumed.
170
+ *
171
+ * GET /openmeter/notification/events
172
+ */
173
+ listEventsAll(request, options) {
174
+ return paginatePages((req, opts) => listNotificationEvents(this._client, req, opts), request ?? {}, options);
175
+ }
176
+ /**
177
+ * Get notification event
178
+ *
179
+ * Get a notification event by id.
180
+ *
181
+ * GET /openmeter/notification/events/{notificationEventId}
182
+ */
183
+ async getEvent(request, options) {
184
+ return unwrap(await getNotificationEvent(this._client, request, options));
185
+ }
186
+ /**
187
+ * Resend notification event
188
+ *
189
+ * Resend a notification event to the channels of the rule that generated it.
190
+ *
191
+ * Delivery is asynchronous: the request marks the selected channels for redelivery
192
+ * and returns immediately. Channels whose delivery is still pending or already
193
+ * being resent are left untouched.
194
+ *
195
+ * POST /openmeter/notification/events/{notificationEventId}/resend
196
+ */
197
+ async resendEvent(request, options) {
198
+ return unwrap(await resendNotificationEvent(this._client, request, options));
199
+ }
200
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmeter/client",
3
- "version": "1.0.0-beta.235",
3
+ "version": "1.0.0-beta.236",
4
4
  "description": "Official TypeScript SDK for the OpenMeter API — usage metering and billing",
5
5
  "keywords": [
6
6
  "openmeter",