@openmeter/sdk 1.0.0-beta.67 → 1.0.0-beta.69
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.
|
@@ -122,6 +122,95 @@ export interface paths {
|
|
|
122
122
|
*/
|
|
123
123
|
get: operations['queryPortalMeter'];
|
|
124
124
|
};
|
|
125
|
+
'/api/v1/features': {
|
|
126
|
+
/**
|
|
127
|
+
* List features
|
|
128
|
+
* @description List features.
|
|
129
|
+
*/
|
|
130
|
+
get: operations['listFeatures'];
|
|
131
|
+
/**
|
|
132
|
+
* Create feature
|
|
133
|
+
* @description Creates a feature.
|
|
134
|
+
*/
|
|
135
|
+
post: operations['createFeature'];
|
|
136
|
+
};
|
|
137
|
+
'/api/v1/features/{featureID}': {
|
|
138
|
+
/**
|
|
139
|
+
* Get feature
|
|
140
|
+
* @description Get feature by key.
|
|
141
|
+
*/
|
|
142
|
+
get: operations['getFeature'];
|
|
143
|
+
/**
|
|
144
|
+
* Delete feature
|
|
145
|
+
* @description Delete a feature by key.
|
|
146
|
+
*/
|
|
147
|
+
delete: operations['deleteFeature'];
|
|
148
|
+
};
|
|
149
|
+
'/api/v1/ledgers': {
|
|
150
|
+
/**
|
|
151
|
+
* List the already defined ledgers.
|
|
152
|
+
* @description List the already defined ledgers.
|
|
153
|
+
*/
|
|
154
|
+
get: operations['listLedgers'];
|
|
155
|
+
/**
|
|
156
|
+
* Creates the specified ledger
|
|
157
|
+
* @description Create or update the specified ledger.
|
|
158
|
+
*/
|
|
159
|
+
post: operations['createLedger'];
|
|
160
|
+
};
|
|
161
|
+
'/api/v1/ledgers/{ledgerID}/balance': {
|
|
162
|
+
/**
|
|
163
|
+
* Get the balance of a specific subject.
|
|
164
|
+
* @description Get the balance of a specific subject.
|
|
165
|
+
*/
|
|
166
|
+
get: operations['getCreditBalance'];
|
|
167
|
+
};
|
|
168
|
+
'/api/v1/ledgers/{ledgerID}/history': {
|
|
169
|
+
/**
|
|
170
|
+
* Get credit ledger
|
|
171
|
+
* @description Get credit ledger for a specific subject.
|
|
172
|
+
*/
|
|
173
|
+
get: operations['getCreditHistory'];
|
|
174
|
+
};
|
|
175
|
+
'/api/v1/ledgers/{ledgerID}/reset': {
|
|
176
|
+
/**
|
|
177
|
+
* Reset credit balance
|
|
178
|
+
* @description Resets the credit balances to zero for a specific subject and re-apply active grants with rollover configuration.
|
|
179
|
+
*/
|
|
180
|
+
post: operations['resetCredit'];
|
|
181
|
+
};
|
|
182
|
+
'/api/v1/ledgers/grants': {
|
|
183
|
+
/**
|
|
184
|
+
* List credit grants for multiple ledgers
|
|
185
|
+
* @description List credit grants for multiple ledgers.
|
|
186
|
+
*/
|
|
187
|
+
get: operations['listCreditGrants'];
|
|
188
|
+
};
|
|
189
|
+
'/api/v1/ledgers/{ledgerID}/grants': {
|
|
190
|
+
/**
|
|
191
|
+
* List credit grants
|
|
192
|
+
* @description List credit grants for a specific ledger.
|
|
193
|
+
*/
|
|
194
|
+
get: operations['listCreditGrantsByLedger'];
|
|
195
|
+
/**
|
|
196
|
+
* Create credit grant
|
|
197
|
+
* @description Creates a credit grant.
|
|
198
|
+
*/
|
|
199
|
+
post: operations['createCreditGrant'];
|
|
200
|
+
};
|
|
201
|
+
'/api/v1/ledgers/{ledgerID}/grants/{creditGrantID}': {
|
|
202
|
+
/**
|
|
203
|
+
* Get credit grant.
|
|
204
|
+
* @description Get credit by key.
|
|
205
|
+
*/
|
|
206
|
+
get: operations['getCreditGrant'];
|
|
207
|
+
/**
|
|
208
|
+
* Void credit grant
|
|
209
|
+
* @description Void a credit grant by ID. Partially or fully used credits cannot be voided.
|
|
210
|
+
* Voided credits won't be applied to the subject's balance anymore.
|
|
211
|
+
*/
|
|
212
|
+
delete: operations['voidCreditGrant'];
|
|
213
|
+
};
|
|
125
214
|
}
|
|
126
215
|
export type webhooks = Record<string, never>;
|
|
127
216
|
export interface components {
|
|
@@ -261,6 +350,260 @@ export interface components {
|
|
|
261
350
|
/** @example invalid event */
|
|
262
351
|
validationError?: string;
|
|
263
352
|
};
|
|
353
|
+
/**
|
|
354
|
+
* @description A feature is a feature or service offered to a customer.
|
|
355
|
+
* For example: CPU-Hours, Tokens, API Calls, etc.
|
|
356
|
+
*/
|
|
357
|
+
Feature: {
|
|
358
|
+
/**
|
|
359
|
+
* @description Readonly unique ULID identifier of the feature.
|
|
360
|
+
*
|
|
361
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
362
|
+
*/
|
|
363
|
+
id?: string;
|
|
364
|
+
/**
|
|
365
|
+
* @description The name of the feature.
|
|
366
|
+
*
|
|
367
|
+
* @example AI Tokens
|
|
368
|
+
*/
|
|
369
|
+
name: string;
|
|
370
|
+
/**
|
|
371
|
+
* @description The meter that the feature is associated with and decreases grants by usage.
|
|
372
|
+
*
|
|
373
|
+
* @example tokens_total
|
|
374
|
+
*/
|
|
375
|
+
meterSlug: string;
|
|
376
|
+
/**
|
|
377
|
+
* @description Optional meter group by filters. Useful if the meter scope is broader than what feature tracks.
|
|
378
|
+
*
|
|
379
|
+
* @example {
|
|
380
|
+
* "model": "gpt-4"
|
|
381
|
+
* }
|
|
382
|
+
*/
|
|
383
|
+
meterGroupByFilters?: {
|
|
384
|
+
[key: string]: string;
|
|
385
|
+
};
|
|
386
|
+
/**
|
|
387
|
+
* @description If the feature is archived, it will not be used for grants or usage.
|
|
388
|
+
*
|
|
389
|
+
* @example false
|
|
390
|
+
*/
|
|
391
|
+
archived?: boolean;
|
|
392
|
+
};
|
|
393
|
+
/**
|
|
394
|
+
* @description A ledger represented in open meter. A ledger must be assigned to a single
|
|
395
|
+
* subject.
|
|
396
|
+
*/
|
|
397
|
+
CreateLedger: {
|
|
398
|
+
/** @description The metering subject this ledger used to track credits for */
|
|
399
|
+
subject: string;
|
|
400
|
+
/**
|
|
401
|
+
* @example {
|
|
402
|
+
* "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
|
|
403
|
+
* }
|
|
404
|
+
*/
|
|
405
|
+
metadata?: {
|
|
406
|
+
[key: string]: string;
|
|
407
|
+
};
|
|
408
|
+
};
|
|
409
|
+
/** @description A ledger represented in our system. */
|
|
410
|
+
Ledger: components['schemas']['CreateLedger'] & {
|
|
411
|
+
/**
|
|
412
|
+
* @description Readonly unique ULID identifier of the ledger.
|
|
413
|
+
*
|
|
414
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
415
|
+
*/
|
|
416
|
+
id: string;
|
|
417
|
+
};
|
|
418
|
+
/** @description Credit ledger entry. */
|
|
419
|
+
CreditLedgerEntry: {
|
|
420
|
+
/**
|
|
421
|
+
* @description Readonly unique ULID identifier of the ledger entry.
|
|
422
|
+
*
|
|
423
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
424
|
+
*/
|
|
425
|
+
id: string;
|
|
426
|
+
type: components['schemas']['CreditLedgerEntryType'];
|
|
427
|
+
/**
|
|
428
|
+
* Format: date-time
|
|
429
|
+
* @description The time the ledger entry was created.
|
|
430
|
+
*
|
|
431
|
+
* @example 2023-01-01T00:00:00Z
|
|
432
|
+
*/
|
|
433
|
+
time: string;
|
|
434
|
+
/**
|
|
435
|
+
* @description The amount to apply. Can be positive or negative number. If applicable.
|
|
436
|
+
*
|
|
437
|
+
* @example 100
|
|
438
|
+
*/
|
|
439
|
+
amount?: number;
|
|
440
|
+
period?: components['schemas']['Period'];
|
|
441
|
+
};
|
|
442
|
+
/** @description A time period */
|
|
443
|
+
Period: {
|
|
444
|
+
/**
|
|
445
|
+
* Format: date-time
|
|
446
|
+
* @description Period start time where the amount was applied. If applicable.
|
|
447
|
+
*
|
|
448
|
+
* @example 2023-01-01T00:00:00Z
|
|
449
|
+
*/
|
|
450
|
+
from: string;
|
|
451
|
+
/**
|
|
452
|
+
* Format: date-time
|
|
453
|
+
* @description Period end time where the amount was applied. If applicable.
|
|
454
|
+
*
|
|
455
|
+
* @example 2023-01-01T00:00:00Z
|
|
456
|
+
*/
|
|
457
|
+
to: string;
|
|
458
|
+
};
|
|
459
|
+
/**
|
|
460
|
+
* @example GRANT
|
|
461
|
+
* @enum {string}
|
|
462
|
+
*/
|
|
463
|
+
CreditLedgerEntryType: 'GRANT' | 'VOID' | 'RESET' | 'GRANT_USAGE';
|
|
464
|
+
/** @description Credit balance of a subject. */
|
|
465
|
+
CreditBalance: {
|
|
466
|
+
/** @description Features with balances. */
|
|
467
|
+
features?: components['schemas']['FeatureBalance'][];
|
|
468
|
+
/** @description The grants applied to the subject. */
|
|
469
|
+
grants: components['schemas']['CreditGrantBalance'][];
|
|
470
|
+
};
|
|
471
|
+
/** @description Credit reset configuration. */
|
|
472
|
+
CreditReset: {
|
|
473
|
+
/**
|
|
474
|
+
* @description Readonly unique ULID identifier of the reset.
|
|
475
|
+
*
|
|
476
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
477
|
+
*/
|
|
478
|
+
id: string;
|
|
479
|
+
/**
|
|
480
|
+
* Format: date-time
|
|
481
|
+
* @description The time to reset the credit. It cannot be in the future.
|
|
482
|
+
*
|
|
483
|
+
* @example 2023-01-01T00:00:00Z
|
|
484
|
+
*/
|
|
485
|
+
effectiveAt: string;
|
|
486
|
+
};
|
|
487
|
+
CreditGrantBalance: components['schemas']['CreditGrantResponse'] & {
|
|
488
|
+
/**
|
|
489
|
+
* @description The balance of the grant.
|
|
490
|
+
*
|
|
491
|
+
* @example 100
|
|
492
|
+
*/
|
|
493
|
+
balance?: number;
|
|
494
|
+
};
|
|
495
|
+
FeatureBalance: components['schemas']['Feature'] & {
|
|
496
|
+
/**
|
|
497
|
+
* @description The balance of the feature.
|
|
498
|
+
*
|
|
499
|
+
* @example 100
|
|
500
|
+
*/
|
|
501
|
+
balance?: number;
|
|
502
|
+
};
|
|
503
|
+
/** @description Grants are used to increase balance of specific subjects. */
|
|
504
|
+
CreateCreditGrantRequest: {
|
|
505
|
+
/**
|
|
506
|
+
* @description Readonly unique ULID identifier of the grant.
|
|
507
|
+
*
|
|
508
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
509
|
+
*/
|
|
510
|
+
id: string;
|
|
511
|
+
type: components['schemas']['CreditGrantType'];
|
|
512
|
+
/**
|
|
513
|
+
* @description The amount to grant. Can be positive or negative number.
|
|
514
|
+
*
|
|
515
|
+
* @example 100
|
|
516
|
+
*/
|
|
517
|
+
amount: number;
|
|
518
|
+
/**
|
|
519
|
+
* @description The unique feature ULID that the grant is associated with, if any.
|
|
520
|
+
*
|
|
521
|
+
* @example 01ARZ3NDEKTSV4RRFFQ69G5FAV
|
|
522
|
+
*/
|
|
523
|
+
featureID: string;
|
|
524
|
+
/**
|
|
525
|
+
* @description The priority of the grant. Grants with higher priority are applied first.
|
|
526
|
+
* Priority is a positive decimal numbers. With lower numbers indicating higher importance.
|
|
527
|
+
* For example, a priority of 1 is more urgent than a priority of 2.
|
|
528
|
+
* When there are several grants available for the same subject, the system selects the grant with the highest priority.
|
|
529
|
+
* In cases where credit grants share the same priority level, the grant closest to its expiration will be used first.
|
|
530
|
+
* In the case of two credits have identical priorities and expiration dates, the system will use the grant that was created first.
|
|
531
|
+
*
|
|
532
|
+
* @default 1
|
|
533
|
+
* @example 1
|
|
534
|
+
*/
|
|
535
|
+
priority?: number;
|
|
536
|
+
/**
|
|
537
|
+
* Format: date-time
|
|
538
|
+
* @description The effective date.
|
|
539
|
+
*
|
|
540
|
+
* @example 2023-01-01T00:00:00Z
|
|
541
|
+
*/
|
|
542
|
+
effectiveAt: string;
|
|
543
|
+
expiration: components['schemas']['CreditExpirationPeriod'];
|
|
544
|
+
rollover?: components['schemas']['CreditGrantRollover'];
|
|
545
|
+
/**
|
|
546
|
+
* @example {
|
|
547
|
+
* "stripePaymentId": "pi_4OrAkhLvyihio9p51h9iiFnB"
|
|
548
|
+
* }
|
|
549
|
+
*/
|
|
550
|
+
metadata?: {
|
|
551
|
+
[key: string]: string;
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
CreditGrantResponse: components['schemas']['CreateCreditGrantRequest'] & {
|
|
555
|
+
/**
|
|
556
|
+
* @description The subject to grant the amount to.
|
|
557
|
+
*
|
|
558
|
+
* @example customer-id
|
|
559
|
+
*/
|
|
560
|
+
subject: string;
|
|
561
|
+
/**
|
|
562
|
+
* Format: date-time
|
|
563
|
+
* @description The expiration date of the grant.
|
|
564
|
+
*
|
|
565
|
+
* @example 2023-01-01T00:00:00Z
|
|
566
|
+
*/
|
|
567
|
+
expiresAt?: string;
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* @description The grant type:
|
|
571
|
+
* - `USAGE` - Increase balance by the amount in the unit of the associated meter.
|
|
572
|
+
*
|
|
573
|
+
* @example USAGE
|
|
574
|
+
* @enum {string}
|
|
575
|
+
*/
|
|
576
|
+
CreditGrantType: 'USAGE';
|
|
577
|
+
/** @description Grant rollover configuration. */
|
|
578
|
+
CreditGrantRollover: {
|
|
579
|
+
type: components['schemas']['CreditGrantRolloverType'];
|
|
580
|
+
/** @description Maximum amount to rollover. */
|
|
581
|
+
maxAmount?: number;
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* @description The rollover type to use:
|
|
585
|
+
* - `REMAINING_AMOUNT` - Rollover remaining amount.
|
|
586
|
+
* - `ORIGINAL_AMOUNT` - Rollover re-applies the full grant amount.
|
|
587
|
+
*
|
|
588
|
+
* @example ORIGINAL_AMOUNT
|
|
589
|
+
* @enum {string}
|
|
590
|
+
*/
|
|
591
|
+
CreditGrantRolloverType: 'REMAINING_AMOUNT' | 'ORIGINAL_AMOUNT';
|
|
592
|
+
/** @description Expiration period of a credit grant. */
|
|
593
|
+
CreditExpirationPeriod: {
|
|
594
|
+
/**
|
|
595
|
+
* @description The expiration period duration like month.
|
|
596
|
+
*
|
|
597
|
+
* @enum {string}
|
|
598
|
+
*/
|
|
599
|
+
duration: 'HOUR' | 'DAY' | 'WEEK' | 'MONTH' | 'YEAR';
|
|
600
|
+
/**
|
|
601
|
+
* @description The expiration period count like 12 months.
|
|
602
|
+
*
|
|
603
|
+
* @example 12
|
|
604
|
+
*/
|
|
605
|
+
count: number;
|
|
606
|
+
};
|
|
264
607
|
/**
|
|
265
608
|
* @description A meter is a configuration that defines how to match and aggregate events.
|
|
266
609
|
* @example {
|
|
@@ -547,6 +890,14 @@ export interface components {
|
|
|
547
890
|
meterIdOrSlug: components['schemas']['IdOrSlug'];
|
|
548
891
|
/** @description A unique identifier for a subject. */
|
|
549
892
|
subjectIdOrKey: string;
|
|
893
|
+
/** @description A unique ULID identifier for a feature. */
|
|
894
|
+
featureID: string;
|
|
895
|
+
/** @description A unique identifier for a credit grant. */
|
|
896
|
+
creditGrantID: string;
|
|
897
|
+
/** @description A unique identifier for a credit ledger's subject. */
|
|
898
|
+
ledgerID: string;
|
|
899
|
+
/** @description Number of entries to return */
|
|
900
|
+
creditQueryLimit?: number;
|
|
550
901
|
/**
|
|
551
902
|
* @description Start date-time in RFC 3339 format.
|
|
552
903
|
* Inclusive.
|
|
@@ -566,6 +917,15 @@ export interface components {
|
|
|
566
917
|
queryWindowTimeZone?: string;
|
|
567
918
|
/**
|
|
568
919
|
* @description Filtering and group by multiple subjects.
|
|
920
|
+
*
|
|
921
|
+
* Usage: `?ledgerID=01HX6VK5C498B3ABY9PR1069PP`
|
|
922
|
+
*
|
|
923
|
+
* @example 01HX6VK5C498B3ABY9PR1069PP
|
|
924
|
+
*/
|
|
925
|
+
queryFilterLedgerID?: string;
|
|
926
|
+
/**
|
|
927
|
+
* @description Filtering by multiple subjects.
|
|
928
|
+
*
|
|
569
929
|
* Usage: ?subject=customer-1&subject=customer-2
|
|
570
930
|
*/
|
|
571
931
|
queryFilterSubject?: string[];
|
|
@@ -987,4 +1347,341 @@ export interface operations {
|
|
|
987
1347
|
default: components['responses']['UnexpectedProblemResponse'];
|
|
988
1348
|
};
|
|
989
1349
|
};
|
|
1350
|
+
/**
|
|
1351
|
+
* List features
|
|
1352
|
+
* @description List features.
|
|
1353
|
+
*/
|
|
1354
|
+
listFeatures: {
|
|
1355
|
+
responses: {
|
|
1356
|
+
/** @description List of features. */
|
|
1357
|
+
200: {
|
|
1358
|
+
content: {
|
|
1359
|
+
'application/json': components['schemas']['Feature'][];
|
|
1360
|
+
};
|
|
1361
|
+
};
|
|
1362
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1363
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1364
|
+
};
|
|
1365
|
+
};
|
|
1366
|
+
/**
|
|
1367
|
+
* Create feature
|
|
1368
|
+
* @description Creates a feature.
|
|
1369
|
+
*/
|
|
1370
|
+
createFeature: {
|
|
1371
|
+
/** @description The feature to create. */
|
|
1372
|
+
requestBody: {
|
|
1373
|
+
content: {
|
|
1374
|
+
'application/json': components['schemas']['Feature'];
|
|
1375
|
+
};
|
|
1376
|
+
};
|
|
1377
|
+
responses: {
|
|
1378
|
+
/** @description Feature created. */
|
|
1379
|
+
201: {
|
|
1380
|
+
content: {
|
|
1381
|
+
'application/json': components['schemas']['Feature'];
|
|
1382
|
+
};
|
|
1383
|
+
};
|
|
1384
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1385
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1386
|
+
501: components['responses']['NotImplementedProblemResponse'];
|
|
1387
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1388
|
+
};
|
|
1389
|
+
};
|
|
1390
|
+
/**
|
|
1391
|
+
* Get feature
|
|
1392
|
+
* @description Get feature by key.
|
|
1393
|
+
*/
|
|
1394
|
+
getFeature: {
|
|
1395
|
+
parameters: {
|
|
1396
|
+
path: {
|
|
1397
|
+
featureID: components['parameters']['featureID'];
|
|
1398
|
+
};
|
|
1399
|
+
};
|
|
1400
|
+
responses: {
|
|
1401
|
+
/** @description Feature found. */
|
|
1402
|
+
200: {
|
|
1403
|
+
content: {
|
|
1404
|
+
'application/json': components['schemas']['Feature'];
|
|
1405
|
+
};
|
|
1406
|
+
};
|
|
1407
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1408
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1409
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1410
|
+
};
|
|
1411
|
+
};
|
|
1412
|
+
/**
|
|
1413
|
+
* Delete feature
|
|
1414
|
+
* @description Delete a feature by key.
|
|
1415
|
+
*/
|
|
1416
|
+
deleteFeature: {
|
|
1417
|
+
parameters: {
|
|
1418
|
+
path: {
|
|
1419
|
+
featureID: components['parameters']['featureID'];
|
|
1420
|
+
};
|
|
1421
|
+
};
|
|
1422
|
+
responses: {
|
|
1423
|
+
/** @description Feature deleted. */
|
|
1424
|
+
204: {
|
|
1425
|
+
content: never;
|
|
1426
|
+
};
|
|
1427
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1428
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1429
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1430
|
+
};
|
|
1431
|
+
};
|
|
1432
|
+
/**
|
|
1433
|
+
* List the already defined ledgers.
|
|
1434
|
+
* @description List the already defined ledgers.
|
|
1435
|
+
*/
|
|
1436
|
+
listLedgers: {
|
|
1437
|
+
parameters: {
|
|
1438
|
+
query?: {
|
|
1439
|
+
/** @description Query a specific ledger */
|
|
1440
|
+
subject?: string[];
|
|
1441
|
+
/** @description Number of ledgers to return */
|
|
1442
|
+
limit?: number;
|
|
1443
|
+
/** @description Start returning ledgers from this offset */
|
|
1444
|
+
offset?: number;
|
|
1445
|
+
};
|
|
1446
|
+
};
|
|
1447
|
+
responses: {
|
|
1448
|
+
/** @description List of the matching ledgers. */
|
|
1449
|
+
200: {
|
|
1450
|
+
content: {
|
|
1451
|
+
'application/json': components['schemas']['Ledger'][];
|
|
1452
|
+
};
|
|
1453
|
+
};
|
|
1454
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1455
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1456
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1457
|
+
};
|
|
1458
|
+
};
|
|
1459
|
+
/**
|
|
1460
|
+
* Creates the specified ledger
|
|
1461
|
+
* @description Create or update the specified ledger.
|
|
1462
|
+
*/
|
|
1463
|
+
createLedger: {
|
|
1464
|
+
/** @description The ledger to be created */
|
|
1465
|
+
requestBody: {
|
|
1466
|
+
content: {
|
|
1467
|
+
'application/json': components['schemas']['CreateLedger'];
|
|
1468
|
+
};
|
|
1469
|
+
};
|
|
1470
|
+
responses: {
|
|
1471
|
+
/** @description The created ledger. */
|
|
1472
|
+
201: {
|
|
1473
|
+
content: {
|
|
1474
|
+
'application/json': components['schemas']['Ledger'];
|
|
1475
|
+
};
|
|
1476
|
+
};
|
|
1477
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1478
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1479
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1480
|
+
};
|
|
1481
|
+
};
|
|
1482
|
+
/**
|
|
1483
|
+
* Get the balance of a specific subject.
|
|
1484
|
+
* @description Get the balance of a specific subject.
|
|
1485
|
+
*/
|
|
1486
|
+
getCreditBalance: {
|
|
1487
|
+
parameters: {
|
|
1488
|
+
query?: {
|
|
1489
|
+
/** @description Point of time to query balances: date-time in RFC 3339 format. Defaults to now. */
|
|
1490
|
+
time?: string;
|
|
1491
|
+
};
|
|
1492
|
+
path: {
|
|
1493
|
+
ledgerID: components['parameters']['ledgerID'];
|
|
1494
|
+
};
|
|
1495
|
+
};
|
|
1496
|
+
responses: {
|
|
1497
|
+
/** @description Credit balances found. */
|
|
1498
|
+
200: {
|
|
1499
|
+
content: {
|
|
1500
|
+
'application/json': components['schemas']['CreditBalance'];
|
|
1501
|
+
};
|
|
1502
|
+
};
|
|
1503
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1504
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1505
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1506
|
+
};
|
|
1507
|
+
};
|
|
1508
|
+
/**
|
|
1509
|
+
* Get credit ledger
|
|
1510
|
+
* @description Get credit ledger for a specific subject.
|
|
1511
|
+
*/
|
|
1512
|
+
getCreditHistory: {
|
|
1513
|
+
parameters: {
|
|
1514
|
+
query: {
|
|
1515
|
+
limit?: components['parameters']['creditQueryLimit'];
|
|
1516
|
+
/** @description Start of time range to query ledger: date-time in RFC 3339 format. */
|
|
1517
|
+
from: string;
|
|
1518
|
+
/** @description End of time range to query ledger: date-time in RFC 3339 format. Defaults to now. */
|
|
1519
|
+
to?: string;
|
|
1520
|
+
};
|
|
1521
|
+
path: {
|
|
1522
|
+
ledgerID: components['parameters']['ledgerID'];
|
|
1523
|
+
};
|
|
1524
|
+
};
|
|
1525
|
+
responses: {
|
|
1526
|
+
/** @description Credit balances found. */
|
|
1527
|
+
200: {
|
|
1528
|
+
content: {
|
|
1529
|
+
'application/json': components['schemas']['CreditLedgerEntry'][];
|
|
1530
|
+
};
|
|
1531
|
+
};
|
|
1532
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1533
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1534
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1535
|
+
};
|
|
1536
|
+
};
|
|
1537
|
+
/**
|
|
1538
|
+
* Reset credit balance
|
|
1539
|
+
* @description Resets the credit balances to zero for a specific subject and re-apply active grants with rollover configuration.
|
|
1540
|
+
*/
|
|
1541
|
+
resetCredit: {
|
|
1542
|
+
parameters: {
|
|
1543
|
+
path: {
|
|
1544
|
+
ledgerID: components['parameters']['ledgerID'];
|
|
1545
|
+
};
|
|
1546
|
+
};
|
|
1547
|
+
/** @description Details for the reset. */
|
|
1548
|
+
requestBody: {
|
|
1549
|
+
content: {
|
|
1550
|
+
'application/json': components['schemas']['CreditReset'];
|
|
1551
|
+
};
|
|
1552
|
+
};
|
|
1553
|
+
responses: {
|
|
1554
|
+
/** @description Credit balance. */
|
|
1555
|
+
201: {
|
|
1556
|
+
content: {
|
|
1557
|
+
'application/json': components['schemas']['CreditReset'];
|
|
1558
|
+
};
|
|
1559
|
+
};
|
|
1560
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1561
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1562
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1563
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1564
|
+
};
|
|
1565
|
+
};
|
|
1566
|
+
/**
|
|
1567
|
+
* List credit grants for multiple ledgers
|
|
1568
|
+
* @description List credit grants for multiple ledgers.
|
|
1569
|
+
*/
|
|
1570
|
+
listCreditGrants: {
|
|
1571
|
+
parameters: {
|
|
1572
|
+
query?: {
|
|
1573
|
+
ledgerID?: components['parameters']['queryFilterLedgerID'];
|
|
1574
|
+
limit?: components['parameters']['creditQueryLimit'];
|
|
1575
|
+
};
|
|
1576
|
+
};
|
|
1577
|
+
responses: {
|
|
1578
|
+
/** @description List of credit grants. */
|
|
1579
|
+
200: {
|
|
1580
|
+
content: {
|
|
1581
|
+
'application/json': components['schemas']['CreditGrantResponse'][];
|
|
1582
|
+
};
|
|
1583
|
+
};
|
|
1584
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1585
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1586
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1587
|
+
};
|
|
1588
|
+
};
|
|
1589
|
+
/**
|
|
1590
|
+
* List credit grants
|
|
1591
|
+
* @description List credit grants for a specific ledger.
|
|
1592
|
+
*/
|
|
1593
|
+
listCreditGrantsByLedger: {
|
|
1594
|
+
parameters: {
|
|
1595
|
+
query?: {
|
|
1596
|
+
limit?: components['parameters']['creditQueryLimit'];
|
|
1597
|
+
};
|
|
1598
|
+
path: {
|
|
1599
|
+
ledgerID: components['parameters']['ledgerID'];
|
|
1600
|
+
};
|
|
1601
|
+
};
|
|
1602
|
+
responses: {
|
|
1603
|
+
/** @description List of credit grants. */
|
|
1604
|
+
200: {
|
|
1605
|
+
content: {
|
|
1606
|
+
'application/json': components['schemas']['CreditGrantResponse'][];
|
|
1607
|
+
};
|
|
1608
|
+
};
|
|
1609
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1610
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1611
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1612
|
+
};
|
|
1613
|
+
};
|
|
1614
|
+
/**
|
|
1615
|
+
* Create credit grant
|
|
1616
|
+
* @description Creates a credit grant.
|
|
1617
|
+
*/
|
|
1618
|
+
createCreditGrant: {
|
|
1619
|
+
parameters: {
|
|
1620
|
+
path: {
|
|
1621
|
+
ledgerID: components['parameters']['ledgerID'];
|
|
1622
|
+
};
|
|
1623
|
+
};
|
|
1624
|
+
/** @description The credit grant to create. */
|
|
1625
|
+
requestBody: {
|
|
1626
|
+
content: {
|
|
1627
|
+
'application/json': components['schemas']['CreateCreditGrantRequest'];
|
|
1628
|
+
};
|
|
1629
|
+
};
|
|
1630
|
+
responses: {
|
|
1631
|
+
/** @description CreditGrant created. */
|
|
1632
|
+
201: {
|
|
1633
|
+
content: {
|
|
1634
|
+
'application/json': components['schemas']['CreditGrantResponse'];
|
|
1635
|
+
};
|
|
1636
|
+
};
|
|
1637
|
+
400: components['responses']['BadRequestProblemResponse'];
|
|
1638
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1639
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1640
|
+
};
|
|
1641
|
+
};
|
|
1642
|
+
/**
|
|
1643
|
+
* Get credit grant.
|
|
1644
|
+
* @description Get credit by key.
|
|
1645
|
+
*/
|
|
1646
|
+
getCreditGrant: {
|
|
1647
|
+
parameters: {
|
|
1648
|
+
path: {
|
|
1649
|
+
ledgerID: components['parameters']['ledgerID'];
|
|
1650
|
+
creditGrantID: components['parameters']['creditGrantID'];
|
|
1651
|
+
};
|
|
1652
|
+
};
|
|
1653
|
+
responses: {
|
|
1654
|
+
/** @description Credit found. */
|
|
1655
|
+
200: {
|
|
1656
|
+
content: {
|
|
1657
|
+
'application/json': components['schemas']['CreditGrantResponse'];
|
|
1658
|
+
};
|
|
1659
|
+
};
|
|
1660
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1661
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1662
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1663
|
+
};
|
|
1664
|
+
};
|
|
1665
|
+
/**
|
|
1666
|
+
* Void credit grant
|
|
1667
|
+
* @description Void a credit grant by ID. Partially or fully used credits cannot be voided.
|
|
1668
|
+
* Voided credits won't be applied to the subject's balance anymore.
|
|
1669
|
+
*/
|
|
1670
|
+
voidCreditGrant: {
|
|
1671
|
+
parameters: {
|
|
1672
|
+
path: {
|
|
1673
|
+
creditGrantID: components['parameters']['creditGrantID'];
|
|
1674
|
+
ledgerID: components['parameters']['ledgerID'];
|
|
1675
|
+
};
|
|
1676
|
+
};
|
|
1677
|
+
responses: {
|
|
1678
|
+
/** @description Credit grant voided. */
|
|
1679
|
+
204: {
|
|
1680
|
+
content: never;
|
|
1681
|
+
};
|
|
1682
|
+
401: components['responses']['UnauthorizedProblemResponse'];
|
|
1683
|
+
404: components['responses']['NotFoundProblemResponse'];
|
|
1684
|
+
default: components['responses']['UnexpectedProblemResponse'];
|
|
1685
|
+
};
|
|
1686
|
+
};
|
|
990
1687
|
}
|