@stigg/typescript 0.1.0-beta.61 → 0.1.0-beta.63

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.
Files changed (104) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/package.json +1 -1
  3. package/resources/v1/addons/addons.d.mts +1 -1
  4. package/resources/v1/addons/addons.d.ts +1 -1
  5. package/resources/v1/credits/credits.d.mts +77 -2
  6. package/resources/v1/credits/credits.d.mts.map +1 -1
  7. package/resources/v1/credits/credits.d.ts +77 -2
  8. package/resources/v1/credits/credits.d.ts.map +1 -1
  9. package/resources/v1/credits/credits.js +4 -0
  10. package/resources/v1/credits/credits.js.map +1 -1
  11. package/resources/v1/credits/credits.mjs +4 -0
  12. package/resources/v1/credits/credits.mjs.map +1 -1
  13. package/resources/v1/credits/index.d.mts +1 -0
  14. package/resources/v1/credits/index.d.mts.map +1 -1
  15. package/resources/v1/credits/index.d.ts +1 -0
  16. package/resources/v1/credits/index.d.ts.map +1 -1
  17. package/resources/v1/credits/index.js +3 -1
  18. package/resources/v1/credits/index.js.map +1 -1
  19. package/resources/v1/credits/index.mjs +1 -0
  20. package/resources/v1/credits/index.mjs.map +1 -1
  21. package/resources/v1/credits/reservations.d.mts +128 -0
  22. package/resources/v1/credits/reservations.d.mts.map +1 -0
  23. package/resources/v1/credits/reservations.d.ts +128 -0
  24. package/resources/v1/credits/reservations.d.ts.map +1 -0
  25. package/resources/v1/credits/reservations.js +30 -0
  26. package/resources/v1/credits/reservations.js.map +1 -0
  27. package/resources/v1/credits/reservations.mjs +26 -0
  28. package/resources/v1/credits/reservations.mjs.map +1 -0
  29. package/resources/v1/customers/customers.d.mts +27 -2
  30. package/resources/v1/customers/customers.d.mts.map +1 -1
  31. package/resources/v1/customers/customers.d.ts +27 -2
  32. package/resources/v1/customers/customers.d.ts.map +1 -1
  33. package/resources/v1/customers/customers.js.map +1 -1
  34. package/resources/v1/customers/customers.mjs.map +1 -1
  35. package/resources/v1/events/beta/customers.d.mts +18 -7
  36. package/resources/v1/events/beta/customers.d.mts.map +1 -1
  37. package/resources/v1/events/beta/customers.d.ts +18 -7
  38. package/resources/v1/events/beta/customers.d.ts.map +1 -1
  39. package/resources/v1/plans/plans.d.mts +1 -1
  40. package/resources/v1/plans/plans.d.ts +1 -1
  41. package/resources/v1/subscriptions/subscriptions.d.mts +1 -1
  42. package/resources/v1/subscriptions/subscriptions.d.mts.map +1 -1
  43. package/resources/v1/subscriptions/subscriptions.d.ts +1 -1
  44. package/resources/v1/subscriptions/subscriptions.d.ts.map +1 -1
  45. package/resources/v1/usage.d.mts +8 -7
  46. package/resources/v1/usage.d.mts.map +1 -1
  47. package/resources/v1/usage.d.ts +8 -7
  48. package/resources/v1/usage.d.ts.map +1 -1
  49. package/resources/v1-beta/customers/assignments.d.mts +2 -1
  50. package/resources/v1-beta/customers/assignments.d.mts.map +1 -1
  51. package/resources/v1-beta/customers/assignments.d.ts +2 -1
  52. package/resources/v1-beta/customers/assignments.d.ts.map +1 -1
  53. package/resources/v1-beta/customers/customers.d.mts +4 -0
  54. package/resources/v1-beta/customers/customers.d.mts.map +1 -1
  55. package/resources/v1-beta/customers/customers.d.ts +4 -0
  56. package/resources/v1-beta/customers/customers.d.ts.map +1 -1
  57. package/resources/v1-beta/customers/customers.js +4 -0
  58. package/resources/v1-beta/customers/customers.js.map +1 -1
  59. package/resources/v1-beta/customers/customers.mjs +4 -0
  60. package/resources/v1-beta/customers/customers.mjs.map +1 -1
  61. package/resources/v1-beta/customers/entitlements.d.mts +1 -1
  62. package/resources/v1-beta/customers/entitlements.d.mts.map +1 -1
  63. package/resources/v1-beta/customers/entitlements.d.ts +1 -1
  64. package/resources/v1-beta/customers/entitlements.d.ts.map +1 -1
  65. package/resources/v1-beta/customers/governance.d.mts +156 -0
  66. package/resources/v1-beta/customers/governance.d.mts.map +1 -0
  67. package/resources/v1-beta/customers/governance.d.ts +156 -0
  68. package/resources/v1-beta/customers/governance.d.ts.map +1 -0
  69. package/resources/v1-beta/customers/governance.js +43 -0
  70. package/resources/v1-beta/customers/governance.js.map +1 -0
  71. package/resources/v1-beta/customers/governance.mjs +39 -0
  72. package/resources/v1-beta/customers/governance.mjs.map +1 -0
  73. package/resources/v1-beta/customers/index.d.mts +1 -0
  74. package/resources/v1-beta/customers/index.d.mts.map +1 -1
  75. package/resources/v1-beta/customers/index.d.ts +1 -0
  76. package/resources/v1-beta/customers/index.d.ts.map +1 -1
  77. package/resources/v1-beta/customers/index.js +3 -1
  78. package/resources/v1-beta/customers/index.js.map +1 -1
  79. package/resources/v1-beta/customers/index.mjs +1 -0
  80. package/resources/v1-beta/customers/index.mjs.map +1 -1
  81. package/resources/v2/usage.d.mts +4 -3
  82. package/resources/v2/usage.d.mts.map +1 -1
  83. package/resources/v2/usage.d.ts +4 -3
  84. package/resources/v2/usage.d.ts.map +1 -1
  85. package/src/resources/v1/addons/addons.ts +1 -1
  86. package/src/resources/v1/credits/credits.ts +109 -2
  87. package/src/resources/v1/credits/index.ts +1 -0
  88. package/src/resources/v1/credits/reservations.ts +172 -0
  89. package/src/resources/v1/customers/customers.ts +32 -2
  90. package/src/resources/v1/events/beta/customers.ts +20 -7
  91. package/src/resources/v1/plans/plans.ts +1 -1
  92. package/src/resources/v1/subscriptions/subscriptions.ts +1 -1
  93. package/src/resources/v1/usage.ts +8 -7
  94. package/src/resources/v1-beta/customers/assignments.ts +2 -1
  95. package/src/resources/v1-beta/customers/customers.ts +16 -0
  96. package/src/resources/v1-beta/customers/entitlements.ts +1 -1
  97. package/src/resources/v1-beta/customers/governance.ts +210 -0
  98. package/src/resources/v1-beta/customers/index.ts +6 -0
  99. package/src/resources/v2/usage.ts +4 -3
  100. package/src/version.ts +1 -1
  101. package/version.d.mts +1 -1
  102. package/version.d.ts +1 -1
  103. package/version.js +1 -1
  104. package/version.mjs +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/resources/v2/usage.ts"],"names":[],"m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M,CAAC;QAElB;;;;;WAKG;QACH,KAAK,EAAE,MAAM,CAAC;QAEd;;WAEG;QACH,SAAS,CAAC,EAAE,MAAM,CAAC;QAEnB;;WAEG;QACH,UAAU,CAAC,EAAE;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;SAAE,CAAC;QAE1D;;;;WAIG;QACH,cAAc,CAAC,EAAE,MAAM,CAAC;QAExB;;;;;WAKG;QACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAE3B;;;;WAIG;QACH,cAAc,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC;KAClC;CACF;AAED,MAAM,CAAC,OAAO,WAAW,KAAK,CAAC;IAC7B,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,KAAK,iBAAiB,IAAI,iBAAiB,EAAE,CAAC;CACzG"}
