@metronome/sdk 0.1.0-beta.9 → 0.2.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 +194 -0
- package/README.md +30 -46
- package/_shims/index.d.ts +2 -0
- package/_shims/index.js +5 -1
- package/_shims/index.mjs +5 -1
- package/core.d.ts +19 -5
- package/core.d.ts.map +1 -1
- package/core.js +23 -14
- package/core.js.map +1 -1
- package/core.mjs +24 -15
- package/core.mjs.map +1 -1
- package/index.d.mts +3 -2
- package/index.d.ts +3 -2
- package/index.d.ts.map +1 -1
- package/index.js +6 -3
- package/index.js.map +1 -1
- package/index.mjs +6 -3
- package/index.mjs.map +1 -1
- package/package.json +1 -5
- package/pagination.d.ts +1 -0
- package/pagination.d.ts.map +1 -1
- package/pagination.js +3 -0
- package/pagination.js.map +1 -1
- package/pagination.mjs +3 -0
- package/pagination.mjs.map +1 -1
- package/resource.d.ts +1 -1
- package/resource.d.ts.map +1 -1
- package/resource.js.map +1 -1
- package/resource.mjs.map +1 -1
- package/resources/shared.d.ts +521 -37
- package/resources/shared.d.ts.map +1 -1
- package/resources/v1/alerts.d.ts +30 -10
- package/resources/v1/alerts.d.ts.map +1 -1
- package/resources/v1/alerts.js +19 -0
- package/resources/v1/alerts.js.map +1 -1
- package/resources/v1/alerts.mjs +19 -0
- package/resources/v1/alerts.mjs.map +1 -1
- package/resources/v1/audit-logs.d.ts +8 -0
- package/resources/v1/audit-logs.d.ts.map +1 -1
- package/resources/v1/audit-logs.js.map +1 -1
- package/resources/v1/audit-logs.mjs.map +1 -1
- package/resources/v1/billable-metrics.d.ts +58 -3
- package/resources/v1/billable-metrics.d.ts.map +1 -1
- package/resources/v1/billable-metrics.js +41 -0
- package/resources/v1/billable-metrics.js.map +1 -1
- package/resources/v1/billable-metrics.mjs +41 -0
- package/resources/v1/billable-metrics.mjs.map +1 -1
- package/resources/v1/contracts/contracts.d.ts +1556 -122
- package/resources/v1/contracts/contracts.d.ts.map +1 -1
- package/resources/v1/contracts/contracts.js +180 -3
- package/resources/v1/contracts/contracts.js.map +1 -1
- package/resources/v1/contracts/contracts.mjs +180 -3
- package/resources/v1/contracts/contracts.mjs.map +1 -1
- package/resources/v1/contracts/index.d.ts +2 -2
- package/resources/v1/contracts/index.d.ts.map +1 -1
- package/resources/v1/contracts/index.js.map +1 -1
- package/resources/v1/contracts/index.mjs.map +1 -1
- package/resources/v1/contracts/named-schedules.d.ts +21 -0
- package/resources/v1/contracts/named-schedules.d.ts.map +1 -1
- package/resources/v1/contracts/named-schedules.js +21 -0
- package/resources/v1/contracts/named-schedules.js.map +1 -1
- package/resources/v1/contracts/named-schedules.mjs +21 -0
- package/resources/v1/contracts/named-schedules.mjs.map +1 -1
- package/resources/v1/contracts/products.d.ts +51 -3
- package/resources/v1/contracts/products.d.ts.map +1 -1
- package/resources/v1/contracts/products.js +33 -0
- package/resources/v1/contracts/products.js.map +1 -1
- package/resources/v1/contracts/products.mjs +33 -0
- package/resources/v1/contracts/products.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/index.d.ts +1 -1
- package/resources/v1/contracts/rate-cards/index.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/index.js.map +1 -1
- package/resources/v1/contracts/rate-cards/index.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/named-schedules.d.ts +25 -0
- package/resources/v1/contracts/rate-cards/named-schedules.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/named-schedules.js +25 -0
- package/resources/v1/contracts/rate-cards/named-schedules.js.map +1 -1
- package/resources/v1/contracts/rate-cards/named-schedules.mjs +25 -0
- package/resources/v1/contracts/rate-cards/named-schedules.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/product-orders.d.ts +30 -0
- package/resources/v1/contracts/rate-cards/product-orders.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/product-orders.js +30 -0
- package/resources/v1/contracts/rate-cards/product-orders.js.map +1 -1
- package/resources/v1/contracts/rate-cards/product-orders.mjs +30 -0
- package/resources/v1/contracts/rate-cards/product-orders.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/rate-cards.d.ts +107 -10
- package/resources/v1/contracts/rate-cards/rate-cards.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/rate-cards.js +71 -0
- package/resources/v1/contracts/rate-cards/rate-cards.js.map +1 -1
- package/resources/v1/contracts/rate-cards/rate-cards.mjs +71 -0
- package/resources/v1/contracts/rate-cards/rate-cards.mjs.map +1 -1
- package/resources/v1/contracts/rate-cards/rates.d.ts +102 -14
- package/resources/v1/contracts/rate-cards/rates.d.ts.map +1 -1
- package/resources/v1/contracts/rate-cards/rates.js +68 -0
- package/resources/v1/contracts/rate-cards/rates.js.map +1 -1
- package/resources/v1/contracts/rate-cards/rates.mjs +68 -0
- package/resources/v1/contracts/rate-cards/rates.mjs.map +1 -1
- package/resources/v1/credit-grants.d.ts +77 -2
- package/resources/v1/credit-grants.d.ts.map +1 -1
- package/resources/v1/credit-grants.js +39 -2
- package/resources/v1/credit-grants.js.map +1 -1
- package/resources/v1/credit-grants.mjs +39 -2
- package/resources/v1/credit-grants.mjs.map +1 -1
- package/resources/v1/custom-fields.d.ts +51 -7
- package/resources/v1/custom-fields.d.ts.map +1 -1
- package/resources/v1/custom-fields.js +35 -0
- package/resources/v1/custom-fields.js.map +1 -1
- package/resources/v1/custom-fields.mjs +35 -0
- package/resources/v1/custom-fields.mjs.map +1 -1
- package/resources/v1/customers/alerts.d.ts +37 -0
- package/resources/v1/customers/alerts.d.ts.map +1 -1
- package/resources/v1/customers/alerts.js +23 -0
- package/resources/v1/customers/alerts.js.map +1 -1
- package/resources/v1/customers/alerts.mjs +23 -0
- package/resources/v1/customers/alerts.mjs.map +1 -1
- package/resources/v1/customers/billing-config.d.ts +31 -0
- package/resources/v1/customers/billing-config.d.ts.map +1 -1
- package/resources/v1/customers/billing-config.js +27 -0
- package/resources/v1/customers/billing-config.js.map +1 -1
- package/resources/v1/customers/billing-config.mjs +27 -0
- package/resources/v1/customers/billing-config.mjs.map +1 -1
- package/resources/v1/customers/commits.d.ts +94 -7
- package/resources/v1/customers/commits.d.ts.map +1 -1
- package/resources/v1/customers/commits.js +56 -1
- package/resources/v1/customers/commits.js.map +1 -1
- package/resources/v1/customers/commits.mjs +56 -1
- package/resources/v1/customers/commits.mjs.map +1 -1
- package/resources/v1/customers/credits.d.ts +73 -3
- package/resources/v1/customers/credits.d.ts.map +1 -1
- package/resources/v1/customers/credits.js +41 -1
- package/resources/v1/customers/credits.js.map +1 -1
- package/resources/v1/customers/credits.mjs +41 -1
- package/resources/v1/customers/credits.mjs.map +1 -1
- package/resources/v1/customers/customers.d.ts +186 -9
- package/resources/v1/customers/customers.d.ts.map +1 -1
- package/resources/v1/customers/customers.js +106 -1
- package/resources/v1/customers/customers.js.map +1 -1
- package/resources/v1/customers/customers.mjs +106 -1
- package/resources/v1/customers/customers.mjs.map +1 -1
- package/resources/v1/customers/index.d.ts +1 -1
- package/resources/v1/customers/index.d.ts.map +1 -1
- package/resources/v1/customers/index.js.map +1 -1
- package/resources/v1/customers/index.mjs.map +1 -1
- package/resources/v1/customers/invoices.d.ts +144 -52
- package/resources/v1/customers/invoices.d.ts.map +1 -1
- package/resources/v1/customers/invoices.js +49 -0
- package/resources/v1/customers/invoices.js.map +1 -1
- package/resources/v1/customers/invoices.mjs +49 -0
- package/resources/v1/customers/invoices.mjs.map +1 -1
- package/resources/v1/customers/named-schedules.d.ts +21 -0
- package/resources/v1/customers/named-schedules.d.ts.map +1 -1
- package/resources/v1/customers/named-schedules.js +21 -0
- package/resources/v1/customers/named-schedules.js.map +1 -1
- package/resources/v1/customers/named-schedules.mjs +21 -0
- package/resources/v1/customers/named-schedules.mjs.map +1 -1
- package/resources/v1/customers/plans.d.ts +46 -1
- package/resources/v1/customers/plans.d.ts.map +1 -1
- package/resources/v1/customers/plans.js +43 -0
- package/resources/v1/customers/plans.js.map +1 -1
- package/resources/v1/customers/plans.mjs +43 -0
- package/resources/v1/customers/plans.mjs.map +1 -1
- package/resources/v1/dashboards.d.ts +31 -3
- package/resources/v1/dashboards.d.ts.map +1 -1
- package/resources/v1/dashboards.js +26 -0
- package/resources/v1/dashboards.js.map +1 -1
- package/resources/v1/dashboards.mjs +26 -0
- package/resources/v1/dashboards.mjs.map +1 -1
- package/resources/v1/index.d.ts +3 -3
- package/resources/v1/index.d.ts.map +1 -1
- package/resources/v1/index.js.map +1 -1
- package/resources/v1/index.mjs.map +1 -1
- package/resources/v1/invoices.d.ts +14 -0
- package/resources/v1/invoices.d.ts.map +1 -1
- package/resources/v1/invoices.js +14 -0
- package/resources/v1/invoices.js.map +1 -1
- package/resources/v1/invoices.mjs +14 -0
- package/resources/v1/invoices.mjs.map +1 -1
- package/resources/v1/plans.d.ts +47 -4
- package/resources/v1/plans.d.ts.map +1 -1
- package/resources/v1/plans.js +27 -0
- package/resources/v1/plans.js.map +1 -1
- package/resources/v1/plans.mjs +27 -0
- package/resources/v1/plans.mjs.map +1 -1
- package/resources/v1/pricing-units.d.ts +8 -0
- package/resources/v1/pricing-units.d.ts.map +1 -1
- package/resources/v1/pricing-units.js.map +1 -1
- package/resources/v1/pricing-units.mjs.map +1 -1
- package/resources/v1/services.d.ts +5 -0
- package/resources/v1/services.d.ts.map +1 -1
- package/resources/v1/services.js +5 -0
- package/resources/v1/services.js.map +1 -1
- package/resources/v1/services.mjs +5 -0
- package/resources/v1/services.mjs.map +1 -1
- package/resources/v1/usage.d.ts +161 -3
- package/resources/v1/usage.d.ts.map +1 -1
- package/resources/v1/usage.js +46 -0
- package/resources/v1/usage.js.map +1 -1
- package/resources/v1/usage.mjs +46 -0
- package/resources/v1/usage.mjs.map +1 -1
- package/resources/v1/v1.d.ts +6 -6
- package/resources/v1/v1.d.ts.map +1 -1
- package/resources/v1/v1.js.map +1 -1
- package/resources/v1/v1.mjs.map +1 -1
- package/resources/v2/contracts.d.ts +3241 -205
- package/resources/v2/contracts.d.ts.map +1 -1
- package/resources/v2/contracts.js +90 -2
- package/resources/v2/contracts.js.map +1 -1
- package/resources/v2/contracts.mjs +90 -2
- package/resources/v2/contracts.mjs.map +1 -1
- package/resources/webhooks.js +5 -5
- package/resources/webhooks.js.map +1 -1
- package/resources/webhooks.mjs +5 -5
- package/resources/webhooks.mjs.map +1 -1
- package/src/_shims/auto/runtime-bun.ts +1 -1
- package/src/_shims/auto/runtime-node.ts +1 -1
- package/src/_shims/auto/runtime.ts +1 -1
- package/src/_shims/auto/types-node.ts +1 -1
- package/src/_shims/bun-runtime.ts +2 -2
- package/src/_shims/index.d.ts +5 -3
- package/src/_shims/index.js +5 -1
- package/src/_shims/index.mjs +6 -2
- package/src/_shims/node-runtime.ts +3 -3
- package/src/_shims/registry.ts +1 -1
- package/src/_shims/web-runtime.ts +3 -3
- package/src/core.ts +46 -18
- package/src/error.ts +1 -1
- package/src/index.ts +22 -16
- package/src/internal/qs/formats.ts +1 -1
- package/src/internal/qs/index.ts +3 -3
- package/src/internal/qs/stringify.ts +3 -3
- package/src/internal/qs/utils.ts +2 -2
- package/src/pagination.ts +5 -1
- package/src/resource.ts +2 -2
- package/src/resources/index.ts +4 -4
- package/src/resources/shared.ts +605 -40
- package/src/resources/v1/alerts.ts +33 -13
- package/src/resources/v1/audit-logs.ts +12 -4
- package/src/resources/v1/billable-metrics.ts +57 -8
- package/src/resources/v1/contracts/contracts.ts +1723 -135
- package/src/resources/v1/contracts/index.ts +8 -4
- package/src/resources/v1/contracts/named-schedules.ts +23 -2
- package/src/resources/v1/contracts/products.ts +53 -9
- package/src/resources/v1/contracts/rate-cards/index.ts +6 -4
- package/src/resources/v1/contracts/rate-cards/named-schedules.ts +27 -2
- package/src/resources/v1/contracts/rate-cards/product-orders.ts +33 -3
- package/src/resources/v1/contracts/rate-cards/rate-cards.ts +113 -20
- package/src/resources/v1/contracts/rate-cards/rates.ts +86 -18
- package/src/resources/v1/contracts/rate-cards.ts +1 -1
- package/src/resources/v1/contracts.ts +1 -1
- package/src/resources/v1/credit-grants.ts +82 -10
- package/src/resources/v1/custom-fields.ts +57 -9
- package/src/resources/v1/customers/alerts.ts +44 -3
- package/src/resources/v1/customers/billing-config.ts +34 -2
- package/src/resources/v1/customers/commits.ts +97 -10
- package/src/resources/v1/customers/credits.ts +76 -6
- package/src/resources/v1/customers/customers.ts +208 -27
- package/src/resources/v1/customers/index.ts +10 -8
- package/src/resources/v1/customers/invoices.ts +123 -57
- package/src/resources/v1/customers/named-schedules.ts +23 -2
- package/src/resources/v1/customers/plans.ts +48 -5
- package/src/resources/v1/customers.ts +1 -1
- package/src/resources/v1/dashboards.ts +33 -5
- package/src/resources/v1/index.ts +20 -14
- package/src/resources/v1/invoices.ts +16 -2
- package/src/resources/v1/plans.ts +45 -10
- package/src/resources/v1/pricing-units.ts +12 -4
- package/src/resources/v1/services.ts +7 -2
- package/src/resources/v1/usage.ts +187 -6
- package/src/resources/v1/v1.ts +39 -27
- package/src/resources/v1.ts +1 -1
- package/src/resources/v2/contracts.ts +3838 -261
- package/src/resources/v2/index.ts +2 -2
- package/src/resources/v2/v2.ts +3 -3
- package/src/resources/v2.ts +1 -1
- package/src/resources/webhooks.ts +7 -7
- package/src/resources.ts +1 -1
- package/src/shims/node.ts +3 -3
- package/src/shims/web.ts +3 -3
- package/src/uploads.ts +4 -4
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from
|
|
4
|
-
import { isRequestOptions } from
|
|
5
|
-
import * as Core from
|
|
6
|
-
import * as Shared from
|
|
7
|
-
import * as AlertsAPI from
|
|
3
|
+
import { APIResource } from "../../../resource.js";
|
|
4
|
+
import { isRequestOptions } from "../../../core.js";
|
|
5
|
+
import * as Core from "../../../core.js";
|
|
6
|
+
import * as Shared from "../../shared.js";
|
|
7
|
+
import * as AlertsAPI from "./alerts.js";
|
|
8
8
|
import {
|
|
9
9
|
AlertListParams,
|
|
10
10
|
AlertListResponse,
|
|
@@ -13,16 +13,16 @@ import {
|
|
|
13
13
|
AlertRetrieveResponse,
|
|
14
14
|
Alerts,
|
|
15
15
|
CustomerAlert,
|
|
16
|
-
} from
|
|
17
|
-
import * as BillingConfigAPI from
|
|
16
|
+
} from "./alerts.js";
|
|
17
|
+
import * as BillingConfigAPI from "./billing-config.js";
|
|
18
18
|
import {
|
|
19
19
|
BillingConfig as BillingConfigAPIBillingConfig,
|
|
20
20
|
BillingConfigCreateParams,
|
|
21
21
|
BillingConfigDeleteParams,
|
|
22
22
|
BillingConfigRetrieveParams,
|
|
23
23
|
BillingConfigRetrieveResponse,
|
|
24
|
-
} from
|
|
25
|
-
import * as CommitsAPI from
|
|
24
|
+
} from "./billing-config.js";
|
|
25
|
+
import * as CommitsAPI from "./commits.js";
|
|
26
26
|
import {
|
|
27
27
|
CommitCreateParams,
|
|
28
28
|
CommitCreateResponse,
|
|
@@ -31,8 +31,8 @@ import {
|
|
|
31
31
|
CommitUpdateEndDateParams,
|
|
32
32
|
CommitUpdateEndDateResponse,
|
|
33
33
|
Commits,
|
|
34
|
-
} from
|
|
35
|
-
import * as CreditsAPI from
|
|
34
|
+
} from "./commits.js";
|
|
35
|
+
import * as CreditsAPI from "./credits.js";
|
|
36
36
|
import {
|
|
37
37
|
CreditCreateParams,
|
|
38
38
|
CreditCreateResponse,
|
|
@@ -41,8 +41,8 @@ import {
|
|
|
41
41
|
CreditUpdateEndDateParams,
|
|
42
42
|
CreditUpdateEndDateResponse,
|
|
43
43
|
Credits,
|
|
44
|
-
} from
|
|
45
|
-
import * as InvoicesAPI from
|
|
44
|
+
} from "./credits.js";
|
|
45
|
+
import * as InvoicesAPI from "./invoices.js";
|
|
46
46
|
import {
|
|
47
47
|
Invoice,
|
|
48
48
|
InvoiceAddChargeParams,
|
|
@@ -55,15 +55,15 @@ import {
|
|
|
55
55
|
InvoiceRetrieveResponse,
|
|
56
56
|
Invoices,
|
|
57
57
|
InvoicesCursorPage,
|
|
58
|
-
} from
|
|
59
|
-
import * as NamedSchedulesAPI from
|
|
58
|
+
} from "./invoices.js";
|
|
59
|
+
import * as NamedSchedulesAPI from "./named-schedules.js";
|
|
60
60
|
import {
|
|
61
61
|
NamedScheduleRetrieveParams,
|
|
62
62
|
NamedScheduleRetrieveResponse,
|
|
63
63
|
NamedScheduleUpdateParams,
|
|
64
64
|
NamedSchedules,
|
|
65
|
-
} from
|
|
66
|
-
import * as PlansAPI from
|
|
65
|
+
} from "./named-schedules.js";
|
|
66
|
+
import * as PlansAPI from "./plans.js";
|
|
67
67
|
import {
|
|
68
68
|
PlanAddParams,
|
|
69
69
|
PlanAddResponse,
|
|
@@ -76,8 +76,8 @@ import {
|
|
|
76
76
|
PlanListResponse,
|
|
77
77
|
PlanListResponsesCursorPage,
|
|
78
78
|
Plans,
|
|
79
|
-
} from
|
|
80
|
-
import { CursorPage, type CursorPageParams } from
|
|
79
|
+
} from "./plans.js";
|
|
80
|
+
import { CursorPage, type CursorPageParams } from "../../../pagination.js";
|
|
81
81
|
|
|
82
82
|
export class Customers extends APIResource {
|
|
83
83
|
alerts: AlertsAPI.Alerts = new AlertsAPI.Alerts(this._client);
|
|
@@ -90,6 +90,24 @@ export class Customers extends APIResource {
|
|
|
90
90
|
|
|
91
91
|
/**
|
|
92
92
|
* Create a new customer
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```ts
|
|
96
|
+
* const customer = await client.v1.customers.create({
|
|
97
|
+
* name: 'Example, Inc.',
|
|
98
|
+
* customer_billing_provider_configurations: [
|
|
99
|
+
* {
|
|
100
|
+
* billing_provider: 'stripe',
|
|
101
|
+
* delivery_method: 'direct_to_billing_provider',
|
|
102
|
+
* configuration: {
|
|
103
|
+
* stripe_customer_id: 'cus_123',
|
|
104
|
+
* stripe_collection_method: 'charge_automatically',
|
|
105
|
+
* },
|
|
106
|
+
* },
|
|
107
|
+
* ],
|
|
108
|
+
* ingest_aliases: ['team@example.com'],
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
93
111
|
*/
|
|
94
112
|
create(body: CustomerCreateParams, options?: Core.RequestOptions): Core.APIPromise<CustomerCreateResponse> {
|
|
95
113
|
return this._client.post('/v1/customers', { body, ...options });
|
|
@@ -97,6 +115,13 @@ export class Customers extends APIResource {
|
|
|
97
115
|
|
|
98
116
|
/**
|
|
99
117
|
* Get a customer by Metronome ID.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* const customer = await client.v1.customers.retrieve({
|
|
122
|
+
* customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
|
|
123
|
+
* });
|
|
124
|
+
* ```
|
|
100
125
|
*/
|
|
101
126
|
retrieve(
|
|
102
127
|
params: CustomerRetrieveParams,
|
|
@@ -108,6 +133,14 @@ export class Customers extends APIResource {
|
|
|
108
133
|
|
|
109
134
|
/**
|
|
110
135
|
* List all customers.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```ts
|
|
139
|
+
* // Automatically fetches more pages as needed.
|
|
140
|
+
* for await (const customerDetail of client.v1.customers.list()) {
|
|
141
|
+
* // ...
|
|
142
|
+
* }
|
|
143
|
+
* ```
|
|
111
144
|
*/
|
|
112
145
|
list(
|
|
113
146
|
query?: CustomerListParams,
|
|
@@ -125,7 +158,15 @@ export class Customers extends APIResource {
|
|
|
125
158
|
}
|
|
126
159
|
|
|
127
160
|
/**
|
|
128
|
-
* Archive a customer
|
|
161
|
+
* Archive a customer Note: any alerts associated with the customer will not be
|
|
162
|
+
* triggered.
|
|
163
|
+
*
|
|
164
|
+
* @example
|
|
165
|
+
* ```ts
|
|
166
|
+
* const response = await client.v1.customers.archive({
|
|
167
|
+
* id: '8deed800-1b7a-495d-a207-6c52bac54dc9',
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
129
170
|
*/
|
|
130
171
|
archive(
|
|
131
172
|
body: CustomerArchiveParams,
|
|
@@ -136,6 +177,16 @@ export class Customers extends APIResource {
|
|
|
136
177
|
|
|
137
178
|
/**
|
|
138
179
|
* Get all billable metrics for a given customer.
|
|
180
|
+
*
|
|
181
|
+
* @example
|
|
182
|
+
* ```ts
|
|
183
|
+
* // Automatically fetches more pages as needed.
|
|
184
|
+
* for await (const customerListBillableMetricsResponse of client.v1.customers.listBillableMetrics(
|
|
185
|
+
* { customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc' },
|
|
186
|
+
* )) {
|
|
187
|
+
* // ...
|
|
188
|
+
* }
|
|
189
|
+
* ```
|
|
139
190
|
*/
|
|
140
191
|
listBillableMetrics(
|
|
141
192
|
params: CustomerListBillableMetricsParams,
|
|
@@ -153,6 +204,20 @@ export class Customers extends APIResource {
|
|
|
153
204
|
* Fetch daily pending costs for the specified customer, broken down by credit type
|
|
154
205
|
* and line items. Note: this is not supported for customers whose plan includes a
|
|
155
206
|
* UNIQUE-type billable metric.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```ts
|
|
210
|
+
* // Automatically fetches more pages as needed.
|
|
211
|
+
* for await (const customerListCostsResponse of client.v1.customers.listCosts(
|
|
212
|
+
* {
|
|
213
|
+
* customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
|
|
214
|
+
* ending_before: '2019-12-27T18:11:19.117Z',
|
|
215
|
+
* starting_on: '2019-12-27T18:11:19.117Z',
|
|
216
|
+
* },
|
|
217
|
+
* )) {
|
|
218
|
+
* // ...
|
|
219
|
+
* }
|
|
220
|
+
* ```
|
|
156
221
|
*/
|
|
157
222
|
listCosts(
|
|
158
223
|
params: CustomerListCostsParams,
|
|
@@ -166,10 +231,46 @@ export class Customers extends APIResource {
|
|
|
166
231
|
);
|
|
167
232
|
}
|
|
168
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Preview how a set of events will affect a customer's invoice. Generates a draft
|
|
236
|
+
* invoice for a customer using their current contract configuration and the
|
|
237
|
+
* provided events. This is useful for testing how new events will affect the
|
|
238
|
+
* customer's invoice before they are actually processed.
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* const response = await client.v1.customers.previewEvents({
|
|
243
|
+
* customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
|
|
244
|
+
* events: [
|
|
245
|
+
* {
|
|
246
|
+
* event_type: 'heartbeat',
|
|
247
|
+
* timestamp: '2021-01-01T00:00:00Z',
|
|
248
|
+
* properties: { cpu_hours: 100, memory_gb_hours: 200 },
|
|
249
|
+
* },
|
|
250
|
+
* ],
|
|
251
|
+
* });
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
previewEvents(
|
|
255
|
+
params: CustomerPreviewEventsParams,
|
|
256
|
+
options?: Core.RequestOptions,
|
|
257
|
+
): Core.APIPromise<CustomerPreviewEventsResponse> {
|
|
258
|
+
const { customer_id, ...body } = params;
|
|
259
|
+
return this._client.post(`/v1/customers/${customer_id}/previewEvents`, { body, ...options });
|
|
260
|
+
}
|
|
261
|
+
|
|
169
262
|
/**
|
|
170
263
|
* Sets the ingest aliases for a customer. Ingest aliases can be used in the
|
|
171
264
|
* `customer_id` field when sending usage events to Metronome. This call is
|
|
172
265
|
* idempotent. It fully replaces the set of ingest aliases for the given customer.
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* ```ts
|
|
269
|
+
* await client.v1.customers.setIngestAliases({
|
|
270
|
+
* customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
|
|
271
|
+
* ingest_aliases: ['team@example.com'],
|
|
272
|
+
* });
|
|
273
|
+
* ```
|
|
173
274
|
*/
|
|
174
275
|
setIngestAliases(
|
|
175
276
|
params: CustomerSetIngestAliasesParams,
|
|
@@ -185,6 +286,14 @@ export class Customers extends APIResource {
|
|
|
185
286
|
|
|
186
287
|
/**
|
|
187
288
|
* Updates the specified customer's name.
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```ts
|
|
292
|
+
* const response = await client.v1.customers.setName({
|
|
293
|
+
* customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
|
|
294
|
+
* name: 'Example, Inc.',
|
|
295
|
+
* });
|
|
296
|
+
* ```
|
|
188
297
|
*/
|
|
189
298
|
setName(
|
|
190
299
|
params: CustomerSetNameParams,
|
|
@@ -196,6 +305,14 @@ export class Customers extends APIResource {
|
|
|
196
305
|
|
|
197
306
|
/**
|
|
198
307
|
* Updates the specified customer's config.
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* ```ts
|
|
311
|
+
* await client.v1.customers.updateConfig({
|
|
312
|
+
* customer_id: 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
|
|
313
|
+
* salesforce_account_id: '0015500001WO1ZiABL',
|
|
314
|
+
* });
|
|
315
|
+
* ```
|
|
199
316
|
*/
|
|
200
317
|
updateConfig(params: CustomerUpdateConfigParams, options?: Core.RequestOptions): Core.APIPromise<void> {
|
|
201
318
|
const { customer_id, ...body } = params;
|
|
@@ -233,7 +350,7 @@ export interface Customer {
|
|
|
233
350
|
|
|
234
351
|
name: string;
|
|
235
352
|
|
|
236
|
-
custom_fields?:
|
|
353
|
+
custom_fields?: { [key: string]: string };
|
|
237
354
|
}
|
|
238
355
|
|
|
239
356
|
export interface CustomerDetail {
|
|
@@ -242,7 +359,12 @@ export interface CustomerDetail {
|
|
|
242
359
|
*/
|
|
243
360
|
id: string;
|
|
244
361
|
|
|
245
|
-
|
|
362
|
+
/**
|
|
363
|
+
* RFC 3339 timestamp indicating when the customer was created.
|
|
364
|
+
*/
|
|
365
|
+
created_at: string;
|
|
366
|
+
|
|
367
|
+
custom_fields: { [key: string]: string };
|
|
246
368
|
|
|
247
369
|
customer_config: CustomerDetail.CustomerConfig;
|
|
248
370
|
|
|
@@ -335,7 +457,7 @@ export interface CustomerListBillableMetricsResponse {
|
|
|
335
457
|
*/
|
|
336
458
|
archived_at?: string;
|
|
337
459
|
|
|
338
|
-
custom_fields?:
|
|
460
|
+
custom_fields?: { [key: string]: string };
|
|
339
461
|
|
|
340
462
|
/**
|
|
341
463
|
* An optional filtering rule to match the 'event_type' property of an event.
|
|
@@ -345,7 +467,7 @@ export interface CustomerListBillableMetricsResponse {
|
|
|
345
467
|
/**
|
|
346
468
|
* (DEPRECATED) use property_filters & event_type_filter instead
|
|
347
469
|
*/
|
|
348
|
-
filter?:
|
|
470
|
+
filter?: { [key: string]: unknown };
|
|
349
471
|
|
|
350
472
|
/**
|
|
351
473
|
* (DEPRECATED) use group_keys instead
|
|
@@ -372,7 +494,7 @@ export interface CustomerListBillableMetricsResponse {
|
|
|
372
494
|
}
|
|
373
495
|
|
|
374
496
|
export interface CustomerListCostsResponse {
|
|
375
|
-
credit_types:
|
|
497
|
+
credit_types: { [key: string]: CustomerListCostsResponse.CreditTypes };
|
|
376
498
|
|
|
377
499
|
end_timestamp: string;
|
|
378
500
|
|
|
@@ -401,6 +523,10 @@ export namespace CustomerListCostsResponse {
|
|
|
401
523
|
}
|
|
402
524
|
}
|
|
403
525
|
|
|
526
|
+
export interface CustomerPreviewEventsResponse {
|
|
527
|
+
data: InvoicesAPI.Invoice;
|
|
528
|
+
}
|
|
529
|
+
|
|
404
530
|
export interface CustomerSetNameResponse {
|
|
405
531
|
data: Customer;
|
|
406
532
|
}
|
|
@@ -413,7 +539,7 @@ export interface CustomerCreateParams {
|
|
|
413
539
|
|
|
414
540
|
billing_config?: CustomerCreateParams.BillingConfig;
|
|
415
541
|
|
|
416
|
-
custom_fields?:
|
|
542
|
+
custom_fields?: { [key: string]: string };
|
|
417
543
|
|
|
418
544
|
customer_billing_provider_configurations?: Array<CustomerCreateParams.CustomerBillingProviderConfiguration>;
|
|
419
545
|
|
|
@@ -492,7 +618,7 @@ export namespace CustomerCreateParams {
|
|
|
492
618
|
* object, however, for most billing provider + delivery method combinations, it
|
|
493
619
|
* will not be a valid configuration.
|
|
494
620
|
*/
|
|
495
|
-
configuration?:
|
|
621
|
+
configuration?: { [key: string]: unknown };
|
|
496
622
|
|
|
497
623
|
/**
|
|
498
624
|
* The method to use for delivering invoices to this customer. If not provided, the
|
|
@@ -575,6 +701,59 @@ export interface CustomerListCostsParams extends CursorPageParams {
|
|
|
575
701
|
starting_on: string;
|
|
576
702
|
}
|
|
577
703
|
|
|
704
|
+
export interface CustomerPreviewEventsParams {
|
|
705
|
+
/**
|
|
706
|
+
* Path param:
|
|
707
|
+
*/
|
|
708
|
+
customer_id: string;
|
|
709
|
+
|
|
710
|
+
/**
|
|
711
|
+
* Body param:
|
|
712
|
+
*/
|
|
713
|
+
events: Array<CustomerPreviewEventsParams.Event>;
|
|
714
|
+
|
|
715
|
+
/**
|
|
716
|
+
* Body param: If set to "replace", the preview will be generated as if those were
|
|
717
|
+
* the only events for the specified customer. If set to "merge", the events will
|
|
718
|
+
* be merged with any existing events for the specified customer. Defaults to
|
|
719
|
+
* "replace".
|
|
720
|
+
*/
|
|
721
|
+
mode?: 'replace' | 'merge';
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Body param: If set, all zero quantity line items will be filtered out of the
|
|
725
|
+
* response.
|
|
726
|
+
*/
|
|
727
|
+
skip_zero_qty_line_items?: boolean;
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
export namespace CustomerPreviewEventsParams {
|
|
731
|
+
export interface Event {
|
|
732
|
+
event_type: string;
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* This has no effect for preview events, but may be set for consistency with Event
|
|
736
|
+
* objects. They will be processed even if they do not match the customer's ID or
|
|
737
|
+
* ingest aliases.
|
|
738
|
+
*/
|
|
739
|
+
customer_id?: string;
|
|
740
|
+
|
|
741
|
+
properties?: { [key: string]: unknown };
|
|
742
|
+
|
|
743
|
+
/**
|
|
744
|
+
* RFC 3339 formatted. If not provided, the current time will be used.
|
|
745
|
+
*/
|
|
746
|
+
timestamp?: string;
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
|
+
* This has no effect for preview events, but may be set for consistency with Event
|
|
750
|
+
* objects. Duplicate transaction_ids are NOT filtered out, even within the same
|
|
751
|
+
* request.
|
|
752
|
+
*/
|
|
753
|
+
transaction_id?: string;
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
|
|
578
757
|
export interface CustomerSetIngestAliasesParams {
|
|
579
758
|
/**
|
|
580
759
|
* Path param:
|
|
@@ -642,6 +821,7 @@ export declare namespace Customers {
|
|
|
642
821
|
type CustomerArchiveResponse as CustomerArchiveResponse,
|
|
643
822
|
type CustomerListBillableMetricsResponse as CustomerListBillableMetricsResponse,
|
|
644
823
|
type CustomerListCostsResponse as CustomerListCostsResponse,
|
|
824
|
+
type CustomerPreviewEventsResponse as CustomerPreviewEventsResponse,
|
|
645
825
|
type CustomerSetNameResponse as CustomerSetNameResponse,
|
|
646
826
|
CustomerDetailsCursorPage as CustomerDetailsCursorPage,
|
|
647
827
|
CustomerListBillableMetricsResponsesCursorPage as CustomerListBillableMetricsResponsesCursorPage,
|
|
@@ -652,6 +832,7 @@ export declare namespace Customers {
|
|
|
652
832
|
type CustomerArchiveParams as CustomerArchiveParams,
|
|
653
833
|
type CustomerListBillableMetricsParams as CustomerListBillableMetricsParams,
|
|
654
834
|
type CustomerListCostsParams as CustomerListCostsParams,
|
|
835
|
+
type CustomerPreviewEventsParams as CustomerPreviewEventsParams,
|
|
655
836
|
type CustomerSetIngestAliasesParams as CustomerSetIngestAliasesParams,
|
|
656
837
|
type CustomerSetNameParams as CustomerSetNameParams,
|
|
657
838
|
type CustomerUpdateConfigParams as CustomerUpdateConfigParams,
|
|
@@ -8,14 +8,14 @@ export {
|
|
|
8
8
|
type AlertRetrieveParams,
|
|
9
9
|
type AlertListParams,
|
|
10
10
|
type AlertResetParams,
|
|
11
|
-
} from
|
|
11
|
+
} from "./alerts.js";
|
|
12
12
|
export {
|
|
13
13
|
BillingConfig,
|
|
14
14
|
type BillingConfigRetrieveResponse,
|
|
15
15
|
type BillingConfigCreateParams,
|
|
16
16
|
type BillingConfigRetrieveParams,
|
|
17
17
|
type BillingConfigDeleteParams,
|
|
18
|
-
} from
|
|
18
|
+
} from "./billing-config.js";
|
|
19
19
|
export {
|
|
20
20
|
Commits,
|
|
21
21
|
type CommitCreateResponse,
|
|
@@ -24,7 +24,7 @@ export {
|
|
|
24
24
|
type CommitCreateParams,
|
|
25
25
|
type CommitListParams,
|
|
26
26
|
type CommitUpdateEndDateParams,
|
|
27
|
-
} from
|
|
27
|
+
} from "./commits.js";
|
|
28
28
|
export {
|
|
29
29
|
Credits,
|
|
30
30
|
type CreditCreateResponse,
|
|
@@ -33,7 +33,7 @@ export {
|
|
|
33
33
|
type CreditCreateParams,
|
|
34
34
|
type CreditListParams,
|
|
35
35
|
type CreditUpdateEndDateParams,
|
|
36
|
-
} from
|
|
36
|
+
} from "./credits.js";
|
|
37
37
|
export {
|
|
38
38
|
CustomerDetailsCursorPage,
|
|
39
39
|
CustomerListBillableMetricsResponsesCursorPage,
|
|
@@ -46,6 +46,7 @@ export {
|
|
|
46
46
|
type CustomerArchiveResponse,
|
|
47
47
|
type CustomerListBillableMetricsResponse,
|
|
48
48
|
type CustomerListCostsResponse,
|
|
49
|
+
type CustomerPreviewEventsResponse,
|
|
49
50
|
type CustomerSetNameResponse,
|
|
50
51
|
type CustomerCreateParams,
|
|
51
52
|
type CustomerRetrieveParams,
|
|
@@ -53,10 +54,11 @@ export {
|
|
|
53
54
|
type CustomerArchiveParams,
|
|
54
55
|
type CustomerListBillableMetricsParams,
|
|
55
56
|
type CustomerListCostsParams,
|
|
57
|
+
type CustomerPreviewEventsParams,
|
|
56
58
|
type CustomerSetIngestAliasesParams,
|
|
57
59
|
type CustomerSetNameParams,
|
|
58
60
|
type CustomerUpdateConfigParams,
|
|
59
|
-
} from
|
|
61
|
+
} from "./customers.js";
|
|
60
62
|
export {
|
|
61
63
|
InvoicesCursorPage,
|
|
62
64
|
InvoiceListBreakdownsResponsesCursorPage,
|
|
@@ -69,13 +71,13 @@ export {
|
|
|
69
71
|
type InvoiceListParams,
|
|
70
72
|
type InvoiceAddChargeParams,
|
|
71
73
|
type InvoiceListBreakdownsParams,
|
|
72
|
-
} from
|
|
74
|
+
} from "./invoices.js";
|
|
73
75
|
export {
|
|
74
76
|
NamedSchedules,
|
|
75
77
|
type NamedScheduleRetrieveResponse,
|
|
76
78
|
type NamedScheduleRetrieveParams,
|
|
77
79
|
type NamedScheduleUpdateParams,
|
|
78
|
-
} from
|
|
80
|
+
} from "./named-schedules.js";
|
|
79
81
|
export {
|
|
80
82
|
PlanListResponsesCursorPage,
|
|
81
83
|
PlanListPriceAdjustmentsResponsesCursorPage,
|
|
@@ -88,4 +90,4 @@ export {
|
|
|
88
90
|
type PlanAddParams,
|
|
89
91
|
type PlanEndParams,
|
|
90
92
|
type PlanListPriceAdjustmentsParams,
|
|
91
|
-
} from
|
|
93
|
+
} from "./plans.js";
|