@stigg/typescript 0.1.0-beta.40 → 0.1.0-beta.42
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 +22 -0
- package/package.json +1 -1
- package/resources/v1/credits/consumption.d.mts +4 -1
- package/resources/v1/credits/consumption.d.mts.map +1 -1
- package/resources/v1/credits/consumption.d.ts +4 -1
- package/resources/v1/credits/consumption.d.ts.map +1 -1
- package/resources/v1/customers/customers.d.mts +9 -2
- package/resources/v1/customers/customers.d.mts.map +1 -1
- package/resources/v1/customers/customers.d.ts +9 -2
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js +9 -2
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs +9 -2
- package/resources/v1/customers/customers.mjs.map +1 -1
- package/resources/v1/customers/events.d.mts +4 -0
- package/resources/v1/customers/events.d.mts.map +1 -0
- package/resources/v1/customers/events.d.ts +4 -0
- package/resources/v1/customers/events.d.ts.map +1 -0
- package/resources/v1/customers/events.js +9 -0
- package/resources/v1/customers/events.js.map +1 -0
- package/resources/v1/customers/events.mjs +5 -0
- package/resources/v1/customers/events.mjs.map +1 -0
- package/resources/v1/customers/index.d.mts +2 -0
- package/resources/v1/customers/index.d.mts.map +1 -1
- package/resources/v1/customers/index.d.ts +2 -0
- package/resources/v1/customers/index.d.ts.map +1 -1
- package/resources/v1/customers/index.js +5 -1
- package/resources/v1/customers/index.js.map +1 -1
- package/resources/v1/customers/index.mjs +2 -0
- package/resources/v1/customers/index.mjs.map +1 -1
- package/resources/v1/customers/usage.d.mts +4 -0
- package/resources/v1/customers/usage.d.mts.map +1 -0
- package/resources/v1/customers/usage.d.ts +4 -0
- package/resources/v1/customers/usage.d.ts.map +1 -0
- package/resources/v1/customers/usage.js +9 -0
- package/resources/v1/customers/usage.js.map +1 -0
- package/resources/v1/customers/usage.mjs +5 -0
- package/resources/v1/customers/usage.mjs.map +1 -0
- package/resources/v1/events/data-export/destinations.d.mts +3 -1
- package/resources/v1/events/data-export/destinations.d.mts.map +1 -1
- package/resources/v1/events/data-export/destinations.d.ts +3 -1
- package/resources/v1/events/data-export/destinations.d.ts.map +1 -1
- package/resources/v1/events/data-export/destinations.js +3 -1
- package/resources/v1/events/data-export/destinations.js.map +1 -1
- package/resources/v1/events/data-export/destinations.mjs +3 -1
- package/resources/v1/events/data-export/destinations.mjs.map +1 -1
- package/resources/v1/events/events.d.mts +106 -1
- package/resources/v1/events/events.d.mts.map +1 -1
- package/resources/v1/events/events.d.ts +106 -1
- package/resources/v1/events/events.d.ts.map +1 -1
- package/resources/v1/events/events.js +19 -0
- package/resources/v1/events/events.js.map +1 -1
- package/resources/v1/events/events.mjs +19 -0
- package/resources/v1/events/events.mjs.map +1 -1
- package/resources/v1/events/index.d.mts +1 -1
- package/resources/v1/events/index.d.mts.map +1 -1
- package/resources/v1/events/index.d.ts +1 -1
- package/resources/v1/events/index.d.ts.map +1 -1
- package/resources/v1/events/index.js.map +1 -1
- package/resources/v1/events/index.mjs +1 -1
- package/resources/v1/events/index.mjs.map +1 -1
- package/resources/v1/index.d.mts +2 -2
- package/resources/v1/index.d.mts.map +1 -1
- package/resources/v1/index.d.ts +2 -2
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs +1 -1
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/usage.d.mts +125 -2
- package/resources/v1/usage.d.mts.map +1 -1
- package/resources/v1/usage.d.ts +125 -2
- package/resources/v1/usage.d.ts.map +1 -1
- package/resources/v1/usage.js +19 -0
- package/resources/v1/usage.js.map +1 -1
- package/resources/v1/usage.mjs +19 -0
- package/resources/v1/usage.mjs.map +1 -1
- package/resources/v1/v1.d.mts +4 -4
- package/resources/v1/v1.d.mts.map +1 -1
- package/resources/v1/v1.d.ts +4 -4
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs +1 -1
- package/resources/v1/v1.mjs.map +1 -1
- package/src/resources/v1/credits/consumption.ts +4 -1
- package/src/resources/v1/customers/customers.ts +13 -2
- package/src/resources/v1/customers/events.ts +5 -0
- package/src/resources/v1/customers/index.ts +2 -0
- package/src/resources/v1/customers/usage.ts +5 -0
- package/src/resources/v1/events/data-export/destinations.ts +3 -1
- package/src/resources/v1/events/events.ts +144 -1
- package/src/resources/v1/events/index.ts +7 -1
- package/src/resources/v1/index.ts +9 -1
- package/src/resources/v1/usage.ts +162 -1
- package/src/resources/v1/v1.ts +13 -1
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -11,12 +11,86 @@ import { RequestOptions } from "../../../internal/request-options.js";
|
|
|
11
11
|
export declare class Events extends APIResource {
|
|
12
12
|
dataExport: DataExportAPI.DataExport;
|
|
13
13
|
beta: BetaAPI.Beta;
|
|
14
|
+
/**
|
|
15
|
+
* Estimates the credit cost of a usage event without ingesting it. Returns the
|
|
16
|
+
* estimated cost per credit currency, the current balance, and the balance after
|
|
17
|
+
* the estimated consumption.
|
|
18
|
+
*/
|
|
19
|
+
estimateCost(params: EventEstimateCostParams, options?: RequestOptions): APIPromise<EventEstimateCostResponse>;
|
|
14
20
|
/**
|
|
15
21
|
* Reports raw usage events for event-based metering. Events are ingested
|
|
16
22
|
* asynchronously and aggregated into usage totals.
|
|
17
23
|
*/
|
|
18
24
|
report(params: EventReportParams, options?: RequestOptions): APIPromise<EventReportResponse>;
|
|
19
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Response object
|
|
28
|
+
*/
|
|
29
|
+
export interface EventEstimateCostResponse {
|
|
30
|
+
/**
|
|
31
|
+
* Estimated credit cost, current balance and balance after
|
|
32
|
+
*/
|
|
33
|
+
data: EventEstimateCostResponse.Data;
|
|
34
|
+
}
|
|
35
|
+
export declare namespace EventEstimateCostResponse {
|
|
36
|
+
/**
|
|
37
|
+
* Estimated credit cost, current balance and balance after
|
|
38
|
+
*/
|
|
39
|
+
interface Data {
|
|
40
|
+
/**
|
|
41
|
+
* Per-currency cost estimates
|
|
42
|
+
*/
|
|
43
|
+
estimates: Array<Data.Estimate>;
|
|
44
|
+
/**
|
|
45
|
+
* Request-level warnings about the estimation context
|
|
46
|
+
*/
|
|
47
|
+
warnings: Array<'RESOURCE_SCOPED_SUBSCRIPTION_EXISTS' | 'FEATURE_NOT_FOUND' | 'FEATURE_NOT_CREDIT_BASED'>;
|
|
48
|
+
}
|
|
49
|
+
namespace Data {
|
|
50
|
+
interface Estimate {
|
|
51
|
+
/**
|
|
52
|
+
* The credit balance after subtracting the estimated cost
|
|
53
|
+
*/
|
|
54
|
+
balanceAfterEstimate: number;
|
|
55
|
+
/**
|
|
56
|
+
* Estimated cost contribution per feature
|
|
57
|
+
*/
|
|
58
|
+
breakdown: Array<Estimate.Breakdown>;
|
|
59
|
+
/**
|
|
60
|
+
* The credit currency identifier
|
|
61
|
+
*/
|
|
62
|
+
currencyId: string;
|
|
63
|
+
/**
|
|
64
|
+
* The current credit balance, including not-yet-reconciled consumption
|
|
65
|
+
*/
|
|
66
|
+
currentBalance: number;
|
|
67
|
+
/**
|
|
68
|
+
* The estimated credit cost of the reported event or usage
|
|
69
|
+
*/
|
|
70
|
+
estimatedCost: number;
|
|
71
|
+
/**
|
|
72
|
+
* Whether the estimated consumption would bring the balance below zero
|
|
73
|
+
*/
|
|
74
|
+
wouldOverdraft: boolean;
|
|
75
|
+
}
|
|
76
|
+
namespace Estimate {
|
|
77
|
+
interface Breakdown {
|
|
78
|
+
/**
|
|
79
|
+
* The estimated credit cost contributed by this feature
|
|
80
|
+
*/
|
|
81
|
+
cost: number;
|
|
82
|
+
/**
|
|
83
|
+
* The feature whose meter contributed this cost
|
|
84
|
+
*/
|
|
85
|
+
featureId: string;
|
|
86
|
+
/**
|
|
87
|
+
* Warning explaining why this cost may be inaccurate, if any
|
|
88
|
+
*/
|
|
89
|
+
warningCode: 'UNSUPPORTED_AGGREGATION' | null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
20
94
|
/**
|
|
21
95
|
* Response object
|
|
22
96
|
*/
|
|
@@ -27,6 +101,37 @@ export interface EventReportResponse {
|
|
|
27
101
|
*/
|
|
28
102
|
data: unknown;
|
|
29
103
|
}
|
|
104
|
+
export interface EventEstimateCostParams {
|
|
105
|
+
/**
|
|
106
|
+
* Body param: Customer id
|
|
107
|
+
*/
|
|
108
|
+
customerId: string;
|
|
109
|
+
/**
|
|
110
|
+
* Body param: The name of the usage event
|
|
111
|
+
*/
|
|
112
|
+
eventName: string;
|
|
113
|
+
/**
|
|
114
|
+
* Body param: Dimensions associated with the usage event
|
|
115
|
+
*/
|
|
116
|
+
dimensions?: {
|
|
117
|
+
[key: string]: string | number | boolean;
|
|
118
|
+
};
|
|
119
|
+
/**
|
|
120
|
+
* Body param: Resource id
|
|
121
|
+
*/
|
|
122
|
+
resourceId?: string | null;
|
|
123
|
+
/**
|
|
124
|
+
* Header param: Account ID — optional when authenticating with a user JWT (Bearer
|
|
125
|
+
* token); falls back to the user's first membership. Ignored for API-key auth.
|
|
126
|
+
*/
|
|
127
|
+
'X-ACCOUNT-ID'?: string;
|
|
128
|
+
/**
|
|
129
|
+
* Header param: Environment ID — required when authenticating with a user JWT
|
|
130
|
+
* (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is
|
|
131
|
+
* intrinsic to the key).
|
|
132
|
+
*/
|
|
133
|
+
'X-ENVIRONMENT-ID'?: string;
|
|
134
|
+
}
|
|
30
135
|
export interface EventReportParams {
|
|
31
136
|
/**
|
|
32
137
|
* Body param: A list of usage events to report
|
|
@@ -78,7 +183,7 @@ export declare namespace EventReportParams {
|
|
|
78
183
|
}
|
|
79
184
|
}
|
|
80
185
|
export declare namespace Events {
|
|
81
|
-
export { type EventReportResponse as EventReportResponse, type EventReportParams as EventReportParams };
|
|
186
|
+
export { type EventEstimateCostResponse as EventEstimateCostResponse, type EventReportResponse as EventReportResponse, type EventEstimateCostParams as EventEstimateCostParams, type EventReportParams as EventReportParams, };
|
|
82
187
|
export { DataExport as DataExport, type DataExportListModelsResponse as DataExportListModelsResponse, type DataExportMintScopedTokenResponse as DataExportMintScopedTokenResponse, type DataExportTriggerSyncResponse as DataExportTriggerSyncResponse, type DataExportListModelsParams as DataExportListModelsParams, type DataExportMintScopedTokenParams as DataExportMintScopedTokenParams, type DataExportTriggerSyncParams as DataExportTriggerSyncParams, };
|
|
83
188
|
export { Beta as Beta };
|
|
84
189
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/events/events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,kCAA+B;AACrD,OAAO,KAAK,OAAO,uBAAoB;AACvC,OAAO,EAAE,IAAI,EAAE,uBAAoB;AACnC,OAAO,KAAK,aAAa,qCAAkC;AAC3D,OAAO,EACL,UAAU,EACV,0BAA0B,EAC1B,4BAA4B,EAC5B,+BAA+B,EAC/B,iCAAiC,EACjC,2BAA2B,EAC3B,6BAA6B,EAC9B,qCAAkC;AACnC,OAAO,EAAE,UAAU,EAAE,qCAAkC;AAEvD,OAAO,EAAE,cAAc,EAAE,6CAA0C;AAEnE;;GAEG;AACH,qBAAa,MAAO,SAAQ,WAAW;IACrC,UAAU,EAAE,aAAa,CAAC,UAAU,CAA8C;IAClF,IAAI,EAAE,OAAO,CAAC,IAAI,CAAkC;IAEpD;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAc7F;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,MAAM,EAAE,KAAK,CAA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UAAU,EACxB,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,iCAAiC,IAAI,iCAAiC,EAC3E,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;IAEF,OAAO,EAAE,IAAI,IAAI,IAAI,EAAE,CAAC;CACzB"}
|
|
@@ -18,6 +18,25 @@ class Events extends resource_1.APIResource {
|
|
|
18
18
|
this.dataExport = new DataExportAPI.DataExport(this._client);
|
|
19
19
|
this.beta = new BetaAPI.Beta(this._client);
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* Estimates the credit cost of a usage event without ingesting it. Returns the
|
|
23
|
+
* estimated cost per credit currency, the current balance, and the balance after
|
|
24
|
+
* the estimated consumption.
|
|
25
|
+
*/
|
|
26
|
+
estimateCost(params, options) {
|
|
27
|
+
const { 'X-ACCOUNT-ID': xAccountID, 'X-ENVIRONMENT-ID': xEnvironmentID, ...body } = params;
|
|
28
|
+
return this._client.post('/api/v1/events/estimate', {
|
|
29
|
+
body,
|
|
30
|
+
...options,
|
|
31
|
+
headers: (0, headers_1.buildHeaders)([
|
|
32
|
+
{
|
|
33
|
+
...(xAccountID != null ? { 'X-ACCOUNT-ID': xAccountID } : undefined),
|
|
34
|
+
...(xEnvironmentID != null ? { 'X-ENVIRONMENT-ID': xEnvironmentID } : undefined),
|
|
35
|
+
},
|
|
36
|
+
options?.headers,
|
|
37
|
+
]),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
21
40
|
/**
|
|
22
41
|
* Reports raw usage events for event-based metering. Events are ingested
|
|
23
42
|
* asynchronously and aggregated into usage totals.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/resources/v1/events/events.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD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;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,MAAyB,EAAE,OAAwB;QACxD,MAAM,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC3F,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE;YACzC,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB;oBACE,GAAG,CAAC,UAAU,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;oBACpE,GAAG,CAAC,cAAc,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACjF;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AA7CD,wBA6CC;AAyLD,MAAM,CAAC,UAAU,GAAG,wBAAU,CAAC;AAC/B,MAAM,CAAC,IAAI,GAAG,WAAI,CAAC"}
|
|
@@ -14,6 +14,25 @@ export class Events extends APIResource {
|
|
|
14
14
|
this.dataExport = new DataExportAPI.DataExport(this._client);
|
|
15
15
|
this.beta = new BetaAPI.Beta(this._client);
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Estimates the credit cost of a usage event without ingesting it. Returns the
|
|
19
|
+
* estimated cost per credit currency, the current balance, and the balance after
|
|
20
|
+
* the estimated consumption.
|
|
21
|
+
*/
|
|
22
|
+
estimateCost(params, options) {
|
|
23
|
+
const { 'X-ACCOUNT-ID': xAccountID, 'X-ENVIRONMENT-ID': xEnvironmentID, ...body } = params;
|
|
24
|
+
return this._client.post('/api/v1/events/estimate', {
|
|
25
|
+
body,
|
|
26
|
+
...options,
|
|
27
|
+
headers: buildHeaders([
|
|
28
|
+
{
|
|
29
|
+
...(xAccountID != null ? { 'X-ACCOUNT-ID': xAccountID } : undefined),
|
|
30
|
+
...(xEnvironmentID != null ? { 'X-ENVIRONMENT-ID': xEnvironmentID } : undefined),
|
|
31
|
+
},
|
|
32
|
+
options?.headers,
|
|
33
|
+
]),
|
|
34
|
+
});
|
|
35
|
+
}
|
|
17
36
|
/**
|
|
18
37
|
* Reports raw usage events for event-based metering. Events are ingested
|
|
19
38
|
* asynchronously and aggregated into usage totals.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../../../src/resources/v1/events/events.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,mCAA+B;AACrD,OAAO,KAAK,OAAO,wBAAoB;AACvC,OAAO,EAAE,IAAI,EAAE,wBAAoB;AACnC,OAAO,KAAK,aAAa,sCAAkC;AAC3D,OAAO,EACL,UAAU,GAOX,sCAAkC;AAEnC,OAAO,EAAE,YAAY,EAAE,sCAAkC;AAGzD;;GAEG;AACH,MAAM,OAAO,MAAO,SAAQ,WAAW;IAAvC;;QACE,eAAU,GAA6B,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAClF,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"events.mjs","sourceRoot":"","sources":["../../../src/resources/v1/events/events.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,mCAA+B;AACrD,OAAO,KAAK,OAAO,wBAAoB;AACvC,OAAO,EAAE,IAAI,EAAE,wBAAoB;AACnC,OAAO,KAAK,aAAa,sCAAkC;AAC3D,OAAO,EACL,UAAU,GAOX,sCAAkC;AAEnC,OAAO,EAAE,YAAY,EAAE,sCAAkC;AAGzD;;GAEG;AACH,MAAM,O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,CAAC,CAAC,CAAC,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC;iBACjF;gBACD,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AAyLD,MAAM,CAAC,UAAU,GAAG,UAAU,CAAC;AAC/B,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Beta } from "./beta/index.mjs";
|
|
2
2
|
export { DataExport, type DataExportListModelsResponse, type DataExportMintScopedTokenResponse, type DataExportTriggerSyncResponse, type DataExportListModelsParams, type DataExportMintScopedTokenParams, type DataExportTriggerSyncParams, } from "./data-export/index.mjs";
|
|
3
|
-
export { Events, type EventReportResponse, type EventReportParams } from "./events.mjs";
|
|
3
|
+
export { Events, type EventEstimateCostResponse, type EventReportResponse, type EventEstimateCostParams, type EventReportParams, } from "./events.mjs";
|
|
4
4
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/events/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,yBAAqB;AACpC,OAAO,EACL,UAAU,EACV,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,GACjC,gCAA4B;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/resources/v1/events/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,yBAAqB;AACpC,OAAO,EACL,UAAU,EACV,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,GACjC,gCAA4B;AAC7B,OAAO,EACL,MAAM,EACN,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GACvB,qBAAiB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Beta } from "./beta/index.js";
|
|
2
2
|
export { DataExport, type DataExportListModelsResponse, type DataExportMintScopedTokenResponse, type DataExportTriggerSyncResponse, type DataExportListModelsParams, type DataExportMintScopedTokenParams, type DataExportTriggerSyncParams, } from "./data-export/index.js";
|
|
3
|
-
export { Events, type EventReportResponse, type EventReportParams } from "./events.js";
|
|
3
|
+
export { Events, type EventEstimateCostResponse, type EventReportResponse, type EventEstimateCostParams, type EventReportParams, } from "./events.js";
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/events/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,wBAAqB;AACpC,OAAO,EACL,UAAU,EACV,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,GACjC,+BAA4B;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/resources/v1/events/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,IAAI,EAAE,wBAAqB;AACpC,OAAO,EACL,UAAU,EACV,KAAK,4BAA4B,EACjC,KAAK,iCAAiC,EACtC,KAAK,6BAA6B,EAClC,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACpC,KAAK,2BAA2B,GACjC,+BAA4B;AAC7B,OAAO,EACL,MAAM,EACN,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,uBAAuB,EAC5B,KAAK,iBAAiB,GACvB,oBAAiB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/v1/events/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,yCAAoC;AAA3B,6FAAA,IAAI,OAAA;AACb,gDAQ6B;AAP3B,mGAAA,UAAU,OAAA;AAQZ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/resources/v1/events/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,yCAAoC;AAA3B,6FAAA,IAAI,OAAA;AACb,gDAQ6B;AAP3B,mGAAA,UAAU,OAAA;AAQZ,sCAMkB;AALhB,gGAAA,MAAM,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
export { Beta } from "./beta/index.mjs";
|
|
3
3
|
export { DataExport, } from "./data-export/index.mjs";
|
|
4
|
-
export { Events } from "./events.mjs";
|
|
4
|
+
export { Events, } from "./events.mjs";
|
|
5
5
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/resources/v1/events/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,IAAI,EAAE,yBAAqB;AACpC,OAAO,EACL,UAAU,GAOX,gCAA4B;AAC7B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/resources/v1/events/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,IAAI,EAAE,yBAAqB;AACpC,OAAO,EACL,UAAU,GAOX,gCAA4B;AAC7B,OAAO,EACL,MAAM,GAKP,qBAAiB"}
|
package/resources/v1/index.d.mts
CHANGED
|
@@ -2,11 +2,11 @@ export { Addons, type Addon, type AddonListResponse, type AddonListChargesRespon
|
|
|
2
2
|
export { Coupons, type Coupon, type CouponListResponse, type CouponCreateParams, type CouponRetrieveParams, type CouponListParams, type CouponArchiveCouponParams, type CouponUpdateCouponParams, type CouponListResponsesMyCursorIDPage, } from "./coupons.mjs";
|
|
3
3
|
export { Credits, type CreditGetAutoRechargeResponse, type CreditGetUsageResponse, type CreditListLedgerResponse, type CreditGetAutoRechargeParams, type CreditGetUsageParams, type CreditListLedgerParams, type CreditListLedgerResponsesMyCursorIDPage, } from "./credits/index.mjs";
|
|
4
4
|
export { Customers, type CustomerIntegrationResponse, type CustomerResponse, type CustomerListResponse, type CustomerCheckEntitlementResponse, type CustomerImportResponse, type CustomerListResourcesResponse, type CustomerRetrieveEntitlementsResponse, type CustomerRetrieveParams, type CustomerUpdateParams, type CustomerListParams, type CustomerArchiveParams, type CustomerCheckEntitlementParams, type CustomerImportParams, type CustomerListResourcesParams, type CustomerProvisionParams, type CustomerRetrieveEntitlementsParams, type CustomerUnarchiveParams, type CustomerListResponsesMyCursorIDPage, type CustomerListResourcesResponsesMyCursorIDPage, } from "./customers/index.mjs";
|
|
5
|
-
export { Events, type EventReportResponse, type EventReportParams } from "./events/index.mjs";
|
|
5
|
+
export { Events, type EventEstimateCostResponse, type EventReportResponse, type EventEstimateCostParams, type EventReportParams, } from "./events/index.mjs";
|
|
6
6
|
export { Features, type Feature, type FeatureListFeaturesResponse, type FeatureArchiveFeatureParams, type FeatureCreateFeatureParams, type FeatureListFeaturesParams, type FeatureRetrieveFeatureParams, type FeatureUnarchiveFeatureParams, type FeatureUpdateFeatureParams, type FeatureListFeaturesResponsesMyCursorIDPage, } from "./features.mjs";
|
|
7
7
|
export { Plans, type Plan, type PlanListResponse, type PlanListChargesResponse, type PlanListOverageChargesResponse, type PlanPublishResponse, type PlanRemoveDraftResponse, type PlanCreateParams, type PlanRetrieveParams, type PlanUpdateParams, type PlanListParams, type PlanArchiveParams, type PlanCreateDraftParams, type PlanListChargesParams, type PlanListOverageChargesParams, type PlanPublishParams, type PlanRemoveDraftParams, type PlanListResponsesMyCursorIDPage, type PlanListChargesResponsesMyCursorIDPage, type PlanListOverageChargesResponsesMyCursorIDPage, } from "./plans/index.mjs";
|
|
8
8
|
export { Products, type Product, type ProductListProductsResponse, type ProductArchiveProductParams, type ProductCreateProductParams, type ProductDuplicateProductParams, type ProductListProductsParams, type ProductUnarchiveProductParams, type ProductUpdateProductParams, type ProductListProductsResponsesMyCursorIDPage, } from "./products.mjs";
|
|
9
9
|
export { Subscriptions, type Subscription, type SubscriptionListResponse, type SubscriptionImportResponse, type SubscriptionPreviewResponse, type SubscriptionProvisionResponse, type SubscriptionRetrieveParams, type SubscriptionUpdateParams, type SubscriptionListParams, type SubscriptionCancelParams, type SubscriptionDelegateParams, type SubscriptionImportParams, type SubscriptionMigrateParams, type SubscriptionPreviewParams, type SubscriptionProvisionParams, type SubscriptionTransferParams, type SubscriptionListResponsesMyCursorIDPage, } from "./subscriptions/index.mjs";
|
|
10
|
-
export { Usage, type UsageHistoryResponse, type UsageReportResponse, type UsageHistoryParams, type UsageReportParams, } from "./usage.mjs";
|
|
10
|
+
export { Usage, type UsageEstimateCostResponse, type UsageHistoryResponse, type UsageReportResponse, type UsageEstimateCostParams, type UsageHistoryParams, type UsageReportParams, } from "./usage.mjs";
|
|
11
11
|
export { V1 } from "./v1.mjs";
|
|
12
12
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/v1/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EACN,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,GAC7C,2BAAuB;AACxB,OAAO,EACL,OAAO,EACP,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,GACvC,sBAAkB;AACnB,OAAO,EACL,OAAO,EACP,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,uCAAuC,GAC7C,4BAAwB;AACzB,OAAO,EACL,SAAS,EACT,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,oCAAoC,EACzC,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,kCAAkC,EACvC,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,EACxC,KAAK,4CAA4C,GAClD,8BAA0B;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/v1/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EACN,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACv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ources/v1/index.d.ts
CHANGED
|
@@ -2,11 +2,11 @@ export { Addons, type Addon, type AddonListResponse, type AddonListChargesRespon
|
|
|
2
2
|
export { Coupons, type Coupon, type CouponListResponse, type CouponCreateParams, type CouponRetrieveParams, type CouponListParams, type CouponArchiveCouponParams, type CouponUpdateCouponParams, type CouponListResponsesMyCursorIDPage, } from "./coupons.js";
|
|
3
3
|
export { Credits, type CreditGetAutoRechargeResponse, type CreditGetUsageResponse, type CreditListLedgerResponse, type CreditGetAutoRechargeParams, type CreditGetUsageParams, type CreditListLedgerParams, type CreditListLedgerResponsesMyCursorIDPage, } from "./credits/index.js";
|
|
4
4
|
export { Customers, type CustomerIntegrationResponse, type CustomerResponse, type CustomerListResponse, type CustomerCheckEntitlementResponse, type CustomerImportResponse, type CustomerListResourcesResponse, type CustomerRetrieveEntitlementsResponse, type CustomerRetrieveParams, type CustomerUpdateParams, type CustomerListParams, type CustomerArchiveParams, type CustomerCheckEntitlementParams, type CustomerImportParams, type CustomerListResourcesParams, type CustomerProvisionParams, type CustomerRetrieveEntitlementsParams, type CustomerUnarchiveParams, type CustomerListResponsesMyCursorIDPage, type CustomerListResourcesResponsesMyCursorIDPage, } from "./customers/index.js";
|
|
5
|
-
export { Events, type EventReportResponse, type EventReportParams } from "./events/index.js";
|
|
5
|
+
export { Events, type EventEstimateCostResponse, type EventReportResponse, type EventEstimateCostParams, type EventReportParams, } from "./events/index.js";
|
|
6
6
|
export { Features, type Feature, type FeatureListFeaturesResponse, type FeatureArchiveFeatureParams, type FeatureCreateFeatureParams, type FeatureListFeaturesParams, type FeatureRetrieveFeatureParams, type FeatureUnarchiveFeatureParams, type FeatureUpdateFeatureParams, type FeatureListFeaturesResponsesMyCursorIDPage, } from "./features.js";
|
|
7
7
|
export { Plans, type Plan, type PlanListResponse, type PlanListChargesResponse, type PlanListOverageChargesResponse, type PlanPublishResponse, type PlanRemoveDraftResponse, type PlanCreateParams, type PlanRetrieveParams, type PlanUpdateParams, type PlanListParams, type PlanArchiveParams, type PlanCreateDraftParams, type PlanListChargesParams, type PlanListOverageChargesParams, type PlanPublishParams, type PlanRemoveDraftParams, type PlanListResponsesMyCursorIDPage, type PlanListChargesResponsesMyCursorIDPage, type PlanListOverageChargesResponsesMyCursorIDPage, } from "./plans/index.js";
|
|
8
8
|
export { Products, type Product, type ProductListProductsResponse, type ProductArchiveProductParams, type ProductCreateProductParams, type ProductDuplicateProductParams, type ProductListProductsParams, type ProductUnarchiveProductParams, type ProductUpdateProductParams, type ProductListProductsResponsesMyCursorIDPage, } from "./products.js";
|
|
9
9
|
export { Subscriptions, type Subscription, type SubscriptionListResponse, type SubscriptionImportResponse, type SubscriptionPreviewResponse, type SubscriptionProvisionResponse, type SubscriptionRetrieveParams, type SubscriptionUpdateParams, type SubscriptionListParams, type SubscriptionCancelParams, type SubscriptionDelegateParams, type SubscriptionImportParams, type SubscriptionMigrateParams, type SubscriptionPreviewParams, type SubscriptionProvisionParams, type SubscriptionTransferParams, type SubscriptionListResponsesMyCursorIDPage, } from "./subscriptions/index.js";
|
|
10
|
-
export { Usage, type UsageHistoryResponse, type UsageReportResponse, type UsageHistoryParams, type UsageReportParams, } from "./usage.js";
|
|
10
|
+
export { Usage, type UsageEstimateCostResponse, type UsageHistoryResponse, type UsageReportResponse, type UsageEstimateCostParams, type UsageHistoryParams, type UsageReportParams, } from "./usage.js";
|
|
11
11
|
export { V1 } from "./v1.js";
|
|
12
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/v1/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EACN,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,EAC3B,KAAK,gCAAgC,EACrC,KAAK,uCAAuC,GAC7C,0BAAuB;AACxB,OAAO,EACL,OAAO,EACP,KAAK,MAAM,EACX,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,gBAAgB,EACrB,KAAK,yBAAyB,EAC9B,KAAK,wBAAwB,EAC7B,KAAK,iCAAiC,GACvC,qBAAkB;AACnB,OAAO,EACL,OAAO,EACP,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAChC,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,uCAAuC,GAC7C,2BAAwB;AACzB,OAAO,EACL,SAAS,EACT,KAAK,2BAA2B,EAChC,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EACzB,KAAK,gCAAgC,EACrC,KAAK,sBAAsB,EAC3B,KAAK,6BAA6B,EAClC,KAAK,oCAAoC,EACzC,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,8BAA8B,EACnC,KAAK,oBAAoB,EACzB,KAAK,2BAA2B,EAChC,KAAK,uBAAuB,EAC5B,KAAK,kCAAkC,EACvC,KAAK,uBAAuB,EAC5B,KAAK,mCAAmC,EACxC,KAAK,4CAA4C,GAClD,6BAA0B;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/v1/index.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,MAAM,EACN,KAAK,KAAK,EACV,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,iBA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uBAAuB,EAC5B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,GACvB,mBAAgB;AACjB,OAAO,EAAE,EAAE,EAAE,gBAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/v1/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2CAkBwB;AAjBtB,+FAAA,MAAM,OAAA;AAkBR,wCAUmB;AATjB,kGAAA,OAAO,OAAA;AAUT,4CASyB;AARvB,gGAAA,OAAO,OAAA;AAST,8CAqB2B;AApBzB,kGAAA,SAAS,OAAA;AAqBX,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/v1/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2CAkBwB;AAjBtB,+FAAA,MAAM,OAAA;AAkBR,wCAUmB;AATjB,kGAAA,OAAO,OAAA;AAUT,4CASyB;AARvB,gGAAA,OAAO,OAAA;AAST,8CAqB2B;AApBzB,kGAAA,SAAS,OAAA;AAqBX,2CAMwB;AALtB,+FAAA,MAAM,OAAA;AAMR,0CAWoB;AAVlB,oGAAA,QAAQ,OAAA;AAWV,0CAqBuB;AApBrB,8FAAA,KAAK,OAAA;AAqBP,0CAWoB;AAVlB,oGAAA,QAAQ,OAAA;AAWV,kDAkB+B;AAjB7B,sGAAA,aAAa,OAAA;AAkBf,oCAQiB;AAPf,8FAAA,KAAK,OAAA;AAQP,8BAA0B;AAAjB,wFAAA,EAAE,OAAA"}
|
package/resources/v1/index.mjs
CHANGED
|
@@ -3,7 +3,7 @@ export { Addons, } from "./addons/index.mjs";
|
|
|
3
3
|
export { Coupons, } from "./coupons.mjs";
|
|
4
4
|
export { Credits, } from "./credits/index.mjs";
|
|
5
5
|
export { Customers, } from "./customers/index.mjs";
|
|
6
|
-
export { Events } from "./events/index.mjs";
|
|
6
|
+
export { Events, } from "./events/index.mjs";
|
|
7
7
|
export { Features, } from "./features.mjs";
|
|
8
8
|
export { Plans, } from "./plans/index.mjs";
|
|
9
9
|
export { Products, } from "./products.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/v1/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EACL,MAAM,GAiBP,2BAAuB;AACxB,OAAO,EACL,OAAO,GASR,sBAAkB;AACnB,OAAO,EACL,OAAO,GAQR,4BAAwB;AACzB,OAAO,EACL,SAAS,GAoBV,8BAA0B;AAC3B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/v1/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EACL,MAAM,GAiBP,2BAAuB;AACxB,OAAO,EACL,OAAO,GASR,sBAAkB;AACnB,OAAO,EACL,OAAO,GAQR,4BAAwB;AACzB,OAAO,EACL,SAAS,GAoBV,8BAA0B;AAC3B,OAAO,EACL,MAAM,GAKP,2BAAuB;AACxB,OAAO,EACL,QAAQ,GAUT,uBAAmB;AACpB,OAAO,EACL,KAAK,GAoBN,0BAAsB;AACvB,OAAO,EACL,QAAQ,GAUT,uBAAmB;AACpB,OAAO,EACL,aAAa,GAiBd,kCAA8B;AAC/B,OAAO,EACL,KAAK,GAON,oBAAgB;AACjB,OAAO,EAAE,EAAE,EAAE,iBAAa"}
|
package/resources/v1/usage.d.mts
CHANGED
|
@@ -5,6 +5,12 @@ import { RequestOptions } from "../../internal/request-options.mjs";
|
|
|
5
5
|
* Operations related to usage & metering
|
|
6
6
|
*/
|
|
7
7
|
export declare class Usage extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Estimates the credit cost of a usage report without recording it. Returns the
|
|
10
|
+
* estimated cost per credit currency, the current balance, and the balance after
|
|
11
|
+
* the estimated consumption.
|
|
12
|
+
*/
|
|
13
|
+
estimateCost(params: UsageEstimateCostParams, options?: RequestOptions): APIPromise<UsageEstimateCostResponse>;
|
|
8
14
|
/**
|
|
9
15
|
* Retrieves historical usage data for a customer's metered feature over time.
|
|
10
16
|
*/
|
|
@@ -15,6 +21,74 @@ export declare class Usage extends APIResource {
|
|
|
15
21
|
*/
|
|
16
22
|
report(params: UsageReportParams, options?: RequestOptions): APIPromise<UsageReportResponse>;
|
|
17
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Response object
|
|
26
|
+
*/
|
|
27
|
+
export interface UsageEstimateCostResponse {
|
|
28
|
+
/**
|
|
29
|
+
* Estimated credit cost, current balance and balance after
|
|
30
|
+
*/
|
|
31
|
+
data: UsageEstimateCostResponse.Data;
|
|
32
|
+
}
|
|
33
|
+
export declare namespace UsageEstimateCostResponse {
|
|
34
|
+
/**
|
|
35
|
+
* Estimated credit cost, current balance and balance after
|
|
36
|
+
*/
|
|
37
|
+
interface Data {
|
|
38
|
+
/**
|
|
39
|
+
* Per-currency cost estimates
|
|
40
|
+
*/
|
|
41
|
+
estimates: Array<Data.Estimate>;
|
|
42
|
+
/**
|
|
43
|
+
* Request-level warnings about the estimation context
|
|
44
|
+
*/
|
|
45
|
+
warnings: Array<'RESOURCE_SCOPED_SUBSCRIPTION_EXISTS' | 'FEATURE_NOT_FOUND' | 'FEATURE_NOT_CREDIT_BASED'>;
|
|
46
|
+
}
|
|
47
|
+
namespace Data {
|
|
48
|
+
interface Estimate {
|
|
49
|
+
/**
|
|
50
|
+
* The credit balance after subtracting the estimated cost
|
|
51
|
+
*/
|
|
52
|
+
balanceAfterEstimate: number;
|
|
53
|
+
/**
|
|
54
|
+
* Estimated cost contribution per feature
|
|
55
|
+
*/
|
|
56
|
+
breakdown: Array<Estimate.Breakdown>;
|
|
57
|
+
/**
|
|
58
|
+
* The credit currency identifier
|
|
59
|
+
*/
|
|
60
|
+
currencyId: string;
|
|
61
|
+
/**
|
|
62
|
+
* The current credit balance, including not-yet-reconciled consumption
|
|
63
|
+
*/
|
|
64
|
+
currentBalance: number;
|
|
65
|
+
/**
|
|
66
|
+
* The estimated credit cost of the reported event or usage
|
|
67
|
+
*/
|
|
68
|
+
estimatedCost: number;
|
|
69
|
+
/**
|
|
70
|
+
* Whether the estimated consumption would bring the balance below zero
|
|
71
|
+
*/
|
|
72
|
+
wouldOverdraft: boolean;
|
|
73
|
+
}
|
|
74
|
+
namespace Estimate {
|
|
75
|
+
interface Breakdown {
|
|
76
|
+
/**
|
|
77
|
+
* The estimated credit cost contributed by this feature
|
|
78
|
+
*/
|
|
79
|
+
cost: number;
|
|
80
|
+
/**
|
|
81
|
+
* The feature whose meter contributed this cost
|
|
82
|
+
*/
|
|
83
|
+
featureId: string;
|
|
84
|
+
/**
|
|
85
|
+
* Warning explaining why this cost may be inaccurate, if any
|
|
86
|
+
*/
|
|
87
|
+
warningCode: 'UNSUPPORTED_AGGREGATION' | null;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
18
92
|
/**
|
|
19
93
|
* Response object
|
|
20
94
|
*/
|
|
@@ -170,12 +244,22 @@ export declare namespace UsageReportResponse {
|
|
|
170
244
|
* Optimistic credit balance for a credit-backed feature
|
|
171
245
|
*/
|
|
172
246
|
interface Credit {
|
|
247
|
+
/**
|
|
248
|
+
* The credits this single reportUsage call deducted, in credit units — scoped to
|
|
249
|
+
* this one measurement (0 for idempotency duplicates). Contrast `currentUsage`,
|
|
250
|
+
* which is the wallet-wide running total shared across all features on this
|
|
251
|
+
* currency. Use it to reconcile expected per-call deductions.
|
|
252
|
+
*/
|
|
253
|
+
consumed: number;
|
|
173
254
|
/**
|
|
174
255
|
* The credit currency identifier
|
|
175
256
|
*/
|
|
176
257
|
currencyId: string;
|
|
177
258
|
/**
|
|
178
|
-
* The
|
|
259
|
+
* The wallet's total consumed credits for this currency (optimistic — includes
|
|
260
|
+
* not-yet-reconciled usage), shared across every feature that draws on the
|
|
261
|
+
* currency. This is the running balance, not this call's deduction — see
|
|
262
|
+
* `consumed` for that.
|
|
179
263
|
*/
|
|
180
264
|
currentUsage: number;
|
|
181
265
|
/**
|
|
@@ -195,6 +279,45 @@ export declare namespace UsageReportResponse {
|
|
|
195
279
|
}
|
|
196
280
|
}
|
|
197
281
|
}
|
|
282
|
+
export interface UsageEstimateCostParams {
|
|
283
|
+
/**
|
|
284
|
+
* Body param: Customer id
|
|
285
|
+
*/
|
|
286
|
+
customerId: string;
|
|
287
|
+
/**
|
|
288
|
+
* Body param: Feature id
|
|
289
|
+
*/
|
|
290
|
+
featureId: string;
|
|
291
|
+
/**
|
|
292
|
+
* Body param: The value to report for usage
|
|
293
|
+
*/
|
|
294
|
+
value: number;
|
|
295
|
+
/**
|
|
296
|
+
* Body param: Additional dimensions for the usage report
|
|
297
|
+
*/
|
|
298
|
+
dimensions?: {
|
|
299
|
+
[key: string]: string | number | boolean;
|
|
300
|
+
};
|
|
301
|
+
/**
|
|
302
|
+
* Body param: Resource id
|
|
303
|
+
*/
|
|
304
|
+
resourceId?: string | null;
|
|
305
|
+
/**
|
|
306
|
+
* Body param: The method by which the usage value should be updated
|
|
307
|
+
*/
|
|
308
|
+
updateBehavior?: 'DELTA' | 'SET';
|
|
309
|
+
/**
|
|
310
|
+
* Header param: Account ID — optional when authenticating with a user JWT (Bearer
|
|
311
|
+
* token); falls back to the user's first membership. Ignored for API-key auth.
|
|
312
|
+
*/
|
|
313
|
+
'X-ACCOUNT-ID'?: string;
|
|
314
|
+
/**
|
|
315
|
+
* Header param: Environment ID — required when authenticating with a user JWT
|
|
316
|
+
* (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is
|
|
317
|
+
* intrinsic to the key).
|
|
318
|
+
*/
|
|
319
|
+
'X-ENVIRONMENT-ID'?: string;
|
|
320
|
+
}
|
|
198
321
|
export interface UsageHistoryParams {
|
|
199
322
|
/**
|
|
200
323
|
* Path param: Customer id
|
|
@@ -287,6 +410,6 @@ export declare namespace UsageReportParams {
|
|
|
287
410
|
}
|
|
288
411
|
}
|
|
289
412
|
export declare namespace Usage {
|
|
290
|
-
export { type UsageHistoryResponse as UsageHistoryResponse, type UsageReportResponse as UsageReportResponse, type UsageHistoryParams as UsageHistoryParams, type UsageReportParams as UsageReportParams, };
|
|
413
|
+
export { type UsageEstimateCostResponse as UsageEstimateCostResponse, type UsageHistoryResponse as UsageHistoryResponse, type UsageReportResponse as UsageReportResponse, type UsageEstimateCostParams as UsageEstimateCostParams, type UsageHistoryParams as UsageHistoryParams, type UsageReportParams as UsageReportParams, };
|
|
291
414
|
}
|
|
292
415
|
//# sourceMappingURL=usage.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage.d.mts","sourceRoot":"","sources":["../../src/resources/v1/usage.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAA4B;AAClD,OAAO,EAAE,UAAU,EAAE,mCAA+B;AAEpD,OAAO,EAAE,cAAc,EAAE,2CAAuC;AAGhE;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC;;OAEG;IACH,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,kBAAkB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,UAAU,CAAC,oBAAoB,CAAC;IAenC;;;OAGG;IACH,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAc7F;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC;CACjC;AAED,yBAAiB,oBAAoB,CAAC;IACpC;;OAEG;IACH,UAAiB,IAAI;QACnB;;WAEG;QACH,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAE5B;;WAEG;QACH,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KAC5B;IAED,UAAiB,IAAI,CAAC;QACpB;;WAEG;QACH,UAAiB,MAAM;YACrB;;eAEG;YACH,SAAS,EAA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