@metronome/sdk 0.1.0-alpha.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 +24 -0
- package/LICENSE +201 -0
- package/README.md +313 -0
- package/_shims/MultipartBody.d.ts +9 -0
- package/_shims/MultipartBody.d.ts.map +1 -0
- package/_shims/MultipartBody.js +16 -0
- package/_shims/MultipartBody.js.map +1 -0
- package/_shims/MultipartBody.mjs +12 -0
- package/_shims/MultipartBody.mjs.map +1 -0
- package/_shims/README.md +46 -0
- package/_shims/auto/runtime-bun.d.ts +5 -0
- package/_shims/auto/runtime-bun.d.ts.map +1 -0
- package/_shims/auto/runtime-bun.js +21 -0
- package/_shims/auto/runtime-bun.js.map +1 -0
- package/_shims/auto/runtime-bun.mjs +2 -0
- package/_shims/auto/runtime-bun.mjs.map +1 -0
- package/_shims/auto/runtime-node.d.ts +5 -0
- package/_shims/auto/runtime-node.d.ts.map +1 -0
- package/_shims/auto/runtime-node.js +21 -0
- package/_shims/auto/runtime-node.js.map +1 -0
- package/_shims/auto/runtime-node.mjs +2 -0
- package/_shims/auto/runtime-node.mjs.map +1 -0
- package/_shims/auto/runtime.d.ts +5 -0
- package/_shims/auto/runtime.d.ts.map +1 -0
- package/_shims/auto/runtime.js +21 -0
- package/_shims/auto/runtime.js.map +1 -0
- package/_shims/auto/runtime.mjs +2 -0
- package/_shims/auto/runtime.mjs.map +1 -0
- package/_shims/auto/types-node.d.ts +5 -0
- package/_shims/auto/types-node.d.ts.map +1 -0
- package/_shims/auto/types-node.js +21 -0
- package/_shims/auto/types-node.js.map +1 -0
- package/_shims/auto/types-node.mjs +2 -0
- package/_shims/auto/types-node.mjs.map +1 -0
- package/_shims/auto/types.d.ts +101 -0
- package/_shims/auto/types.js +3 -0
- package/_shims/auto/types.mjs +3 -0
- package/_shims/bun-runtime.d.ts +6 -0
- package/_shims/bun-runtime.d.ts.map +1 -0
- package/_shims/bun-runtime.js +14 -0
- package/_shims/bun-runtime.js.map +1 -0
- package/_shims/bun-runtime.mjs +10 -0
- package/_shims/bun-runtime.mjs.map +1 -0
- package/_shims/index.d.ts +81 -0
- package/_shims/index.js +13 -0
- package/_shims/index.mjs +7 -0
- package/_shims/manual-types.d.ts +12 -0
- package/_shims/manual-types.js +3 -0
- package/_shims/manual-types.mjs +3 -0
- package/_shims/node-runtime.d.ts +3 -0
- package/_shims/node-runtime.d.ts.map +1 -0
- package/_shims/node-runtime.js +90 -0
- package/_shims/node-runtime.js.map +1 -0
- package/_shims/node-runtime.mjs +56 -0
- package/_shims/node-runtime.mjs.map +1 -0
- package/_shims/node-types.d.ts +42 -0
- package/_shims/node-types.js +3 -0
- package/_shims/node-types.mjs +3 -0
- package/_shims/registry.d.ts +37 -0
- package/_shims/registry.d.ts.map +1 -0
- package/_shims/registry.js +41 -0
- package/_shims/registry.js.map +1 -0
- package/_shims/registry.mjs +37 -0
- package/_shims/registry.mjs.map +1 -0
- package/_shims/web-runtime.d.ts +5 -0
- package/_shims/web-runtime.d.ts.map +1 -0
- package/_shims/web-runtime.js +78 -0
- package/_shims/web-runtime.js.map +1 -0
- package/_shims/web-runtime.mjs +71 -0
- package/_shims/web-runtime.mjs.map +1 -0
- package/_shims/web-types.d.ts +83 -0
- package/_shims/web-types.js +3 -0
- package/_shims/web-types.mjs +3 -0
- package/core.d.ts +237 -0
- package/core.d.ts.map +1 -0
- package/core.js +868 -0
- package/core.js.map +1 -0
- package/core.mjs +837 -0
- package/core.mjs.map +1 -0
- package/error.d.ts +53 -0
- package/error.d.ts.map +1 -0
- package/error.js +143 -0
- package/error.js.map +1 -0
- package/error.mjs +127 -0
- package/error.mjs.map +1 -0
- package/index.d.mts +210 -0
- package/index.d.ts +210 -0
- package/index.d.ts.map +1 -0
- package/index.js +133 -0
- package/index.js.map +1 -0
- package/index.mjs +105 -0
- package/index.mjs.map +1 -0
- package/package.json +106 -0
- package/resource.d.ts +6 -0
- package/resource.d.ts.map +1 -0
- package/resource.js +11 -0
- package/resource.js.map +1 -0
- package/resource.mjs +7 -0
- package/resource.mjs.map +1 -0
- package/resources/alerts.d.ts +103 -0
- package/resources/alerts.d.ts.map +1 -0
- package/resources/alerts.js +23 -0
- package/resources/alerts.js.map +1 -0
- package/resources/alerts.mjs +19 -0
- package/resources/alerts.mjs.map +1 -0
- package/resources/audit-logs.d.ts +83 -0
- package/resources/audit-logs.d.ts.map +1 -0
- package/resources/audit-logs.js +18 -0
- package/resources/audit-logs.js.map +1 -0
- package/resources/audit-logs.mjs +14 -0
- package/resources/audit-logs.mjs.map +1 -0
- package/resources/billable-metrics.d.ts +236 -0
- package/resources/billable-metrics.d.ts.map +1 -0
- package/resources/billable-metrics.js +36 -0
- package/resources/billable-metrics.js.map +1 -0
- package/resources/billable-metrics.mjs +32 -0
- package/resources/billable-metrics.mjs.map +1 -0
- package/resources/credit-grants.d.ts +469 -0
- package/resources/credit-grants.d.ts.map +1 -0
- package/resources/credit-grants.js +50 -0
- package/resources/credit-grants.js.map +1 -0
- package/resources/credit-grants.mjs +46 -0
- package/resources/credit-grants.mjs.map +1 -0
- package/resources/custom-fields.d.ts +82 -0
- package/resources/custom-fields.d.ts.map +1 -0
- package/resources/custom-fields.js +66 -0
- package/resources/custom-fields.js.map +1 -0
- package/resources/custom-fields.mjs +62 -0
- package/resources/custom-fields.mjs.map +1 -0
- package/resources/customers/alerts.d.ts +146 -0
- package/resources/customers/alerts.d.ts.map +1 -0
- package/resources/customers/alerts.js +35 -0
- package/resources/customers/alerts.js.map +1 -0
- package/resources/customers/alerts.mjs +31 -0
- package/resources/customers/alerts.mjs.map +1 -0
- package/resources/customers/billing-config.d.ts +64 -0
- package/resources/customers/billing-config.d.ts.map +1 -0
- package/resources/customers/billing-config.js +37 -0
- package/resources/customers/billing-config.js.map +1 -0
- package/resources/customers/billing-config.mjs +33 -0
- package/resources/customers/billing-config.mjs.map +1 -0
- package/resources/customers/customers.d.ts +313 -0
- package/resources/customers/customers.d.ts.map +1 -0
- package/resources/customers/customers.js +116 -0
- package/resources/customers/customers.js.map +1 -0
- package/resources/customers/customers.mjs +89 -0
- package/resources/customers/customers.mjs.map +1 -0
- package/resources/customers/index.d.ts +6 -0
- package/resources/customers/index.d.ts.map +1 -0
- package/resources/customers/index.js +15 -0
- package/resources/customers/index.js.map +1 -0
- package/resources/customers/index.mjs +7 -0
- package/resources/customers/index.mjs.map +1 -0
- package/resources/customers/invoices.d.ts +331 -0
- package/resources/customers/invoices.d.ts.map +1 -0
- package/resources/customers/invoices.js +30 -0
- package/resources/customers/invoices.js.map +1 -0
- package/resources/customers/invoices.mjs +26 -0
- package/resources/customers/invoices.mjs.map +1 -0
- package/resources/customers/plans.d.ts +239 -0
- package/resources/customers/plans.d.ts.map +1 -0
- package/resources/customers/plans.js +41 -0
- package/resources/customers/plans.js.map +1 -0
- package/resources/customers/plans.mjs +37 -0
- package/resources/customers/plans.mjs.map +1 -0
- package/resources/dashboards.d.ts +61 -0
- package/resources/dashboards.d.ts.map +1 -0
- package/resources/dashboards.js +19 -0
- package/resources/dashboards.js.map +1 -0
- package/resources/dashboards.mjs +15 -0
- package/resources/dashboards.mjs.map +1 -0
- package/resources/index.d.ts +13 -0
- package/resources/index.d.ts.map +1 -0
- package/resources/index.js +42 -0
- package/resources/index.js.map +1 -0
- package/resources/index.mjs +14 -0
- package/resources/index.mjs.map +1 -0
- package/resources/plans.d.ts +217 -0
- package/resources/plans.d.ts.map +1 -0
- package/resources/plans.js +36 -0
- package/resources/plans.js.map +1 -0
- package/resources/plans.mjs +32 -0
- package/resources/plans.mjs.map +1 -0
- package/resources/services.d.ts +26 -0
- package/resources/services.d.ts.map +1 -0
- package/resources/services.js +20 -0
- package/resources/services.js.map +1 -0
- package/resources/services.mjs +16 -0
- package/resources/services.mjs.map +1 -0
- package/resources/shared.d.ts +540 -0
- package/resources/shared.d.ts.map +1 -0
- package/resources/shared.js +4 -0
- package/resources/shared.js.map +1 -0
- package/resources/shared.mjs +3 -0
- package/resources/shared.mjs.map +1 -0
- package/resources/usage.d.ts +182 -0
- package/resources/usage.d.ts.map +1 -0
- package/resources/usage.js +41 -0
- package/resources/usage.js.map +1 -0
- package/resources/usage.mjs +37 -0
- package/resources/usage.mjs.map +1 -0
- package/resources/webhooks.d.ts +22 -0
- package/resources/webhooks.d.ts.map +1 -0
- package/resources/webhooks.js +91 -0
- package/resources/webhooks.js.map +1 -0
- package/resources/webhooks.mjs +87 -0
- package/resources/webhooks.mjs.map +1 -0
- package/shims/node.d.ts +29 -0
- package/shims/node.d.ts.map +1 -0
- package/shims/node.js +31 -0
- package/shims/node.js.map +1 -0
- package/shims/node.mjs +5 -0
- package/shims/node.mjs.map +1 -0
- package/shims/web.d.ts +26 -0
- package/shims/web.d.ts.map +1 -0
- package/shims/web.js +31 -0
- package/shims/web.js.map +1 -0
- package/shims/web.mjs +5 -0
- package/shims/web.mjs.map +1 -0
- package/src/_shims/MultipartBody.ts +9 -0
- package/src/_shims/README.md +46 -0
- package/src/_shims/auto/runtime-bun.ts +4 -0
- package/src/_shims/auto/runtime-node.ts +4 -0
- package/src/_shims/auto/runtime.ts +4 -0
- package/src/_shims/auto/types-node.ts +4 -0
- package/src/_shims/auto/types.d.ts +101 -0
- package/src/_shims/auto/types.js +3 -0
- package/src/_shims/auto/types.mjs +3 -0
- package/src/_shims/bun-runtime.ts +14 -0
- package/src/_shims/index.d.ts +81 -0
- package/src/_shims/index.js +13 -0
- package/src/_shims/index.mjs +7 -0
- package/src/_shims/manual-types.d.ts +12 -0
- package/src/_shims/manual-types.js +3 -0
- package/src/_shims/manual-types.mjs +3 -0
- package/src/_shims/node-runtime.ts +83 -0
- package/src/_shims/node-types.d.ts +42 -0
- package/src/_shims/node-types.js +3 -0
- package/src/_shims/node-types.mjs +3 -0
- package/src/_shims/registry.ts +67 -0
- package/src/_shims/web-runtime.ts +103 -0
- package/src/_shims/web-types.d.ts +83 -0
- package/src/_shims/web-types.js +3 -0
- package/src/_shims/web-types.mjs +3 -0
- package/src/core.ts +1146 -0
- package/src/error.ts +146 -0
- package/src/index.ts +303 -0
- package/src/lib/.keep +4 -0
- package/src/resource.ts +11 -0
- package/src/resources/alerts.ts +144 -0
- package/src/resources/audit-logs.ts +116 -0
- package/src/resources/billable-metrics.ts +341 -0
- package/src/resources/credit-grants.ts +627 -0
- package/src/resources/custom-fields.ts +242 -0
- package/src/resources/customers/alerts.ts +214 -0
- package/src/resources/customers/billing-config.ts +183 -0
- package/src/resources/customers/customers.ts +500 -0
- package/src/resources/customers/index.ts +53 -0
- package/src/resources/customers/invoices.ts +533 -0
- package/src/resources/customers/plans.ts +363 -0
- package/src/resources/dashboards.ts +98 -0
- package/src/resources/index.ts +90 -0
- package/src/resources/plans.ts +333 -0
- package/src/resources/services.ts +35 -0
- package/src/resources/shared.ts +849 -0
- package/src/resources/usage.ts +245 -0
- package/src/resources/webhooks.ts +120 -0
- package/src/shims/node.ts +50 -0
- package/src/shims/web.ts +50 -0
- package/src/tsconfig.json +11 -0
- package/src/uploads.ts +248 -0
- package/src/version.ts +1 -0
- package/uploads.d.ts +75 -0
- package/uploads.d.ts.map +1 -0
- package/uploads.js +165 -0
- package/uploads.js.map +1 -0
- package/uploads.mjs +152 -0
- package/uploads.mjs.map +1 -0
- package/version.d.ts +2 -0
- package/version.d.ts.map +1 -0
- package/version.js +5 -0
- package/version.js.map +1 -0
- package/version.mjs +2 -0
- package/version.mjs.map +1 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import * as Core from "../core";
|
|
4
|
+
import { APIResource } from "../resource";
|
|
5
|
+
import { isRequestOptions } from "../core";
|
|
6
|
+
import * as AuditLogsAPI from "./audit-logs";
|
|
7
|
+
|
|
8
|
+
export class AuditLogs extends APIResource {
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves a range of audit logs. If no further audit logs are currently
|
|
11
|
+
* available, the data array will be empty. As new audit logs are created,
|
|
12
|
+
* subsequent requests using the same next_page value will be in the returned data
|
|
13
|
+
* array, ensuring a continuous and uninterrupted reading of audit logs.
|
|
14
|
+
*/
|
|
15
|
+
list(query?: AuditLogListParams, options?: Core.RequestOptions): Core.APIPromise<AuditLogListResponse>;
|
|
16
|
+
list(options?: Core.RequestOptions): Core.APIPromise<AuditLogListResponse>;
|
|
17
|
+
list(
|
|
18
|
+
query: AuditLogListParams | Core.RequestOptions = {},
|
|
19
|
+
options?: Core.RequestOptions,
|
|
20
|
+
): Core.APIPromise<AuditLogListResponse> {
|
|
21
|
+
if (isRequestOptions(query)) {
|
|
22
|
+
return this.list({}, query);
|
|
23
|
+
}
|
|
24
|
+
return this._client.get('/auditLogs', { query, ...options });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface AuditLogListResponse {
|
|
29
|
+
data: Array<AuditLogListResponse.Data>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The next_page parameter is always returned to support ongoing log retrieval. It
|
|
33
|
+
* enables continuous querying, even when some requests return no new data. Save
|
|
34
|
+
* the next_page token from each response and use it for future requests to ensure
|
|
35
|
+
* no logs are missed. This setup is ideal for regular updates via automated
|
|
36
|
+
* processes, like cron jobs, to fetch logs continuously as they become available.
|
|
37
|
+
* When you receive an empty data array, it indicates a temporary absence of new
|
|
38
|
+
* logs, but subsequent requests might return new data.
|
|
39
|
+
*/
|
|
40
|
+
next_page: string | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export namespace AuditLogListResponse {
|
|
44
|
+
export interface Data {
|
|
45
|
+
id: string;
|
|
46
|
+
|
|
47
|
+
timestamp: string;
|
|
48
|
+
|
|
49
|
+
action?: string;
|
|
50
|
+
|
|
51
|
+
actor?: Data.Actor;
|
|
52
|
+
|
|
53
|
+
description?: string;
|
|
54
|
+
|
|
55
|
+
resource_id?: string;
|
|
56
|
+
|
|
57
|
+
resource_type?: string;
|
|
58
|
+
|
|
59
|
+
status?: 'success' | 'failure' | 'pending';
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export namespace Data {
|
|
63
|
+
export interface Actor {
|
|
64
|
+
id: string;
|
|
65
|
+
|
|
66
|
+
name: string;
|
|
67
|
+
|
|
68
|
+
email?: string;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface AuditLogListParams {
|
|
74
|
+
/**
|
|
75
|
+
* RFC 3339 timestamp (exclusive). Cannot be used with 'next_page'.
|
|
76
|
+
*/
|
|
77
|
+
ending_before?: string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Max number of results that should be returned
|
|
81
|
+
*/
|
|
82
|
+
limit?: number;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Cursor that indicates where the next page of results should start.
|
|
86
|
+
*/
|
|
87
|
+
next_page?: string;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Optional parameter that can be used to filter which audit logs are returned. If
|
|
91
|
+
* you specify resource_id, you must also specify resource_type.
|
|
92
|
+
*/
|
|
93
|
+
resource_id?: string;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Optional parameter that can be used to filter which audit logs are returned. If
|
|
97
|
+
* you specify resource_type, you must also specify resource_id.
|
|
98
|
+
*/
|
|
99
|
+
resource_type?: string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Sort order by timestamp, e.g. date_asc or date_desc. Defaults to date_asc.
|
|
103
|
+
*/
|
|
104
|
+
sort?: 'date_asc' | 'date_desc';
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* RFC 3339 timestamp of the earliest audit log to return. Cannot be used with
|
|
108
|
+
* 'next_page'.
|
|
109
|
+
*/
|
|
110
|
+
starting_on?: string;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export namespace AuditLogs {
|
|
114
|
+
export import AuditLogListResponse = AuditLogsAPI.AuditLogListResponse;
|
|
115
|
+
export import AuditLogListParams = AuditLogsAPI.AuditLogListParams;
|
|
116
|
+
}
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import * as Core from "../core";
|
|
4
|
+
import { APIResource } from "../resource";
|
|
5
|
+
import { isRequestOptions } from "../core";
|
|
6
|
+
import * as BillableMetricsAPI from "./billable-metrics";
|
|
7
|
+
import * as Shared from "./shared";
|
|
8
|
+
|
|
9
|
+
export class BillableMetrics extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new Billable Metric.
|
|
12
|
+
*/
|
|
13
|
+
create(
|
|
14
|
+
body: BillableMetricCreateParams,
|
|
15
|
+
options?: Core.RequestOptions,
|
|
16
|
+
): Core.APIPromise<BillableMetricCreateResponse> {
|
|
17
|
+
return this._client.post('/billable-metrics/create', { body, ...options });
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Get a billable metric
|
|
22
|
+
*/
|
|
23
|
+
retrieve(
|
|
24
|
+
billableMetricId: string,
|
|
25
|
+
options?: Core.RequestOptions,
|
|
26
|
+
): Core.APIPromise<BillableMetricRetrieveResponse> {
|
|
27
|
+
return this._client.get(`/billable-metrics/${billableMetricId}`, options);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* List all billable metrics.
|
|
32
|
+
*/
|
|
33
|
+
list(
|
|
34
|
+
customerId: string,
|
|
35
|
+
query?: BillableMetricListParams,
|
|
36
|
+
options?: Core.RequestOptions,
|
|
37
|
+
): Core.APIPromise<BillableMetricListResponse>;
|
|
38
|
+
list(customerId: string, options?: Core.RequestOptions): Core.APIPromise<BillableMetricListResponse>;
|
|
39
|
+
list(
|
|
40
|
+
customerId: string,
|
|
41
|
+
query: BillableMetricListParams | Core.RequestOptions = {},
|
|
42
|
+
options?: Core.RequestOptions,
|
|
43
|
+
): Core.APIPromise<BillableMetricListResponse> {
|
|
44
|
+
if (isRequestOptions(query)) {
|
|
45
|
+
return this.list(customerId, {}, query);
|
|
46
|
+
}
|
|
47
|
+
return this._client.get(`/customers/${customerId}/billable-metrics`, { query, ...options });
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Archive an existing billable metric
|
|
52
|
+
*/
|
|
53
|
+
archive(
|
|
54
|
+
body: BillableMetricArchiveParams,
|
|
55
|
+
options?: Core.RequestOptions,
|
|
56
|
+
): Core.APIPromise<BillableMetricArchiveResponse> {
|
|
57
|
+
return this._client.post('/billable-metrics/archive', { body, ...options });
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface BillableMetricCreateResponse {
|
|
62
|
+
data: Shared.ID;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface BillableMetricRetrieveResponse {
|
|
66
|
+
data: BillableMetricRetrieveResponse.Data;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export namespace BillableMetricRetrieveResponse {
|
|
70
|
+
export interface Data {
|
|
71
|
+
/**
|
|
72
|
+
* ID of the billable metric
|
|
73
|
+
*/
|
|
74
|
+
id: string;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Specifies the type of aggregation performed on matching events.
|
|
78
|
+
*/
|
|
79
|
+
aggregation_type:
|
|
80
|
+
| 'count'
|
|
81
|
+
| 'Count'
|
|
82
|
+
| 'COUNT'
|
|
83
|
+
| 'latest'
|
|
84
|
+
| 'Latest'
|
|
85
|
+
| 'LATEST'
|
|
86
|
+
| 'max'
|
|
87
|
+
| 'Max'
|
|
88
|
+
| 'MAX'
|
|
89
|
+
| 'sum'
|
|
90
|
+
| 'Sum'
|
|
91
|
+
| 'SUM'
|
|
92
|
+
| 'unique'
|
|
93
|
+
| 'Unique'
|
|
94
|
+
| 'UNIQUE';
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* The display name of the billable metric.
|
|
98
|
+
*/
|
|
99
|
+
name: string;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* A key that specifies which property of the event is used to aggregate data. This
|
|
103
|
+
* key must be one of the property filter names and is not applicable when the
|
|
104
|
+
* aggregation type is 'count'.
|
|
105
|
+
*/
|
|
106
|
+
aggregation_key?: string;
|
|
107
|
+
|
|
108
|
+
custom_fields?: Record<string, string>;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
112
|
+
*/
|
|
113
|
+
event_type_filter?: Data.EventTypeFilter;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Property names that are used to group usage costs on an invoice. Each entry
|
|
117
|
+
* represents a set of properties used to slice events into distinct buckets.
|
|
118
|
+
*/
|
|
119
|
+
group_keys?: Array<Array<string>>;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* A list of filters to match events to this billable metric. Each filter defines a
|
|
123
|
+
* rule on an event property. All rules must pass for the event to match the
|
|
124
|
+
* billable metric.
|
|
125
|
+
*/
|
|
126
|
+
property_filters?: Array<Data.PropertyFilter>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export namespace Data {
|
|
130
|
+
/**
|
|
131
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
132
|
+
*/
|
|
133
|
+
export interface EventTypeFilter {
|
|
134
|
+
/**
|
|
135
|
+
* A list of event types that are explicitly included in the billable metric. If
|
|
136
|
+
* specified, only events of these types will match the billable metric. Must be
|
|
137
|
+
* non-empty if present.
|
|
138
|
+
*/
|
|
139
|
+
in_values?: Array<string>;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* A list of event types that are explicitly excluded from the billable metric. If
|
|
143
|
+
* specified, events of these types will not match the billable metric. Must be
|
|
144
|
+
* non-empty if present.
|
|
145
|
+
*/
|
|
146
|
+
not_in_values?: Array<string>;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface PropertyFilter {
|
|
150
|
+
/**
|
|
151
|
+
* The name of the event property.
|
|
152
|
+
*/
|
|
153
|
+
name: string;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Determines whether the property must exist in the event. If true, only events
|
|
157
|
+
* with this property will pass the filter. If false, only events without this
|
|
158
|
+
* property will pass the filter. If null or omitted, the existence of the property
|
|
159
|
+
* is optional.
|
|
160
|
+
*/
|
|
161
|
+
exists?: boolean;
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Specifies the allowed values for the property to match an event. An event will
|
|
165
|
+
* pass the filter only if its property value is included in this list. If
|
|
166
|
+
* undefined, all property values will pass the filter. Must be non-empty if
|
|
167
|
+
* present.
|
|
168
|
+
*/
|
|
169
|
+
in_values?: Array<string>;
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Specifies the values that prevent an event from matching the filter. An event
|
|
173
|
+
* will not pass the filter if its property value is included in this list. If null
|
|
174
|
+
* or empty, all property values will pass the filter. Must be non-empty if
|
|
175
|
+
* present.
|
|
176
|
+
*/
|
|
177
|
+
not_in_values?: Array<string>;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface BillableMetricListResponse {
|
|
183
|
+
data: Array<BillableMetricListResponse.Data>;
|
|
184
|
+
|
|
185
|
+
next_page: string | null;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export namespace BillableMetricListResponse {
|
|
189
|
+
export interface Data {
|
|
190
|
+
id: string;
|
|
191
|
+
|
|
192
|
+
name: string;
|
|
193
|
+
|
|
194
|
+
group_by?: Array<string>;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export interface BillableMetricArchiveResponse {
|
|
199
|
+
data: Shared.ID;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
export interface BillableMetricCreateParams {
|
|
203
|
+
/**
|
|
204
|
+
* Specifies the type of aggregation performed on matching events.
|
|
205
|
+
*/
|
|
206
|
+
aggregation_type:
|
|
207
|
+
| 'count'
|
|
208
|
+
| 'Count'
|
|
209
|
+
| 'COUNT'
|
|
210
|
+
| 'latest'
|
|
211
|
+
| 'Latest'
|
|
212
|
+
| 'LATEST'
|
|
213
|
+
| 'max'
|
|
214
|
+
| 'Max'
|
|
215
|
+
| 'MAX'
|
|
216
|
+
| 'sum'
|
|
217
|
+
| 'Sum'
|
|
218
|
+
| 'SUM'
|
|
219
|
+
| 'unique'
|
|
220
|
+
| 'Unique'
|
|
221
|
+
| 'UNIQUE';
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* The display name of the billable metric.
|
|
225
|
+
*/
|
|
226
|
+
name: string;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* A key that specifies which property of the event is used to aggregate data. This
|
|
230
|
+
* key must be one of the property filter names and is not applicable when the
|
|
231
|
+
* aggregation type is 'count'.
|
|
232
|
+
*/
|
|
233
|
+
aggregation_key?: string;
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Custom fields to attach to the billable metric.
|
|
237
|
+
*/
|
|
238
|
+
custom_fields?: Record<string, string>;
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
242
|
+
*/
|
|
243
|
+
event_type_filter?: BillableMetricCreateParams.EventTypeFilter;
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Property names that are used to group usage costs on an invoice. Each entry
|
|
247
|
+
* represents a set of properties used to slice events into distinct buckets.
|
|
248
|
+
*/
|
|
249
|
+
group_keys?: Array<Array<string>>;
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* A list of filters to match events to this billable metric. Each filter defines a
|
|
253
|
+
* rule on an event property. All rules must pass for the event to match the
|
|
254
|
+
* billable metric.
|
|
255
|
+
*/
|
|
256
|
+
property_filters?: Array<BillableMetricCreateParams.PropertyFilter>;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export namespace BillableMetricCreateParams {
|
|
260
|
+
/**
|
|
261
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
262
|
+
*/
|
|
263
|
+
export interface EventTypeFilter {
|
|
264
|
+
/**
|
|
265
|
+
* A list of event types that are explicitly included in the billable metric. If
|
|
266
|
+
* specified, only events of these types will match the billable metric. Must be
|
|
267
|
+
* non-empty if present.
|
|
268
|
+
*/
|
|
269
|
+
in_values?: Array<string>;
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* A list of event types that are explicitly excluded from the billable metric. If
|
|
273
|
+
* specified, events of these types will not match the billable metric. Must be
|
|
274
|
+
* non-empty if present.
|
|
275
|
+
*/
|
|
276
|
+
not_in_values?: Array<string>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface PropertyFilter {
|
|
280
|
+
/**
|
|
281
|
+
* The name of the event property.
|
|
282
|
+
*/
|
|
283
|
+
name: string;
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Determines whether the property must exist in the event. If true, only events
|
|
287
|
+
* with this property will pass the filter. If false, only events without this
|
|
288
|
+
* property will pass the filter. If null or omitted, the existence of the property
|
|
289
|
+
* is optional.
|
|
290
|
+
*/
|
|
291
|
+
exists?: boolean;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Specifies the allowed values for the property to match an event. An event will
|
|
295
|
+
* pass the filter only if its property value is included in this list. If
|
|
296
|
+
* undefined, all property values will pass the filter. Must be non-empty if
|
|
297
|
+
* present.
|
|
298
|
+
*/
|
|
299
|
+
in_values?: Array<string>;
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Specifies the values that prevent an event from matching the filter. An event
|
|
303
|
+
* will not pass the filter if its property value is included in this list. If null
|
|
304
|
+
* or empty, all property values will pass the filter. Must be non-empty if
|
|
305
|
+
* present.
|
|
306
|
+
*/
|
|
307
|
+
not_in_values?: Array<string>;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
export interface BillableMetricListParams {
|
|
312
|
+
/**
|
|
313
|
+
* Max number of results that should be returned
|
|
314
|
+
*/
|
|
315
|
+
limit?: number;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Cursor that indicates where the next page of results should start.
|
|
319
|
+
*/
|
|
320
|
+
next_page?: string;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* If true, the list of metrics will be filtered to just ones that are on the
|
|
324
|
+
* customer's current plan
|
|
325
|
+
*/
|
|
326
|
+
on_current_plan?: boolean;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
export interface BillableMetricArchiveParams {
|
|
330
|
+
id: string;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
export namespace BillableMetrics {
|
|
334
|
+
export import BillableMetricCreateResponse = BillableMetricsAPI.BillableMetricCreateResponse;
|
|
335
|
+
export import BillableMetricRetrieveResponse = BillableMetricsAPI.BillableMetricRetrieveResponse;
|
|
336
|
+
export import BillableMetricListResponse = BillableMetricsAPI.BillableMetricListResponse;
|
|
337
|
+
export import BillableMetricArchiveResponse = BillableMetricsAPI.BillableMetricArchiveResponse;
|
|
338
|
+
export import BillableMetricCreateParams = BillableMetricsAPI.BillableMetricCreateParams;
|
|
339
|
+
export import BillableMetricListParams = BillableMetricsAPI.BillableMetricListParams;
|
|
340
|
+
export import BillableMetricArchiveParams = BillableMetricsAPI.BillableMetricArchiveParams;
|
|
341
|
+
}
|