@@ -1968,7 +1968,7 @@ export namespace AddonUpdateParams {
1968
1968
  featureId?: string;
1969
1969
 
1970
1970
  /**
1971
- * Maximum number of units (max 999999)
1971
+ * Maximum number of units
1972
1972
  */
1973
1973
  maxUnitQuantity?: number;
1974
1974
 
@@ -33,6 +33,8 @@ import {
33
33
  GrantVoidParams,
34
34
  Grants,
35
35
  } from './grants';
36
+ import * as ReservationsAPI from './reservations';
37
+ import { ReservationReleaseParams, ReservationReleaseResponse, Reservations } from './reservations';
36
38
  import { APIPromise } from '../../../core/api-promise';
37
39
  import { MyCursorIDPage, type MyCursorIDPageParams, PagePromise } from '../../../core/pagination';
38
40
  import { buildHeaders } from '../../../internal/headers';
@@ -44,6 +46,7 @@ export class Credits extends APIResource {
44
46
  this._client,
45
47
  );
46
48
  consumption: ConsumptionAPI.Consumption = new ConsumptionAPI.Consumption(this._client);
49
+ reservations: ReservationsAPI.Reservations = new ReservationsAPI.Reservations(this._client);
47
50
 
48
51
  /**
49
52
  * Retrieves the automatic recharge configuration for a customer and currency.
@@ -347,10 +350,17 @@ export namespace CreditGetUsageResponse {
347
350
  */
348
351
  export interface CreditListLedgerResponse {
349
352
  /**
350
- * The credit amount for this event
353
+ * The amount of the ledger event. Reservation events carry their net effect on the
354
+ * balance: a reserve is negative, and so is a release that consumed more than was
355
+ * held
351
356
  */
352
357
  amount: number;
353
358
 
359
+ /**
360
+ * On a released reservation, the credits consumed from each grant
361
+ */
362
+ breakdown: Array<CreditListLedgerResponse.Breakdown> | null;
363
+
354
364
  /**
355
365
  * The credit currency ID
356
366
  */
@@ -381,13 +391,32 @@ export interface CreditListLedgerResponse {
381
391
  | 'CREDITS_VOIDED'
382
392
  | 'CREDITS_UPDATED'
383
393
  | 'CREDITS_CONSUMPTION_TRANSFER_SOURCE'
384
- | 'CREDITS_CONSUMPTION_TRANSFER_TARGET';
394
+ | 'CREDITS_CONSUMPTION_TRANSFER_TARGET'
395
+ | 'CREDITS_RESERVED'
396
+ | 'CREDITS_RESERVATION_RELEASED'
397
+ | 'CREDITS_RESERVATION_EXPIRED';
385
398
 
386
399
  /**
387
400
  * The feature ID associated with this event
388
401
  */
389
402
  featureId: string | null;
390
403
 
404
+ /**
405
+ * On a released reservation, the held amount returned to the balance before
406
+ * consumed credits are deducted
407
+ */
408
+ holdReturnedAmount: number | null;
409
+
410
+ /**
411
+ * The metadata sent with the credit reservation
412
+ */
413
+ metadata: { [key: string]: string } | null;
414
+
415
+ /**
416
+ * The credit reservation this event belongs to
417
+ */
418
+ reservationId: string | null;
419
+
391
420
  /**
392
421
  * The resource ID this event is scoped to
393
422
  */
@@ -399,6 +428,72 @@ export interface CreditListLedgerResponse {
399
428
  timestamp: string;
400
429
  }
401
430
 
431
+ export namespace CreditListLedgerResponse {
432
+ export interface Breakdown {
433
+ /**
434
+ * The amount of the ledger event. Reservation events carry their net effect on the
435
+ * balance: a reserve is negative, and so is a release that consumed more than was
436
+ * held
437
+ */
438
+ amount: number;
439
+
440
+ /**
441
+ * The credit currency ID
442
+ */
443
+ creditCurrencyId: string;
444
+
445
+ /**
446
+ * The credit grant ID associated with this event
447
+ */
448
+ creditGrantId: string;
449
+
450
+ /**
451
+ * The customer ID this event belongs to
452
+ */
453
+ customerId: string;
454
+
455
+ /**
456
+ * The unique event identifier
457
+ */
458
+ eventId: string | null;
459
+
460
+ /**
461
+ * The type of credit event
462
+ */
463
+ eventType:
464
+ | 'CREDITS_GRANTED'
465
+ | 'CREDITS_EXPIRED'
466
+ | 'CREDITS_CONSUMED'
467
+ | 'CREDITS_VOIDED'
468
+ | 'CREDITS_UPDATED'
469
+ | 'CREDITS_CONSUMPTION_TRANSFER_SOURCE'
470
+ | 'CREDITS_CONSUMPTION_TRANSFER_TARGET'
471
+ | 'CREDITS_RESERVED'
472
+ | 'CREDITS_RESERVATION_RELEASED'
473
+ | 'CREDITS_RESERVATION_EXPIRED';
474
+
475
+ /**
476
+ * The feature ID associated with this event
477
+ */
478
+ featureId: string | null;
479
+
480
+ /**
481
+ * The credit reservation this event belongs to
482
+ */
483
+ reservationId: string | null;
484
+
485
+ /**
486
+ * The resource ID this event is scoped to
487
+ */
488
+ resourceId: string | null;
489
+
490
+ /**
491
+ * The timestamp when the event occurred
492
+ */
493
+ timestamp: string;
494
+ }
495
+ }
496
+
402
497
  export interface CreditGetAutoRechargeParams {
403
498
  /**
404
499
  * Query param: Filter by currency ID (required)
@@ -511,6 +606,11 @@ export interface CreditListLedgerParams extends MyCursorIDPageParams {
511
606
  */
512
607
  eventType?: string;
513
608
 
609
+ /**
610
+ * Query param: Filter by credit reservation ID
611
+ */
612
+ reservationId?: string;
613
+
514
614
  /**
515
615
  * Query param: Filter by resource ID
516
616
  */
@@ -533,6 +633,7 @@ export interface CreditListLedgerParams extends MyCursorIDPageParams {
533
633
  Credits.Grants = Grants;
534
634
  Credits.CustomCurrencies = CustomCurrencies;
535
635
  Credits.Consumption = Consumption;
636
+ Credits.Reservations = Reservations;
536
637
 
537
638
  export declare namespace Credits {
538
639
  export {
@@ -576,4 +677,10 @@ export declare namespace Credits {
576
677
  type ConsumptionConsumeParams as ConsumptionConsumeParams,
577
678
  type ConsumptionConsumeAsyncParams as ConsumptionConsumeAsyncParams,
578
679
  };
680
+
681
+ export {
682
+ Reservations as Reservations,
683
+ type ReservationReleaseResponse as ReservationReleaseResponse,
684
+ type ReservationReleaseParams as ReservationReleaseParams,
685
+ };
579
686
  }
@@ -39,3 +39,4 @@ export {
39
39
  type GrantVoidParams,
40
40
  type GrantListResponsesMyCursorIDPage,
41
41
  } from './grants';
42
+ export { Reservations, type ReservationReleaseResponse, type ReservationReleaseParams } from './reservations';
@@ -0,0 +1,172 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../../core/resource';
4
+ import { APIPromise } from '../../../core/api-promise';
5
+ import { buildHeaders } from '../../../internal/headers';
6
+ import { RequestOptions } from '../../../internal/request-options';
7
+ import { path } from '../../../internal/utils/path';
8
+
9
+ export class Reservations extends APIResource {
10
+ /**
11
+ * Releases a credit reservation, consuming the given amount and returning the rest
12
+ * of the held credits to the balance. Retry a failed release with the same
13
+ * reservation ID; it is applied once.
14
+ */
15
+ release(
16
+ reservationID: string,
17
+ params: ReservationReleaseParams,
18
+ options?: RequestOptions,
19
+ ): APIPromise<ReservationReleaseResponse> {
20
+ const { 'X-ACCOUNT-ID': xAccountID, 'X-ENVIRONMENT-ID': xEnvironmentID, ...body } = params;
21
+ return this._client.post(path`/api/v1/credits/reservations/${reservationID}/release`, {
22
+ body,
23
+ ...options,
24
+ headers: buildHeaders([
25
+ {
26
+ ...(xAccountID != null ? { 'X-ACCOUNT-ID': xAccountID } : undefined),
27
+ ...(xEnvironmentID != null ? { 'X-ENVIRONMENT-ID': xEnvironmentID } : undefined),
28
+ },
29
+ options?.headers,
30
+ ]),
31
+ });
32
+ }
33
+ }
34
+
35
+ /**
36
+ * Response object
37
+ */
38
+ export interface ReservationReleaseResponse {
39
+ /**
40
+ * Result of releasing a credit reservation
41
+ */
42
+ data: ReservationReleaseResponse.Data;
43
+ }
44
+
45
+ export namespace ReservationReleaseResponse {
46
+ /**
47
+ * Result of releasing a credit reservation
48
+ */
49
+ export interface Data {
50
+ /**
51
+ * The optimistic credit balance after the release
52
+ */
53
+ credit: Data.Credit | null;
54
+
55
+ /**
56
+ * The released reservation
57
+ */
58
+ reservation: Data.Reservation;
59
+ }
60
+
61
+ export namespace Data {
62
+ /**
63
+ * The optimistic credit balance after the release
64
+ */
65
+ export interface Credit {
66
+ /**
67
+ * The credit currency identifier
68
+ */
69
+ currencyId: string;
70
+
71
+ /**
72
+ * The wallet's total consumed credits for this currency (optimistic — includes
73
+ * not-yet-reconciled usage), shared across every feature that draws on the
74
+ * currency. This is the running balance, not this call's deduction — see
75
+ * `consumed` for that.
76
+ */
77
+ currentUsage: number;
78
+
79
+ /**
80
+ * The grant-version timestamp of this balance, used by the SDK for last-write-wins
81
+ * reconciliation
82
+ */
83
+ timestamp: string;
84
+
85
+ /**
86
+ * The total credits granted
87
+ */
88
+ usageLimit: number;
89
+
90
+ /**
91
+ * End of the current credit grant period (when recurring credits reset), if
92
+ * applicable
93
+ */
94
+ usagePeriodEnd?: string | null;
95
+ }
96
+
97
+ /**
98
+ * The released reservation
99
+ */
100
+ export interface Reservation {
101
+ /**
102
+ * The client-provided reservation ID.
103
+ */
104
+ id: string;
105
+
106
+ /**
107
+ * The amount of credits held.
108
+ */
109
+ amount: number;
110
+
111
+ /**
112
+ * The amount consumed at release
113
+ */
114
+ consumedAmount: number | null;
115
+
116
+ /**
117
+ * When the reservation expires. Unreleased credits return to the balance at this
118
+ * time.
119
+ */
120
+ expiresAt: string;
121
+
122
+ /**
123
+ * The status of the reservation.
124
+ */
125
+ status: 'ACTIVE' | 'RELEASED' | 'EXPIRED';
126
+ }
127
+ }
128
+ }
129
+
130
+ export interface ReservationReleaseParams {
131
+ /**
132
+ * Body param: The amount of credits to consume at release. Up to the reserved
133
+ * amount is charged to the credits that backed the reservation; the rest returns
134
+ * to the balance, and any amount above the reservation is consumed normally.
135
+ */
136
+ consumedAmount: number;
137
+
138
+ /**
139
+ * Body param: The credit currency of the reservation
140
+ */
141
+ currencyId: string;
142
+
143
+ /**
144
+ * Body param: The customer the reservation was made for
145
+ */
146
+ customerId: string;
147
+
148
+ /**
149
+ * Body param: The resource the reservation was made for, if any
150
+ */
151
+ resourceId?: string;
152
+
153
+ /**
154
+ * Header param: Account ID — optional when authenticating with a user JWT (Bearer
155
+ * token); falls back to the user's first membership. Ignored for API-key auth.
156
+ */
157
+ 'X-ACCOUNT-ID'?: string;
158
+
159
+ /**
160
+ * Header param: Environment ID — required when authenticating with a user JWT
161
+ * (Bearer token) on environment-scoped endpoints. Ignored for API-key auth (env is
162
+ * intrinsic to the key).
163
+ */
164
+ 'X-ENVIRONMENT-ID'?: string;
165
+ }
166
+
167
+ export declare namespace Reservations {
168
+ export {
169
+ type ReservationReleaseResponse as ReservationReleaseResponse,
170
+ type ReservationReleaseParams as ReservationReleaseParams,
171
+ };
172
+ }
@@ -1873,7 +1873,7 @@ export namespace CustomerCheckEntitlementResponse {
1873
1873
  /**
1874
1874
  * The status of the reservation.
1875
1875
  */
1876
- status: 'ACTIVE' | 'RELEASED';
1876
+ status: 'ACTIVE' | 'RELEASED' | 'EXPIRED';
1877
1877
  }
1878
1878
  }
1879
1879
  }
@@ -2625,7 +2625,7 @@ export namespace CustomerRetrieveEntitlementsResponse {
2625
2625
  /**
2626
2626
  * The status of the reservation.
2627
2627
  */
2628
- status: 'ACTIVE' | 'RELEASED';
2628
+ status: 'ACTIVE' | 'RELEASED' | 'EXPIRED';
2629
2629
  }
2630
2630
  }
2631
2631
  }
@@ -3294,6 +3294,36 @@ export interface CustomerCheckEntitlementParams {
3294
3294
  */
3295
3295
  requestedValues?: Array<string>;
3296
3296
 
3297
+ /**
3298
+ * Query param: When the reservation expires (ISO 8601, at most 24 hours ahead).
3299
+ * Mutually exclusive with `reservationTtlSeconds`.
3300
+ */
3301
+ reservationExpiresAt?: string;
3302
+
3303
+ /**
3304
+ * Query param: Client-provided reservation ID, required with `reserveAmount`.
3305
+ * Retry with the same ID to get the same result; reuse with different parameters
3306
+ * is a conflict.
3307
+ */
3308
+ reservationId?: string;
3309
+
3310
+ /**
3311
+ * Query param: JSON-encoded object of string values to attach to the reservation.
3312
+ */
3313
+ reservationMetadata?: string;
3314
+
3315
+ /**
3316
+ * Query param: How long the reservation holds the credits, in seconds (1–86400,
3317
+ * default 3600). Mutually exclusive with `reservationExpiresAt`.
3318
+ */
3319
+ reservationTtlSeconds?: number;
3320
+
3321
+ /**
3322
+ * Query param: Credits to reserve (credit entitlements only). The check is decided
3323
+ * and the credits held atomically; `requestedUsage` is ignored.
3324
+ */
3325
+ reserveAmount?: number;
3326
+
3297
3327
  /**
3298
3328
  * Query param: Resource ID to scope the entitlement check to a specific resource
3299
3329
  */
@@ -137,18 +137,31 @@ export namespace CustomerRetrieveGovernanceResponse {
137
137
  * exist
138
138
  */
139
139
  next: string | null;
140
+
141
+ /**
142
+ * Cursor for fetching the previous page of results, or null if at the beginning
143
+ */
144
+ prev: string | null;
140
145
  }
141
146
  }
142
147
 
143
148
  export interface CustomerRetrieveGovernanceParams {
144
149
  /**
145
- * Query param: Return items that come after this cursor
150
+ * Query param: Opaque cursor from a page’s `next`; returns the page after it.
151
+ * Mutually exclusive with `before`.
146
152
  */
147
153
  after?: string;
148
154
 
149
155
  /**
150
- * Query param: Currency ids to include, repeated per value (e.g.
151
- * `?currencyIds=credits`). Omit both featureIds and currencyIds for tree mode.
156
+ * Query param: Opaque cursor from a page’s `prev`; returns the page before it.
157
+ * Mutually exclusive with `after`.
158
+ */
159
+ before?: string;
160
+
161
+ /**
162
+ * Query param: Currency ids to include, comma-separated (e.g.
163
+ * `?currencyIds=credits`), up to 100. Omit both featureIds and currencyIds for
164
+ * tree mode.
152
165
  */
153
166
  currencyIds?: Array<string>;
154
167
 
@@ -159,14 +172,14 @@ export interface CustomerRetrieveGovernanceParams {
159
172
  entityIdSearch?: string;
160
173
 
161
174
  /**
162
- * Query param: Filter to one or more entity types, repeated per value (e.g.
163
- * `?entityTypeIds=team&entityTypeIds=user`).
175
+ * Query param: Filter to one or more entity types, comma-separated (e.g.
176
+ * `?entityTypeIds=team,user`), up to 100.
164
177
  */
165
178
  entityTypeIds?: Array<string>;
166
179
 
167
180
  /**
168
- * Query param: Feature ids to include, repeated per value (e.g.
169
- * `?featureIds=ai-tokens&featureIds=seats`). Omit both featureIds and currencyIds
181
+ * Query param: Feature ids to include, comma-separated (e.g.
182
+ * `?featureIds=ai-tokens,seats`), up to 100. Omit both featureIds and currencyIds
170
183
  * for tree mode — every node in the hierarchy with no usage configuration
171
184
  * attached.
172
185
  */
@@ -2692,7 +2692,7 @@ export namespace PlanUpdateParams {
2692
2692
  featureId?: string;
2693
2693
 
2694
2694
  /**
2695
- * Maximum number of units (max 999999)
2695
+ * Maximum number of units
2696
2696
  */
2697
2697
  maxUnitQuantity?: number;
2698
2698
 
@@ -3029,7 +3029,7 @@ export namespace SubscriptionProvisionResponse {
3029
3029
  /**
3030
3030
  * The status of the reservation.
3031
3031
  */
3032
- status: 'ACTIVE' | 'RELEASED';
3032
+ status: 'ACTIVE' | 'RELEASED' | 'EXPIRED';
3033
3033
  }
3034
3034
  }
3035
3035
 
@@ -391,10 +391,10 @@ export interface UsageEstimateParams {
391
391
  featureId: string;
392
392
 
393
393
  /**
394
- * Body param: The value to report for usage. Must be a whole number — the REST API
395
- * does not accept fractional (float) usage values; scale up (e.g. report cents
396
- * instead of dollars, or milliseconds instead of seconds) if you need sub-unit
397
- * precision.
394
+ * Body param: The value to report for usage. Fractional values are accepted and
395
+ * rounded half away from zero to 5 decimal places. A value with a fractional part
396
+ * must have an absolute value below 34,359,738,368 (2^35); whole numbers are
397
+ * accepted up to ±9,007,199,254,740,991.
398
398
  */
399
399
  value: number;
400
400
 
@@ -511,9 +511,10 @@ export namespace UsageReportParams {
511
511
  featureId: string;
512
512
 
513
513
  /**
514
- * The value to report for usage. Must be a whole number — the REST API does not
515
- * accept fractional (float) usage values; scale up (e.g. report cents instead of
516
- * dollars, or milliseconds instead of seconds) if you need sub-unit precision.
514
+ * The value to report for usage. Fractional values are accepted and rounded half
515
+ * away from zero to 5 decimal places. A value with a fractional part must have an
516
+ * absolute value below 34,359,738,368 (2^35); whole numbers are accepted up to
517
+ * ±9,007,199,254,740,991.
517
518
  */
518
519
  value: number;
519
520
 
@@ -312,7 +312,8 @@ export namespace AssignmentUpsertParams {
312
312
  /**
313
313
  * Parent entity ID in the hierarchy. Omit to leave the current parent untouched (a
314
314
  * new node defaults to a root); `null` detaches to a root; an ID sets or changes
315
- * the parent. Reparenting an existing node is leaf-only.
315
+ * the parent. Reparenting or detaching an existing node is leaf-only; place a
316
+ * parent before its children, or in the same batch.
316
317
  */
317
318
  parentId?: string | null;
318
319
 
@@ -27,16 +27,25 @@ import {
27
27
  } from './entities';
28
28
  import * as EntitlementsAPI from './entitlements';
29
29
  import { EntitlementCheckParams, EntitlementCheckResponse, Entitlements } from './entitlements';
30
+ import * as GovernanceAPI from './governance';
31
+ import {
32
+ Governance,
33
+ GovernanceListParams,
34
+ GovernanceListResponse,
35
+ GovernanceListResponsesMyCursorIDPage,
36
+ } from './governance';
30
37
 
31
38
  export class Customers extends APIResource {
32
39
  entitlements: EntitlementsAPI.Entitlements = new EntitlementsAPI.Entitlements(this._client);
33
40
  entities: EntitiesAPI.Entities = new EntitiesAPI.Entities(this._client);
34
41
  assignments: AssignmentsAPI.Assignments = new AssignmentsAPI.Assignments(this._client);
42
+ governance: GovernanceAPI.Governance = new GovernanceAPI.Governance(this._client);
35
43
  }
36
44
 
37
45
  Customers.Entitlements = Entitlements;
38
46
  Customers.Entities = Entities;
39
47
  Customers.Assignments = Assignments;
48
+ Customers.Governance = Governance;
40
49
 
41
50
  export declare namespace Customers {
42
51
  export {
@@ -68,4 +77,11 @@ export declare namespace Customers {
68
77
  type AssignmentListParams as AssignmentListParams,
69
78
  type AssignmentUpsertParams as AssignmentUpsertParams,
70
79
  };
80
+
81
+ export {
82
+ Governance as Governance,
83
+ type GovernanceListResponse as GovernanceListResponse,
84
+ type GovernanceListResponsesMyCursorIDPage as GovernanceListResponsesMyCursorIDPage,
85
+ type GovernanceListParams as GovernanceListParams,
86
+ };
71
87
  }
@@ -349,7 +349,7 @@ export namespace EntitlementCheckResponse {
349
349
  /**
350
350
  * The status of the reservation.
351
351
  */
352
- status: 'ACTIVE' | 'RELEASED';
352
+ status: 'ACTIVE' | 'RELEASED' | 'EXPIRED';
353
353
  }
354
354
  }
355
355
  }