@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,363 @@
|
|
|
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 PlansAPI from "./plans";
|
|
7
|
+
import * as Shared from "../shared";
|
|
8
|
+
|
|
9
|
+
export class Plans extends APIResource {
|
|
10
|
+
/**
|
|
11
|
+
* List the given customer's plans in reverse-chronological order.
|
|
12
|
+
*/
|
|
13
|
+
list(
|
|
14
|
+
customerId: string,
|
|
15
|
+
query?: PlanListParams,
|
|
16
|
+
options?: Core.RequestOptions,
|
|
17
|
+
): Core.APIPromise<PlanListResponse>;
|
|
18
|
+
list(customerId: string, options?: Core.RequestOptions): Core.APIPromise<PlanListResponse>;
|
|
19
|
+
list(
|
|
20
|
+
customerId: string,
|
|
21
|
+
query: PlanListParams | Core.RequestOptions = {},
|
|
22
|
+
options?: Core.RequestOptions,
|
|
23
|
+
): Core.APIPromise<PlanListResponse> {
|
|
24
|
+
if (isRequestOptions(query)) {
|
|
25
|
+
return this.list(customerId, {}, query);
|
|
26
|
+
}
|
|
27
|
+
return this._client.get(`/customers/${customerId}/plans`, { query, ...options });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Associate an existing customer with a plan for a specified date range. See the
|
|
32
|
+
* [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments)
|
|
33
|
+
* for details on the price adjustments.
|
|
34
|
+
*/
|
|
35
|
+
add(
|
|
36
|
+
customerId: string,
|
|
37
|
+
body: PlanAddParams,
|
|
38
|
+
options?: Core.RequestOptions,
|
|
39
|
+
): Core.APIPromise<PlanAddResponse> {
|
|
40
|
+
return this._client.post(`/customers/${customerId}/plans/add`, { body, ...options });
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Change the end date of a customer's plan.
|
|
45
|
+
*/
|
|
46
|
+
end(
|
|
47
|
+
customerId: string,
|
|
48
|
+
customerPlanId: string,
|
|
49
|
+
body?: PlanEndParams,
|
|
50
|
+
options?: Core.RequestOptions,
|
|
51
|
+
): Core.APIPromise<PlanEndResponse>;
|
|
52
|
+
end(
|
|
53
|
+
customerId: string,
|
|
54
|
+
customerPlanId: string,
|
|
55
|
+
options?: Core.RequestOptions,
|
|
56
|
+
): Core.APIPromise<PlanEndResponse>;
|
|
57
|
+
end(
|
|
58
|
+
customerId: string,
|
|
59
|
+
customerPlanId: string,
|
|
60
|
+
body: PlanEndParams | Core.RequestOptions = {},
|
|
61
|
+
options?: Core.RequestOptions,
|
|
62
|
+
): Core.APIPromise<PlanEndResponse> {
|
|
63
|
+
if (isRequestOptions(body)) {
|
|
64
|
+
return this.end(customerId, customerPlanId, {}, body);
|
|
65
|
+
}
|
|
66
|
+
return this._client.post(`/customers/${customerId}/plans/${customerPlanId}/end`, { body, ...options });
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Lists a customer plans adjustments. See the
|
|
71
|
+
* [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments)
|
|
72
|
+
* for details.
|
|
73
|
+
*/
|
|
74
|
+
listPriceAdjustments(
|
|
75
|
+
customerId: string,
|
|
76
|
+
customerPlanId: string,
|
|
77
|
+
query?: PlanListPriceAdjustmentsParams,
|
|
78
|
+
options?: Core.RequestOptions,
|
|
79
|
+
): Core.APIPromise<PlanListPriceAdjustmentsResponse>;
|
|
80
|
+
listPriceAdjustments(
|
|
81
|
+
customerId: string,
|
|
82
|
+
customerPlanId: string,
|
|
83
|
+
options?: Core.RequestOptions,
|
|
84
|
+
): Core.APIPromise<PlanListPriceAdjustmentsResponse>;
|
|
85
|
+
listPriceAdjustments(
|
|
86
|
+
customerId: string,
|
|
87
|
+
customerPlanId: string,
|
|
88
|
+
query: PlanListPriceAdjustmentsParams | Core.RequestOptions = {},
|
|
89
|
+
options?: Core.RequestOptions,
|
|
90
|
+
): Core.APIPromise<PlanListPriceAdjustmentsResponse> {
|
|
91
|
+
if (isRequestOptions(query)) {
|
|
92
|
+
return this.listPriceAdjustments(customerId, customerPlanId, {}, query);
|
|
93
|
+
}
|
|
94
|
+
return this._client.get(`/customers/${customerId}/plans/${customerPlanId}/priceAdjustments`, {
|
|
95
|
+
query,
|
|
96
|
+
...options,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export interface PlanListResponse {
|
|
102
|
+
data: Array<PlanListResponse.Data>;
|
|
103
|
+
|
|
104
|
+
next_page: string | null;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export namespace PlanListResponse {
|
|
108
|
+
export interface Data {
|
|
109
|
+
/**
|
|
110
|
+
* the ID of the customer plan
|
|
111
|
+
*/
|
|
112
|
+
id: string;
|
|
113
|
+
|
|
114
|
+
custom_fields: Record<string, string>;
|
|
115
|
+
|
|
116
|
+
plan_description: string;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* the ID of the plan
|
|
120
|
+
*/
|
|
121
|
+
plan_id: string;
|
|
122
|
+
|
|
123
|
+
plan_name: string;
|
|
124
|
+
|
|
125
|
+
starting_on: string;
|
|
126
|
+
|
|
127
|
+
ending_before?: string;
|
|
128
|
+
|
|
129
|
+
net_payment_terms_days?: number;
|
|
130
|
+
|
|
131
|
+
trial_info?: Data.TrialInfo;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export namespace Data {
|
|
135
|
+
export interface TrialInfo {
|
|
136
|
+
ending_before: string;
|
|
137
|
+
|
|
138
|
+
spending_caps: Array<TrialInfo.SpendingCap>;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export namespace TrialInfo {
|
|
142
|
+
export interface SpendingCap {
|
|
143
|
+
amount: number;
|
|
144
|
+
|
|
145
|
+
amount_remaining: number;
|
|
146
|
+
|
|
147
|
+
credit_type: Shared.CreditType;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface PlanAddResponse {
|
|
154
|
+
data: Shared.ID;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export interface PlanEndResponse {}
|
|
158
|
+
|
|
159
|
+
export interface PlanListPriceAdjustmentsResponse {
|
|
160
|
+
data: Array<PlanListPriceAdjustmentsResponse.Data>;
|
|
161
|
+
|
|
162
|
+
next_page: string | null;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export namespace PlanListPriceAdjustmentsResponse {
|
|
166
|
+
export interface Data {
|
|
167
|
+
charge_id: string;
|
|
168
|
+
|
|
169
|
+
charge_type: 'usage' | 'fixed' | 'composite' | 'minimum' | 'seat';
|
|
170
|
+
|
|
171
|
+
prices: Array<Data.Price>;
|
|
172
|
+
|
|
173
|
+
start_period: number;
|
|
174
|
+
|
|
175
|
+
quantity?: number;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export namespace Data {
|
|
179
|
+
export interface Price {
|
|
180
|
+
/**
|
|
181
|
+
* Determines how the value will be applied.
|
|
182
|
+
*/
|
|
183
|
+
adjustment_type: 'fixed' | 'quantity' | 'percentage' | 'override';
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* Used in pricing tiers. Indicates at what metric value the price applies.
|
|
187
|
+
*/
|
|
188
|
+
tier?: number;
|
|
189
|
+
|
|
190
|
+
value?: number;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface PlanListParams {
|
|
196
|
+
/**
|
|
197
|
+
* Max number of results that should be returned
|
|
198
|
+
*/
|
|
199
|
+
limit?: number;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Cursor that indicates where the next page of results should start.
|
|
203
|
+
*/
|
|
204
|
+
next_page?: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface PlanAddParams {
|
|
208
|
+
plan_id: string;
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* RFC 3339 timestamp for when the plan becomes active for this customer. Must be
|
|
212
|
+
* at 0:00 UTC (midnight).
|
|
213
|
+
*/
|
|
214
|
+
starting_on: string;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* RFC 3339 timestamp for when the plan ends (exclusive) for this customer. Must be
|
|
218
|
+
* at 0:00 UTC (midnight).
|
|
219
|
+
*/
|
|
220
|
+
ending_before?: string;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Number of days after issuance of invoice after which the invoice is due (e.g.
|
|
224
|
+
* Net 30).
|
|
225
|
+
*/
|
|
226
|
+
net_payment_terms_days?: number;
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* An optional list of overage rates that override the rates of the original plan
|
|
230
|
+
* configuration. These new rates will apply to all pricing ramps.
|
|
231
|
+
*/
|
|
232
|
+
overage_rate_adjustments?: Array<PlanAddParams.OverageRateAdjustment>;
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* A list of price adjustments can be applied on top of the pricing in the plans.
|
|
236
|
+
* See the
|
|
237
|
+
* [price adjustments documentation](https://docs.metronome.com/pricing/managing-plans/#price-adjustments)
|
|
238
|
+
* for details.
|
|
239
|
+
*/
|
|
240
|
+
price_adjustments?: Array<PlanAddParams.PriceAdjustment>;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* A custom trial can be set for the customer's plan. See the
|
|
244
|
+
* [trial configuration documentation](https://docs.metronome.com/provisioning/configure-trials/)
|
|
245
|
+
* for details.
|
|
246
|
+
*/
|
|
247
|
+
trial_spec?: PlanAddParams.TrialSpec;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
export namespace PlanAddParams {
|
|
251
|
+
export interface OverageRateAdjustment {
|
|
252
|
+
custom_credit_type_id: string;
|
|
253
|
+
|
|
254
|
+
fiat_currency_credit_type_id: string;
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* The overage cost in fiat currency for each credit of the custom credit type.
|
|
258
|
+
*/
|
|
259
|
+
to_fiat_conversion_factor: number;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface PriceAdjustment {
|
|
263
|
+
adjustment_type: 'percentage' | 'fixed' | 'override' | 'quantity';
|
|
264
|
+
|
|
265
|
+
charge_id: string;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Used in price ramps. Indicates how many billing periods pass before the charge
|
|
269
|
+
* applies.
|
|
270
|
+
*/
|
|
271
|
+
start_period: number;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* the overridden quantity for a fixed charge
|
|
275
|
+
*/
|
|
276
|
+
quantity?: number;
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* Used in pricing tiers. Indicates at what metric value the price applies.
|
|
280
|
+
*/
|
|
281
|
+
tier?: number;
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* The amount of change to a price. Percentage and fixed adjustments can be
|
|
285
|
+
* positive or negative. Percentage-based adjustments should be decimals, e.g.
|
|
286
|
+
* -0.05 for a 5% discount.
|
|
287
|
+
*/
|
|
288
|
+
value?: number;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* A custom trial can be set for the customer's plan. See the
|
|
293
|
+
* [trial configuration documentation](https://docs.metronome.com/provisioning/configure-trials/)
|
|
294
|
+
* for details.
|
|
295
|
+
*/
|
|
296
|
+
export interface TrialSpec {
|
|
297
|
+
/**
|
|
298
|
+
* Length of the trial period in days.
|
|
299
|
+
*/
|
|
300
|
+
length_in_days: number;
|
|
301
|
+
|
|
302
|
+
spending_cap?: TrialSpec.SpendingCap;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export namespace TrialSpec {
|
|
306
|
+
export interface SpendingCap {
|
|
307
|
+
/**
|
|
308
|
+
* The credit amount in the given denomination based on the credit type, e.g. US
|
|
309
|
+
* cents.
|
|
310
|
+
*/
|
|
311
|
+
amount: number;
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* The credit type ID for the spending cap.
|
|
315
|
+
*/
|
|
316
|
+
credit_type_id: string;
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface PlanEndParams {
|
|
322
|
+
/**
|
|
323
|
+
* RFC 3339 timestamp for when the plan ends (exclusive) for this customer. Must be
|
|
324
|
+
* at 0:00 UTC (midnight). If not provided, the plan end date will be cleared.
|
|
325
|
+
*/
|
|
326
|
+
ending_before?: string;
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* If true, plan end date can be before the last finalized invoice date. Any
|
|
330
|
+
* invoices generated after the plan end date will be voided.
|
|
331
|
+
*/
|
|
332
|
+
void_invoices?: boolean;
|
|
333
|
+
|
|
334
|
+
/**
|
|
335
|
+
* Only applicable when void_invoices is set to true. If true, for every invoice
|
|
336
|
+
* that is voided we will also attempt to void/delete the stripe invoice (if any).
|
|
337
|
+
* Stripe invoices will be voided if finalized or deleted if still in draft state.
|
|
338
|
+
*/
|
|
339
|
+
void_stripe_invoices?: boolean;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
export interface PlanListPriceAdjustmentsParams {
|
|
343
|
+
/**
|
|
344
|
+
* Max number of results that should be returned
|
|
345
|
+
*/
|
|
346
|
+
limit?: number;
|
|
347
|
+
|
|
348
|
+
/**
|
|
349
|
+
* Cursor that indicates where the next page of results should start.
|
|
350
|
+
*/
|
|
351
|
+
next_page?: string;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export namespace Plans {
|
|
355
|
+
export import PlanListResponse = PlansAPI.PlanListResponse;
|
|
356
|
+
export import PlanAddResponse = PlansAPI.PlanAddResponse;
|
|
357
|
+
export import PlanEndResponse = PlansAPI.PlanEndResponse;
|
|
358
|
+
export import PlanListPriceAdjustmentsResponse = PlansAPI.PlanListPriceAdjustmentsResponse;
|
|
359
|
+
export import PlanListParams = PlansAPI.PlanListParams;
|
|
360
|
+
export import PlanAddParams = PlansAPI.PlanAddParams;
|
|
361
|
+
export import PlanEndParams = PlansAPI.PlanEndParams;
|
|
362
|
+
export import PlanListPriceAdjustmentsParams = PlansAPI.PlanListPriceAdjustmentsParams;
|
|
363
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
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 * as DashboardsAPI from "./dashboards";
|
|
6
|
+
|
|
7
|
+
export class Dashboards extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Retrieve an embeddable dashboard url for a customer. The dashboard can be
|
|
10
|
+
* embedded using an iframe in a website. This will show information such as usage
|
|
11
|
+
* data and customer invoices.
|
|
12
|
+
*/
|
|
13
|
+
getEmbeddableURL(
|
|
14
|
+
body: DashboardGetEmbeddableURLParams,
|
|
15
|
+
options?: Core.RequestOptions,
|
|
16
|
+
): Core.APIPromise<DashboardGetEmbeddableURLResponse> {
|
|
17
|
+
return this._client.post('/dashboards/getEmbeddableUrl', { body, ...options });
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface DashboardGetEmbeddableURLResponse {
|
|
22
|
+
data: DashboardGetEmbeddableURLResponse.Data;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export namespace DashboardGetEmbeddableURLResponse {
|
|
26
|
+
export interface Data {
|
|
27
|
+
url?: string;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface DashboardGetEmbeddableURLParams {
|
|
32
|
+
customer_id: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The type of dashboard to retrieve.
|
|
36
|
+
*/
|
|
37
|
+
dashboard: 'invoices' | 'usage' | 'credits';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Optional list of colors to override
|
|
41
|
+
*/
|
|
42
|
+
color_overrides?: Array<DashboardGetEmbeddableURLParams.ColorOverride>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Optional dashboard specific options
|
|
46
|
+
*/
|
|
47
|
+
dashboard_options?: Array<DashboardGetEmbeddableURLParams.DashboardOption>;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export namespace DashboardGetEmbeddableURLParams {
|
|
51
|
+
export interface ColorOverride {
|
|
52
|
+
/**
|
|
53
|
+
* The color to override
|
|
54
|
+
*/
|
|
55
|
+
name?:
|
|
56
|
+
| 'Gray_dark'
|
|
57
|
+
| 'Gray_medium'
|
|
58
|
+
| 'Gray_light'
|
|
59
|
+
| 'Gray_extralight'
|
|
60
|
+
| 'White'
|
|
61
|
+
| 'Primary_medium'
|
|
62
|
+
| 'Primary_light'
|
|
63
|
+
| 'UsageLine_0'
|
|
64
|
+
| 'UsageLine_1'
|
|
65
|
+
| 'UsageLine_2'
|
|
66
|
+
| 'UsageLine_3'
|
|
67
|
+
| 'UsageLine_4'
|
|
68
|
+
| 'UsageLine_5'
|
|
69
|
+
| 'UsageLine_6'
|
|
70
|
+
| 'UsageLine_7'
|
|
71
|
+
| 'UsageLine_8'
|
|
72
|
+
| 'UsageLine_9'
|
|
73
|
+
| 'Primary_green'
|
|
74
|
+
| 'Primary_red';
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Hex value representation of the color
|
|
78
|
+
*/
|
|
79
|
+
value?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface DashboardOption {
|
|
83
|
+
/**
|
|
84
|
+
* The option key name
|
|
85
|
+
*/
|
|
86
|
+
key: string;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The option value
|
|
90
|
+
*/
|
|
91
|
+
value: string;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export namespace Dashboards {
|
|
96
|
+
export import DashboardGetEmbeddableURLResponse = DashboardsAPI.DashboardGetEmbeddableURLResponse;
|
|
97
|
+
export import DashboardGetEmbeddableURLParams = DashboardsAPI.DashboardGetEmbeddableURLParams;
|
|
98
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export * from './shared';
|
|
4
|
+
export {
|
|
5
|
+
AlertCreateResponse,
|
|
6
|
+
AlertArchiveResponse,
|
|
7
|
+
AlertCreateParams,
|
|
8
|
+
AlertArchiveParams,
|
|
9
|
+
Alerts,
|
|
10
|
+
} from './alerts';
|
|
11
|
+
export { AuditLogListResponse, AuditLogListParams, AuditLogs } from './audit-logs';
|
|
12
|
+
export {
|
|
13
|
+
BillableMetricCreateResponse,
|
|
14
|
+
BillableMetricRetrieveResponse,
|
|
15
|
+
BillableMetricListResponse,
|
|
16
|
+
BillableMetricArchiveResponse,
|
|
17
|
+
BillableMetricCreateParams,
|
|
18
|
+
BillableMetricListParams,
|
|
19
|
+
BillableMetricArchiveParams,
|
|
20
|
+
BillableMetrics,
|
|
21
|
+
} from './billable-metrics';
|
|
22
|
+
export {
|
|
23
|
+
CreditLedgerEntry,
|
|
24
|
+
RolloverAmountMaxAmount,
|
|
25
|
+
RolloverAmountMaxPercentage,
|
|
26
|
+
CreditGrantCreateResponse,
|
|
27
|
+
CreditGrantListResponse,
|
|
28
|
+
CreditGrantEditResponse,
|
|
29
|
+
CreditGrantListCreditTypesResponse,
|
|
30
|
+
CreditGrantListEntriesResponse,
|
|
31
|
+
CreditGrantVoidResponse,
|
|
32
|
+
CreditGrantCreateParams,
|
|
33
|
+
CreditGrantListParams,
|
|
34
|
+
CreditGrantEditParams,
|
|
35
|
+
CreditGrantListCreditTypesParams,
|
|
36
|
+
CreditGrantListEntriesParams,
|
|
37
|
+
CreditGrantVoidParams,
|
|
38
|
+
CreditGrants,
|
|
39
|
+
} from './credit-grants';
|
|
40
|
+
export {
|
|
41
|
+
CustomFieldListKeysResponse,
|
|
42
|
+
CustomFieldAddKeyParams,
|
|
43
|
+
CustomFieldDeleteValuesParams,
|
|
44
|
+
CustomFieldListKeysParams,
|
|
45
|
+
CustomFieldRemoveKeyParams,
|
|
46
|
+
CustomFieldSetValuesParams,
|
|
47
|
+
CustomFields,
|
|
48
|
+
} from './custom-fields';
|
|
49
|
+
export {
|
|
50
|
+
Customer,
|
|
51
|
+
CustomerDetail,
|
|
52
|
+
CustomerCreateResponse,
|
|
53
|
+
CustomerRetrieveResponse,
|
|
54
|
+
CustomerListResponse,
|
|
55
|
+
CustomerArchiveResponse,
|
|
56
|
+
CustomerListBillableMetricsResponse,
|
|
57
|
+
CustomerListCostsResponse,
|
|
58
|
+
CustomerSetNameResponse,
|
|
59
|
+
CustomerCreateParams,
|
|
60
|
+
CustomerListParams,
|
|
61
|
+
CustomerArchiveParams,
|
|
62
|
+
CustomerListBillableMetricsParams,
|
|
63
|
+
CustomerListCostsParams,
|
|
64
|
+
CustomerSetIngestAliasesParams,
|
|
65
|
+
CustomerSetNameParams,
|
|
66
|
+
CustomerUpdateConfigParams,
|
|
67
|
+
Customers,
|
|
68
|
+
} from './customers/customers';
|
|
69
|
+
export { DashboardGetEmbeddableURLResponse, DashboardGetEmbeddableURLParams, Dashboards } from './dashboards';
|
|
70
|
+
export {
|
|
71
|
+
PlanDetail,
|
|
72
|
+
PlanListResponse,
|
|
73
|
+
PlanGetDetailsResponse,
|
|
74
|
+
PlanListChargesResponse,
|
|
75
|
+
PlanListCustomersResponse,
|
|
76
|
+
PlanListParams,
|
|
77
|
+
PlanListChargesParams,
|
|
78
|
+
PlanListCustomersParams,
|
|
79
|
+
Plans,
|
|
80
|
+
} from './plans';
|
|
81
|
+
export { ServiceListResponse, Services } from './services';
|
|
82
|
+
export {
|
|
83
|
+
UsageListResponse,
|
|
84
|
+
UsageListWithGroupsResponse,
|
|
85
|
+
UsageListParams,
|
|
86
|
+
UsageIngestParams,
|
|
87
|
+
UsageListWithGroupsParams,
|
|
88
|
+
Usage,
|
|
89
|
+
} from './usage';
|
|
90
|
+
export { Webhooks } from './webhooks';
|