@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
|
@@ -6,26 +6,93 @@ import { CursorPage, type CursorPageParams } from "../../pagination.js";
|
|
|
6
6
|
export declare class CreditGrants extends APIResource {
|
|
7
7
|
/**
|
|
8
8
|
* Create a new credit grant
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const creditGrant = await client.v1.creditGrants.create({
|
|
13
|
+
* customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
14
|
+
* expires_at: '2022-04-01T00:00:00Z',
|
|
15
|
+
* grant_amount: {
|
|
16
|
+
* amount: 1000,
|
|
17
|
+
* credit_type_id: '5ae401dc-a648-4b49-9ac3-391bb5bc4d7b',
|
|
18
|
+
* },
|
|
19
|
+
* name: 'Acme Corp Promotional Credit Grant',
|
|
20
|
+
* paid_amount: {
|
|
21
|
+
* amount: 5000,
|
|
22
|
+
* credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
|
|
23
|
+
* },
|
|
24
|
+
* priority: 0.5,
|
|
25
|
+
* credit_grant_type: 'trial',
|
|
26
|
+
* effective_at: '2022-02-01T00:00:00Z',
|
|
27
|
+
* reason: 'Incentivize new customer',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
9
30
|
*/
|
|
10
31
|
create(body: CreditGrantCreateParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantCreateResponse>;
|
|
11
32
|
/**
|
|
12
33
|
* List credit grants. This list does not included voided grants.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* // Automatically fetches more pages as needed.
|
|
38
|
+
* for await (const creditGrantListResponse of client.v1.creditGrants.list(
|
|
39
|
+
* {
|
|
40
|
+
* credit_type_ids: [
|
|
41
|
+
* '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
|
|
42
|
+
* ],
|
|
43
|
+
* customer_ids: [
|
|
44
|
+
* 'd7abd0cd-4ae9-4db7-8676-e986a4ebd8dc',
|
|
45
|
+
* '0e5b8609-d901-4992-b394-c3c2e3f37b1c',
|
|
46
|
+
* ],
|
|
47
|
+
* effective_before: '2022-02-01T00:00:00Z',
|
|
48
|
+
* not_expiring_before: '2022-02-01T00:00:00Z',
|
|
49
|
+
* },
|
|
50
|
+
* )) {
|
|
51
|
+
* // ...
|
|
52
|
+
* }
|
|
53
|
+
* ```
|
|
13
54
|
*/
|
|
14
55
|
list(params?: CreditGrantListParams, options?: Core.RequestOptions): Core.PagePromise<CreditGrantListResponsesCursorPage, CreditGrantListResponse>;
|
|
15
56
|
list(options?: Core.RequestOptions): Core.PagePromise<CreditGrantListResponsesCursorPage, CreditGrantListResponse>;
|
|
16
57
|
/**
|
|
17
58
|
* Edit an existing credit grant
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* const response = await client.v1.creditGrants.edit({
|
|
63
|
+
* id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
64
|
+
* expires_at: '2022-04-01T00:00:00Z',
|
|
65
|
+
* name: 'Acme Corp Promotional Credit Grant',
|
|
66
|
+
* });
|
|
67
|
+
* ```
|
|
18
68
|
*/
|
|
19
69
|
edit(body: CreditGrantEditParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantEditResponse>;
|
|
20
70
|
/**
|
|
21
71
|
* Fetches a list of credit ledger entries. Returns lists of ledgers per customer.
|
|
22
72
|
* Ledger entries are returned in chronological order. Ledger entries associated
|
|
23
73
|
* with voided credit grants are not included.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const response = await client.v1.creditGrants.listEntries({
|
|
78
|
+
* credit_type_ids: ['2714e483-4ff1-48e4-9e25-ac732e8f24f2'],
|
|
79
|
+
* customer_ids: ['6a37bb88-8538-48c5-b37b-a41c836328bd'],
|
|
80
|
+
* ending_before: '2021-02-01T00:00:00Z',
|
|
81
|
+
* starting_on: '2021-01-01T00:00:00Z',
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
24
84
|
*/
|
|
25
85
|
listEntries(params?: CreditGrantListEntriesParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantListEntriesResponse>;
|
|
26
86
|
listEntries(options?: Core.RequestOptions): Core.APIPromise<CreditGrantListEntriesResponse>;
|
|
27
87
|
/**
|
|
28
88
|
* Void a credit grant
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* const response = await client.v1.creditGrants.void({
|
|
93
|
+
* id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
94
|
+
* });
|
|
95
|
+
* ```
|
|
29
96
|
*/
|
|
30
97
|
void(body: CreditGrantVoidParams, options?: Core.RequestOptions): Core.APIPromise<CreditGrantVoidResponse>;
|
|
31
98
|
}
|
|
@@ -89,7 +156,9 @@ export interface CreditGrantListResponse {
|
|
|
89
156
|
* before the end of the current billing period.
|
|
90
157
|
*/
|
|
91
158
|
balance: CreditGrantListResponse.Balance;
|
|
92
|
-
custom_fields:
|
|
159
|
+
custom_fields: {
|
|
160
|
+
[key: string]: string;
|
|
161
|
+
};
|
|
93
162
|
/**
|
|
94
163
|
* the Metronome ID of the customer
|
|
95
164
|
*/
|
|
@@ -269,7 +338,9 @@ export interface CreditGrantCreateParams {
|
|
|
269
338
|
/**
|
|
270
339
|
* Custom fields to attach to the credit grant.
|
|
271
340
|
*/
|
|
272
|
-
custom_fields?:
|
|
341
|
+
custom_fields?: {
|
|
342
|
+
[key: string]: string;
|
|
343
|
+
};
|
|
273
344
|
/**
|
|
274
345
|
* The credit grant will only apply to usage or charges dated on or after this
|
|
275
346
|
* timestamp
|
|
@@ -391,6 +462,10 @@ export interface CreditGrantListEntriesParams {
|
|
|
391
462
|
* Query param: Cursor that indicates where the next page of results should start.
|
|
392
463
|
*/
|
|
393
464
|
next_page?: string;
|
|
465
|
+
/**
|
|
466
|
+
* Query param: Ledgers sort order by date, asc or desc. Defaults to asc.
|
|
467
|
+
*/
|
|
468
|
+
sort?: 'asc' | 'desc';
|
|
394
469
|
/**
|
|
395
470
|
* Body param: A list of Metronome credit type IDs to fetch ledger entries for. If
|
|
396
471
|
* absent, ledger entries for all credit types will be returned.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit-grants.d.ts","sourceRoot":"","sources":["../../src/resources/v1/credit-grants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAA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I,2BAA2B,EAC/D,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,kCAAkC,IAAI,kCAAkC,EACxE,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,4BAA4B,IAAI,4BAA4B,EACjE,KAAK,qBAAqB,IAAI,qBAAqB,GACpD,CAAC;CACH"}
|
|
@@ -8,6 +8,27 @@ const pagination_1 = require("../../pagination.js");
|
|
|
8
8
|
class CreditGrants extends resource_1.APIResource {
|
|
9
9
|
/**
|
|
10
10
|
* Create a new credit grant
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* const creditGrant = await client.v1.creditGrants.create({
|
|
15
|
+
* customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
16
|
+
* expires_at: '2022-04-01T00:00:00Z',
|
|
17
|
+
* grant_amount: {
|
|
18
|
+
* amount: 1000,
|
|
19
|
+
* credit_type_id: '5ae401dc-a648-4b49-9ac3-391bb5bc4d7b',
|
|
20
|
+
* },
|
|
21
|
+
* name: 'Acme Corp Promotional Credit Grant',
|
|
22
|
+
* paid_amount: {
|
|
23
|
+
* amount: 5000,
|
|
24
|
+
* credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
|
|
25
|
+
* },
|
|
26
|
+
* priority: 0.5,
|
|
27
|
+
* credit_grant_type: 'trial',
|
|
28
|
+
* effective_at: '2022-02-01T00:00:00Z',
|
|
29
|
+
* reason: 'Incentivize new customer',
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
11
32
|
*/
|
|
12
33
|
create(body, options) {
|
|
13
34
|
return this._client.post('/v1/credits/createGrant', { body, ...options });
|
|
@@ -26,6 +47,15 @@ class CreditGrants extends resource_1.APIResource {
|
|
|
26
47
|
}
|
|
27
48
|
/**
|
|
28
49
|
* Edit an existing credit grant
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const response = await client.v1.creditGrants.edit({
|
|
54
|
+
* id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
55
|
+
* expires_at: '2022-04-01T00:00:00Z',
|
|
56
|
+
* name: 'Acme Corp Promotional Credit Grant',
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
29
59
|
*/
|
|
30
60
|
edit(body, options) {
|
|
31
61
|
return this._client.post('/v1/credits/editGrant', { body, ...options });
|
|
@@ -34,11 +64,18 @@ class CreditGrants extends resource_1.APIResource {
|
|
|
34
64
|
if ((0, core_1.isRequestOptions)(params)) {
|
|
35
65
|
return this.listEntries({}, params);
|
|
36
66
|
}
|
|
37
|
-
const { next_page, ...body } = params;
|
|
38
|
-
return this._client.post('/v1/credits/listEntries', { query: { next_page }, body, ...options });
|
|
67
|
+
const { next_page, sort, ...body } = params;
|
|
68
|
+
return this._client.post('/v1/credits/listEntries', { query: { next_page, sort }, body, ...options });
|
|
39
69
|
}
|
|
40
70
|
/**
|
|
41
71
|
* Void a credit grant
|
|
72
|
+
*
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* const response = await client.v1.creditGrants.void({
|
|
76
|
+
* id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
42
79
|
*/
|
|
43
80
|
void(body, options) {
|
|
44
81
|
return this._client.post('/v1/credits/voidGrant', { body, ...options });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit-grants.js","sourceRoot":"","sources":["../../src/resources/v1/credit-grants.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAC7C,wCAA8C;AAI9C,oDAAqE;AAEr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ACrC;QACD,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxG,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,IAA2B,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF;AA1ID,oCA0IC;AAED,MAAa,kCAAmC,SAAQ,uBAAmC;CAAG;AAA9F,gFAA8F;AA8e9F,YAAY,CAAC,kCAAkC,GAAG,kCAAkC,CAAC"}
|
|
@@ -5,6 +5,27 @@ import { CursorPage } from "../../pagination.mjs";
|
|
|
5
5
|
export class CreditGrants extends APIResource {
|
|
6
6
|
/**
|
|
7
7
|
* Create a new credit grant
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const creditGrant = await client.v1.creditGrants.create({
|
|
12
|
+
* customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
13
|
+
* expires_at: '2022-04-01T00:00:00Z',
|
|
14
|
+
* grant_amount: {
|
|
15
|
+
* amount: 1000,
|
|
16
|
+
* credit_type_id: '5ae401dc-a648-4b49-9ac3-391bb5bc4d7b',
|
|
17
|
+
* },
|
|
18
|
+
* name: 'Acme Corp Promotional Credit Grant',
|
|
19
|
+
* paid_amount: {
|
|
20
|
+
* amount: 5000,
|
|
21
|
+
* credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
|
|
22
|
+
* },
|
|
23
|
+
* priority: 0.5,
|
|
24
|
+
* credit_grant_type: 'trial',
|
|
25
|
+
* effective_at: '2022-02-01T00:00:00Z',
|
|
26
|
+
* reason: 'Incentivize new customer',
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
8
29
|
*/
|
|
9
30
|
create(body, options) {
|
|
10
31
|
return this._client.post('/v1/credits/createGrant', { body, ...options });
|
|
@@ -23,6 +44,15 @@ export class CreditGrants extends APIResource {
|
|
|
23
44
|
}
|
|
24
45
|
/**
|
|
25
46
|
* Edit an existing credit grant
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* const response = await client.v1.creditGrants.edit({
|
|
51
|
+
* id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
52
|
+
* expires_at: '2022-04-01T00:00:00Z',
|
|
53
|
+
* name: 'Acme Corp Promotional Credit Grant',
|
|
54
|
+
* });
|
|
55
|
+
* ```
|
|
26
56
|
*/
|
|
27
57
|
edit(body, options) {
|
|
28
58
|
return this._client.post('/v1/credits/editGrant', { body, ...options });
|
|
@@ -31,11 +61,18 @@ export class CreditGrants extends APIResource {
|
|
|
31
61
|
if (isRequestOptions(params)) {
|
|
32
62
|
return this.listEntries({}, params);
|
|
33
63
|
}
|
|
34
|
-
const { next_page, ...body } = params;
|
|
35
|
-
return this._client.post('/v1/credits/listEntries', { query: { next_page }, body, ...options });
|
|
64
|
+
const { next_page, sort, ...body } = params;
|
|
65
|
+
return this._client.post('/v1/credits/listEntries', { query: { next_page, sort }, body, ...options });
|
|
36
66
|
}
|
|
37
67
|
/**
|
|
38
68
|
* Void a credit grant
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const response = await client.v1.creditGrants.void({
|
|
73
|
+
* id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
39
76
|
*/
|
|
40
77
|
void(body, options) {
|
|
41
78
|
return this._client.post('/v1/credits/voidGrant', { body, ...options });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit-grants.mjs","sourceRoot":"","sources":["../../src/resources/v1/credit-grants.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAIpB,EAAE,UAAU,EAAyB;AAE5C,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C
|
|
1
|
+
{"version":3,"file":"credit-grants.mjs","sourceRoot":"","sources":["../../src/resources/v1/credit-grants.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;OAIpB,EAAE,UAAU,EAAyB;AAE5C,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,MAAM,CACJ,IAA6B,EAC7B,OAA6B;QAE7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5E,CAAC;IAgCD,IAAI,CACF,SAAsD,EAAE,EACxD,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SAC9B;QACD,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC7C,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,wBAAwB,EAAE,kCAAkC,EAAE;YAC3F,KAAK,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE;YAC3B,IAAI;YACJ,MAAM,EAAE,MAAM;YACd,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,IAAI,CAAC,IAA2B,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;IAsBD,WAAW,CACT,SAA6D,EAAE,EAC/D,OAA6B;QAE7B,IAAI,gBAAgB,CAAC,MAAM,CAAC,EAAE;YAC5B,OAAO,IAAI,CAAC,WAAW,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;SACrC;QACD,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxG,CAAC;IAED;;;;;;;;;OASG;IACH,IAAI,CAAC,IAA2B,EAAE,OAA6B;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF;AAED,MAAM,OAAO,kCAAmC,SAAQ,UAAmC;CAAG;AA8e9F,YAAY,CAAC,kCAAkC,GAAG,kCAAkC,CAAC"}
|
|
@@ -4,19 +4,52 @@ export declare class CustomFields extends APIResource {
|
|
|
4
4
|
/**
|
|
5
5
|
* Add a key to the allow list for a given entity. There is a 100 character limit
|
|
6
6
|
* on custom field keys.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* await client.v1.customFields.addKey({
|
|
11
|
+
* enforce_uniqueness: true,
|
|
12
|
+
* entity: 'customer',
|
|
13
|
+
* key: 'x_account_id',
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
7
16
|
*/
|
|
8
17
|
addKey(body: CustomFieldAddKeyParams, options?: Core.RequestOptions): Core.APIPromise<void>;
|
|
9
18
|
/**
|
|
10
19
|
* Deletes one or more custom fields on an instance of a Metronome entity.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* await client.v1.customFields.deleteValues({
|
|
24
|
+
* entity: 'customer',
|
|
25
|
+
* entity_id: '99594816-e8a5-4bca-be21-8d1de0f45120',
|
|
26
|
+
* keys: ['x_account_id'],
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
11
29
|
*/
|
|
12
30
|
deleteValues(body: CustomFieldDeleteValuesParams, options?: Core.RequestOptions): Core.APIPromise<void>;
|
|
13
31
|
/**
|
|
14
32
|
* List all active custom field keys, optionally filtered by entity type.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const response = await client.v1.customFields.listKeys({
|
|
37
|
+
* entities: ['customer'],
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
15
40
|
*/
|
|
16
41
|
listKeys(params?: CustomFieldListKeysParams, options?: Core.RequestOptions): Core.APIPromise<CustomFieldListKeysResponse>;
|
|
17
42
|
listKeys(options?: Core.RequestOptions): Core.APIPromise<CustomFieldListKeysResponse>;
|
|
18
43
|
/**
|
|
19
44
|
* Remove a key from the allow list for a given entity.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* await client.v1.customFields.removeKey({
|
|
49
|
+
* entity: 'customer',
|
|
50
|
+
* key: 'x_account_id',
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
20
53
|
*/
|
|
21
54
|
removeKey(body: CustomFieldRemoveKeyParams, options?: Core.RequestOptions): Core.APIPromise<void>;
|
|
22
55
|
/**
|
|
@@ -27,6 +60,15 @@ export declare class CustomFields extends APIResource {
|
|
|
27
60
|
* transactional and will update all key/value pairs or no key/value pairs. Partial
|
|
28
61
|
* updates are not supported. There is a 200 character limit on custom field
|
|
29
62
|
* values.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```ts
|
|
66
|
+
* await client.v1.customFields.setValues({
|
|
67
|
+
* custom_fields: { x_account_id: 'KyVnHhSBWl7eY2bl' },
|
|
68
|
+
* entity: 'customer',
|
|
69
|
+
* entity_id: '99594816-e8a5-4bca-be21-8d1de0f45120',
|
|
70
|
+
* });
|
|
71
|
+
* ```
|
|
30
72
|
*/
|
|
31
73
|
setValues(body: CustomFieldSetValuesParams, options?: Core.RequestOptions): Core.APIPromise<void>;
|
|
32
74
|
}
|
|
@@ -37,17 +79,17 @@ export interface CustomFieldListKeysResponse {
|
|
|
37
79
|
export declare namespace CustomFieldListKeysResponse {
|
|
38
80
|
interface Data {
|
|
39
81
|
enforce_uniqueness: boolean;
|
|
40
|
-
entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge';
|
|
82
|
+
entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge' | 'subscription';
|
|
41
83
|
key: string;
|
|
42
84
|
}
|
|
43
85
|
}
|
|
44
86
|
export interface CustomFieldAddKeyParams {
|
|
45
87
|
enforce_uniqueness: boolean;
|
|
46
|
-
entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge';
|
|
88
|
+
entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge' | 'subscription';
|
|
47
89
|
key: string;
|
|
48
90
|
}
|
|
49
91
|
export interface CustomFieldDeleteValuesParams {
|
|
50
|
-
entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge';
|
|
92
|
+
entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge' | 'subscription';
|
|
51
93
|
entity_id: string;
|
|
52
94
|
keys: Array<string>;
|
|
53
95
|
}
|
|
@@ -59,15 +101,17 @@ export interface CustomFieldListKeysParams {
|
|
|
59
101
|
/**
|
|
60
102
|
* Body param: Optional list of entity types to return keys for
|
|
61
103
|
*/
|
|
62
|
-
entities?: Array<'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge'>;
|
|
104
|
+
entities?: Array<'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge' | 'subscription'>;
|
|
63
105
|
}
|
|
64
106
|
export interface CustomFieldRemoveKeyParams {
|
|
65
|
-
entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge';
|
|
107
|
+
entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge' | 'subscription';
|
|
66
108
|
key: string;
|
|
67
109
|
}
|
|
68
110
|
export interface CustomFieldSetValuesParams {
|
|
69
|
-
custom_fields:
|
|
70
|
-
|
|
111
|
+
custom_fields: {
|
|
112
|
+
[key: string]: string;
|
|
113
|
+
};
|
|
114
|
+
entity: 'alert' | 'billable_metric' | 'charge' | 'commit' | 'contract_credit' | 'contract_product' | 'contract' | 'credit_grant' | 'customer_plan' | 'customer' | 'discount' | 'invoice' | 'plan' | 'professional_service' | 'product' | 'rate_card' | 'scheduled_charge' | 'subscription';
|
|
71
115
|
entity_id: string;
|
|
72
116
|
}
|
|
73
117
|
export declare namespace CustomFields {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-fields.d.ts","sourceRoot":"","sources":["../../src/resources/v1/custom-fields.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,qBAAa,YAAa,SAAQ,WAAW;IAC3C
|
|
1
|
+
{"version":3,"file":"custom-fields.d.ts","sourceRoot":"","sources":["../../src/resources/v1/custom-fields.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAEnC,qBAAa,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,IAAI,EAAE,uBAAuB,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAQ3F;;;;;;;;;;;OAWG;IACH,YAAY,CAAC,IAAI,EAAE,6BAA6B,EAAE,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;IAQvG;;;;;;;;;OASG;IACH,QAAQ,CACN,MAAM,CAAC,EAAE,yBAAyB,EAClC,OAAO,CAA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ACR,iBAAiB,GACjB,kBAAkB,GAClB,UAAU,GACV,cAAc,GACd,eAAe,GACf,UAAU,GACV,UAAU,GACV,SAAS,GACT,MAAM,GACN,sBAAsB,GACtB,SAAS,GACT,WAAW,GACX,kBAAkB,GAClB,cAAc,CAAC;IAEnB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,CAAC,OAAO,WAAW,YAAY,CAAC;IACpC,OAAO,EACL,KAAK,2BAA2B,IAAI,2BAA2B,EAC/D,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,yBAAyB,IAAI,yBAAyB,EAC3D,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,0BAA0B,IAAI,0BAA0B,GAC9D,CAAC;CACH"}
|
|
@@ -8,6 +8,15 @@ class CustomFields extends resource_1.APIResource {
|
|
|
8
8
|
/**
|
|
9
9
|
* Add a key to the allow list for a given entity. There is a 100 character limit
|
|
10
10
|
* on custom field keys.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* await client.v1.customFields.addKey({
|
|
15
|
+
* enforce_uniqueness: true,
|
|
16
|
+
* entity: 'customer',
|
|
17
|
+
* key: 'x_account_id',
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
11
20
|
*/
|
|
12
21
|
addKey(body, options) {
|
|
13
22
|
return this._client.post('/v1/customFields/addKey', {
|
|
@@ -18,6 +27,15 @@ class CustomFields extends resource_1.APIResource {
|
|
|
18
27
|
}
|
|
19
28
|
/**
|
|
20
29
|
* Deletes one or more custom fields on an instance of a Metronome entity.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* await client.v1.customFields.deleteValues({
|
|
34
|
+
* entity: 'customer',
|
|
35
|
+
* entity_id: '99594816-e8a5-4bca-be21-8d1de0f45120',
|
|
36
|
+
* keys: ['x_account_id'],
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
21
39
|
*/
|
|
22
40
|
deleteValues(body, options) {
|
|
23
41
|
return this._client.post('/v1/customFields/deleteValues', {
|
|
@@ -35,6 +53,14 @@ class CustomFields extends resource_1.APIResource {
|
|
|
35
53
|
}
|
|
36
54
|
/**
|
|
37
55
|
* Remove a key from the allow list for a given entity.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* await client.v1.customFields.removeKey({
|
|
60
|
+
* entity: 'customer',
|
|
61
|
+
* key: 'x_account_id',
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
38
64
|
*/
|
|
39
65
|
removeKey(body, options) {
|
|
40
66
|
return this._client.post('/v1/customFields/removeKey', {
|
|
@@ -51,6 +77,15 @@ class CustomFields extends resource_1.APIResource {
|
|
|
51
77
|
* transactional and will update all key/value pairs or no key/value pairs. Partial
|
|
52
78
|
* updates are not supported. There is a 200 character limit on custom field
|
|
53
79
|
* values.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* await client.v1.customFields.setValues({
|
|
84
|
+
* custom_fields: { x_account_id: 'KyVnHhSBWl7eY2bl' },
|
|
85
|
+
* entity: 'customer',
|
|
86
|
+
* entity_id: '99594816-e8a5-4bca-be21-8d1de0f45120',
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
54
89
|
*/
|
|
55
90
|
setValues(body, options) {
|
|
56
91
|
return this._client.post('/v1/customFields/setValues', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-fields.js","sourceRoot":"","sources":["../../src/resources/v1/custom-fields.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6C;AAC7C,wCAA8C;AAG9C,MAAa,YAAa,SAAQ,sBAAW;IAC3C
|
|
1
|
+
{"version":3,"file":"custom-fields.js","sourceRoot":"","sources":["../../src/resources/v1/custom-fields.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gDAA6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;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,IAAgC,EAAE,OAA6B;QACvE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,4BAA4B,EAAE;YACrD,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;CACF;AAhHD,oCAgHC"}
|
|
@@ -5,6 +5,15 @@ export class CustomFields extends APIResource {
|
|
|
5
5
|
/**
|
|
6
6
|
* Add a key to the allow list for a given entity. There is a 100 character limit
|
|
7
7
|
* on custom field keys.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* await client.v1.customFields.addKey({
|
|
12
|
+
* enforce_uniqueness: true,
|
|
13
|
+
* entity: 'customer',
|
|
14
|
+
* key: 'x_account_id',
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
8
17
|
*/
|
|
9
18
|
addKey(body, options) {
|
|
10
19
|
return this._client.post('/v1/customFields/addKey', {
|
|
@@ -15,6 +24,15 @@ export class CustomFields extends APIResource {
|
|
|
15
24
|
}
|
|
16
25
|
/**
|
|
17
26
|
* Deletes one or more custom fields on an instance of a Metronome entity.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* await client.v1.customFields.deleteValues({
|
|
31
|
+
* entity: 'customer',
|
|
32
|
+
* entity_id: '99594816-e8a5-4bca-be21-8d1de0f45120',
|
|
33
|
+
* keys: ['x_account_id'],
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
18
36
|
*/
|
|
19
37
|
deleteValues(body, options) {
|
|
20
38
|
return this._client.post('/v1/customFields/deleteValues', {
|
|
@@ -32,6 +50,14 @@ export class CustomFields extends APIResource {
|
|
|
32
50
|
}
|
|
33
51
|
/**
|
|
34
52
|
* Remove a key from the allow list for a given entity.
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* await client.v1.customFields.removeKey({
|
|
57
|
+
* entity: 'customer',
|
|
58
|
+
* key: 'x_account_id',
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
35
61
|
*/
|
|
36
62
|
removeKey(body, options) {
|
|
37
63
|
return this._client.post('/v1/customFields/removeKey', {
|
|
@@ -48,6 +74,15 @@ export class CustomFields extends APIResource {
|
|
|
48
74
|
* transactional and will update all key/value pairs or no key/value pairs. Partial
|
|
49
75
|
* updates are not supported. There is a 200 character limit on custom field
|
|
50
76
|
* values.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* await client.v1.customFields.setValues({
|
|
81
|
+
* custom_fields: { x_account_id: 'KyVnHhSBWl7eY2bl' },
|
|
82
|
+
* entity: 'customer',
|
|
83
|
+
* entity_id: '99594816-e8a5-4bca-be21-8d1de0f45120',
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
51
86
|
*/
|
|
52
87
|
setValues(body, options) {
|
|
53
88
|
return this._client.post('/v1/customFields/setValues', {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-fields.mjs","sourceRoot":"","sources":["../../src/resources/v1/custom-fields.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;AAG3B,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C
|
|
1
|
+
{"version":3,"file":"custom-fields.mjs","sourceRoot":"","sources":["../../src/resources/v1/custom-fields.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,EAAE,gBAAgB,EAAE;AAG3B,MAAM,OAAO,YAAa,SAAQ,WAAW;IAC3C;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,IAA6B,EAAE,OAA6B;QACjE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,yBAAyB,EAAE;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M,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,OAAO,EAAE;SAChD,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -5,14 +5,37 @@ export declare class Alerts extends APIResource {
|
|
|
5
5
|
/**
|
|
6
6
|
* Get the customer alert status and alert information for the specified customer
|
|
7
7
|
* and alert
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const alert = await client.v1.customers.alerts.retrieve({
|
|
12
|
+
* alert_id: '8deed800-1b7a-495d-a207-6c52bac54dc9',
|
|
13
|
+
* customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
14
|
+
* });
|
|
15
|
+
* ```
|
|
8
16
|
*/
|
|
9
17
|
retrieve(body: AlertRetrieveParams, options?: Core.RequestOptions): Core.APIPromise<AlertRetrieveResponse>;
|
|
10
18
|
/**
|
|
11
19
|
* Fetch all customer alert statuses and alert information for a customer
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* const alerts = await client.v1.customers.alerts.list({
|
|
24
|
+
* customer_id: '9b85c1c1-5238-4f2a-a409-61412905e1e1',
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
12
27
|
*/
|
|
13
28
|
list(params: AlertListParams, options?: Core.RequestOptions): Core.APIPromise<AlertListResponse>;
|
|
14
29
|
/**
|
|
15
30
|
* Reset state for an alert by customer id and force re-evaluation
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* await client.v1.customers.alerts.reset({
|
|
35
|
+
* alert_id: '5e8691bf-b22a-4672-922d-f80eee940f01',
|
|
36
|
+
* customer_id: '4c83caf3-8af4-44e2-9aeb-e290531726d9',
|
|
37
|
+
* });
|
|
38
|
+
* ```
|
|
16
39
|
*/
|
|
17
40
|
reset(body: AlertResetParams, options?: Core.RequestOptions): Core.APIPromise<void>;
|
|
18
41
|
}
|
|
@@ -70,6 +93,11 @@ export declare namespace CustomerAlert {
|
|
|
70
93
|
* items. Only present for spend alerts.
|
|
71
94
|
*/
|
|
72
95
|
group_key_filter?: Alert.GroupKeyFilter;
|
|
96
|
+
/**
|
|
97
|
+
* Only present for `spend_threshold_reached` alerts. Scope alert to a specific
|
|
98
|
+
* group key on individual line items.
|
|
99
|
+
*/
|
|
100
|
+
group_values?: Array<Alert.GroupValue>;
|
|
73
101
|
/**
|
|
74
102
|
* Only supported for invoice_total_reached alerts. A list of invoice types to
|
|
75
103
|
* evaluate.
|
|
@@ -96,6 +124,10 @@ export declare namespace CustomerAlert {
|
|
|
96
124
|
key: string;
|
|
97
125
|
value: string;
|
|
98
126
|
}
|
|
127
|
+
interface GroupValue {
|
|
128
|
+
key: string;
|
|
129
|
+
value: string;
|
|
130
|
+
}
|
|
99
131
|
}
|
|
100
132
|
}
|
|
101
133
|
export interface AlertRetrieveResponse {
|
|
@@ -114,6 +146,11 @@ export interface AlertRetrieveParams {
|
|
|
114
146
|
* The Metronome ID of the customer
|
|
115
147
|
*/
|
|
116
148
|
customer_id: string;
|
|
149
|
+
/**
|
|
150
|
+
* When parallel alerts are enabled during migration, this flag denotes whether to
|
|
151
|
+
* fetch alerts for plans or contracts.
|
|
152
|
+
*/
|
|
153
|
+
plans_or_contracts?: 'PLANS' | 'CONTRACTS';
|
|
117
154
|
}
|
|
118
155
|
export interface AlertListParams {
|
|
119
156
|
/**
|