@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,103 @@
|
|
|
1
|
+
import * as Core from '@metronome/sdk/core';
|
|
2
|
+
import { APIResource } from '@metronome/sdk/resource';
|
|
3
|
+
import * as AlertsAPI from '@metronome/sdk/resources/alerts';
|
|
4
|
+
import * as Shared from '@metronome/sdk/resources/shared';
|
|
5
|
+
export declare class Alerts extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Create a new alert
|
|
8
|
+
*/
|
|
9
|
+
create(body: AlertCreateParams, options?: Core.RequestOptions): Core.APIPromise<AlertCreateResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* Archive an existing alert
|
|
12
|
+
*/
|
|
13
|
+
archive(body: AlertArchiveParams, options?: Core.RequestOptions): Core.APIPromise<AlertArchiveResponse>;
|
|
14
|
+
}
|
|
15
|
+
export interface AlertCreateResponse {
|
|
16
|
+
data: Shared.ID;
|
|
17
|
+
}
|
|
18
|
+
export interface AlertArchiveResponse {
|
|
19
|
+
data: Shared.ID;
|
|
20
|
+
}
|
|
21
|
+
export interface AlertCreateParams {
|
|
22
|
+
/**
|
|
23
|
+
* Type of the alert
|
|
24
|
+
*/
|
|
25
|
+
alert_type: 'low_credit_balance_reached' | 'spend_threshold_reached' | 'monthly_invoice_total_spend_threshold_reached' | 'low_remaining_days_in_plan_reached' | 'low_remaining_credit_percentage_reached' | 'usage_threshold_reached' | 'low_remaining_days_for_commit_segment_reached' | 'low_remaining_commit_balance_reached' | 'low_remaining_commit_percentage_reached' | 'low_remaining_days_for_contract_credit_segment_reached' | 'low_remaining_contract_credit_balance_reached' | 'low_remaining_contract_credit_percentage_reached' | 'invoice_total_reached';
|
|
26
|
+
/**
|
|
27
|
+
* Name of the alert
|
|
28
|
+
*/
|
|
29
|
+
name: string;
|
|
30
|
+
/**
|
|
31
|
+
* Threshold value of the alert policy
|
|
32
|
+
*/
|
|
33
|
+
threshold: number;
|
|
34
|
+
/**
|
|
35
|
+
* For alerts of type `usage_threshold_reached`, specifies which billable metric to
|
|
36
|
+
* track the usage for.
|
|
37
|
+
*/
|
|
38
|
+
billable_metric_id?: string;
|
|
39
|
+
credit_type_id?: string;
|
|
40
|
+
/**
|
|
41
|
+
* Only present for beta contract invoices. This field's availability is dependent
|
|
42
|
+
* on your client's configuration. A list of custom field filters for alert types
|
|
43
|
+
* that support advanced filtering
|
|
44
|
+
*/
|
|
45
|
+
custom_field_filters?: Array<AlertCreateParams.CustomFieldFilter>;
|
|
46
|
+
/**
|
|
47
|
+
* If provided, will create this alert for this specific customer. To create an
|
|
48
|
+
* alert for all customers, do not specify `customer_id` or `plan_id`.
|
|
49
|
+
*/
|
|
50
|
+
customer_id?: string;
|
|
51
|
+
/**
|
|
52
|
+
* If true, the alert will evaluate immediately on customers that already meet the
|
|
53
|
+
* alert threshold. If false, it will only evaluate on future customers that
|
|
54
|
+
* trigger the alert threshold. Defaults to true.
|
|
55
|
+
*/
|
|
56
|
+
evaluate_on_create?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Scopes alert evaluation to a specific presentation group key on individual line
|
|
59
|
+
* items. Only present for spend alerts.
|
|
60
|
+
*/
|
|
61
|
+
group_key_filter?: AlertCreateParams.GroupKeyFilter;
|
|
62
|
+
/**
|
|
63
|
+
* Only supported for invoice_total_reached alerts. A list of invoice types to
|
|
64
|
+
* evaluate.
|
|
65
|
+
*/
|
|
66
|
+
invoice_types_filter?: Array<string>;
|
|
67
|
+
/**
|
|
68
|
+
* If provided, will create this alert for this specific plan. To create an alert
|
|
69
|
+
* for all customers, do not specify `customer_id` or `plan_id`.
|
|
70
|
+
*/
|
|
71
|
+
plan_id?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Prevents the creation of duplicates. If a request to create a record is made
|
|
74
|
+
* with a previously used uniqueness key, a new record will not be created and the
|
|
75
|
+
* request will fail with a 409 error.
|
|
76
|
+
*/
|
|
77
|
+
uniqueness_key?: string;
|
|
78
|
+
}
|
|
79
|
+
export declare namespace AlertCreateParams {
|
|
80
|
+
interface CustomFieldFilter {
|
|
81
|
+
entity: 'Contract' | 'Commit' | 'ContractCredit';
|
|
82
|
+
key: string;
|
|
83
|
+
value: string;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Scopes alert evaluation to a specific presentation group key on individual line
|
|
87
|
+
* items. Only present for spend alerts.
|
|
88
|
+
*/
|
|
89
|
+
interface GroupKeyFilter {
|
|
90
|
+
key: string;
|
|
91
|
+
value: string;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
export interface AlertArchiveParams {
|
|
95
|
+
id: string;
|
|
96
|
+
}
|
|
97
|
+
export declare namespace Alerts {
|
|
98
|
+
export import AlertCreateResponse = AlertsAPI.AlertCreateResponse;
|
|
99
|
+
export import AlertArchiveResponse = AlertsAPI.AlertArchiveResponse;
|
|
100
|
+
export import AlertCreateParams = AlertsAPI.AlertCreateParams;
|
|
101
|
+
export import AlertArchiveParams = AlertsAPI.AlertArchiveParams;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=alerts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerts.d.ts","sourceRoot":"","sources":["../src/resources/alerts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,SAAS,MAAM,iCAAiC,CAAC;AAC7D,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAE1D,qBAAa,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,MAAM,CAAC,IAAI,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC;IAIpG;;OAEG;IACH,OAAO,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC;CAGxG;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,UAAU,EACN,4BAA4B,GAC5B,yBAAyB,GACzB,+CAA+C,GAC/C,oCAAoC,GACpC,yCAAyC,GACzC,yBAAyB,GACzB,+CAA+C,GAC/C,sCAAsC,GACtC,yCAAyC,GACzC,wDAAwD,GACxD,+CAA+C,GAC/C,kDA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kB,CAAC;CACjE"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.Alerts = void 0;
|
|
5
|
+
const resource_1 = require("@metronome/sdk/resource");
|
|
6
|
+
class Alerts extends resource_1.APIResource {
|
|
7
|
+
/**
|
|
8
|
+
* Create a new alert
|
|
9
|
+
*/
|
|
10
|
+
create(body, options) {
|
|
11
|
+
return this._client.post('/alerts/create', { body, ...options });
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Archive an existing alert
|
|
15
|
+
*/
|
|
16
|
+
archive(body, options) {
|
|
17
|
+
return this._client.post('/alerts/archive', { body, ...options });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Alerts = Alerts;
|
|
21
|
+
(function (Alerts) {
|
|
22
|
+
})(Alerts = exports.Alerts || (exports.Alerts = {}));
|
|
23
|
+
//# sourceMappingURL=alerts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alerts.js","sourceRoot":"","sources":["../src/resources/alerts.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAGtF,sDAAsD;AAItD,MAAa,MAAO,SAAQ,sBAAW;IACrC;;OAEG;IACH,MAAM,CAAC,IAAuB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAwB,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAdD,wBAcC;AAqHD,WAAiB,MAAM;AAKvB,CAAC,EALgB,MAAM,GAAN,cAAM,KAAN,cAAM,QAKtB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from '@metronome/sdk/resource';
|
|
3
|
+
export class Alerts extends APIResource {
|
|
4
|
+
/**
|
|
5
|
+
* Create a new alert
|
|
6
|
+
*/
|
|
7
|
+
create(body, options) {
|
|
8
|
+
return this._client.post('/alerts/create', { body, ...options });
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Archive an existing alert
|
|
12
|
+
*/
|
|
13
|
+
archive(body, options) {
|
|
14
|
+
return this._client.post('/alerts/archive', { body, ...options });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
(function (Alerts) {
|
|
18
|
+
})(Alerts || (Alerts = {}));
|
|
19
|
+
//# 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,yBAAyB;AAIrD,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,MAAM,CAAC,IAAuB,EAAE,OAA6B;QAC3D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACH,OAAO,CAAC,IAAwB,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACpE,CAAC;CACF;AAqHD,WAAiB,MAAM;AAKvB,CAAC,EALgB,MAAM,KAAN,MAAM,QAKtB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as Core from '@metronome/sdk/core';
|
|
2
|
+
import { APIResource } from '@metronome/sdk/resource';
|
|
3
|
+
import * as AuditLogsAPI from '@metronome/sdk/resources/audit-logs';
|
|
4
|
+
export declare class AuditLogs extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Retrieves a range of audit logs. If no further audit logs are currently
|
|
7
|
+
* available, the data array will be empty. As new audit logs are created,
|
|
8
|
+
* subsequent requests using the same next_page value will be in the returned data
|
|
9
|
+
* array, ensuring a continuous and uninterrupted reading of audit logs.
|
|
10
|
+
*/
|
|
11
|
+
list(query?: AuditLogListParams, options?: Core.RequestOptions): Core.APIPromise<AuditLogListResponse>;
|
|
12
|
+
list(options?: Core.RequestOptions): Core.APIPromise<AuditLogListResponse>;
|
|
13
|
+
}
|
|
14
|
+
export interface AuditLogListResponse {
|
|
15
|
+
data: Array<AuditLogListResponse.Data>;
|
|
16
|
+
/**
|
|
17
|
+
* The next_page parameter is always returned to support ongoing log retrieval. It
|
|
18
|
+
* enables continuous querying, even when some requests return no new data. Save
|
|
19
|
+
* the next_page token from each response and use it for future requests to ensure
|
|
20
|
+
* no logs are missed. This setup is ideal for regular updates via automated
|
|
21
|
+
* processes, like cron jobs, to fetch logs continuously as they become available.
|
|
22
|
+
* When you receive an empty data array, it indicates a temporary absence of new
|
|
23
|
+
* logs, but subsequent requests might return new data.
|
|
24
|
+
*/
|
|
25
|
+
next_page: string | null;
|
|
26
|
+
}
|
|
27
|
+
export declare namespace AuditLogListResponse {
|
|
28
|
+
interface Data {
|
|
29
|
+
id: string;
|
|
30
|
+
timestamp: string;
|
|
31
|
+
action?: string;
|
|
32
|
+
actor?: Data.Actor;
|
|
33
|
+
description?: string;
|
|
34
|
+
resource_id?: string;
|
|
35
|
+
resource_type?: string;
|
|
36
|
+
status?: 'success' | 'failure' | 'pending';
|
|
37
|
+
}
|
|
38
|
+
namespace Data {
|
|
39
|
+
interface Actor {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
email?: string;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
export interface AuditLogListParams {
|
|
47
|
+
/**
|
|
48
|
+
* RFC 3339 timestamp (exclusive). Cannot be used with 'next_page'.
|
|
49
|
+
*/
|
|
50
|
+
ending_before?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Max number of results that should be returned
|
|
53
|
+
*/
|
|
54
|
+
limit?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Cursor that indicates where the next page of results should start.
|
|
57
|
+
*/
|
|
58
|
+
next_page?: string;
|
|
59
|
+
/**
|
|
60
|
+
* Optional parameter that can be used to filter which audit logs are returned. If
|
|
61
|
+
* you specify resource_id, you must also specify resource_type.
|
|
62
|
+
*/
|
|
63
|
+
resource_id?: string;
|
|
64
|
+
/**
|
|
65
|
+
* Optional parameter that can be used to filter which audit logs are returned. If
|
|
66
|
+
* you specify resource_type, you must also specify resource_id.
|
|
67
|
+
*/
|
|
68
|
+
resource_type?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Sort order by timestamp, e.g. date_asc or date_desc. Defaults to date_asc.
|
|
71
|
+
*/
|
|
72
|
+
sort?: 'date_asc' | 'date_desc';
|
|
73
|
+
/**
|
|
74
|
+
* RFC 3339 timestamp of the earliest audit log to return. Cannot be used with
|
|
75
|
+
* 'next_page'.
|
|
76
|
+
*/
|
|
77
|
+
starting_on?: string;
|
|
78
|
+
}
|
|
79
|
+
export declare namespace AuditLogs {
|
|
80
|
+
export import AuditLogListResponse = AuditLogsAPI.AuditLogListResponse;
|
|
81
|
+
export import AuditLogListParams = AuditLogsAPI.AuditLogListParams;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=audit-logs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-logs.d.ts","sourceRoot":"","sources":["../src/resources/audit-logs.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,WAAW,EA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AAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,GAAG,WAAW,CAAC;IAEhC;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,yBAAiB,SAAS,CAAC;IACzB,MAAM,QAAQ,oBAAoB,GAAG,YAAY,CAAC,oBAAoB,CAAC;IACvE,MAAM,QAAQ,kBAAkB,GAAG,YAAY,CAAC,kBAAkB,CAAC;CACpE"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.AuditLogs = void 0;
|
|
5
|
+
const resource_1 = require("@metronome/sdk/resource");
|
|
6
|
+
const core_1 = require("@metronome/sdk/core");
|
|
7
|
+
class AuditLogs extends resource_1.APIResource {
|
|
8
|
+
list(query = {}, options) {
|
|
9
|
+
if ((0, core_1.isRequestOptions)(query)) {
|
|
10
|
+
return this.list({}, query);
|
|
11
|
+
}
|
|
12
|
+
return this._client.get('/auditLogs', { query, ...options });
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.AuditLogs = AuditLogs;
|
|
16
|
+
(function (AuditLogs) {
|
|
17
|
+
})(AuditLogs = exports.AuditLogs || (exports.AuditLogs = {}));
|
|
18
|
+
//# sourceMappingURL=audit-logs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-logs.js","sourceRoot":"","sources":["../src/resources/audit-logs.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAGtF,sDAAsD;AACtD,8CAAuD;AAGvD,MAAa,SAAU,SAAQ,sBAAW;IASxC,IAAI,CACF,QAAkD,EAAE,EACpD,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,GAAG,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;CACF;AAlBD,8BAkBC;AAuFD,WAAiB,SAAS;AAG1B,CAAC,EAHgB,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAGzB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from '@metronome/sdk/resource';
|
|
3
|
+
import { isRequestOptions } from '@metronome/sdk/core';
|
|
4
|
+
export class AuditLogs extends APIResource {
|
|
5
|
+
list(query = {}, options) {
|
|
6
|
+
if (isRequestOptions(query)) {
|
|
7
|
+
return this.list({}, query);
|
|
8
|
+
}
|
|
9
|
+
return this._client.get('/auditLogs', { query, ...options });
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
(function (AuditLogs) {
|
|
13
|
+
})(AuditLogs || (AuditLogs = {}));
|
|
14
|
+
//# sourceMappingURL=audit-logs.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit-logs.mjs","sourceRoot":"","sources":["../src/resources/audit-logs.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,WAAW,EAAE,MAAM,yBAAyB;OAC9C,EAAE,gBAAgB,EAAE,MAAM,qBAAqB;AAGtD,MAAM,OAAO,SAAU,SAAQ,WAAW;IASxC,IAAI,CACF,QAAkD,EAAE,EACpD,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,GAAG,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/D,CAAC;CACF;AAuFD,WAAiB,SAAS;AAG1B,CAAC,EAHgB,SAAS,KAAT,SAAS,QAGzB"}
|
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import * as Core from '@metronome/sdk/core';
|
|
2
|
+
import { APIResource } from '@metronome/sdk/resource';
|
|
3
|
+
import * as BillableMetricsAPI from '@metronome/sdk/resources/billable-metrics';
|
|
4
|
+
import * as Shared from '@metronome/sdk/resources/shared';
|
|
5
|
+
export declare class BillableMetrics extends APIResource {
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new Billable Metric.
|
|
8
|
+
*/
|
|
9
|
+
create(body: BillableMetricCreateParams, options?: Core.RequestOptions): Core.APIPromise<BillableMetricCreateResponse>;
|
|
10
|
+
/**
|
|
11
|
+
* Get a billable metric
|
|
12
|
+
*/
|
|
13
|
+
retrieve(billableMetricId: string, options?: Core.RequestOptions): Core.APIPromise<BillableMetricRetrieveResponse>;
|
|
14
|
+
/**
|
|
15
|
+
* List all billable metrics.
|
|
16
|
+
*/
|
|
17
|
+
list(customerId: string, query?: BillableMetricListParams, options?: Core.RequestOptions): Core.APIPromise<BillableMetricListResponse>;
|
|
18
|
+
list(customerId: string, options?: Core.RequestOptions): Core.APIPromise<BillableMetricListResponse>;
|
|
19
|
+
/**
|
|
20
|
+
* Archive an existing billable metric
|
|
21
|
+
*/
|
|
22
|
+
archive(body: BillableMetricArchiveParams, options?: Core.RequestOptions): Core.APIPromise<BillableMetricArchiveResponse>;
|
|
23
|
+
}
|
|
24
|
+
export interface BillableMetricCreateResponse {
|
|
25
|
+
data: Shared.ID;
|
|
26
|
+
}
|
|
27
|
+
export interface BillableMetricRetrieveResponse {
|
|
28
|
+
data: BillableMetricRetrieveResponse.Data;
|
|
29
|
+
}
|
|
30
|
+
export declare namespace BillableMetricRetrieveResponse {
|
|
31
|
+
interface Data {
|
|
32
|
+
/**
|
|
33
|
+
* ID of the billable metric
|
|
34
|
+
*/
|
|
35
|
+
id: string;
|
|
36
|
+
/**
|
|
37
|
+
* Specifies the type of aggregation performed on matching events.
|
|
38
|
+
*/
|
|
39
|
+
aggregation_type: 'count' | 'Count' | 'COUNT' | 'latest' | 'Latest' | 'LATEST' | 'max' | 'Max' | 'MAX' | 'sum' | 'Sum' | 'SUM' | 'unique' | 'Unique' | 'UNIQUE';
|
|
40
|
+
/**
|
|
41
|
+
* The display name of the billable metric.
|
|
42
|
+
*/
|
|
43
|
+
name: string;
|
|
44
|
+
/**
|
|
45
|
+
* A key that specifies which property of the event is used to aggregate data. This
|
|
46
|
+
* key must be one of the property filter names and is not applicable when the
|
|
47
|
+
* aggregation type is 'count'.
|
|
48
|
+
*/
|
|
49
|
+
aggregation_key?: string;
|
|
50
|
+
custom_fields?: Record<string, string>;
|
|
51
|
+
/**
|
|
52
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
53
|
+
*/
|
|
54
|
+
event_type_filter?: Data.EventTypeFilter;
|
|
55
|
+
/**
|
|
56
|
+
* Property names that are used to group usage costs on an invoice. Each entry
|
|
57
|
+
* represents a set of properties used to slice events into distinct buckets.
|
|
58
|
+
*/
|
|
59
|
+
group_keys?: Array<Array<string>>;
|
|
60
|
+
/**
|
|
61
|
+
* A list of filters to match events to this billable metric. Each filter defines a
|
|
62
|
+
* rule on an event property. All rules must pass for the event to match the
|
|
63
|
+
* billable metric.
|
|
64
|
+
*/
|
|
65
|
+
property_filters?: Array<Data.PropertyFilter>;
|
|
66
|
+
}
|
|
67
|
+
namespace Data {
|
|
68
|
+
/**
|
|
69
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
70
|
+
*/
|
|
71
|
+
interface EventTypeFilter {
|
|
72
|
+
/**
|
|
73
|
+
* A list of event types that are explicitly included in the billable metric. If
|
|
74
|
+
* specified, only events of these types will match the billable metric. Must be
|
|
75
|
+
* non-empty if present.
|
|
76
|
+
*/
|
|
77
|
+
in_values?: Array<string>;
|
|
78
|
+
/**
|
|
79
|
+
* A list of event types that are explicitly excluded from the billable metric. If
|
|
80
|
+
* specified, events of these types will not match the billable metric. Must be
|
|
81
|
+
* non-empty if present.
|
|
82
|
+
*/
|
|
83
|
+
not_in_values?: Array<string>;
|
|
84
|
+
}
|
|
85
|
+
interface PropertyFilter {
|
|
86
|
+
/**
|
|
87
|
+
* The name of the event property.
|
|
88
|
+
*/
|
|
89
|
+
name: string;
|
|
90
|
+
/**
|
|
91
|
+
* Determines whether the property must exist in the event. If true, only events
|
|
92
|
+
* with this property will pass the filter. If false, only events without this
|
|
93
|
+
* property will pass the filter. If null or omitted, the existence of the property
|
|
94
|
+
* is optional.
|
|
95
|
+
*/
|
|
96
|
+
exists?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* Specifies the allowed values for the property to match an event. An event will
|
|
99
|
+
* pass the filter only if its property value is included in this list. If
|
|
100
|
+
* undefined, all property values will pass the filter. Must be non-empty if
|
|
101
|
+
* present.
|
|
102
|
+
*/
|
|
103
|
+
in_values?: Array<string>;
|
|
104
|
+
/**
|
|
105
|
+
* Specifies the values that prevent an event from matching the filter. An event
|
|
106
|
+
* will not pass the filter if its property value is included in this list. If null
|
|
107
|
+
* or empty, all property values will pass the filter. Must be non-empty if
|
|
108
|
+
* present.
|
|
109
|
+
*/
|
|
110
|
+
not_in_values?: Array<string>;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
export interface BillableMetricListResponse {
|
|
115
|
+
data: Array<BillableMetricListResponse.Data>;
|
|
116
|
+
next_page: string | null;
|
|
117
|
+
}
|
|
118
|
+
export declare namespace BillableMetricListResponse {
|
|
119
|
+
interface Data {
|
|
120
|
+
id: string;
|
|
121
|
+
name: string;
|
|
122
|
+
group_by?: Array<string>;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
export interface BillableMetricArchiveResponse {
|
|
126
|
+
data: Shared.ID;
|
|
127
|
+
}
|
|
128
|
+
export interface BillableMetricCreateParams {
|
|
129
|
+
/**
|
|
130
|
+
* Specifies the type of aggregation performed on matching events.
|
|
131
|
+
*/
|
|
132
|
+
aggregation_type: 'count' | 'Count' | 'COUNT' | 'latest' | 'Latest' | 'LATEST' | 'max' | 'Max' | 'MAX' | 'sum' | 'Sum' | 'SUM' | 'unique' | 'Unique' | 'UNIQUE';
|
|
133
|
+
/**
|
|
134
|
+
* The display name of the billable metric.
|
|
135
|
+
*/
|
|
136
|
+
name: string;
|
|
137
|
+
/**
|
|
138
|
+
* A key that specifies which property of the event is used to aggregate data. This
|
|
139
|
+
* key must be one of the property filter names and is not applicable when the
|
|
140
|
+
* aggregation type is 'count'.
|
|
141
|
+
*/
|
|
142
|
+
aggregation_key?: string;
|
|
143
|
+
/**
|
|
144
|
+
* Custom fields to attach to the billable metric.
|
|
145
|
+
*/
|
|
146
|
+
custom_fields?: Record<string, string>;
|
|
147
|
+
/**
|
|
148
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
149
|
+
*/
|
|
150
|
+
event_type_filter?: BillableMetricCreateParams.EventTypeFilter;
|
|
151
|
+
/**
|
|
152
|
+
* Property names that are used to group usage costs on an invoice. Each entry
|
|
153
|
+
* represents a set of properties used to slice events into distinct buckets.
|
|
154
|
+
*/
|
|
155
|
+
group_keys?: Array<Array<string>>;
|
|
156
|
+
/**
|
|
157
|
+
* A list of filters to match events to this billable metric. Each filter defines a
|
|
158
|
+
* rule on an event property. All rules must pass for the event to match the
|
|
159
|
+
* billable metric.
|
|
160
|
+
*/
|
|
161
|
+
property_filters?: Array<BillableMetricCreateParams.PropertyFilter>;
|
|
162
|
+
}
|
|
163
|
+
export declare namespace BillableMetricCreateParams {
|
|
164
|
+
/**
|
|
165
|
+
* An optional filtering rule to match the 'event_type' property of an event.
|
|
166
|
+
*/
|
|
167
|
+
interface EventTypeFilter {
|
|
168
|
+
/**
|
|
169
|
+
* A list of event types that are explicitly included in the billable metric. If
|
|
170
|
+
* specified, only events of these types will match the billable metric. Must be
|
|
171
|
+
* non-empty if present.
|
|
172
|
+
*/
|
|
173
|
+
in_values?: Array<string>;
|
|
174
|
+
/**
|
|
175
|
+
* A list of event types that are explicitly excluded from the billable metric. If
|
|
176
|
+
* specified, events of these types will not match the billable metric. Must be
|
|
177
|
+
* non-empty if present.
|
|
178
|
+
*/
|
|
179
|
+
not_in_values?: Array<string>;
|
|
180
|
+
}
|
|
181
|
+
interface PropertyFilter {
|
|
182
|
+
/**
|
|
183
|
+
* The name of the event property.
|
|
184
|
+
*/
|
|
185
|
+
name: string;
|
|
186
|
+
/**
|
|
187
|
+
* Determines whether the property must exist in the event. If true, only events
|
|
188
|
+
* with this property will pass the filter. If false, only events without this
|
|
189
|
+
* property will pass the filter. If null or omitted, the existence of the property
|
|
190
|
+
* is optional.
|
|
191
|
+
*/
|
|
192
|
+
exists?: boolean;
|
|
193
|
+
/**
|
|
194
|
+
* Specifies the allowed values for the property to match an event. An event will
|
|
195
|
+
* pass the filter only if its property value is included in this list. If
|
|
196
|
+
* undefined, all property values will pass the filter. Must be non-empty if
|
|
197
|
+
* present.
|
|
198
|
+
*/
|
|
199
|
+
in_values?: Array<string>;
|
|
200
|
+
/**
|
|
201
|
+
* Specifies the values that prevent an event from matching the filter. An event
|
|
202
|
+
* will not pass the filter if its property value is included in this list. If null
|
|
203
|
+
* or empty, all property values will pass the filter. Must be non-empty if
|
|
204
|
+
* present.
|
|
205
|
+
*/
|
|
206
|
+
not_in_values?: Array<string>;
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
export interface BillableMetricListParams {
|
|
210
|
+
/**
|
|
211
|
+
* Max number of results that should be returned
|
|
212
|
+
*/
|
|
213
|
+
limit?: number;
|
|
214
|
+
/**
|
|
215
|
+
* Cursor that indicates where the next page of results should start.
|
|
216
|
+
*/
|
|
217
|
+
next_page?: string;
|
|
218
|
+
/**
|
|
219
|
+
* If true, the list of metrics will be filtered to just ones that are on the
|
|
220
|
+
* customer's current plan
|
|
221
|
+
*/
|
|
222
|
+
on_current_plan?: boolean;
|
|
223
|
+
}
|
|
224
|
+
export interface BillableMetricArchiveParams {
|
|
225
|
+
id: string;
|
|
226
|
+
}
|
|
227
|
+
export declare namespace BillableMetrics {
|
|
228
|
+
export import BillableMetricCreateResponse = BillableMetricsAPI.BillableMetricCreateResponse;
|
|
229
|
+
export import BillableMetricRetrieveResponse = BillableMetricsAPI.BillableMetricRetrieveResponse;
|
|
230
|
+
export import BillableMetricListResponse = BillableMetricsAPI.BillableMetricListResponse;
|
|
231
|
+
export import BillableMetricArchiveResponse = BillableMetricsAPI.BillableMetricArchiveResponse;
|
|
232
|
+
export import BillableMetricCreateParams = BillableMetricsAPI.BillableMetricCreateParams;
|
|
233
|
+
export import BillableMetricListParams = BillableMetricsAPI.BillableMetricListParams;
|
|
234
|
+
export import BillableMetricArchiveParams = BillableMetricsAPI.BillableMetricArchiveParams;
|
|
235
|
+
}
|
|
236
|
+
//# sourceMappingURL=billable-metrics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billable-metrics.d.ts","sourceRoot":"","sources":["../src/resources/billable-metrics.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD,OAAO,KAAK,kBAAkB,MAAM,2CAA2C,CAAC;AAChF,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAE1D,qBAAa,eAAgB,SAAQ,WAAW;IAC9C;;OAEG;IACH,MAAM,CACJ,IAAI,EAAE,0BAA0B,EAChC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,4BAA4B,CAAC;IAIhD;;OAEG;IACH,QAAQ,CACN,gBAAgB,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAC5B,IAAI,CAAC,UAAU,CAAC,8BAA8B,CAAC;IAIlD;;OAEG;IACH,IAAI,CACF,UAAU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AAM,QAAQ,6BAA6B,GAAG,kBAAkB,CAAC,6BAA6B,CAAC;IAC/F,MAAM,QAAQ,0BAA0B,GAAG,kBAAkB,CAAC,0BAA0B,CAAC;IACzF,MAAM,QAAQ,wBAAwB,GAAG,kBAAkB,CAAC,wBAAwB,CAAC;IACrF,MAAM,QAAQ,2BAA2B,GAAG,kBAAkB,CAAC,2BAA2B,CAAC;CAC5F"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.BillableMetrics = void 0;
|
|
5
|
+
const resource_1 = require("@metronome/sdk/resource");
|
|
6
|
+
const core_1 = require("@metronome/sdk/core");
|
|
7
|
+
class BillableMetrics extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new Billable Metric.
|
|
10
|
+
*/
|
|
11
|
+
create(body, options) {
|
|
12
|
+
return this._client.post('/billable-metrics/create', { body, ...options });
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get a billable metric
|
|
16
|
+
*/
|
|
17
|
+
retrieve(billableMetricId, options) {
|
|
18
|
+
return this._client.get(`/billable-metrics/${billableMetricId}`, options);
|
|
19
|
+
}
|
|
20
|
+
list(customerId, query = {}, options) {
|
|
21
|
+
if ((0, core_1.isRequestOptions)(query)) {
|
|
22
|
+
return this.list(customerId, {}, query);
|
|
23
|
+
}
|
|
24
|
+
return this._client.get(`/customers/${customerId}/billable-metrics`, { query, ...options });
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Archive an existing billable metric
|
|
28
|
+
*/
|
|
29
|
+
archive(body, options) {
|
|
30
|
+
return this._client.post('/billable-metrics/archive', { body, ...options });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.BillableMetrics = BillableMetrics;
|
|
34
|
+
(function (BillableMetrics) {
|
|
35
|
+
})(BillableMetrics = exports.BillableMetrics || (exports.BillableMetrics = {}));
|
|
36
|
+
//# sourceMappingURL=billable-metrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billable-metrics.js","sourceRoot":"","sources":["../src/resources/billable-metrics.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAGtF,sDAAsD;AACtD,8CAAuD;AAIvD,MAAa,eAAgB,SAAQ,sBAAW;IAC9C;;OAEG;IACH,MAAM,CACJ,IAAgC,EAChC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,gBAAwB,EACxB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;IAWD,IAAI,CACF,UAAkB,EAClB,QAAwD,EAAE,EAC1D,OAA6B;QAE7B,IAAI,IAAA,uBAAgB,EAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACzC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,mBAAmB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;OAEG;IACH,OAAO,CACL,IAAiC,EACjC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF;AAlDD,0CAkDC;AAkRD,WAAiB,eAAe;AAQhC,CAAC,EARgB,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAQ/B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from '@metronome/sdk/resource';
|
|
3
|
+
import { isRequestOptions } from '@metronome/sdk/core';
|
|
4
|
+
export class BillableMetrics extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Creates a new Billable Metric.
|
|
7
|
+
*/
|
|
8
|
+
create(body, options) {
|
|
9
|
+
return this._client.post('/billable-metrics/create', { body, ...options });
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Get a billable metric
|
|
13
|
+
*/
|
|
14
|
+
retrieve(billableMetricId, options) {
|
|
15
|
+
return this._client.get(`/billable-metrics/${billableMetricId}`, options);
|
|
16
|
+
}
|
|
17
|
+
list(customerId, query = {}, options) {
|
|
18
|
+
if (isRequestOptions(query)) {
|
|
19
|
+
return this.list(customerId, {}, query);
|
|
20
|
+
}
|
|
21
|
+
return this._client.get(`/customers/${customerId}/billable-metrics`, { query, ...options });
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Archive an existing billable metric
|
|
25
|
+
*/
|
|
26
|
+
archive(body, options) {
|
|
27
|
+
return this._client.post('/billable-metrics/archive', { body, ...options });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
(function (BillableMetrics) {
|
|
31
|
+
})(BillableMetrics || (BillableMetrics = {}));
|
|
32
|
+
//# sourceMappingURL=billable-metrics.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billable-metrics.mjs","sourceRoot":"","sources":["../src/resources/billable-metrics.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAG/E,EAAE,WAAW,EAAE,MAAM,yBAAyB;OAC9C,EAAE,gBAAgB,EAAE,MAAM,qBAAqB;AAItD,MAAM,OAAO,eAAgB,SAAQ,WAAW;IAC9C;;OAEG;IACH,MAAM,CACJ,IAAgC,EAChC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACH,QAAQ,CACN,gBAAwB,EACxB,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,qBAAqB,gBAAgB,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5E,CAAC;IAWD,IAAI,CACF,UAAkB,EAClB,QAAwD,EAAE,EAC1D,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE;YAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,CAAC,CAAC;SACzC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,UAAU,mBAAmB,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9F,CAAC;IAED;;OAEG;IACH,OAAO,CACL,IAAiC,EACjC,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9E,CAAC;CACF;AAkRD,WAAiB,eAAe;AAQhC,CAAC,EARgB,eAAe,KAAf,eAAe,QAQ/B"}
|