orb-billing 2.4.0 → 2.6.0
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/CHANGELOG.md +32 -0
- package/index.d.mts +232 -5
- package/index.d.ts +232 -5
- package/index.d.ts.map +1 -1
- package/index.js +133 -10
- package/index.js.map +1 -1
- package/index.mjs +130 -5
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/alerts.d.ts +340 -0
- package/resources/alerts.d.ts.map +1 -0
- package/resources/alerts.js +134 -0
- package/resources/alerts.js.map +1 -0
- package/resources/alerts.mjs +106 -0
- package/resources/alerts.mjs.map +1 -0
- package/resources/customers/customers.d.ts +592 -432
- package/resources/customers/customers.d.ts.map +1 -1
- package/resources/customers/customers.js.map +1 -1
- package/resources/customers/customers.mjs.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +4 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/invoices.d.ts +296 -216
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs.map +1 -1
- package/resources/subscriptions.d.ts +1 -1
- package/src/index.ts +311 -6
- package/src/resources/alerts.ts +466 -0
- package/src/resources/customers/customers.ts +728 -424
- package/src/resources/index.ts +12 -0
- package/src/resources/invoices.ts +364 -212
- package/src/resources/subscriptions.ts +1 -1
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/client.d.ts +0 -222
- package/client.d.ts.map +0 -1
- package/client.js +0 -156
- package/client.js.map +0 -1
- package/client.mjs +0 -129
- package/client.mjs.map +0 -1
- package/src/client.ts +0 -301
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import * as Core from 'orb-billing/core';
|
|
2
|
+
import { APIResource } from 'orb-billing/resource';
|
|
3
|
+
import * as AlertsAPI from 'orb-billing/resources/alerts';
|
|
4
|
+
import { Page, type PageParams } from 'orb-billing/pagination';
|
|
5
|
+
export declare class Alerts extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* This endpoint retrieves an alert by its ID.
|
|
8
|
+
*/
|
|
9
|
+
retrieve(alertId: string, options?: Core.RequestOptions): Core.APIPromise<Alert>;
|
|
10
|
+
/**
|
|
11
|
+
* This endpoint returns a list of all
|
|
12
|
+
* [`alerts`](https://docs.withorb.com/guides/product-catalog/configuring-alerts).
|
|
13
|
+
*
|
|
14
|
+
* The list of alerts is ordered starting from the most recently created alert.
|
|
15
|
+
* This endpoint follows Orb's
|
|
16
|
+
* [standardized pagination format](../reference/pagination).
|
|
17
|
+
*
|
|
18
|
+
* The request must specify one of customer_id, external_customer_id,
|
|
19
|
+
* subscription_id, or plan_id
|
|
20
|
+
*
|
|
21
|
+
* If querying by subscripion_id, the endpoint will return the subscription level
|
|
22
|
+
* alerts as well as the plan level alerts associated with the subscription.
|
|
23
|
+
*/
|
|
24
|
+
list(query?: AlertListParams, options?: Core.RequestOptions): Core.PagePromise<AlertsPage, Alert>;
|
|
25
|
+
list(options?: Core.RequestOptions): Core.PagePromise<AlertsPage, Alert>;
|
|
26
|
+
/**
|
|
27
|
+
* This endpoint creates a new alert to monitor a customer's credit balance. There
|
|
28
|
+
* are three types of alerts that can be scoped to customers:
|
|
29
|
+
* `credit_balance_depleted`, `credit_balance_dropped`, and
|
|
30
|
+
* `credit_balance_recovered`. Customers can have a maximum of one of each type of
|
|
31
|
+
* alert per
|
|
32
|
+
* [credit balance currency](https://docs.withorb.com/guides/product-catalog/prepurchase).
|
|
33
|
+
* `credit_balance_dropped` alerts require a list of thresholds to be provided
|
|
34
|
+
* while `credit_balance_depleted` and `credit_balance_recovered` alerts do not
|
|
35
|
+
* require thresholds.
|
|
36
|
+
*/
|
|
37
|
+
createForCustomer(customerId: string, body: AlertCreateForCustomerParams, options?: Core.RequestOptions): Core.APIPromise<Alert>;
|
|
38
|
+
/**
|
|
39
|
+
* This endpoint creates a new alert to monitor a customer's credit balance. There
|
|
40
|
+
* are three types of alerts that can be scoped to customers:
|
|
41
|
+
* `credit_balance_depleted`, `credit_balance_dropped`, and
|
|
42
|
+
* `credit_balance_recovered`. Customers can have a maximum of one of each type of
|
|
43
|
+
* alert per
|
|
44
|
+
* [credit balance currency](https://docs.withorb.com/guides/product-catalog/prepurchase).
|
|
45
|
+
* `credit_balance_dropped` alerts require a list of thresholds to be provided
|
|
46
|
+
* while `credit_balance_depleted` and `credit_balance_recovered` alerts do not
|
|
47
|
+
* require thresholds.
|
|
48
|
+
*/
|
|
49
|
+
createForExternalCustomer(externalCustomerId: string, body: AlertCreateForExternalCustomerParams, options?: Core.RequestOptions): Core.APIPromise<Alert>;
|
|
50
|
+
/**
|
|
51
|
+
* This endpoint is used to create alerts at the plan level. Plan level alerts are
|
|
52
|
+
* automatically propagated to all subscriptions associated with the plan. These
|
|
53
|
+
* alerts are scoped to a specific plan version; if no version is specified, the
|
|
54
|
+
* active plan version is used.
|
|
55
|
+
*
|
|
56
|
+
* Plan level alerts can be of two types: `usage_exceeded` or `cost_exceeded`. A
|
|
57
|
+
* `usage_exceeded` alert is scoped to a particular metric and is triggered when
|
|
58
|
+
* the usage of that metric exceeds a predefined thresholds during the current
|
|
59
|
+
* invoice cycle. A `cost_exceeded` alert is triggered when the total cost of the
|
|
60
|
+
* subscription on the plan surpasses predefined thresholds in the current invoice
|
|
61
|
+
* cycle.Each plan can have one `cost_exceeded` alert and one `usage_exceeded`
|
|
62
|
+
* alert per metric that is apart of the plan.
|
|
63
|
+
*/
|
|
64
|
+
createForPlan(planId: string, body: AlertCreateForPlanParams, options?: Core.RequestOptions): Core.APIPromise<Alert>;
|
|
65
|
+
/**
|
|
66
|
+
* This endpoint is used to create alerts at the subscription level.
|
|
67
|
+
*
|
|
68
|
+
* Subscription level alerts can be one of two types: `usage_exceeded` or
|
|
69
|
+
* `cost_exceeded`. A `usage_exceeded` alert is scoped to a particular metric and
|
|
70
|
+
* is triggered when the usage of that metric exceeds a predefined thresholds
|
|
71
|
+
* during the current invoice cycle. A `cost_exceeded` alert is triggered when the
|
|
72
|
+
* total cost of the subscription surpasses predefined thresholds in the current
|
|
73
|
+
* invoice cycle. Each subscription can have one `cost_exceeded` alert and one
|
|
74
|
+
* `usage_exceeded` alert per metric that is apart of the subscription. Alerts are
|
|
75
|
+
* triggered based on usage or cost conditions met during the current invoice
|
|
76
|
+
* cycle.
|
|
77
|
+
*/
|
|
78
|
+
createForSubscription(subscriptionId: string, body: AlertCreateForSubscriptionParams, options?: Core.RequestOptions): Core.APIPromise<Alert>;
|
|
79
|
+
/**
|
|
80
|
+
* This endpoint can be used to disable an alert.
|
|
81
|
+
*
|
|
82
|
+
* By default, disabling a plan level alert will apply to all subscriptions on that
|
|
83
|
+
* plan. In order to toggle a plan level alert for a specific subscription, the
|
|
84
|
+
* client must provide the plan level alert id as well as the subscription_id
|
|
85
|
+
* parameter.
|
|
86
|
+
*/
|
|
87
|
+
disable(alertConfigurationId: string, params?: AlertDisableParams, options?: Core.RequestOptions): Core.APIPromise<Alert>;
|
|
88
|
+
disable(alertConfigurationId: string, options?: Core.RequestOptions): Core.APIPromise<Alert>;
|
|
89
|
+
/**
|
|
90
|
+
* This endpoint can be used to enable an alert.
|
|
91
|
+
*
|
|
92
|
+
* By default, enabling a plan level alert will apply to all subscriptions on that
|
|
93
|
+
* plan. In order to toggle a plan level alert for a specific subscription, the
|
|
94
|
+
* client must provide the plan level alert id as well as the subscription_id
|
|
95
|
+
* parameter.
|
|
96
|
+
*/
|
|
97
|
+
enable(alertConfigurationId: string, params?: AlertEnableParams, options?: Core.RequestOptions): Core.APIPromise<Alert>;
|
|
98
|
+
enable(alertConfigurationId: string, options?: Core.RequestOptions): Core.APIPromise<Alert>;
|
|
99
|
+
}
|
|
100
|
+
export declare class AlertsPage extends Page<Alert> {
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* An
|
|
104
|
+
* [Alert within Orb](https://docs.withorb.com/guides/product-catalog/configuring-alerts)
|
|
105
|
+
* monitors a customer's spending, usage, or credit balance and triggers a webhook
|
|
106
|
+
* when a threshold is exceeded.
|
|
107
|
+
*
|
|
108
|
+
* Alerts can be configured to monitor usage, cost, or credit balance. Alerts can
|
|
109
|
+
* be scoped to either a customer, a plan, or a subscription.
|
|
110
|
+
*
|
|
111
|
+
* Customer scoped alerts track a customer's credit balance. Valid customer alert
|
|
112
|
+
* types are "credit_balance_depleted", "credit_balance_recovered", and
|
|
113
|
+
* "credit_balance_dropped".
|
|
114
|
+
*
|
|
115
|
+
* Subscription scoped alerts track a subscriptions's usage or cost. Valid plan
|
|
116
|
+
* alert types are "usage_exceeded" or "cost_exceeded".
|
|
117
|
+
*
|
|
118
|
+
* Plan scoped alerts are similar to subscriptions alerts but when a plan alert is
|
|
119
|
+
* created, it is propagated to all subscriptions associated with the plan.
|
|
120
|
+
* Disabling a plan alert will disable the alert for all subscriptions. Valid plan
|
|
121
|
+
* alert types are "usage_exceeded" or "cost_exceeded".
|
|
122
|
+
*/
|
|
123
|
+
export interface Alert {
|
|
124
|
+
/**
|
|
125
|
+
* Also referred to as alert_id in this documentation.
|
|
126
|
+
*/
|
|
127
|
+
id: string;
|
|
128
|
+
/**
|
|
129
|
+
* The creation time of the resource in Orb.
|
|
130
|
+
*/
|
|
131
|
+
created_at: string;
|
|
132
|
+
/**
|
|
133
|
+
* The name of the currency the credit balance for this alert is denominated in.
|
|
134
|
+
*/
|
|
135
|
+
currency: string | null;
|
|
136
|
+
/**
|
|
137
|
+
* The customer the alert applies to.
|
|
138
|
+
*/
|
|
139
|
+
customer: Record<string, string | null> | null;
|
|
140
|
+
/**
|
|
141
|
+
* Whether the alert is enabled or disabled.
|
|
142
|
+
*/
|
|
143
|
+
enabled: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* The metric the alert applies to.
|
|
146
|
+
*/
|
|
147
|
+
metric: Record<string, string | null> | null;
|
|
148
|
+
/**
|
|
149
|
+
* The plan the alert applies to.
|
|
150
|
+
*/
|
|
151
|
+
plan: Record<string, string | null> | null;
|
|
152
|
+
/**
|
|
153
|
+
* The subscription the alert applies to.
|
|
154
|
+
*/
|
|
155
|
+
subscription: Record<string, string | null> | null;
|
|
156
|
+
/**
|
|
157
|
+
* The thresholds that define the conditions under which the alert will be
|
|
158
|
+
* triggered.
|
|
159
|
+
*/
|
|
160
|
+
thresholds: Array<Alert.Threshold> | null;
|
|
161
|
+
/**
|
|
162
|
+
* The type of alert. This must be a valid alert type.
|
|
163
|
+
*/
|
|
164
|
+
type: 'usage_exceeded' | 'cost_exceeded' | 'credit_balance_depleted' | 'credit_balance_dropped' | 'credit_balance_recovered';
|
|
165
|
+
}
|
|
166
|
+
export declare namespace Alert {
|
|
167
|
+
/**
|
|
168
|
+
* Thresholds are used to define the conditions under which an alert will be
|
|
169
|
+
* triggered.
|
|
170
|
+
*/
|
|
171
|
+
interface Threshold {
|
|
172
|
+
/**
|
|
173
|
+
* The value at which an alert will fire. For credit balance alerts, the alert will fire at or below this value. For usage and
|
|
174
|
+
* cost alerts, the alert will fire at or above this value.
|
|
175
|
+
*/
|
|
176
|
+
value: number;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
export interface AlertListParams extends PageParams {
|
|
180
|
+
'created_at[gt]'?: string | null;
|
|
181
|
+
'created_at[gte]'?: string | null;
|
|
182
|
+
'created_at[lt]'?: string | null;
|
|
183
|
+
'created_at[lte]'?: string | null;
|
|
184
|
+
/**
|
|
185
|
+
* Fetch alerts scoped to this customer_id
|
|
186
|
+
*/
|
|
187
|
+
customer_id?: string | null;
|
|
188
|
+
/**
|
|
189
|
+
* Fetch alerts scoped to this external_customer_id
|
|
190
|
+
*/
|
|
191
|
+
external_customer_id?: string | null;
|
|
192
|
+
/**
|
|
193
|
+
* Fetch alerts scoped to this plan_id
|
|
194
|
+
*/
|
|
195
|
+
plan_id?: string | null;
|
|
196
|
+
/**
|
|
197
|
+
* If provided alongside plan_id, only the alerts that are scoped to the specified plan_version will be returned.
|
|
198
|
+
*/
|
|
199
|
+
plan_version?: number | null;
|
|
200
|
+
/**
|
|
201
|
+
* Fetch alerts scoped to this subscription_id
|
|
202
|
+
*/
|
|
203
|
+
subscription_id?: string | null;
|
|
204
|
+
}
|
|
205
|
+
export interface AlertCreateForCustomerParams {
|
|
206
|
+
/**
|
|
207
|
+
* The case sensitive currency or custom pricing unit to use for this alert.
|
|
208
|
+
*/
|
|
209
|
+
currency: string;
|
|
210
|
+
/**
|
|
211
|
+
* The thresholds that define the values at which the alert will be triggered.
|
|
212
|
+
*/
|
|
213
|
+
type: string;
|
|
214
|
+
/**
|
|
215
|
+
* The thresholds for the alert.
|
|
216
|
+
*/
|
|
217
|
+
thresholds?: Array<AlertCreateForCustomerParams.Threshold> | null;
|
|
218
|
+
}
|
|
219
|
+
export declare namespace AlertCreateForCustomerParams {
|
|
220
|
+
/**
|
|
221
|
+
* Thresholds are used to define the conditions under which an alert will be
|
|
222
|
+
* triggered.
|
|
223
|
+
*/
|
|
224
|
+
interface Threshold {
|
|
225
|
+
/**
|
|
226
|
+
* The value at which an alert will fire. For credit balance alerts, the alert will fire at or below this value. For usage and
|
|
227
|
+
* cost alerts, the alert will fire at or above this value.
|
|
228
|
+
*/
|
|
229
|
+
value: number;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
export interface AlertCreateForExternalCustomerParams {
|
|
233
|
+
/**
|
|
234
|
+
* The case sensitive currency or custom pricing unit to use for this alert.
|
|
235
|
+
*/
|
|
236
|
+
currency: string;
|
|
237
|
+
/**
|
|
238
|
+
* The thresholds that define the values at which the alert will be triggered.
|
|
239
|
+
*/
|
|
240
|
+
type: string;
|
|
241
|
+
/**
|
|
242
|
+
* The thresholds for the alert.
|
|
243
|
+
*/
|
|
244
|
+
thresholds?: Array<AlertCreateForExternalCustomerParams.Threshold> | null;
|
|
245
|
+
}
|
|
246
|
+
export declare namespace AlertCreateForExternalCustomerParams {
|
|
247
|
+
/**
|
|
248
|
+
* Thresholds are used to define the conditions under which an alert will be
|
|
249
|
+
* triggered.
|
|
250
|
+
*/
|
|
251
|
+
interface Threshold {
|
|
252
|
+
/**
|
|
253
|
+
* The value at which an alert will fire. For credit balance alerts, the alert will fire at or below this value. For usage and
|
|
254
|
+
* cost alerts, the alert will fire at or above this value.
|
|
255
|
+
*/
|
|
256
|
+
value: number;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
export interface AlertCreateForPlanParams {
|
|
260
|
+
/**
|
|
261
|
+
* The thresholds for the alert.
|
|
262
|
+
*/
|
|
263
|
+
thresholds: Array<AlertCreateForPlanParams.Threshold>;
|
|
264
|
+
/**
|
|
265
|
+
* The thresholds that define the values at which the alert will be triggered.
|
|
266
|
+
*/
|
|
267
|
+
type: string;
|
|
268
|
+
/**
|
|
269
|
+
* The metric to track usage for.
|
|
270
|
+
*/
|
|
271
|
+
metric_id?: string | null;
|
|
272
|
+
/**
|
|
273
|
+
* The plan version to create alerts for. If not specified, the default will be the plan's active plan version.
|
|
274
|
+
*/
|
|
275
|
+
plan_version?: number | null;
|
|
276
|
+
}
|
|
277
|
+
export declare namespace AlertCreateForPlanParams {
|
|
278
|
+
/**
|
|
279
|
+
* Thresholds are used to define the conditions under which an alert will be
|
|
280
|
+
* triggered.
|
|
281
|
+
*/
|
|
282
|
+
interface Threshold {
|
|
283
|
+
/**
|
|
284
|
+
* The value at which an alert will fire. For credit balance alerts, the alert will fire at or below this value. For usage and
|
|
285
|
+
* cost alerts, the alert will fire at or above this value.
|
|
286
|
+
*/
|
|
287
|
+
value: number;
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
export interface AlertCreateForSubscriptionParams {
|
|
291
|
+
/**
|
|
292
|
+
* The thresholds for the alert.
|
|
293
|
+
*/
|
|
294
|
+
thresholds: Array<AlertCreateForSubscriptionParams.Threshold>;
|
|
295
|
+
/**
|
|
296
|
+
* The thresholds that define the values at which the alert will be triggered.
|
|
297
|
+
*/
|
|
298
|
+
type: string;
|
|
299
|
+
/**
|
|
300
|
+
* The metric to track usage for.
|
|
301
|
+
*/
|
|
302
|
+
metric_id?: string | null;
|
|
303
|
+
}
|
|
304
|
+
export declare namespace AlertCreateForSubscriptionParams {
|
|
305
|
+
/**
|
|
306
|
+
* Thresholds are used to define the conditions under which an alert will be
|
|
307
|
+
* triggered.
|
|
308
|
+
*/
|
|
309
|
+
interface Threshold {
|
|
310
|
+
/**
|
|
311
|
+
* The value at which an alert will fire. For credit balance alerts, the alert will fire at or below this value. For usage and
|
|
312
|
+
* cost alerts, the alert will fire at or above this value.
|
|
313
|
+
*/
|
|
314
|
+
value: number;
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
export interface AlertDisableParams {
|
|
318
|
+
/**
|
|
319
|
+
* Used to update the status of a plan alert scoped to this subscription_id
|
|
320
|
+
*/
|
|
321
|
+
subscription_id?: string | null;
|
|
322
|
+
}
|
|
323
|
+
export interface AlertEnableParams {
|
|
324
|
+
/**
|
|
325
|
+
* Used to update the status of a plan alert scoped to this subscription_id
|
|
326
|
+
*/
|
|
327
|
+
subscription_id?: string | null;
|
|
328
|
+
}
|
|
329
|
+
export declare namespace Alerts {
|
|
330
|
+
export import Alert = AlertsAPI.Alert;
|
|
331
|
+
export import AlertsPage = AlertsAPI.AlertsPage;
|
|
332
|
+
export import AlertListParams = AlertsAPI.AlertListParams;
|
|
333
|
+
export import AlertCreateForCustomerParams = AlertsAPI.AlertCreateForCustomerParams;
|
|
334
|
+
export import AlertCreateForExternalCustomerParams = AlertsAPI.AlertCreateForExternalCustomerParams;
|
|
335
|
+
export import AlertCreateForPlanParams = AlertsAPI.AlertCreateForPlanParams;
|
|
336
|
+
export import AlertCreateForSubscriptionParams = AlertsAPI.AlertCreateForSubscriptionParams;
|
|
337
|
+
export import AlertDisableParams = AlertsAPI.AlertDisableParams;
|
|
338
|
+
export import AlertEnableParams = AlertsAPI.AlertEnableParams;
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=alerts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xB;;;WAGG;QACH,KAAK,EAAE,MAAM,CAAC;KACf;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,yBAAiB,MAAM,CAAC;IACtB,MAAM,QAAQ,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC;IACtC,MAAM,QAAQ,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC;IAChD,MAAM,QAAQ,eAAe,GAAG,SAAS,CAAC,eAAe,CAAC;IAC1D,MAAM,QAAQ,4BAA4B,GAAG,SAAS,CAAC,4BAA4B,CAAC;IACpF,MAAM,QAAQ,oCAAoC,GAAG,SAAS,CAAC,oCAAoC,CAAC;IACpG,MAAM,QAAQ,wBAAwB,GAAG,SAAS,CAAC,wBAAwB,CAAC;IAC5E,MAAM,QAAQ,gCAAgC,GAAG,SAAS,CAAC,gCAAgC,CAAC;IAC5F,MAAM,QAAQ,kBAAkB,GAAG,SAAS,CAAC,kBAAkB,CAAC;IAChE,MAAM,QAAQ,iBAAiB,GAAG,SAAS,CAAC,iBAAiB,CAAC;CAC/D"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
20
|
+
if (mod && mod.__esModule) return mod;
|
|
21
|
+
var result = {};
|
|
22
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
23
|
+
__setModuleDefault(result, mod);
|
|
24
|
+
return result;
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.AlertsPage = exports.Alerts = void 0;
|
|
28
|
+
const resource_1 = require("orb-billing/resource");
|
|
29
|
+
const core_1 = require("orb-billing/core");
|
|
30
|
+
const AlertsAPI = __importStar(require("orb-billing/resources/alerts"));
|
|
31
|
+
const pagination_1 = require("orb-billing/pagination");
|
|
32
|
+
class Alerts extends resource_1.APIResource {
|
|
33
|
+
/**
|
|
34
|
+
* This endpoint retrieves an alert by its ID.
|
|
35
|
+
*/
|
|
36
|
+
retrieve(alertId, options) {
|
|
37
|
+
return this._client.get(`/alerts/${alertId}`, options);
|
|
38
|
+
}
|
|
39
|
+
list(query = {}, options) {
|
|
40
|
+
if ((0, core_1.isRequestOptions)(query)) {
|
|
41
|
+
return this.list({}, query);
|
|
42
|
+
}
|
|
43
|
+
return this._client.getAPIList('/alerts', AlertsPage, { query, ...options });
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* This endpoint creates a new alert to monitor a customer's credit balance. There
|
|
47
|
+
* are three types of alerts that can be scoped to customers:
|
|
48
|
+
* `credit_balance_depleted`, `credit_balance_dropped`, and
|
|
49
|
+
* `credit_balance_recovered`. Customers can have a maximum of one of each type of
|
|
50
|
+
* alert per
|
|
51
|
+
* [credit balance currency](https://docs.withorb.com/guides/product-catalog/prepurchase).
|
|
52
|
+
* `credit_balance_dropped` alerts require a list of thresholds to be provided
|
|
53
|
+
* while `credit_balance_depleted` and `credit_balance_recovered` alerts do not
|
|
54
|
+
* require thresholds.
|
|
55
|
+
*/
|
|
56
|
+
createForCustomer(customerId, body, options) {
|
|
57
|
+
return this._client.post(`/alerts/customer_id/${customerId}`, { body, ...options });
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* This endpoint creates a new alert to monitor a customer's credit balance. There
|
|
61
|
+
* are three types of alerts that can be scoped to customers:
|
|
62
|
+
* `credit_balance_depleted`, `credit_balance_dropped`, and
|
|
63
|
+
* `credit_balance_recovered`. Customers can have a maximum of one of each type of
|
|
64
|
+
* alert per
|
|
65
|
+
* [credit balance currency](https://docs.withorb.com/guides/product-catalog/prepurchase).
|
|
66
|
+
* `credit_balance_dropped` alerts require a list of thresholds to be provided
|
|
67
|
+
* while `credit_balance_depleted` and `credit_balance_recovered` alerts do not
|
|
68
|
+
* require thresholds.
|
|
69
|
+
*/
|
|
70
|
+
createForExternalCustomer(externalCustomerId, body, options) {
|
|
71
|
+
return this._client.post(`/alerts/external_customer_id/${externalCustomerId}`, { body, ...options });
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* This endpoint is used to create alerts at the plan level. Plan level alerts are
|
|
75
|
+
* automatically propagated to all subscriptions associated with the plan. These
|
|
76
|
+
* alerts are scoped to a specific plan version; if no version is specified, the
|
|
77
|
+
* active plan version is used.
|
|
78
|
+
*
|
|
79
|
+
* Plan level alerts can be of two types: `usage_exceeded` or `cost_exceeded`. A
|
|
80
|
+
* `usage_exceeded` alert is scoped to a particular metric and is triggered when
|
|
81
|
+
* the usage of that metric exceeds a predefined thresholds during the current
|
|
82
|
+
* invoice cycle. A `cost_exceeded` alert is triggered when the total cost of the
|
|
83
|
+
* subscription on the plan surpasses predefined thresholds in the current invoice
|
|
84
|
+
* cycle.Each plan can have one `cost_exceeded` alert and one `usage_exceeded`
|
|
85
|
+
* alert per metric that is apart of the plan.
|
|
86
|
+
*/
|
|
87
|
+
createForPlan(planId, body, options) {
|
|
88
|
+
return this._client.post(`/alerts/plan_id/${planId}`, { body, ...options });
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* This endpoint is used to create alerts at the subscription level.
|
|
92
|
+
*
|
|
93
|
+
* Subscription level alerts can be one of two types: `usage_exceeded` or
|
|
94
|
+
* `cost_exceeded`. A `usage_exceeded` alert is scoped to a particular metric and
|
|
95
|
+
* is triggered when the usage of that metric exceeds a predefined thresholds
|
|
96
|
+
* during the current invoice cycle. A `cost_exceeded` alert is triggered when the
|
|
97
|
+
* total cost of the subscription surpasses predefined thresholds in the current
|
|
98
|
+
* invoice cycle. Each subscription can have one `cost_exceeded` alert and one
|
|
99
|
+
* `usage_exceeded` alert per metric that is apart of the subscription. Alerts are
|
|
100
|
+
* triggered based on usage or cost conditions met during the current invoice
|
|
101
|
+
* cycle.
|
|
102
|
+
*/
|
|
103
|
+
createForSubscription(subscriptionId, body, options) {
|
|
104
|
+
return this._client.post(`/alerts/subscription_id/${subscriptionId}`, { body, ...options });
|
|
105
|
+
}
|
|
106
|
+
disable(alertConfigurationId, params = {}, options) {
|
|
107
|
+
if ((0, core_1.isRequestOptions)(params)) {
|
|
108
|
+
return this.disable(alertConfigurationId, {}, params);
|
|
109
|
+
}
|
|
110
|
+
const { subscription_id } = params;
|
|
111
|
+
return this._client.post(`/alerts/${alertConfigurationId}/disable`, {
|
|
112
|
+
query: { subscription_id },
|
|
113
|
+
...options,
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
enable(alertConfigurationId, params = {}, options) {
|
|
117
|
+
if ((0, core_1.isRequestOptions)(params)) {
|
|
118
|
+
return this.enable(alertConfigurationId, {}, params);
|
|
119
|
+
}
|
|
120
|
+
const { subscription_id } = params;
|
|
121
|
+
return this._client.post(`/alerts/${alertConfigurationId}/enable`, {
|
|
122
|
+
query: { subscription_id },
|
|
123
|
+
...options,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
exports.Alerts = Alerts;
|
|
128
|
+
class AlertsPage extends pagination_1.Page {
|
|
129
|
+
}
|
|
130
|
+
exports.AlertsPage = AlertsPage;
|
|
131
|
+
(function (Alerts) {
|
|
132
|
+
Alerts.AlertsPage = AlertsAPI.AlertsPage;
|
|
133
|
+
})(Alerts = exports.Alerts || (exports.Alerts = {}));
|
|
134
|
+
//# sourceMappingURL=alerts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["../src/resources/alerts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;;;;;;;;;;;;;;;;;;;;;;;AAGtF,mDAAmD;AACnD,2CAAoD;AACpD,wEAA0D;AAC1D,uDAA+D;AAE/D,MAAa,MAAO,SAAQ,sBAAW;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAe,EAAE,OAA6B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAkBD,IAAI,CACF,QAA+C,EAAE,EACjD,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;OAUG;IACH,iBAAiB,CACf,UAAkB,EAClB,IAAkC,EAClC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,GA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AC,oBAAoB,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;SACtD;QACD,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,CAAC;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,oBAAoB,SAAS,EAAE;YACjE,KAAK,EAAE,EAAE,eAAe,EAAE;YAC1B,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF;AA5KD,wBA4KC;AAED,MAAa,UAAW,SAAQ,iBAAW;CAAG;AAA9C,gCAA8C;AAiR9C,WAAiB,MAAM;IAEP,iBAAU,GAAG,SAAS,CAAC,UAAU,CAAC;AAQlD,CAAC,EAVgB,MAAM,GAAN,cAAM,KAAN,cAAM,QAUtB"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from 'orb-billing/resource';
|
|
3
|
+
import { isRequestOptions } from 'orb-billing/core';
|
|
4
|
+
import * as AlertsAPI from 'orb-billing/resources/alerts';
|
|
5
|
+
import { Page } from 'orb-billing/pagination';
|
|
6
|
+
export class Alerts extends APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* This endpoint retrieves an alert by its ID.
|
|
9
|
+
*/
|
|
10
|
+
retrieve(alertId, options) {
|
|
11
|
+
return this._client.get(`/alerts/${alertId}`, options);
|
|
12
|
+
}
|
|
13
|
+
list(query = {}, options) {
|
|
14
|
+
if (isRequestOptions(query)) {
|
|
15
|
+
return this.list({}, query);
|
|
16
|
+
}
|
|
17
|
+
return this._client.getAPIList('/alerts', AlertsPage, { query, ...options });
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* This endpoint creates a new alert to monitor a customer's credit balance. There
|
|
21
|
+
* are three types of alerts that can be scoped to customers:
|
|
22
|
+
* `credit_balance_depleted`, `credit_balance_dropped`, and
|
|
23
|
+
* `credit_balance_recovered`. Customers can have a maximum of one of each type of
|
|
24
|
+
* alert per
|
|
25
|
+
* [credit balance currency](https://docs.withorb.com/guides/product-catalog/prepurchase).
|
|
26
|
+
* `credit_balance_dropped` alerts require a list of thresholds to be provided
|
|
27
|
+
* while `credit_balance_depleted` and `credit_balance_recovered` alerts do not
|
|
28
|
+
* require thresholds.
|
|
29
|
+
*/
|
|
30
|
+
createForCustomer(customerId, body, options) {
|
|
31
|
+
return this._client.post(`/alerts/customer_id/${customerId}`, { body, ...options });
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* This endpoint creates a new alert to monitor a customer's credit balance. There
|
|
35
|
+
* are three types of alerts that can be scoped to customers:
|
|
36
|
+
* `credit_balance_depleted`, `credit_balance_dropped`, and
|
|
37
|
+
* `credit_balance_recovered`. Customers can have a maximum of one of each type of
|
|
38
|
+
* alert per
|
|
39
|
+
* [credit balance currency](https://docs.withorb.com/guides/product-catalog/prepurchase).
|
|
40
|
+
* `credit_balance_dropped` alerts require a list of thresholds to be provided
|
|
41
|
+
* while `credit_balance_depleted` and `credit_balance_recovered` alerts do not
|
|
42
|
+
* require thresholds.
|
|
43
|
+
*/
|
|
44
|
+
createForExternalCustomer(externalCustomerId, body, options) {
|
|
45
|
+
return this._client.post(`/alerts/external_customer_id/${externalCustomerId}`, { body, ...options });
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* This endpoint is used to create alerts at the plan level. Plan level alerts are
|
|
49
|
+
* automatically propagated to all subscriptions associated with the plan. These
|
|
50
|
+
* alerts are scoped to a specific plan version; if no version is specified, the
|
|
51
|
+
* active plan version is used.
|
|
52
|
+
*
|
|
53
|
+
* Plan level alerts can be of two types: `usage_exceeded` or `cost_exceeded`. A
|
|
54
|
+
* `usage_exceeded` alert is scoped to a particular metric and is triggered when
|
|
55
|
+
* the usage of that metric exceeds a predefined thresholds during the current
|
|
56
|
+
* invoice cycle. A `cost_exceeded` alert is triggered when the total cost of the
|
|
57
|
+
* subscription on the plan surpasses predefined thresholds in the current invoice
|
|
58
|
+
* cycle.Each plan can have one `cost_exceeded` alert and one `usage_exceeded`
|
|
59
|
+
* alert per metric that is apart of the plan.
|
|
60
|
+
*/
|
|
61
|
+
createForPlan(planId, body, options) {
|
|
62
|
+
return this._client.post(`/alerts/plan_id/${planId}`, { body, ...options });
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* This endpoint is used to create alerts at the subscription level.
|
|
66
|
+
*
|
|
67
|
+
* Subscription level alerts can be one of two types: `usage_exceeded` or
|
|
68
|
+
* `cost_exceeded`. A `usage_exceeded` alert is scoped to a particular metric and
|
|
69
|
+
* is triggered when the usage of that metric exceeds a predefined thresholds
|
|
70
|
+
* during the current invoice cycle. A `cost_exceeded` alert is triggered when the
|
|
71
|
+
* total cost of the subscription surpasses predefined thresholds in the current
|
|
72
|
+
* invoice cycle. Each subscription can have one `cost_exceeded` alert and one
|
|
73
|
+
* `usage_exceeded` alert per metric that is apart of the subscription. Alerts are
|
|
74
|
+
* triggered based on usage or cost conditions met during the current invoice
|
|
75
|
+
* cycle.
|
|
76
|
+
*/
|
|
77
|
+
createForSubscription(subscriptionId, body, options) {
|
|
78
|
+
return this._client.post(`/alerts/subscription_id/${subscriptionId}`, { body, ...options });
|
|
79
|
+
}
|
|
80
|
+
disable(alertConfigurationId, params = {}, options) {
|
|
81
|
+
if (isRequestOptions(params)) {
|
|
82
|
+
return this.disable(alertConfigurationId, {}, params);
|
|
83
|
+
}
|
|
84
|
+
const { subscription_id } = params;
|
|
85
|
+
return this._client.post(`/alerts/${alertConfigurationId}/disable`, {
|
|
86
|
+
query: { subscription_id },
|
|
87
|
+
...options,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
enable(alertConfigurationId, params = {}, options) {
|
|
91
|
+
if (isRequestOptions(params)) {
|
|
92
|
+
return this.enable(alertConfigurationId, {}, params);
|
|
93
|
+
}
|
|
94
|
+
const { subscription_id } = params;
|
|
95
|
+
return this._client.post(`/alerts/${alertConfigurationId}/enable`, {
|
|
96
|
+
query: { subscription_id },
|
|
97
|
+
...options,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
export class AlertsPage extends Page {
|
|
102
|
+
}
|
|
103
|
+
(function (Alerts) {
|
|
104
|
+
Alerts.AlertsPage = AlertsAPI.AlertsPage;
|
|
105
|
+
})(Alerts || (Alerts = {}));
|
|
106
|
+
//# sourceMappingURL=alerts.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerts.mjs","sourceRoot":"","sources":["../src/resources/alerts.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,WAAW,EAAE,MAAM,sBAAsB;OAC3C,EAAE,gBAAgB,EAAE,MAAM,kBAAkB;OAC5C,KAAK,SAAS,MAAM,8BAA8B;OAClD,EAAE,IAAI,EAAmB,MAAM,wBAAwB;AAE9D,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,QAAQ,CAAC,OAAe,EAAE,OAA6B;QACrD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAkBD,IAAI,CACF,QAA+C,EAAE,EACjD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;SAC7B;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;OAUG;IACH,iBAAiB,CACf,UAAkB,EAClB,IAAkC,EAClC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,UAAU,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACtF,CAAC;IAED;;;;;;;;;;OA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