@metronome/sdk 0.1.0-beta.9 → 0.1.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 +179 -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 -1
- 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 +473 -37
- package/resources/shared.d.ts.map +1 -1
- package/resources/v1/alerts.d.ts +26 -2
- 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 +1478 -102
- 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 +28 -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 +30 -2
- 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 +2923 -207
- 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 +539 -40
- package/src/resources/v1/alerts.ts +29 -5
- 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 +1643 -124
- 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 +32 -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 +30 -4
- 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 +3397 -235
- 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,12 +1,45 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from
|
|
4
|
-
import * as Core from
|
|
5
|
-
import * as Shared from
|
|
3
|
+
import { APIResource } from "../../../resource.js";
|
|
4
|
+
import * as Core from "../../../core.js";
|
|
5
|
+
import * as Shared from "../../shared.js";
|
|
6
6
|
|
|
7
7
|
export class Commits extends APIResource {
|
|
8
8
|
/**
|
|
9
9
|
* Create a new commit at the customer level.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const commit = await client.v1.customers.commits.create({
|
|
14
|
+
* access_schedule: {
|
|
15
|
+
* credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
|
|
16
|
+
* schedule_items: [
|
|
17
|
+
* {
|
|
18
|
+
* amount: 1000,
|
|
19
|
+
* starting_at: '2020-01-01T00:00:00.000Z',
|
|
20
|
+
* ending_before: '2020-02-01T00:00:00.000Z',
|
|
21
|
+
* },
|
|
22
|
+
* ],
|
|
23
|
+
* },
|
|
24
|
+
* customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
|
|
25
|
+
* priority: 100,
|
|
26
|
+
* product_id: 'f14d6729-6a44-4b13-9908-9387f1918790',
|
|
27
|
+
* type: 'prepaid',
|
|
28
|
+
* invoice_contract_id:
|
|
29
|
+
* 'e57d6929-c2f1-4796-a9a8-63cedefe848d',
|
|
30
|
+
* invoice_schedule: {
|
|
31
|
+
* credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
|
|
32
|
+
* schedule_items: [
|
|
33
|
+
* {
|
|
34
|
+
* unit_price: 10000000,
|
|
35
|
+
* quantity: 1,
|
|
36
|
+
* timestamp: '2020-03-01T00:00:00.000Z',
|
|
37
|
+
* },
|
|
38
|
+
* ],
|
|
39
|
+
* },
|
|
40
|
+
* name: 'My Commit',
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
10
43
|
*/
|
|
11
44
|
create(body: CommitCreateParams, options?: Core.RequestOptions): Core.APIPromise<CommitCreateResponse> {
|
|
12
45
|
return this._client.post('/v1/contracts/customerCommits/create', { body, ...options });
|
|
@@ -14,13 +47,35 @@ export class Commits extends APIResource {
|
|
|
14
47
|
|
|
15
48
|
/**
|
|
16
49
|
* List commits.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* const commits = await client.v1.customers.commits.list({
|
|
54
|
+
* customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
|
|
55
|
+
* commit_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
|
|
56
|
+
* include_ledgers: true,
|
|
57
|
+
* });
|
|
58
|
+
* ```
|
|
17
59
|
*/
|
|
18
60
|
list(body: CommitListParams, options?: Core.RequestOptions): Core.APIPromise<CommitListResponse> {
|
|
19
61
|
return this._client.post('/v1/contracts/customerCommits/list', { body, ...options });
|
|
20
62
|
}
|
|
21
63
|
|
|
22
64
|
/**
|
|
23
|
-
*
|
|
65
|
+
* Pull forward the end date of a prepaid commit. Use the "edit a commit" endpoint
|
|
66
|
+
* to extend the end date of a prepaid commit, or to make other edits to the
|
|
67
|
+
* commit.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const response =
|
|
72
|
+
* await client.v1.customers.commits.updateEndDate({
|
|
73
|
+
* commit_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
|
|
74
|
+
* customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
|
|
75
|
+
* access_ending_before: '2020-01-01T00:00:00.000Z',
|
|
76
|
+
* invoices_ending_before: '2020-01-01T00:00:00.000Z',
|
|
77
|
+
* });
|
|
78
|
+
* ```
|
|
24
79
|
*/
|
|
25
80
|
updateEndDate(
|
|
26
81
|
body: CommitUpdateEndDateParams,
|
|
@@ -74,18 +129,20 @@ export interface CommitCreateParams {
|
|
|
74
129
|
applicable_contract_ids?: Array<string>;
|
|
75
130
|
|
|
76
131
|
/**
|
|
77
|
-
* Which products the commit applies to. If
|
|
78
|
-
* applicable_product_tags are not provided, the commit applies to
|
|
132
|
+
* Which products the commit applies to. If applicable_product_ids,
|
|
133
|
+
* applicable_product_tags or specifiers are not provided, the commit applies to
|
|
134
|
+
* all products.
|
|
79
135
|
*/
|
|
80
136
|
applicable_product_ids?: Array<string>;
|
|
81
137
|
|
|
82
138
|
/**
|
|
83
|
-
* Which tags the commit applies to. If
|
|
84
|
-
* applicable_product_tags are not provided, the commit applies to
|
|
139
|
+
* Which tags the commit applies to. If applicable_product_ids,
|
|
140
|
+
* applicable_product_tags or specifiers are not provided, the commit applies to
|
|
141
|
+
* all products.
|
|
85
142
|
*/
|
|
86
143
|
applicable_product_tags?: Array<string>;
|
|
87
144
|
|
|
88
|
-
custom_fields?:
|
|
145
|
+
custom_fields?: { [key: string]: string };
|
|
89
146
|
|
|
90
147
|
/**
|
|
91
148
|
* Used only in UI/API. It is not exposed to end customers.
|
|
@@ -124,6 +181,14 @@ export interface CommitCreateParams {
|
|
|
124
181
|
*/
|
|
125
182
|
salesforce_opportunity_id?: string;
|
|
126
183
|
|
|
184
|
+
/**
|
|
185
|
+
* List of filters that determine what kind of customer usage draws down a commit
|
|
186
|
+
* or credit. A customer's usage needs to meet the condition of at least one of the
|
|
187
|
+
* specifiers to contribute to a commit's or credit's drawdown. This field cannot
|
|
188
|
+
* be used together with `applicable_product_ids` or `applicable_product_tags`.
|
|
189
|
+
*/
|
|
190
|
+
specifiers?: Array<CommitCreateParams.Specifier>;
|
|
191
|
+
|
|
127
192
|
/**
|
|
128
193
|
* Prevents the creation of duplicates. If a request to create a commit or credit
|
|
129
194
|
* is made with a uniqueness key that was previously used to create a commit or
|
|
@@ -259,6 +324,23 @@ export namespace CommitCreateParams {
|
|
|
259
324
|
unit_price?: number;
|
|
260
325
|
}
|
|
261
326
|
}
|
|
327
|
+
|
|
328
|
+
export interface Specifier {
|
|
329
|
+
presentation_group_values?: { [key: string]: string };
|
|
330
|
+
|
|
331
|
+
pricing_group_values?: { [key: string]: string };
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* If provided, the specifier will only apply to the product with the specified ID.
|
|
335
|
+
*/
|
|
336
|
+
product_id?: string;
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
|
+
* If provided, the specifier will only apply to products with all the specified
|
|
340
|
+
* tags.
|
|
341
|
+
*/
|
|
342
|
+
product_tags?: Array<string>;
|
|
343
|
+
}
|
|
262
344
|
}
|
|
263
345
|
|
|
264
346
|
export interface CommitListParams {
|
|
@@ -277,7 +359,7 @@ export interface CommitListParams {
|
|
|
277
359
|
effective_before?: string;
|
|
278
360
|
|
|
279
361
|
/**
|
|
280
|
-
* Include commits from archived contracts.
|
|
362
|
+
* Include archived commits and commits from archived contracts.
|
|
281
363
|
*/
|
|
282
364
|
include_archived?: boolean;
|
|
283
365
|
|
|
@@ -298,6 +380,11 @@ export interface CommitListParams {
|
|
|
298
380
|
*/
|
|
299
381
|
include_ledgers?: boolean;
|
|
300
382
|
|
|
383
|
+
/**
|
|
384
|
+
* The maximum number of commits to return. Defaults to 25.
|
|
385
|
+
*/
|
|
386
|
+
limit?: number;
|
|
387
|
+
|
|
301
388
|
/**
|
|
302
389
|
* The next page token from a previous response.
|
|
303
390
|
*/
|
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
import { APIResource } from
|
|
4
|
-
import * as Core from
|
|
5
|
-
import * as Shared from
|
|
3
|
+
import { APIResource } from "../../../resource.js";
|
|
4
|
+
import * as Core from "../../../core.js";
|
|
5
|
+
import * as Shared from "../../shared.js";
|
|
6
6
|
|
|
7
7
|
export class Credits extends APIResource {
|
|
8
8
|
/**
|
|
9
9
|
* Create a new credit at the customer level.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const credit = await client.v1.customers.credits.create({
|
|
14
|
+
* access_schedule: {
|
|
15
|
+
* credit_type_id: '2714e483-4ff1-48e4-9e25-ac732e8f24f2',
|
|
16
|
+
* schedule_items: [
|
|
17
|
+
* {
|
|
18
|
+
* amount: 1000,
|
|
19
|
+
* starting_at: '2020-01-01T00:00:00.000Z',
|
|
20
|
+
* ending_before: '2020-02-01T00:00:00.000Z',
|
|
21
|
+
* },
|
|
22
|
+
* ],
|
|
23
|
+
* },
|
|
24
|
+
* customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
|
|
25
|
+
* priority: 100,
|
|
26
|
+
* product_id: 'f14d6729-6a44-4b13-9908-9387f1918790',
|
|
27
|
+
* name: 'My Credit',
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
10
30
|
*/
|
|
11
31
|
create(body: CreditCreateParams, options?: Core.RequestOptions): Core.APIPromise<CreditCreateResponse> {
|
|
12
32
|
return this._client.post('/v1/contracts/customerCredits/create', { body, ...options });
|
|
@@ -14,13 +34,33 @@ export class Credits extends APIResource {
|
|
|
14
34
|
|
|
15
35
|
/**
|
|
16
36
|
* List credits.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const credits = await client.v1.customers.credits.list({
|
|
41
|
+
* customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
|
|
42
|
+
* credit_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
|
|
43
|
+
* include_ledgers: true,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
17
46
|
*/
|
|
18
47
|
list(body: CreditListParams, options?: Core.RequestOptions): Core.APIPromise<CreditListResponse> {
|
|
19
48
|
return this._client.post('/v1/contracts/customerCredits/list', { body, ...options });
|
|
20
49
|
}
|
|
21
50
|
|
|
22
51
|
/**
|
|
23
|
-
*
|
|
52
|
+
* Pull forward the end date of a credit. Use the "edit a credit" endpoint to
|
|
53
|
+
* extend the end date of a credit, or to make other edits to the credit.
|
|
54
|
+
*
|
|
55
|
+
* @example
|
|
56
|
+
* ```ts
|
|
57
|
+
* const response =
|
|
58
|
+
* await client.v1.customers.credits.updateEndDate({
|
|
59
|
+
* access_ending_before: '2020-01-01T00:00:00.000Z',
|
|
60
|
+
* credit_id: '6162d87b-e5db-4a33-b7f2-76ce6ead4e85',
|
|
61
|
+
* customer_id: '13117714-3f05-48e5-a6e9-a66093f13b4d',
|
|
62
|
+
* });
|
|
63
|
+
* ```
|
|
24
64
|
*/
|
|
25
65
|
updateEndDate(
|
|
26
66
|
body: CreditUpdateEndDateParams,
|
|
@@ -78,7 +118,7 @@ export interface CreditCreateParams {
|
|
|
78
118
|
*/
|
|
79
119
|
applicable_product_tags?: Array<string>;
|
|
80
120
|
|
|
81
|
-
custom_fields?:
|
|
121
|
+
custom_fields?: { [key: string]: string };
|
|
82
122
|
|
|
83
123
|
/**
|
|
84
124
|
* Used only in UI/API. It is not exposed to end customers.
|
|
@@ -102,6 +142,14 @@ export interface CreditCreateParams {
|
|
|
102
142
|
*/
|
|
103
143
|
salesforce_opportunity_id?: string;
|
|
104
144
|
|
|
145
|
+
/**
|
|
146
|
+
* List of filters that determine what kind of customer usage draws down a commit
|
|
147
|
+
* or credit. A customer's usage needs to meet the condition of at least one of the
|
|
148
|
+
* specifiers to contribute to a commit's or credit's drawdown. This field cannot
|
|
149
|
+
* be used together with `applicable_product_ids` or `applicable_product_tags`.
|
|
150
|
+
*/
|
|
151
|
+
specifiers?: Array<CreditCreateParams.Specifier>;
|
|
152
|
+
|
|
105
153
|
/**
|
|
106
154
|
* Prevents the creation of duplicates. If a request to create a commit or credit
|
|
107
155
|
* is made with a uniqueness key that was previously used to create a commit or
|
|
@@ -139,6 +187,23 @@ export namespace CreditCreateParams {
|
|
|
139
187
|
starting_at: string;
|
|
140
188
|
}
|
|
141
189
|
}
|
|
190
|
+
|
|
191
|
+
export interface Specifier {
|
|
192
|
+
presentation_group_values?: { [key: string]: string };
|
|
193
|
+
|
|
194
|
+
pricing_group_values?: { [key: string]: string };
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* If provided, the specifier will only apply to the product with the specified ID.
|
|
198
|
+
*/
|
|
199
|
+
product_id?: string;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* If provided, the specifier will only apply to products with all the specified
|
|
203
|
+
* tags.
|
|
204
|
+
*/
|
|
205
|
+
product_tags?: Array<string>;
|
|
206
|
+
}
|
|
142
207
|
}
|
|
143
208
|
|
|
144
209
|
export interface CreditListParams {
|
|
@@ -157,7 +222,7 @@ export interface CreditListParams {
|
|
|
157
222
|
effective_before?: string;
|
|
158
223
|
|
|
159
224
|
/**
|
|
160
|
-
* Include credits from archived contracts.
|
|
225
|
+
* Include archived credits and credits from archived contracts.
|
|
161
226
|
*/
|
|
162
227
|
include_archived?: boolean;
|
|
163
228
|
|
|
@@ -178,6 +243,11 @@ export interface CreditListParams {
|
|
|
178
243
|
*/
|
|
179
244
|
include_ledgers?: boolean;
|
|
180
245
|
|
|
246
|
+
/**
|
|
247
|
+
* The maximum number of commits to return. Defaults to 25.
|
|
248
|
+
*/
|
|
249
|
+
limit?: number;
|
|
250
|
+
|
|
181
251
|
/**
|
|
182
252
|
* The next page token from a previous response.
|
|
183
253
|
*/
|