@leaflow/sdk 0.26.0 → 0.28.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.
@@ -0,0 +1,1258 @@
1
+ /**
2
+ * This file was auto-generated by openapi-typescript.
3
+ * Do not make direct changes to the file.
4
+ */
5
+ export interface paths {
6
+ "/account/v1/billing-accounts": {
7
+ parameters: {
8
+ query?: never;
9
+ header?: never;
10
+ path?: never;
11
+ cookie?: never;
12
+ };
13
+ /**
14
+ * List my billing accounts
15
+ * @description Every billing account belonging to the caller, with the projects each one currently pays for.
16
+ *
17
+ * Not paginated: how many accounts one person holds is bounded by how many they bothered to
18
+ * create, and that is a small number.
19
+ */
20
+ get: operations["list-billing-accounts"];
21
+ put?: never;
22
+ /**
23
+ * Create a billing account
24
+ * @description Creates a billing account for the caller.
25
+ *
26
+ * **`seq` is supplied by the client, not assigned here.** Assigning it would mean reading the
27
+ * existing accounts and adding one, which is a read-modify-write race: two concurrent "create"
28
+ * clicks compute the same `seq`. Having the client name it turns that race into a plain
29
+ * idempotent repeat — the second request returns the first account instead of failing.
30
+ *
31
+ * The new account pays for nothing. Binding a project is a separate, deliberate act; doing it
32
+ * here would quietly turn "I want to add a card" into "I have changed who pays".
33
+ */
34
+ post: operations["create-billing-account"];
35
+ delete?: never;
36
+ options?: never;
37
+ head?: never;
38
+ patch?: never;
39
+ trace?: never;
40
+ };
41
+ "/account/v1/billing-accounts/{accountKey}/balance": {
42
+ parameters: {
43
+ query?: never;
44
+ header?: never;
45
+ path?: never;
46
+ cookie?: never;
47
+ };
48
+ /**
49
+ * Read an account's balance
50
+ * @description What is left on the account.
51
+ *
52
+ * The figure is the **live** balance: usage that has been reported but not yet settled is
53
+ * already subtracted. The settled figure is larger, and the difference is precisely what the
54
+ * holder has just spent — showing that instead would tell them they can afford something they
55
+ * cannot.
56
+ *
57
+ * An account that has never been topped up reports `"0"` — not an absent field, and not an
58
+ * empty string.
59
+ */
60
+ get: operations["read-billing-account-balance"];
61
+ put?: never;
62
+ post?: never;
63
+ delete?: never;
64
+ options?: never;
65
+ head?: never;
66
+ patch?: never;
67
+ trace?: never;
68
+ };
69
+ "/account/v1/billing-accounts/{accountKey}/projects/{projectId}": {
70
+ parameters: {
71
+ query?: never;
72
+ header?: never;
73
+ path?: never;
74
+ cookie?: never;
75
+ };
76
+ get?: never;
77
+ /**
78
+ * Make this account pay for a project
79
+ * @description Binds a project to this account. A project bound to another account is moved.
80
+ *
81
+ * **Both the account and the project must belong to the caller.** Either one failing refuses the
82
+ * request. Requiring the project as well as the account is what stops somebody attaching a
83
+ * project that is not theirs — which sounds generous, since they would be paying for it, but it
84
+ * would also expose that project's usage to them, and let them detach it again at any moment,
85
+ * leaving the project with no account and therefore unable to allocate anything.
86
+ *
87
+ * Idempotent: binding a project already bound to this account changes nothing.
88
+ *
89
+ * Only subsequent usage is affected; see the hard constraint on rebinding.
90
+ */
91
+ put: operations["bind-project-to-billing-account"];
92
+ post?: never;
93
+ delete?: never;
94
+ options?: never;
95
+ head?: never;
96
+ patch?: never;
97
+ trace?: never;
98
+ };
99
+ "/account/v1/billing-accounts/{accountKey}/top-ups": {
100
+ parameters: {
101
+ query?: never;
102
+ header?: never;
103
+ path?: never;
104
+ cookie?: never;
105
+ };
106
+ get?: never;
107
+ put?: never;
108
+ /**
109
+ * Start a top-up
110
+ * @description Begins adding money to this account. Returns a URL to send the browser to; the card is
111
+ * entered there, on the payment provider's own page.
112
+ *
113
+ * **No card data ever reaches this platform**, in any field, in any log. That is the entire
114
+ * reason this returns a redirect instead of accepting card details.
115
+ *
116
+ * **Credit is not added here.** It is added once the payment provider confirms the money
117
+ * arrived, which happens out of band and usually within seconds. The balance is unchanged when
118
+ * this call returns, and polling it immediately will show the old figure.
119
+ *
120
+ * That ordering is deliberate. Credit is spendable as soon as it exists, so anything added
121
+ * before the charge succeeds is money the holder can spend against a payment that then fails.
122
+ *
123
+ * Abandoning the page costs nothing; nothing is created on the account until the money arrives.
124
+ */
125
+ post: operations["start-top-up"];
126
+ delete?: never;
127
+ options?: never;
128
+ head?: never;
129
+ patch?: never;
130
+ trace?: never;
131
+ };
132
+ "/account/v1/billing-accounts/{accountKey}/charges": {
133
+ parameters: {
134
+ query?: never;
135
+ header?: never;
136
+ path?: never;
137
+ cookie?: never;
138
+ };
139
+ /**
140
+ * What this period has run up so far
141
+ * @description The itemised version of `unsettled`: what has been used this period and not yet billed.
142
+ *
143
+ * It has to come from charges rather than from invoices. An invoice only exists once a period has
144
+ * been billed, and the one for the period in progress is in a state that does not appear in the
145
+ * invoice list at all — reading invoices would show nothing and suggest the account has used
146
+ * nothing, while the spend keeps climbing.
147
+ */
148
+ get: operations["list-charges"];
149
+ put?: never;
150
+ post?: never;
151
+ delete?: never;
152
+ options?: never;
153
+ head?: never;
154
+ patch?: never;
155
+ trace?: never;
156
+ };
157
+ "/account/v1/billing-accounts/{accountKey}/invoices": {
158
+ parameters: {
159
+ query?: never;
160
+ header?: never;
161
+ path?: never;
162
+ cookie?: never;
163
+ };
164
+ /**
165
+ * List this account's invoices
166
+ * @description Past periods, most recent first. The period in progress is not here — see the charges
167
+ * endpoint for that.
168
+ */
169
+ get: operations["list-invoices"];
170
+ put?: never;
171
+ post?: never;
172
+ delete?: never;
173
+ options?: never;
174
+ head?: never;
175
+ patch?: never;
176
+ trace?: never;
177
+ };
178
+ "/account/v1/billing-accounts/{accountKey}/invoices/{invoiceId}": {
179
+ parameters: {
180
+ query?: never;
181
+ header?: never;
182
+ path?: never;
183
+ cookie?: never;
184
+ };
185
+ /**
186
+ * Read one invoice with its lines
187
+ * @description A total does not answer "why is it this much", and that is the question a bill provokes. Each
188
+ * line carries its service period, without which lines of the same name — hundreds of them on an
189
+ * hourly bill — cannot be told apart, and how much of it credit covered, which is the answer to
190
+ * "I have a balance, why am I being charged".
191
+ */
192
+ get: operations["get-invoice"];
193
+ put?: never;
194
+ post?: never;
195
+ delete?: never;
196
+ options?: never;
197
+ head?: never;
198
+ patch?: never;
199
+ trace?: never;
200
+ };
201
+ "/account/v1/billing-accounts/{accountKey}/subscription": {
202
+ parameters: {
203
+ query?: never;
204
+ header?: never;
205
+ path?: never;
206
+ cookie?: never;
207
+ };
208
+ /**
209
+ * Which plan this account is on
210
+ * @description `404` means no plan, which is worth showing rather than hiding: an account without one is
211
+ * refused admission, so nothing can be allocated in it.
212
+ *
213
+ * A subscription that has been cancelled but has not reached the end of its period still counts
214
+ * as being on a plan — it is still serving, still billing, and the period has already been paid
215
+ * for.
216
+ */
217
+ get: operations["read-subscription"];
218
+ put?: never;
219
+ post?: never;
220
+ delete?: never;
221
+ options?: never;
222
+ head?: never;
223
+ patch?: never;
224
+ trace?: never;
225
+ };
226
+ "/account/v1/billing-accounts/{accountKey}/subscription/cancel": {
227
+ parameters: {
228
+ query?: never;
229
+ header?: never;
230
+ path?: never;
231
+ cookie?: never;
232
+ };
233
+ get?: never;
234
+ put?: never;
235
+ /**
236
+ * Come off the paid plan
237
+ * @description Moves the account off whatever plan it is on.
238
+ *
239
+ * Where a default plan is configured this is a switch to it rather than a cancellation — an
240
+ * account with no plan is refused admission, so cancelling outright would cut off someone who
241
+ * only meant to drop back to the free tier. Without a default plan it is a real cancellation and
242
+ * the account is left with no plan on purpose.
243
+ *
244
+ * `timing` has to be stated. Ending immediately on an account that has already paid for the
245
+ * current period takes back what they paid for; ending at the end of the period does not. There
246
+ * is no default because the two are materially different and picking one silently would make the
247
+ * wrong one happen whenever the field is forgotten.
248
+ *
249
+ * Without this, someone who bought a paid plan can only stop paying by contacting support —
250
+ * which is how a cancellation becomes a chargeback.
251
+ */
252
+ post: operations["cancel-subscription"];
253
+ delete?: never;
254
+ options?: never;
255
+ head?: never;
256
+ patch?: never;
257
+ trace?: never;
258
+ };
259
+ "/account/v1/billing-accounts/{accountKey}/top-ups/{paymentId}": {
260
+ parameters: {
261
+ query?: never;
262
+ header?: never;
263
+ path?: never;
264
+ cookie?: never;
265
+ };
266
+ /**
267
+ * How far along a top-up is
268
+ * @description Credit arrives asynchronously, shortly after the payment provider confirms the money. Coming
269
+ * back from the payment page the balance has usually not moved yet, and without this there is no
270
+ * way to tell "it is on its way" from "it failed" — the only recourse is refreshing the balance
271
+ * and guessing.
272
+ *
273
+ * `settled` means the credit has landed. `pending` means the money arrived and the credit has
274
+ * not been issued yet, or the payment method is an asynchronous one and the money itself is
275
+ * still in transit.
276
+ */
277
+ get: operations["read-top-up"];
278
+ put?: never;
279
+ post?: never;
280
+ delete?: never;
281
+ options?: never;
282
+ head?: never;
283
+ patch?: never;
284
+ trace?: never;
285
+ };
286
+ "/account/v1/billing-accounts/{accountKey}/card": {
287
+ parameters: {
288
+ query?: never;
289
+ header?: never;
290
+ path?: never;
291
+ cookie?: never;
292
+ };
293
+ get?: never;
294
+ put?: never;
295
+ /**
296
+ * Add or replace the card on file
297
+ * @description Begins adding a card. Returns a URL to send the browser to; the card is entered there, on the
298
+ * payment provider's own page, and **no card data ever reaches this platform**.
299
+ *
300
+ * ## This is a prerequisite for buying a plan, not a convenience
301
+ *
302
+ * A plan is charged by invoice, and the invoice is collected from the card on file. The billing
303
+ * a subscription cannot start for an account that has none — so "add a card, then
304
+ * buy" is the order the system requires, not a flow that was chosen.
305
+ *
306
+ * It is *not* a prerequisite for topping up: a top-up collects the money there and then.
307
+ *
308
+ * Replacing the card uses the same operation. The new card becomes the default and the old one
309
+ * stops being used; nothing else about the account changes.
310
+ */
311
+ post: operations["start-card-setup"];
312
+ delete?: never;
313
+ options?: never;
314
+ head?: never;
315
+ patch?: never;
316
+ trace?: never;
317
+ };
318
+ "/account/v1/billing-accounts/{accountKey}/offers": {
319
+ parameters: {
320
+ query?: never;
321
+ header?: never;
322
+ path?: never;
323
+ cookie?: never;
324
+ };
325
+ /**
326
+ * List the offers this account can buy
327
+ * @description Lists what is actually purchasable by this account, right now.
328
+ *
329
+ * ## Every offer here has passed the full eligibility check
330
+ *
331
+ * The list is not "everything on sale" filtered by status. A promotion whose places are gone, a
332
+ * first-month discount this person already used, a beta price they are not on the list for —
333
+ * none of them appear. Returning them and rejecting the purchase afterwards reads as a broken
334
+ * system rather than as a rule.
335
+ *
336
+ * The price is not here, and not because it was left out: an offer states **who may buy, and
337
+ * when**. What it costs comes from the plan it points at, and is reported by the offers list.
338
+ */
339
+ get: operations["list-offers"];
340
+ put?: never;
341
+ post?: never;
342
+ delete?: never;
343
+ options?: never;
344
+ head?: never;
345
+ patch?: never;
346
+ trace?: never;
347
+ };
348
+ "/account/v1/billing-accounts/{accountKey}/offers/{offerKey}/purchase": {
349
+ parameters: {
350
+ query?: never;
351
+ header?: never;
352
+ path?: never;
353
+ cookie?: never;
354
+ };
355
+ get?: never;
356
+ put?: never;
357
+ /**
358
+ * Buy an offer
359
+ * @description Puts the account on the plan this offer points at, taking one of its places if it has a limit.
360
+ *
361
+ * ## A card has to be on file first
362
+ *
363
+ * Unless the offer points at a free plan. A paid plan is collected from the card on file
364
+ * and refuses to start the subscription without one; that refusal arrives here as a
365
+ * precondition error rather than as a conflict.
366
+ *
367
+ * ## `timing` is required only when the account already has a plan
368
+ *
369
+ * Moving between plans immediately is what an upgrade wants — the customer paid more and wants
370
+ * it now. Waiting for the end of the period is what a downgrade wants — they already paid for
371
+ * this one. Neither is a safe default, and picking one silently gets the money wrong whenever
372
+ * the field is forgotten.
373
+ *
374
+ * ## Being refused says which rule refused
375
+ *
376
+ * Places gone, window closed, already used, not on the list — each needs the customer to do
377
+ * something different, and several of them need them to do nothing at all. A single "not
378
+ * eligible" sends everyone to support.
379
+ *
380
+ * ## Retrying is safe
381
+ *
382
+ * A place is taken before the subscription is created, so a failure in between leaves the place
383
+ * held rather than the discount given away. Retrying the same purchase finishes it instead of
384
+ * taking a second place.
385
+ */
386
+ post: operations["purchase-offer"];
387
+ delete?: never;
388
+ options?: never;
389
+ head?: never;
390
+ patch?: never;
391
+ trace?: never;
392
+ };
393
+ }
394
+ export type webhooks = Record<string, never>;
395
+ export interface components {
396
+ schemas: {
397
+ /**
398
+ * @description When a plan change takes effect. There is no default: an upgrade and a downgrade want opposite
399
+ * answers, and the difference is money
400
+ * @enum {string}
401
+ */
402
+ PlanChangeTiming: "immediate" | "next_billing_cycle";
403
+ OfferList: {
404
+ offers: components["schemas"]["Offer"][];
405
+ };
406
+ /**
407
+ * @description One thing this account can buy. It carries no price — the price is on the plan it points at,
408
+ * recorded in exactly one place
409
+ */
410
+ Offer: {
411
+ /** @description The stable identifier operations and support use for this offer */
412
+ offer_key: string;
413
+ name: string;
414
+ description?: string;
415
+ /** @description A short label for the pricing page, e.g. the one marking the recommended tier */
416
+ badge?: string;
417
+ /**
418
+ * Format: date-time
419
+ * @description When this offer stops being purchasable. Absent means it does not expire
420
+ */
421
+ valid_until?: string;
422
+ /** @description Present on offers that sell a plan */
423
+ pricing?: components["schemas"]["Pricing"];
424
+ /** @description Present on offers that sell credit */
425
+ top_up?: components["schemas"]["TopUpPricing"];
426
+ };
427
+ /**
428
+ * @description What this offer costs, as a structure rather than a number.
429
+ *
430
+ * A plan is rarely one number: an introductory period at one price followed by another, a monthly
431
+ * fee alongside metered usage, an allowance of free units before metering starts. Flattening that
432
+ * into a single figure means deciding which part to show, and every such decision is wrong for
433
+ * some plan.
434
+ *
435
+ * This is read on each request rather than stored alongside the offer. The plan owns
436
+ * prices; a second copy would be a second answer, and the two would drift without anything saying
437
+ * so — the visible symptom being a pricing page that disagrees with the invoice.
438
+ */
439
+ Pricing: {
440
+ currency: components["schemas"]["Currency"];
441
+ /** @description How often this recurs, as an ISO 8601 duration. `P1M` is monthly */
442
+ billing_period?: string;
443
+ /**
444
+ * @description In order. A phase with no `duration` runs until the subscription ends, and there is at most
445
+ * one of those, last
446
+ */
447
+ phases: components["schemas"]["PricingPhase"][];
448
+ };
449
+ PricingPhase: {
450
+ name: string;
451
+ /** @description How long this phase lasts, as an ISO 8601 duration. Absent means "until the end" */
452
+ duration?: string;
453
+ lines: components["schemas"]["PricingLine"][];
454
+ };
455
+ /** @description One charge within a phase — a fee, or a rate for something metered */
456
+ PricingLine: {
457
+ name: string;
458
+ /**
459
+ * @description `free` costs nothing. `flat` is charged once per period regardless of use. `unit` is charged
460
+ * per unit consumed
461
+ * @enum {string}
462
+ */
463
+ type: "free" | "flat" | "unit";
464
+ /** @description A decimal string. Money is never a float */
465
+ amount?: string;
466
+ /**
467
+ * @description For `unit` lines whose meter counts something finer than what is charged for: how many
468
+ * metered units one charge covers. A price of `10` with `units_per_charge` of `1000000` is
469
+ * ten currency units per million.
470
+ *
471
+ * Absent means one for one. **Showing the amount without this is wrong by whatever this
472
+ * factor is**, which for token pricing is six orders of magnitude
473
+ */
474
+ units_per_charge?: string;
475
+ /** @description How many units are not charged for before charging starts */
476
+ free_units?: string;
477
+ /**
478
+ * Format: float
479
+ * @description A reduction applied to this line, 0 to 100
480
+ */
481
+ percent_off?: number;
482
+ /**
483
+ * @description True when this is charged once at the start rather than every period. Absent or false means
484
+ * it recurs
485
+ */
486
+ one_time?: boolean;
487
+ };
488
+ /**
489
+ * @description What a top-up bundle costs and what it grants. Present only on offers that sell credit.
490
+ *
491
+ * Unlike a plan price, this is stated on the bundle itself: credit is granted per
492
+ * transaction and has no catalog of bundles to read from. There is no second copy to drift
493
+ * against, because there is no first one anywhere else
494
+ */
495
+ TopUpPricing: {
496
+ /** @description What is charged, as a decimal string */
497
+ pay: string;
498
+ /** @description How much credit is granted. Equal to `pay` when there is no bonus */
499
+ credit: string;
500
+ };
501
+ Purchase: {
502
+ offer_key: string;
503
+ /**
504
+ * @description The subscription now serving this account. When the change was set to take effect at the
505
+ * end of the period, this is the one that takes over then, and its status says `scheduled`
506
+ */
507
+ subscription_id: string;
508
+ };
509
+ Error: {
510
+ code?: string;
511
+ message: string;
512
+ meta?: {
513
+ [key: string]: unknown;
514
+ };
515
+ /** Format: int64 */
516
+ status: number;
517
+ };
518
+ /**
519
+ * @description A billing account.
520
+ *
521
+ * Any internal identifier is deliberately absent: the key addresses everything on
522
+ * this API, and a second identifier is one more thing a client can pass in the wrong place, for
523
+ * no benefit to anyone reading the page.
524
+ */
525
+ BillingAccount: {
526
+ /** @description Addresses the account and states who owns it. Of the form `u_<user_id>_<seq>` */
527
+ key: string;
528
+ /** @description What the holder called it. Not unique, and it addresses nothing */
529
+ display_name: string;
530
+ currency: components["schemas"]["Currency"];
531
+ /** @description The projects this account pays for. Empty when it pays for none, never `null` */
532
+ project_ids: string[];
533
+ };
534
+ BillingAccountList: {
535
+ /** @description Every account belonging to the caller. Empty when they hold none */
536
+ accounts: components["schemas"]["BillingAccount"][];
537
+ };
538
+ CreateBillingAccountRequestBody: {
539
+ /**
540
+ * Format: int32
541
+ * @description Which of the caller's accounts this is. Two requests carrying the same `seq` describe the
542
+ * same account, so a retry is safe; a different `seq` creates a different account.
543
+ *
544
+ * It is not optional. Defaulting it would mean that a client which forgot the field
545
+ * silently receives the account it already had, and reads that as a successful creation.
546
+ */
547
+ seq: number;
548
+ /** @description A name for the holder's own benefit */
549
+ display_name: string;
550
+ currency?: components["schemas"]["Currency"];
551
+ /**
552
+ * @description Buy one of the top-up bundles from `/offers` instead of an arbitrary amount. When given,
553
+ * `amount` is ignored: the bundle says what is charged and how much credit it grants.
554
+ *
555
+ * How much credit arrives is decided when the money does, not now — and only if the amount
556
+ * collected matches what the bundle costs. A bundle whose places ran out, or whose window
557
+ * closed, in between still grants what was paid for; it just does not grant the bonus.
558
+ */
559
+ offer_key?: string;
560
+ };
561
+ /**
562
+ * @description The three numbers a billing page needs, which are not the same number.
563
+ *
564
+ * `balance` answers "can I start another one" and is floored at zero, so it cannot express
565
+ * being past zero. `unsettled` is what the current period has run up. `available` is the
566
+ * difference between the two and **may be negative**.
567
+ *
568
+ * Reporting only the first would make an account that has overspent indistinguishable from one
569
+ * that spent exactly what it had, and those two call for different actions.
570
+ */
571
+ Balance: {
572
+ currency: components["schemas"]["Currency"];
573
+ /**
574
+ * @description What is spendable right now, with usage reported but not yet settled already subtracted.
575
+ * Never negative — it is floored at zero, so it answers "can I start another machine" but
576
+ * not "how much do I owe". A decimal string; `"0"` when the account has never been topped up
577
+ */
578
+ balance: string;
579
+ /** @description The amount booked to the ledger, before this period's usage is taken off */
580
+ cash: string;
581
+ /**
582
+ * @description What this period has run up and not yet been billed for. It keeps growing past the cash
583
+ * balance, which is precisely the case the live figure cannot show
584
+ */
585
+ unsettled: string;
586
+ /**
587
+ * @description `cash` minus `unsettled`. **Negative means already in arrears**, and being able to say that
588
+ * is the whole reason this field exists — the positive range is already covered by `balance`
589
+ */
590
+ available: string;
591
+ };
592
+ /** @description Which account pays for which project, as it stands once the request has been applied */
593
+ ProjectBinding: {
594
+ account_key: string;
595
+ /** Format: uuid */
596
+ project_id: string;
597
+ };
598
+ StartTopUpRequestBody: {
599
+ /**
600
+ * @description How much to add, as a decimal string — `"20"`, `"19.99"`.
601
+ *
602
+ * **Anything below one cent is rejected rather than rounded.** Rounding up overcharges and
603
+ * rounding down undercharges; both alter the amount somewhere the payer cannot see it, and
604
+ * this is the one number on this API where being wrong means money is wrong.
605
+ */
606
+ amount: string;
607
+ currency?: components["schemas"]["Currency"];
608
+ /**
609
+ * @description Buy one of the top-up bundles from `/offers` instead of an arbitrary amount. When given,
610
+ * `amount` is ignored: the bundle says what is charged and how much credit it grants.
611
+ *
612
+ * How much credit arrives is decided when the money does, not now — and only if the amount
613
+ * collected matches what the bundle costs. A bundle whose places ran out, or whose window
614
+ * closed, in between still grants what was paid for; it just does not grant the bonus.
615
+ */
616
+ offer_key?: string;
617
+ };
618
+ CardSetupSession: {
619
+ /**
620
+ * Format: uri
621
+ * @description Send the browser here. It expires, so do not store it
622
+ */
623
+ url: string;
624
+ };
625
+ TopUpSession: {
626
+ /**
627
+ * @description Identifies this attempt. Quote it in a support conversation — it is what ties the payment
628
+ * provider's record to the credit that was granted
629
+ */
630
+ payment_id: string;
631
+ /**
632
+ * Format: uri
633
+ * @description Send the browser here. It expires, so do not store it
634
+ */
635
+ url: string;
636
+ };
637
+ /** @description One thing this period has been charged for */
638
+ Charge: {
639
+ id: string;
640
+ name: string;
641
+ /**
642
+ * @description Decimal string, the real-time figure. The booked figure would show a machine that only
643
+ * just started as zero
644
+ */
645
+ total: string;
646
+ };
647
+ ChargeList: {
648
+ currency: components["schemas"]["Currency"];
649
+ charges: components["schemas"]["Charge"][];
650
+ /** @description The sum, which is the same number as `unsettled` on the balance */
651
+ total: string;
652
+ };
653
+ /** @enum {string} */
654
+ InvoiceStatus: "draft" | "issuing" | "issued" | "payment_processing" | "overdue" | "paid" | "uncollectible" | "voided";
655
+ Invoice: {
656
+ id: string;
657
+ number?: string;
658
+ status: components["schemas"]["InvoiceStatus"];
659
+ currency: components["schemas"]["Currency"];
660
+ total: string;
661
+ /** Format: date-time */
662
+ due_at?: string;
663
+ /** Format: date-time */
664
+ issued_at?: string;
665
+ /** Format: date-time */
666
+ created_at: string;
667
+ };
668
+ InvoiceList: {
669
+ invoices: components["schemas"]["Invoice"][];
670
+ };
671
+ InvoiceLine: {
672
+ name: string;
673
+ description?: string;
674
+ /**
675
+ * Format: date-time
676
+ * @description Required. Lines of the same name repeat many times on one invoice — hundreds on an hourly
677
+ * bill — and without the period they cannot be told apart
678
+ */
679
+ period_from: string;
680
+ /** Format: date-time */
681
+ period_to: string;
682
+ /** @description Before discounts and credit */
683
+ amount: string;
684
+ discounts_total?: string;
685
+ /** @description How much of this line credit covered */
686
+ credits_total?: string;
687
+ total: string;
688
+ };
689
+ InvoiceDetail: {
690
+ id: string;
691
+ number?: string;
692
+ status: components["schemas"]["InvoiceStatus"];
693
+ currency: components["schemas"]["Currency"];
694
+ total: string;
695
+ charges_total?: string;
696
+ discounts_total?: string;
697
+ credits_total?: string;
698
+ taxes_total?: string;
699
+ /** Format: date-time */
700
+ period_from?: string;
701
+ /** Format: date-time */
702
+ period_to?: string;
703
+ /** Format: date-time */
704
+ due_at?: string;
705
+ /** Format: date-time */
706
+ issued_at?: string;
707
+ /** Format: date-time */
708
+ created_at: string;
709
+ lines: components["schemas"]["InvoiceLine"][];
710
+ };
711
+ Subscription: {
712
+ id: string;
713
+ plan_key: string;
714
+ plan_version?: number;
715
+ /**
716
+ * @description `canceled` still counts as being on a plan — it is serving until the end of the period,
717
+ * which has already been paid for
718
+ */
719
+ status: string;
720
+ };
721
+ TopUpStatus: {
722
+ payment_id: string;
723
+ /**
724
+ * @description `settled` means the credit has landed. `pending` means it has not yet — the payment is
725
+ * still being confirmed, or the money itself is still in transit
726
+ * @enum {string}
727
+ */
728
+ state: "settled" | "pending";
729
+ /** @description The credit that was issued, present once settled */
730
+ amount?: string;
731
+ currency?: components["schemas"]["Currency"];
732
+ };
733
+ /**
734
+ * @description ISO 4217, uppercase. `USD` is the only value the platform issues today, and a request
735
+ * naming any other is refused with `BILLING_CURRENCY_UNSUPPORTED`.
736
+ *
737
+ * Deliberately not an enumeration. The set of currency codes is governed outside this API, so
738
+ * a client generated today must still be able to read a response naming a code added later —
739
+ * an enumeration turns that response into a decode failure in a client nobody can redeploy.
740
+ * Restricting what may be *sent* is a rule about what the platform supports, and it lives
741
+ * where that rule can change without regenerating anything.
742
+ */
743
+ Currency: string;
744
+ };
745
+ responses: never;
746
+ parameters: {
747
+ /**
748
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
749
+ * which is why the key is what addresses the account.
750
+ */
751
+ AccountKey: string;
752
+ };
753
+ requestBodies: never;
754
+ headers: never;
755
+ pathItems: never;
756
+ }
757
+ export type $defs = Record<string, never>;
758
+ export interface operations {
759
+ "list-billing-accounts": {
760
+ parameters: {
761
+ query?: never;
762
+ header?: never;
763
+ path?: never;
764
+ cookie?: never;
765
+ };
766
+ requestBody?: never;
767
+ responses: {
768
+ /** @description OK */
769
+ 200: {
770
+ headers: {
771
+ [name: string]: unknown;
772
+ };
773
+ content: {
774
+ "application/json": components["schemas"]["BillingAccountList"];
775
+ };
776
+ };
777
+ /** @description Error */
778
+ default: {
779
+ headers: {
780
+ [name: string]: unknown;
781
+ };
782
+ content: {
783
+ "application/json": components["schemas"]["Error"];
784
+ };
785
+ };
786
+ };
787
+ };
788
+ "create-billing-account": {
789
+ parameters: {
790
+ query?: never;
791
+ header?: never;
792
+ path?: never;
793
+ cookie?: never;
794
+ };
795
+ requestBody: {
796
+ content: {
797
+ "application/json": components["schemas"]["CreateBillingAccountRequestBody"];
798
+ };
799
+ };
800
+ responses: {
801
+ /** @description OK */
802
+ 200: {
803
+ headers: {
804
+ [name: string]: unknown;
805
+ };
806
+ content: {
807
+ "application/json": components["schemas"]["BillingAccount"];
808
+ };
809
+ };
810
+ /** @description Error */
811
+ default: {
812
+ headers: {
813
+ [name: string]: unknown;
814
+ };
815
+ content: {
816
+ "application/json": components["schemas"]["Error"];
817
+ };
818
+ };
819
+ };
820
+ };
821
+ "read-billing-account-balance": {
822
+ parameters: {
823
+ query?: never;
824
+ header?: never;
825
+ path: {
826
+ /**
827
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
828
+ * which is why the key is what addresses the account.
829
+ */
830
+ accountKey: components["parameters"]["AccountKey"];
831
+ };
832
+ cookie?: never;
833
+ };
834
+ requestBody?: never;
835
+ responses: {
836
+ /** @description OK */
837
+ 200: {
838
+ headers: {
839
+ [name: string]: unknown;
840
+ };
841
+ content: {
842
+ "application/json": components["schemas"]["Balance"];
843
+ };
844
+ };
845
+ /** @description Error */
846
+ default: {
847
+ headers: {
848
+ [name: string]: unknown;
849
+ };
850
+ content: {
851
+ "application/json": components["schemas"]["Error"];
852
+ };
853
+ };
854
+ };
855
+ };
856
+ "bind-project-to-billing-account": {
857
+ parameters: {
858
+ query?: never;
859
+ header?: never;
860
+ path: {
861
+ /**
862
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
863
+ * which is why the key is what addresses the account.
864
+ */
865
+ accountKey: components["parameters"]["AccountKey"];
866
+ /** @description The project this account should pay for */
867
+ projectId: string;
868
+ };
869
+ cookie?: never;
870
+ };
871
+ requestBody?: never;
872
+ responses: {
873
+ /** @description OK */
874
+ 200: {
875
+ headers: {
876
+ [name: string]: unknown;
877
+ };
878
+ content: {
879
+ "application/json": components["schemas"]["ProjectBinding"];
880
+ };
881
+ };
882
+ /** @description Error */
883
+ default: {
884
+ headers: {
885
+ [name: string]: unknown;
886
+ };
887
+ content: {
888
+ "application/json": components["schemas"]["Error"];
889
+ };
890
+ };
891
+ };
892
+ };
893
+ "start-top-up": {
894
+ parameters: {
895
+ query?: never;
896
+ header?: never;
897
+ path: {
898
+ /**
899
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
900
+ * which is why the key is what addresses the account.
901
+ */
902
+ accountKey: components["parameters"]["AccountKey"];
903
+ };
904
+ cookie?: never;
905
+ };
906
+ requestBody: {
907
+ content: {
908
+ "application/json": components["schemas"]["StartTopUpRequestBody"];
909
+ };
910
+ };
911
+ responses: {
912
+ /** @description OK */
913
+ 200: {
914
+ headers: {
915
+ [name: string]: unknown;
916
+ };
917
+ content: {
918
+ "application/json": components["schemas"]["TopUpSession"];
919
+ };
920
+ };
921
+ /** @description Error */
922
+ default: {
923
+ headers: {
924
+ [name: string]: unknown;
925
+ };
926
+ content: {
927
+ "application/json": components["schemas"]["Error"];
928
+ };
929
+ };
930
+ };
931
+ };
932
+ "list-charges": {
933
+ parameters: {
934
+ query?: never;
935
+ header?: never;
936
+ path: {
937
+ /**
938
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
939
+ * which is why the key is what addresses the account.
940
+ */
941
+ accountKey: components["parameters"]["AccountKey"];
942
+ };
943
+ cookie?: never;
944
+ };
945
+ requestBody?: never;
946
+ responses: {
947
+ /** @description OK */
948
+ 200: {
949
+ headers: {
950
+ [name: string]: unknown;
951
+ };
952
+ content: {
953
+ "application/json": components["schemas"]["ChargeList"];
954
+ };
955
+ };
956
+ /** @description Error */
957
+ default: {
958
+ headers: {
959
+ [name: string]: unknown;
960
+ };
961
+ content: {
962
+ "application/json": components["schemas"]["Error"];
963
+ };
964
+ };
965
+ };
966
+ };
967
+ "list-invoices": {
968
+ parameters: {
969
+ query?: never;
970
+ header?: never;
971
+ path: {
972
+ /**
973
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
974
+ * which is why the key is what addresses the account.
975
+ */
976
+ accountKey: components["parameters"]["AccountKey"];
977
+ };
978
+ cookie?: never;
979
+ };
980
+ requestBody?: never;
981
+ responses: {
982
+ /** @description OK */
983
+ 200: {
984
+ headers: {
985
+ [name: string]: unknown;
986
+ };
987
+ content: {
988
+ "application/json": components["schemas"]["InvoiceList"];
989
+ };
990
+ };
991
+ /** @description Error */
992
+ default: {
993
+ headers: {
994
+ [name: string]: unknown;
995
+ };
996
+ content: {
997
+ "application/json": components["schemas"]["Error"];
998
+ };
999
+ };
1000
+ };
1001
+ };
1002
+ "get-invoice": {
1003
+ parameters: {
1004
+ query?: never;
1005
+ header?: never;
1006
+ path: {
1007
+ /**
1008
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1009
+ * which is why the key is what addresses the account.
1010
+ */
1011
+ accountKey: components["parameters"]["AccountKey"];
1012
+ invoiceId: string;
1013
+ };
1014
+ cookie?: never;
1015
+ };
1016
+ requestBody?: never;
1017
+ responses: {
1018
+ /** @description OK */
1019
+ 200: {
1020
+ headers: {
1021
+ [name: string]: unknown;
1022
+ };
1023
+ content: {
1024
+ "application/json": components["schemas"]["InvoiceDetail"];
1025
+ };
1026
+ };
1027
+ /** @description Error */
1028
+ default: {
1029
+ headers: {
1030
+ [name: string]: unknown;
1031
+ };
1032
+ content: {
1033
+ "application/json": components["schemas"]["Error"];
1034
+ };
1035
+ };
1036
+ };
1037
+ };
1038
+ "read-subscription": {
1039
+ parameters: {
1040
+ query?: never;
1041
+ header?: never;
1042
+ path: {
1043
+ /**
1044
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1045
+ * which is why the key is what addresses the account.
1046
+ */
1047
+ accountKey: components["parameters"]["AccountKey"];
1048
+ };
1049
+ cookie?: never;
1050
+ };
1051
+ requestBody?: never;
1052
+ responses: {
1053
+ /** @description OK */
1054
+ 200: {
1055
+ headers: {
1056
+ [name: string]: unknown;
1057
+ };
1058
+ content: {
1059
+ "application/json": components["schemas"]["Subscription"];
1060
+ };
1061
+ };
1062
+ /** @description Error */
1063
+ default: {
1064
+ headers: {
1065
+ [name: string]: unknown;
1066
+ };
1067
+ content: {
1068
+ "application/json": components["schemas"]["Error"];
1069
+ };
1070
+ };
1071
+ };
1072
+ };
1073
+ "cancel-subscription": {
1074
+ parameters: {
1075
+ query: {
1076
+ /** @description When it takes effect */
1077
+ timing: "immediate" | "next_billing_cycle";
1078
+ };
1079
+ header?: never;
1080
+ path: {
1081
+ /**
1082
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1083
+ * which is why the key is what addresses the account.
1084
+ */
1085
+ accountKey: components["parameters"]["AccountKey"];
1086
+ };
1087
+ cookie?: never;
1088
+ };
1089
+ requestBody?: never;
1090
+ responses: {
1091
+ /** @description OK */
1092
+ 200: {
1093
+ headers: {
1094
+ [name: string]: unknown;
1095
+ };
1096
+ content: {
1097
+ "application/json": components["schemas"]["Subscription"];
1098
+ };
1099
+ };
1100
+ /** @description Error */
1101
+ default: {
1102
+ headers: {
1103
+ [name: string]: unknown;
1104
+ };
1105
+ content: {
1106
+ "application/json": components["schemas"]["Error"];
1107
+ };
1108
+ };
1109
+ };
1110
+ };
1111
+ "read-top-up": {
1112
+ parameters: {
1113
+ query?: never;
1114
+ header?: never;
1115
+ path: {
1116
+ /**
1117
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1118
+ * which is why the key is what addresses the account.
1119
+ */
1120
+ accountKey: components["parameters"]["AccountKey"];
1121
+ /** @description The payment id returned when the top-up was started */
1122
+ paymentId: string;
1123
+ };
1124
+ cookie?: never;
1125
+ };
1126
+ requestBody?: never;
1127
+ responses: {
1128
+ /** @description OK */
1129
+ 200: {
1130
+ headers: {
1131
+ [name: string]: unknown;
1132
+ };
1133
+ content: {
1134
+ "application/json": components["schemas"]["TopUpStatus"];
1135
+ };
1136
+ };
1137
+ /** @description Error */
1138
+ default: {
1139
+ headers: {
1140
+ [name: string]: unknown;
1141
+ };
1142
+ content: {
1143
+ "application/json": components["schemas"]["Error"];
1144
+ };
1145
+ };
1146
+ };
1147
+ };
1148
+ "start-card-setup": {
1149
+ parameters: {
1150
+ query?: never;
1151
+ header?: never;
1152
+ path: {
1153
+ /**
1154
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1155
+ * which is why the key is what addresses the account.
1156
+ */
1157
+ accountKey: components["parameters"]["AccountKey"];
1158
+ };
1159
+ cookie?: never;
1160
+ };
1161
+ requestBody?: never;
1162
+ responses: {
1163
+ /** @description OK */
1164
+ 200: {
1165
+ headers: {
1166
+ [name: string]: unknown;
1167
+ };
1168
+ content: {
1169
+ "application/json": components["schemas"]["CardSetupSession"];
1170
+ };
1171
+ };
1172
+ /** @description Error */
1173
+ default: {
1174
+ headers: {
1175
+ [name: string]: unknown;
1176
+ };
1177
+ content: {
1178
+ "application/json": components["schemas"]["Error"];
1179
+ };
1180
+ };
1181
+ };
1182
+ };
1183
+ "list-offers": {
1184
+ parameters: {
1185
+ query?: never;
1186
+ header?: never;
1187
+ path: {
1188
+ /**
1189
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1190
+ * which is why the key is what addresses the account.
1191
+ */
1192
+ accountKey: components["parameters"]["AccountKey"];
1193
+ };
1194
+ cookie?: never;
1195
+ };
1196
+ requestBody?: never;
1197
+ responses: {
1198
+ /** @description OK */
1199
+ 200: {
1200
+ headers: {
1201
+ [name: string]: unknown;
1202
+ };
1203
+ content: {
1204
+ "application/json": components["schemas"]["OfferList"];
1205
+ };
1206
+ };
1207
+ /** @description Error */
1208
+ default: {
1209
+ headers: {
1210
+ [name: string]: unknown;
1211
+ };
1212
+ content: {
1213
+ "application/json": components["schemas"]["Error"];
1214
+ };
1215
+ };
1216
+ };
1217
+ };
1218
+ "purchase-offer": {
1219
+ parameters: {
1220
+ query?: {
1221
+ /** @description When the switch takes effect. Required if the account already has a plan, ignored otherwise */
1222
+ timing?: components["schemas"]["PlanChangeTiming"];
1223
+ };
1224
+ header?: never;
1225
+ path: {
1226
+ /**
1227
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1228
+ * which is why the key is what addresses the account.
1229
+ */
1230
+ accountKey: components["parameters"]["AccountKey"];
1231
+ /** @description Which offer */
1232
+ offerKey: string;
1233
+ };
1234
+ cookie?: never;
1235
+ };
1236
+ requestBody?: never;
1237
+ responses: {
1238
+ /** @description OK */
1239
+ 200: {
1240
+ headers: {
1241
+ [name: string]: unknown;
1242
+ };
1243
+ content: {
1244
+ "application/json": components["schemas"]["Purchase"];
1245
+ };
1246
+ };
1247
+ /** @description Error */
1248
+ default: {
1249
+ headers: {
1250
+ [name: string]: unknown;
1251
+ };
1252
+ content: {
1253
+ "application/json": components["schemas"]["Error"];
1254
+ };
1255
+ };
1256
+ };
1257
+ };
1258
+ }