orb-billing 5.43.0 → 5.45.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 +52 -0
- package/core.d.ts +1 -1
- package/core.d.ts.map +1 -1
- package/core.js +13 -17
- package/core.js.map +1 -1
- package/core.mjs +13 -17
- package/core.mjs.map +1 -1
- package/index.d.mts +91 -5
- package/index.d.ts +91 -5
- package/index.d.ts.map +1 -1
- package/index.js +90 -2
- package/index.js.map +1 -1
- package/index.mjs +91 -3
- package/index.mjs.map +1 -1
- package/internal/utils/query.d.ts +2 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +33 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +6 -0
- package/internal/utils/query.mjs.map +1 -0
- package/package.json +1 -1
- package/resources/alerts.d.ts +32 -1
- package/resources/alerts.d.ts.map +1 -1
- package/resources/alerts.js +6 -0
- package/resources/alerts.js.map +1 -1
- package/resources/alerts.mjs +6 -0
- package/resources/alerts.mjs.map +1 -1
- package/resources/beta/beta.d.ts +8293 -140
- package/resources/beta/beta.d.ts.map +1 -1
- package/resources/beta/beta.js +5 -0
- package/resources/beta/beta.js.map +1 -1
- package/resources/beta/beta.mjs +5 -0
- package/resources/beta/beta.mjs.map +1 -1
- package/resources/beta/external-plan-id.d.ts +8293 -140
- package/resources/beta/external-plan-id.d.ts.map +1 -1
- package/resources/beta/external-plan-id.js +5 -0
- package/resources/beta/external-plan-id.js.map +1 -1
- package/resources/beta/external-plan-id.mjs +5 -0
- package/resources/beta/external-plan-id.mjs.map +1 -1
- package/resources/coupons/coupons.d.ts +3 -0
- package/resources/coupons/coupons.d.ts.map +1 -1
- package/resources/coupons/coupons.js +3 -0
- package/resources/coupons/coupons.js.map +1 -1
- package/resources/coupons/coupons.mjs +3 -0
- package/resources/coupons/coupons.mjs.map +1 -1
- package/resources/coupons/subscriptions.d.ts +3 -0
- package/resources/coupons/subscriptions.d.ts.map +1 -1
- package/resources/coupons/subscriptions.js +3 -0
- package/resources/coupons/subscriptions.js.map +1 -1
- package/resources/coupons/subscriptions.mjs +3 -0
- package/resources/coupons/subscriptions.mjs.map +1 -1
- package/resources/credit-blocks.d.ts +85 -1
- package/resources/credit-blocks.d.ts.map +1 -1
- package/resources/credit-blocks.js +22 -0
- package/resources/credit-blocks.js.map +1 -1
- package/resources/credit-blocks.mjs +22 -0
- package/resources/credit-blocks.mjs.map +1 -1
- package/resources/credit-notes.d.ts +4 -0
- package/resources/credit-notes.d.ts.map +1 -1
- package/resources/credit-notes.js +4 -0
- package/resources/credit-notes.js.map +1 -1
- package/resources/credit-notes.mjs +4 -0
- package/resources/credit-notes.mjs.map +1 -1
- package/resources/customers/balance-transactions.d.ts +16 -0
- package/resources/customers/balance-transactions.d.ts.map +1 -1
- package/resources/customers/balance-transactions.js +16 -0
- package/resources/customers/balance-transactions.js.map +1 -1
- package/resources/customers/balance-transactions.mjs +16 -0
- package/resources/customers/balance-transactions.mjs.map +1 -1
- package/resources/customers/costs.d.ts +16 -0
- package/resources/customers/costs.d.ts.map +1 -1
- package/resources/customers/costs.js +16 -0
- package/resources/customers/costs.js.map +1 -1
- package/resources/customers/costs.mjs +16 -0
- package/resources/customers/costs.mjs.map +1 -1
- package/resources/customers/credits/credits.d.ts +39 -0
- package/resources/customers/credits/credits.d.ts.map +1 -1
- package/resources/customers/credits/credits.js +3 -0
- package/resources/customers/credits/credits.js.map +1 -1
- package/resources/customers/credits/credits.mjs +3 -0
- package/resources/customers/credits/credits.mjs.map +1 -1
- package/resources/customers/credits/ledger.d.ts +31 -4
- package/resources/customers/credits/ledger.d.ts.map +1 -1
- package/resources/customers/credits/ledger.js +19 -2
- package/resources/customers/credits/ledger.js.map +1 -1
- package/resources/customers/credits/ledger.mjs +19 -2
- package/resources/customers/credits/ledger.mjs.map +1 -1
- package/resources/customers/credits/top-ups.d.ts +3 -0
- package/resources/customers/credits/top-ups.d.ts.map +1 -1
- package/resources/customers/credits/top-ups.js +3 -0
- package/resources/customers/credits/top-ups.js.map +1 -1
- package/resources/customers/credits/top-ups.mjs +3 -0
- package/resources/customers/credits/top-ups.mjs.map +1 -1
- package/resources/customers/customers.d.ts +33 -12
- package/resources/customers/customers.d.ts.map +1 -1
- package/resources/customers/customers.js +20 -3
- package/resources/customers/customers.js.map +1 -1
- package/resources/customers/customers.mjs +20 -3
- package/resources/customers/customers.mjs.map +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts +1 -1
- package/resources/dimensional-price-groups/external-dimensional-price-group-id.d.ts.map +1 -1
- package/resources/events/backfills.d.ts +5 -0
- package/resources/events/backfills.d.ts.map +1 -1
- package/resources/events/backfills.js +5 -0
- package/resources/events/backfills.js.map +1 -1
- package/resources/events/backfills.mjs +5 -0
- package/resources/events/backfills.mjs.map +1 -1
- package/resources/events/events.d.ts +5 -0
- package/resources/events/events.d.ts.map +1 -1
- package/resources/events/events.js +5 -0
- package/resources/events/events.js.map +1 -1
- package/resources/events/events.mjs +5 -0
- package/resources/events/events.mjs.map +1 -1
- package/resources/events/volume.d.ts +5 -0
- package/resources/events/volume.d.ts.map +1 -1
- package/resources/events/volume.js +5 -0
- package/resources/events/volume.js.map +1 -1
- package/resources/events/volume.mjs +5 -0
- package/resources/events/volume.mjs.map +1 -1
- package/resources/index.d.ts +4 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +7 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +3 -1
- package/resources/index.mjs.map +1 -1
- package/resources/invoice-line-items.d.ts +6 -0
- package/resources/invoice-line-items.d.ts.map +1 -1
- package/resources/invoice-line-items.js +6 -0
- package/resources/invoice-line-items.js.map +1 -1
- package/resources/invoice-line-items.mjs +6 -0
- package/resources/invoice-line-items.mjs.map +1 -1
- package/resources/invoices.d.ts +432 -7
- package/resources/invoices.d.ts.map +1 -1
- package/resources/invoices.js +18 -5
- package/resources/invoices.js.map +1 -1
- package/resources/invoices.mjs +18 -5
- package/resources/invoices.mjs.map +1 -1
- package/resources/items.d.ts +6 -2
- package/resources/items.d.ts.map +1 -1
- package/resources/items.js +4 -0
- package/resources/items.js.map +1 -1
- package/resources/items.mjs +4 -0
- package/resources/items.mjs.map +1 -1
- package/resources/license-types.d.ts +113 -0
- package/resources/license-types.d.ts.map +1 -0
- package/resources/license-types.js +44 -0
- package/resources/license-types.js.map +1 -0
- package/resources/license-types.mjs +39 -0
- package/resources/license-types.mjs.map +1 -0
- package/resources/licenses/external-licenses.d.ts +114 -0
- package/resources/licenses/external-licenses.d.ts.map +1 -0
- package/resources/licenses/external-licenses.js +18 -0
- package/resources/licenses/external-licenses.js.map +1 -0
- package/resources/licenses/external-licenses.mjs +14 -0
- package/resources/licenses/external-licenses.mjs.map +1 -0
- package/resources/licenses/index.d.ts +4 -0
- package/resources/licenses/index.d.ts.map +1 -0
- package/resources/licenses/index.js +12 -0
- package/resources/licenses/index.js.map +1 -0
- package/resources/licenses/index.mjs +5 -0
- package/resources/licenses/index.mjs.map +1 -0
- package/resources/licenses/licenses.d.ts +133 -0
- package/resources/licenses/licenses.d.ts.map +1 -0
- package/resources/licenses/licenses.js +86 -0
- package/resources/licenses/licenses.js.map +1 -0
- package/resources/licenses/licenses.mjs +58 -0
- package/resources/licenses/licenses.mjs.map +1 -0
- package/resources/licenses/usage.d.ts +211 -0
- package/resources/licenses/usage.d.ts.map +1 -0
- package/resources/licenses/usage.js +25 -0
- package/resources/licenses/usage.js.map +1 -0
- package/resources/licenses/usage.mjs +21 -0
- package/resources/licenses/usage.mjs.map +1 -0
- package/resources/licenses.d.ts +2 -0
- package/resources/licenses.d.ts.map +1 -0
- package/resources/licenses.js +19 -0
- package/resources/licenses.js.map +1 -0
- package/resources/licenses.mjs +3 -0
- package/resources/licenses.mjs.map +1 -0
- package/resources/metrics.d.ts +7 -0
- package/resources/metrics.d.ts.map +1 -1
- package/resources/metrics.js +4 -0
- package/resources/metrics.js.map +1 -1
- package/resources/metrics.mjs +4 -0
- package/resources/metrics.mjs.map +1 -1
- package/resources/plans/external-plan-id.d.ts +5 -0
- package/resources/plans/external-plan-id.d.ts.map +1 -1
- package/resources/plans/external-plan-id.js +5 -0
- package/resources/plans/external-plan-id.js.map +1 -1
- package/resources/plans/external-plan-id.mjs +5 -0
- package/resources/plans/external-plan-id.mjs.map +1 -1
- package/resources/plans/migrations.d.ts +5 -0
- package/resources/plans/migrations.d.ts.map +1 -1
- package/resources/plans/migrations.js +5 -0
- package/resources/plans/migrations.js.map +1 -1
- package/resources/plans/migrations.mjs +5 -0
- package/resources/plans/migrations.mjs.map +1 -1
- package/resources/plans/plans.d.ts +4200 -121
- package/resources/plans/plans.d.ts.map +1 -1
- package/resources/plans/plans.js +5 -0
- package/resources/plans/plans.js.map +1 -1
- package/resources/plans/plans.mjs +5 -0
- package/resources/plans/plans.mjs.map +1 -1
- package/resources/prices/external-price-id.d.ts +9 -0
- package/resources/prices/external-price-id.d.ts.map +1 -1
- package/resources/prices/external-price-id.js +9 -0
- package/resources/prices/external-price-id.js.map +1 -1
- package/resources/prices/external-price-id.mjs +9 -0
- package/resources/prices/external-price-id.mjs.map +1 -1
- package/resources/prices/prices.d.ts +198 -0
- package/resources/prices/prices.d.ts.map +1 -1
- package/resources/prices/prices.js +9 -0
- package/resources/prices/prices.js.map +1 -1
- package/resources/prices/prices.mjs +9 -0
- package/resources/prices/prices.mjs.map +1 -1
- package/resources/shared.d.ts +1040 -6
- package/resources/shared.d.ts.map +1 -1
- package/resources/shared.js.map +1 -1
- package/resources/shared.mjs.map +1 -1
- package/resources/subscriptions.d.ts +262 -0
- package/resources/subscriptions.d.ts.map +1 -1
- package/resources/subscriptions.js.map +1 -1
- package/resources/subscriptions.mjs.map +1 -1
- package/src/core.ts +16 -21
- package/src/index.ts +149 -5
- package/src/internal/utils/query.ts +7 -0
- package/src/resources/alerts.ts +38 -1
- package/src/resources/beta/beta.ts +9945 -194
- package/src/resources/beta/external-plan-id.ts +9945 -194
- package/src/resources/coupons/coupons.ts +3 -0
- package/src/resources/coupons/subscriptions.ts +3 -0
- package/src/resources/credit-blocks.ts +110 -1
- package/src/resources/credit-notes.ts +4 -0
- package/src/resources/customers/balance-transactions.ts +16 -0
- package/src/resources/customers/costs.ts +16 -0
- package/src/resources/customers/credits/credits.ts +45 -0
- package/src/resources/customers/credits/ledger.ts +33 -4
- package/src/resources/customers/credits/top-ups.ts +3 -0
- package/src/resources/customers/customers.ts +61 -12
- package/src/resources/dimensional-price-groups/external-dimensional-price-group-id.ts +1 -1
- package/src/resources/events/backfills.ts +5 -0
- package/src/resources/events/events.ts +5 -0
- package/src/resources/events/volume.ts +5 -0
- package/src/resources/index.ts +29 -1
- package/src/resources/invoice-line-items.ts +6 -0
- package/src/resources/invoices.ts +523 -6
- package/src/resources/items.ts +8 -2
- package/src/resources/license-types.ts +163 -0
- package/src/resources/licenses/external-licenses.ts +147 -0
- package/src/resources/licenses/index.ts +27 -0
- package/src/resources/licenses/licenses.ts +248 -0
- package/src/resources/licenses/usage.ts +280 -0
- package/src/resources/licenses.ts +3 -0
- package/src/resources/metrics.ts +6 -0
- package/src/resources/plans/external-plan-id.ts +5 -0
- package/src/resources/plans/migrations.ts +5 -0
- package/src/resources/plans/plans.ts +5004 -126
- package/src/resources/prices/external-price-id.ts +9 -0
- package/src/resources/prices/prices.ts +237 -0
- package/src/resources/shared.ts +1213 -0
- package/src/resources/subscriptions.ts +311 -0
- package/src/version.ts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../resource';
|
|
4
|
+
import { isRequestOptions } from '../core';
|
|
5
|
+
import * as Core from '../core';
|
|
6
|
+
import { Page, type PageParams } from '../pagination';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The LicenseType resource represents a type of license that can be assigned to users.
|
|
10
|
+
* License types are used during billing by grouping metrics on the configured grouping key.
|
|
11
|
+
*/
|
|
12
|
+
export class LicenseTypes extends APIResource {
|
|
13
|
+
/**
|
|
14
|
+
* This endpoint is used to create a new license type.
|
|
15
|
+
*
|
|
16
|
+
* License types are used to group licenses and define billing behavior. Each
|
|
17
|
+
* license type has a name and a grouping key that determines how metrics are
|
|
18
|
+
* aggregated for billing purposes.
|
|
19
|
+
*/
|
|
20
|
+
create(
|
|
21
|
+
body: LicenseTypeCreateParams,
|
|
22
|
+
options?: Core.RequestOptions,
|
|
23
|
+
): Core.APIPromise<LicenseTypeCreateResponse> {
|
|
24
|
+
return this._client.post('/license_types', { body, ...options });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* This endpoint returns a license type identified by its license_type_id.
|
|
29
|
+
*
|
|
30
|
+
* Use this endpoint to retrieve details about a specific license type, including
|
|
31
|
+
* its name and grouping key.
|
|
32
|
+
*/
|
|
33
|
+
retrieve(
|
|
34
|
+
licenseTypeId: string,
|
|
35
|
+
options?: Core.RequestOptions,
|
|
36
|
+
): Core.APIPromise<LicenseTypeRetrieveResponse> {
|
|
37
|
+
return this._client.get(`/license_types/${licenseTypeId}`, options);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* This endpoint returns a list of all license types configured for the account,
|
|
42
|
+
* ordered in ascending order by creation time.
|
|
43
|
+
*
|
|
44
|
+
* License types are used to group licenses and define billing behavior. Each
|
|
45
|
+
* license type has a name and a grouping key that determines how metrics are
|
|
46
|
+
* aggregated for billing purposes.
|
|
47
|
+
*/
|
|
48
|
+
list(
|
|
49
|
+
query?: LicenseTypeListParams,
|
|
50
|
+
options?: Core.RequestOptions,
|
|
51
|
+
): Core.PagePromise<LicenseTypeListResponsesPage, LicenseTypeListResponse>;
|
|
52
|
+
list(
|
|
53
|
+
options?: Core.RequestOptions,
|
|
54
|
+
): Core.PagePromise<LicenseTypeListResponsesPage, LicenseTypeListResponse>;
|
|
55
|
+
list(
|
|
56
|
+
query: LicenseTypeListParams | Core.RequestOptions = {},
|
|
57
|
+
options?: Core.RequestOptions,
|
|
58
|
+
): Core.PagePromise<LicenseTypeListResponsesPage, LicenseTypeListResponse> {
|
|
59
|
+
if (isRequestOptions(query)) {
|
|
60
|
+
return this.list({}, query);
|
|
61
|
+
}
|
|
62
|
+
return this._client.getAPIList('/license_types', LicenseTypeListResponsesPage, { query, ...options });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export class LicenseTypeListResponsesPage extends Page<LicenseTypeListResponse> {}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The LicenseType resource represents a type of license that can be assigned to
|
|
70
|
+
* users. License types are used during billing by grouping metrics on the
|
|
71
|
+
* configured grouping key.
|
|
72
|
+
*/
|
|
73
|
+
export interface LicenseTypeCreateResponse {
|
|
74
|
+
/**
|
|
75
|
+
* The Orb-assigned unique identifier for the license type.
|
|
76
|
+
*/
|
|
77
|
+
id: string;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The key used for grouping licenses of this type. This is typically a user
|
|
81
|
+
* identifier field.
|
|
82
|
+
*/
|
|
83
|
+
grouping_key: string;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The name of the license type.
|
|
87
|
+
*/
|
|
88
|
+
name: string;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The LicenseType resource represents a type of license that can be assigned to
|
|
93
|
+
* users. License types are used during billing by grouping metrics on the
|
|
94
|
+
* configured grouping key.
|
|
95
|
+
*/
|
|
96
|
+
export interface LicenseTypeRetrieveResponse {
|
|
97
|
+
/**
|
|
98
|
+
* The Orb-assigned unique identifier for the license type.
|
|
99
|
+
*/
|
|
100
|
+
id: string;
|
|
101
|
+
|
|
102
|
+
/**
|
|
103
|
+
* The key used for grouping licenses of this type. This is typically a user
|
|
104
|
+
* identifier field.
|
|
105
|
+
*/
|
|
106
|
+
grouping_key: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The name of the license type.
|
|
110
|
+
*/
|
|
111
|
+
name: string;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The LicenseType resource represents a type of license that can be assigned to
|
|
116
|
+
* users. License types are used during billing by grouping metrics on the
|
|
117
|
+
* configured grouping key.
|
|
118
|
+
*/
|
|
119
|
+
export interface LicenseTypeListResponse {
|
|
120
|
+
/**
|
|
121
|
+
* The Orb-assigned unique identifier for the license type.
|
|
122
|
+
*/
|
|
123
|
+
id: string;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* The key used for grouping licenses of this type. This is typically a user
|
|
127
|
+
* identifier field.
|
|
128
|
+
*/
|
|
129
|
+
grouping_key: string;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* The name of the license type.
|
|
133
|
+
*/
|
|
134
|
+
name: string;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface LicenseTypeCreateParams {
|
|
138
|
+
/**
|
|
139
|
+
* The key used for grouping licenses of this type. This is typically a user
|
|
140
|
+
* identifier field.
|
|
141
|
+
*/
|
|
142
|
+
grouping_key: string;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* The name of the license type.
|
|
146
|
+
*/
|
|
147
|
+
name: string;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export interface LicenseTypeListParams extends PageParams {}
|
|
151
|
+
|
|
152
|
+
LicenseTypes.LicenseTypeListResponsesPage = LicenseTypeListResponsesPage;
|
|
153
|
+
|
|
154
|
+
export declare namespace LicenseTypes {
|
|
155
|
+
export {
|
|
156
|
+
type LicenseTypeCreateResponse as LicenseTypeCreateResponse,
|
|
157
|
+
type LicenseTypeRetrieveResponse as LicenseTypeRetrieveResponse,
|
|
158
|
+
type LicenseTypeListResponse as LicenseTypeListResponse,
|
|
159
|
+
LicenseTypeListResponsesPage as LicenseTypeListResponsesPage,
|
|
160
|
+
type LicenseTypeCreateParams as LicenseTypeCreateParams,
|
|
161
|
+
type LicenseTypeListParams as LicenseTypeListParams,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../resource';
|
|
4
|
+
import * as Core from '../../core';
|
|
5
|
+
import * as Shared from '../shared';
|
|
6
|
+
|
|
7
|
+
export class ExternalLicenses extends APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Returns usage and remaining credits for a license identified by its external
|
|
10
|
+
* license ID.
|
|
11
|
+
*
|
|
12
|
+
* Date range defaults to the current billing period if not specified.
|
|
13
|
+
*/
|
|
14
|
+
getUsage(
|
|
15
|
+
externalLicenseId: string,
|
|
16
|
+
query: ExternalLicenseGetUsageParams,
|
|
17
|
+
options?: Core.RequestOptions,
|
|
18
|
+
): Core.APIPromise<ExternalLicenseGetUsageResponse> {
|
|
19
|
+
return this._client.get(`/licenses/external_licenses/${externalLicenseId}/usage`, { query, ...options });
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface ExternalLicenseGetUsageResponse {
|
|
24
|
+
data: Array<ExternalLicenseGetUsageResponse.Data>;
|
|
25
|
+
|
|
26
|
+
pagination_metadata: Shared.PaginationMetadata;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export namespace ExternalLicenseGetUsageResponse {
|
|
30
|
+
/**
|
|
31
|
+
* The LicenseUsage resource represents usage and remaining credits for a license
|
|
32
|
+
* over a date range.
|
|
33
|
+
*
|
|
34
|
+
* When grouped by 'day' only, license_id and external_license_id will be null as
|
|
35
|
+
* the data is aggregated across all licenses.
|
|
36
|
+
*/
|
|
37
|
+
export interface Data {
|
|
38
|
+
/**
|
|
39
|
+
* The total credits allocated to this license for the period.
|
|
40
|
+
*/
|
|
41
|
+
allocated_credits: number;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The credits consumed by this license for the period.
|
|
45
|
+
*/
|
|
46
|
+
consumed_credits: number;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The end date of the usage period.
|
|
50
|
+
*/
|
|
51
|
+
end_date: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The unique identifier for the license type.
|
|
55
|
+
*/
|
|
56
|
+
license_type_id: string;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* The pricing unit for the credits (e.g., 'credits').
|
|
60
|
+
*/
|
|
61
|
+
pricing_unit: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The remaining credits available for this license (allocated - consumed).
|
|
65
|
+
*/
|
|
66
|
+
remaining_credits: number;
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* The start date of the usage period.
|
|
70
|
+
*/
|
|
71
|
+
start_date: string;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The unique identifier for the subscription.
|
|
75
|
+
*/
|
|
76
|
+
subscription_id: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Credits consumed while the license was active (eligible for individual
|
|
80
|
+
* allocation deduction).
|
|
81
|
+
*/
|
|
82
|
+
allocation_eligible_credits?: number | null;
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* The external identifier for the license. Null when grouped by day only.
|
|
86
|
+
*/
|
|
87
|
+
external_license_id?: string | null;
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The unique identifier for the license. Null when grouped by day only.
|
|
91
|
+
*/
|
|
92
|
+
license_id?: string | null;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Credits consumed while the license was inactive (draws from shared pool, not
|
|
96
|
+
* individual allocation).
|
|
97
|
+
*/
|
|
98
|
+
shared_pool_credits?: number | null;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
export interface ExternalLicenseGetUsageParams {
|
|
103
|
+
/**
|
|
104
|
+
* The license type ID to filter licenses by.
|
|
105
|
+
*/
|
|
106
|
+
license_type_id: string;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* The subscription ID to get license usage for.
|
|
110
|
+
*/
|
|
111
|
+
subscription_id: string;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Pagination cursor from a previous request.
|
|
115
|
+
*/
|
|
116
|
+
cursor?: string | null;
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* End date for the usage period (YYYY-MM-DD). Defaults to end of current billing
|
|
120
|
+
* period.
|
|
121
|
+
*/
|
|
122
|
+
end_date?: string | null;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* How to group the results. Valid values: 'license', 'day'. Can be combined (e.g.,
|
|
126
|
+
* 'license,day').
|
|
127
|
+
*/
|
|
128
|
+
group_by?: Array<string> | null;
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Maximum number of rows in the response data (default 20, max 100).
|
|
132
|
+
*/
|
|
133
|
+
limit?: number;
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* Start date for the usage period (YYYY-MM-DD). Defaults to start of current
|
|
137
|
+
* billing period.
|
|
138
|
+
*/
|
|
139
|
+
start_date?: string | null;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export declare namespace ExternalLicenses {
|
|
143
|
+
export {
|
|
144
|
+
type ExternalLicenseGetUsageResponse as ExternalLicenseGetUsageResponse,
|
|
145
|
+
type ExternalLicenseGetUsageParams as ExternalLicenseGetUsageParams,
|
|
146
|
+
};
|
|
147
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
ExternalLicenses,
|
|
5
|
+
type ExternalLicenseGetUsageResponse,
|
|
6
|
+
type ExternalLicenseGetUsageParams,
|
|
7
|
+
} from './external-licenses';
|
|
8
|
+
export {
|
|
9
|
+
LicenseListResponsesPage,
|
|
10
|
+
Licenses,
|
|
11
|
+
type LicenseCreateResponse,
|
|
12
|
+
type LicenseRetrieveResponse,
|
|
13
|
+
type LicenseListResponse,
|
|
14
|
+
type LicenseDeactivateResponse,
|
|
15
|
+
type LicenseRetrieveByExternalIDResponse,
|
|
16
|
+
type LicenseCreateParams,
|
|
17
|
+
type LicenseListParams,
|
|
18
|
+
type LicenseDeactivateParams,
|
|
19
|
+
type LicenseRetrieveByExternalIDParams,
|
|
20
|
+
} from './licenses';
|
|
21
|
+
export {
|
|
22
|
+
Usage,
|
|
23
|
+
type UsageGetAllUsageResponse,
|
|
24
|
+
type UsageGetUsageResponse,
|
|
25
|
+
type UsageGetAllUsageParams,
|
|
26
|
+
type UsageGetUsageParams,
|
|
27
|
+
} from './usage';
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../resource';
|
|
4
|
+
import * as Core from '../../core';
|
|
5
|
+
import * as ExternalLicensesAPI from './external-licenses';
|
|
6
|
+
import {
|
|
7
|
+
ExternalLicenseGetUsageParams,
|
|
8
|
+
ExternalLicenseGetUsageResponse,
|
|
9
|
+
ExternalLicenses,
|
|
10
|
+
} from './external-licenses';
|
|
11
|
+
import * as UsageAPI from './usage';
|
|
12
|
+
import {
|
|
13
|
+
Usage,
|
|
14
|
+
UsageGetAllUsageParams,
|
|
15
|
+
UsageGetAllUsageResponse,
|
|
16
|
+
UsageGetUsageParams,
|
|
17
|
+
UsageGetUsageResponse,
|
|
18
|
+
} from './usage';
|
|
19
|
+
import { Page, type PageParams } from '../../pagination';
|
|
20
|
+
|
|
21
|
+
export class Licenses extends APIResource {
|
|
22
|
+
externalLicenses: ExternalLicensesAPI.ExternalLicenses = new ExternalLicensesAPI.ExternalLicenses(
|
|
23
|
+
this._client,
|
|
24
|
+
);
|
|
25
|
+
usage: UsageAPI.Usage = new UsageAPI.Usage(this._client);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* This endpoint is used to create a new license for a user.
|
|
29
|
+
*
|
|
30
|
+
* If a start date is provided, the license will be activated at the **start** of
|
|
31
|
+
* the specified date in the customer's timezone. Otherwise, the activation time
|
|
32
|
+
* will default to the **start** of the current day in the customer's timezone.
|
|
33
|
+
*/
|
|
34
|
+
create(body: LicenseCreateParams, options?: Core.RequestOptions): Core.APIPromise<LicenseCreateResponse> {
|
|
35
|
+
return this._client.post('/licenses', { body, ...options });
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* This endpoint is used to fetch a license given an identifier.
|
|
40
|
+
*/
|
|
41
|
+
retrieve(licenseId: string, options?: Core.RequestOptions): Core.APIPromise<LicenseRetrieveResponse> {
|
|
42
|
+
return this._client.get(`/licenses/${licenseId}`, options);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* This endpoint returns a list of all licenses for a subscription.
|
|
47
|
+
*/
|
|
48
|
+
list(
|
|
49
|
+
query: LicenseListParams,
|
|
50
|
+
options?: Core.RequestOptions,
|
|
51
|
+
): Core.PagePromise<LicenseListResponsesPage, LicenseListResponse> {
|
|
52
|
+
return this._client.getAPIList('/licenses', LicenseListResponsesPage, { query, ...options });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* This endpoint is used to deactivate an existing license.
|
|
57
|
+
*
|
|
58
|
+
* If an end date is provided, the license will be deactivated at the **start** of
|
|
59
|
+
* the specified date in the customer's timezone. Otherwise, the deactivation time
|
|
60
|
+
* will default to the **end** of the current day in the customer's timezone.
|
|
61
|
+
*/
|
|
62
|
+
deactivate(
|
|
63
|
+
licenseId: string,
|
|
64
|
+
body: LicenseDeactivateParams,
|
|
65
|
+
options?: Core.RequestOptions,
|
|
66
|
+
): Core.APIPromise<LicenseDeactivateResponse> {
|
|
67
|
+
return this._client.post(`/licenses/${licenseId}/deactivate`, { body, ...options });
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* This endpoint is used to fetch a license given an external license identifier.
|
|
72
|
+
*/
|
|
73
|
+
retrieveByExternalId(
|
|
74
|
+
externalLicenseId: string,
|
|
75
|
+
query: LicenseRetrieveByExternalIDParams,
|
|
76
|
+
options?: Core.RequestOptions,
|
|
77
|
+
): Core.APIPromise<LicenseRetrieveByExternalIDResponse> {
|
|
78
|
+
return this._client.get(`/licenses/external_license_id/${externalLicenseId}`, { query, ...options });
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export class LicenseListResponsesPage extends Page<LicenseListResponse> {}
|
|
83
|
+
|
|
84
|
+
export interface LicenseCreateResponse {
|
|
85
|
+
id: string;
|
|
86
|
+
|
|
87
|
+
end_date: string | null;
|
|
88
|
+
|
|
89
|
+
external_license_id: string;
|
|
90
|
+
|
|
91
|
+
license_type_id: string;
|
|
92
|
+
|
|
93
|
+
start_date: string;
|
|
94
|
+
|
|
95
|
+
status: 'active' | 'inactive';
|
|
96
|
+
|
|
97
|
+
subscription_id: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface LicenseRetrieveResponse {
|
|
101
|
+
id: string;
|
|
102
|
+
|
|
103
|
+
end_date: string | null;
|
|
104
|
+
|
|
105
|
+
external_license_id: string;
|
|
106
|
+
|
|
107
|
+
license_type_id: string;
|
|
108
|
+
|
|
109
|
+
start_date: string;
|
|
110
|
+
|
|
111
|
+
status: 'active' | 'inactive';
|
|
112
|
+
|
|
113
|
+
subscription_id: string;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface LicenseListResponse {
|
|
117
|
+
id: string;
|
|
118
|
+
|
|
119
|
+
end_date: string | null;
|
|
120
|
+
|
|
121
|
+
external_license_id: string;
|
|
122
|
+
|
|
123
|
+
license_type_id: string;
|
|
124
|
+
|
|
125
|
+
start_date: string;
|
|
126
|
+
|
|
127
|
+
status: 'active' | 'inactive';
|
|
128
|
+
|
|
129
|
+
subscription_id: string;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export interface LicenseDeactivateResponse {
|
|
133
|
+
id: string;
|
|
134
|
+
|
|
135
|
+
end_date: string | null;
|
|
136
|
+
|
|
137
|
+
external_license_id: string;
|
|
138
|
+
|
|
139
|
+
license_type_id: string;
|
|
140
|
+
|
|
141
|
+
start_date: string;
|
|
142
|
+
|
|
143
|
+
status: 'active' | 'inactive';
|
|
144
|
+
|
|
145
|
+
subscription_id: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface LicenseRetrieveByExternalIDResponse {
|
|
149
|
+
id: string;
|
|
150
|
+
|
|
151
|
+
end_date: string | null;
|
|
152
|
+
|
|
153
|
+
external_license_id: string;
|
|
154
|
+
|
|
155
|
+
license_type_id: string;
|
|
156
|
+
|
|
157
|
+
start_date: string;
|
|
158
|
+
|
|
159
|
+
status: 'active' | 'inactive';
|
|
160
|
+
|
|
161
|
+
subscription_id: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export interface LicenseCreateParams {
|
|
165
|
+
/**
|
|
166
|
+
* The external identifier for the license.
|
|
167
|
+
*/
|
|
168
|
+
external_license_id: string;
|
|
169
|
+
|
|
170
|
+
license_type_id: string;
|
|
171
|
+
|
|
172
|
+
subscription_id: string;
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* The end date of the license. If not provided, the license will remain active
|
|
176
|
+
* until deactivated.
|
|
177
|
+
*/
|
|
178
|
+
end_date?: string | null;
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* The start date of the license. If not provided, defaults to start of day today
|
|
182
|
+
* in the customer's timezone.
|
|
183
|
+
*/
|
|
184
|
+
start_date?: string | null;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export interface LicenseListParams extends PageParams {
|
|
188
|
+
subscription_id: string;
|
|
189
|
+
|
|
190
|
+
external_license_id?: string | null;
|
|
191
|
+
|
|
192
|
+
license_type_id?: string | null;
|
|
193
|
+
|
|
194
|
+
status?: 'active' | 'inactive' | null;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
export interface LicenseDeactivateParams {
|
|
198
|
+
/**
|
|
199
|
+
* The date to deactivate the license. If not provided, defaults to end of day
|
|
200
|
+
* today in the customer's timezone.
|
|
201
|
+
*/
|
|
202
|
+
end_date?: string | null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export interface LicenseRetrieveByExternalIDParams {
|
|
206
|
+
/**
|
|
207
|
+
* The ID of the license type to fetch the license for.
|
|
208
|
+
*/
|
|
209
|
+
license_type_id: string;
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* The ID of the subscription to fetch the license for.
|
|
213
|
+
*/
|
|
214
|
+
subscription_id: string;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
Licenses.LicenseListResponsesPage = LicenseListResponsesPage;
|
|
218
|
+
Licenses.ExternalLicenses = ExternalLicenses;
|
|
219
|
+
Licenses.Usage = Usage;
|
|
220
|
+
|
|
221
|
+
export declare namespace Licenses {
|
|
222
|
+
export {
|
|
223
|
+
type LicenseCreateResponse as LicenseCreateResponse,
|
|
224
|
+
type LicenseRetrieveResponse as LicenseRetrieveResponse,
|
|
225
|
+
type LicenseListResponse as LicenseListResponse,
|
|
226
|
+
type LicenseDeactivateResponse as LicenseDeactivateResponse,
|
|
227
|
+
type LicenseRetrieveByExternalIDResponse as LicenseRetrieveByExternalIDResponse,
|
|
228
|
+
LicenseListResponsesPage as LicenseListResponsesPage,
|
|
229
|
+
type LicenseCreateParams as LicenseCreateParams,
|
|
230
|
+
type LicenseListParams as LicenseListParams,
|
|
231
|
+
type LicenseDeactivateParams as LicenseDeactivateParams,
|
|
232
|
+
type LicenseRetrieveByExternalIDParams as LicenseRetrieveByExternalIDParams,
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export {
|
|
236
|
+
ExternalLicenses as ExternalLicenses,
|
|
237
|
+
type ExternalLicenseGetUsageResponse as ExternalLicenseGetUsageResponse,
|
|
238
|
+
type ExternalLicenseGetUsageParams as ExternalLicenseGetUsageParams,
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
export {
|
|
242
|
+
Usage as Usage,
|
|
243
|
+
type UsageGetAllUsageResponse as UsageGetAllUsageResponse,
|
|
244
|
+
type UsageGetUsageResponse as UsageGetUsageResponse,
|
|
245
|
+
type UsageGetAllUsageParams as UsageGetAllUsageParams,
|
|
246
|
+
type UsageGetUsageParams as UsageGetUsageParams,
|
|
247
|
+
};
|
|
248
|
+
}
|