@leaflow/sdk 0.49.0 → 0.51.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.
@@ -56,12 +56,10 @@ export type CancelSubscriptionResult = operations["cancel-subscription"]["respon
56
56
  export type CancelSubscriptionQuery = operations["cancel-subscription"]["parameters"]["query"];
57
57
  /** `GET /account/v1/billing-accounts/{accountKey}/top-ups/{paymentId}` 成功时的响应体。 */
58
58
  export type ReadTopUpResult = operations["read-top-up"]["responses"][200]["content"]["application/json"];
59
- /** `GET /account/v1/billing-accounts/{accountKey}/payment-method` 成功时的响应体。 */
60
- export type ReadPaymentMethodResult = operations["read-payment-method"]["responses"][200]["content"]["application/json"];
61
- /** `POST /account/v1/billing-accounts/{accountKey}/payment-method` 成功时的响应体。 */
59
+ /** `GET /account/v1/billing-accounts/{accountKey}/payment-methods` 成功时的响应体。 */
60
+ export type ListPaymentMethodsResult = operations["list-payment-methods"]["responses"][200]["content"]["application/json"];
61
+ /** `POST /account/v1/billing-accounts/{accountKey}/payment-methods` 成功时的响应体。 */
62
62
  export type StartPaymentMethodSetupResult = operations["start-payment-method-setup"]["responses"][200]["content"]["application/json"];
63
- /** `POST /account/v1/billing-accounts/{accountKey}/billing-portal` 成功时的响应体。 */
64
- export type StartBillingPortalResult = operations["start-billing-portal"]["responses"][200]["content"]["application/json"];
65
63
  /** `GET /account/v1/billing-accounts/{accountKey}/offers` 成功时的响应体。 */
66
64
  export type ListOffersResult = operations["list-offers"]["responses"][200]["content"]["application/json"];
67
65
  /** `POST /account/v1/billing-accounts/{accountKey}/offers/{offerKey}/purchase` 成功时的响应体。 */
@@ -70,11 +68,3 @@ export type PurchaseOfferResult = operations["purchase-offer"]["responses"][200]
70
68
  export type PurchaseOfferQuery = operations["purchase-offer"]["parameters"]["query"];
71
69
  /** `GET /account/v1/billing-accounts/{accountKey}/prepaid-assets` 成功时的响应体。 */
72
70
  export type ListPrepaidAssetsResult = operations["list-prepaid-assets"]["responses"][200]["content"]["application/json"];
73
- /** `GET /account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renewal-quote` 成功时的响应体。 */
74
- export type QuoteRenewalResult = operations["quote-renewal"]["responses"][200]["content"]["application/json"];
75
- /** `GET /account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renewal-quote` 的查询参数。 */
76
- export type QuoteRenewalQuery = operations["quote-renewal"]["parameters"]["query"];
77
- /** `POST /account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renew` 成功时的响应体。 */
78
- export type RenewPrepaidAssetResult = operations["renew-prepaid-asset"]["responses"][200]["content"]["application/json"];
79
- /** `POST /account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renew` 的请求体。 */
80
- export type RenewPrepaidAssetBody = NonNullable<operations["renew-prepaid-asset"]["requestBody"]>["content"]["application/json"];
@@ -598,7 +598,7 @@ export interface paths {
598
598
  patch?: never;
599
599
  trace?: never;
600
600
  };
601
- "/account/v1/billing-accounts/{accountKey}/payment-method": {
601
+ "/account/v1/billing-accounts/{accountKey}/payment-methods": {
602
602
  parameters: {
603
603
  query?: never;
604
604
  header?: never;
@@ -606,57 +606,50 @@ export interface paths {
606
606
  cookie?: never;
607
607
  };
608
608
  /**
609
- * Whether this account can be charged
610
- * @description Answers whether a payment method is on file, and nothing else.
609
+ * The payment methods on file
610
+ * @description Every method saved against this account, and which one an invoice will be charged to.
611
611
  *
612
- * ## It is a payment method, not a card
612
+ * ## Why the brand, last four and expiry are here
613
613
  *
614
- * A card is one kind. Direct debit and the recurring-payment mandates offered by regional
615
- * wallets are others, and they occupy the same slot: something the provider can charge later
616
- * without the account holder present. Naming the slot after cards would put an assumption
617
- * into the contract that stops being true the day a second kind is accepted.
614
+ * They were deliberately absent while the billing engine held the card, because the answer
615
+ * that mattered can money be collected came from the engine, and a page built on the
616
+ * provider's answer could show a method the engine had not recorded. Collection now runs from
617
+ * this service against the provider directly, so there is one answer, and it is the one shown.
618
618
  *
619
- * ## Why there is no brand, no last four digits, no expiry
619
+ * Expiry is the reason this is worth showing at all: a card expires, the invoice then fails,
620
+ * dunning runs out, and the project stops — with the account holder watching it happen and no
621
+ * indication that a card was the cause.
620
622
  *
621
- * Those would have to be read from the payment provider, and the two answers can disagree: a
622
- * method present at the provider that the billing engine has not recorded as the default is
623
- * exactly the state in which money cannot be collected — while a page built on the provider's
624
- * answer would be showing one. What matters here is whether the party that will run the
625
- * charge believes it can, so the answer comes from that party alone.
623
+ * No other card data exists here. The number, the expiry entered by the holder and the CVC go
624
+ * from the browser to the provider and never reach this platform.
626
625
  *
627
- * To see it, replace it, or remove it, open the billing portal.
628
- *
629
- * ## Read this before offering a paid plan, not after
630
- *
631
- * `ready` being false is why the engine refuses to start a paid subscription. Discovering it
632
- * at purchase time turns a missing payment method into a rejection whose wording is about
633
- * something else entirely.
634
- *
635
- * An account that has never had one returns `ready: false`. That is the normal state of a
636
- * new account, not an error.
626
+ * An account that has never added one returns an empty list. That is the normal state of a new
627
+ * account, not an error.
637
628
  */
638
- get: operations["read-payment-method"];
629
+ get: operations["list-payment-methods"];
639
630
  put?: never;
640
631
  /**
641
- * Add or replace the payment method on file
642
- * @description Begins adding a payment method. Returns a URL to send the browser to; the details are
643
- * entered there, on the payment provider's own page, and **no card data ever reaches this
644
- * platform**.
632
+ * Begin adding a payment method
633
+ * @description Starts a session for adding a method, and returns the secret the browser needs to mount the
634
+ * provider's own form.
645
635
  *
646
- * Which kinds are offered is the provider's decision, not this API's — a card today, a
647
- * wallet mandate or a direct debit wherever the provider supports charging one later without
648
- * the account holder present.
636
+ * ## The form is embedded, not a redirect
637
+ *
638
+ * The returned `client_secret` initialises the provider's JavaScript, which renders its form
639
+ * inside an iframe on this platform's own page. **No card data reaches this platform** — the
640
+ * number goes from the browser straight to the provider, exactly as it would on a redirect —
641
+ * but the account holder never leaves the console.
642
+ *
643
+ * A redirect would take them to a page with someone else's branding in the middle of adding a
644
+ * payment method, which is the moment they are most likely to abandon it.
649
645
  *
650
646
  * ## This is a prerequisite for buying a plan, not a convenience
651
647
  *
652
- * A plan is charged by invoice, and the invoice is collected from the method on file. A
653
- * subscription cannot start for an account that has none so "add a payment method, then
654
- * buy" is the order the system requires, not a flow that was chosen.
648
+ * A plan is charged by invoice, and the invoice is collected from a method on file. Discovering
649
+ * that none exists at purchase time turns a missing payment method into a rejection whose
650
+ * wording is about something else entirely.
655
651
  *
656
652
  * It is *not* a prerequisite for topping up: a top-up collects the money there and then.
657
- *
658
- * Replacing uses the same operation. The new method becomes the default and the old one stops
659
- * being used; nothing else about the account changes.
660
653
  */
661
654
  post: operations["start-payment-method-setup"];
662
655
  delete?: never;
@@ -665,7 +658,7 @@ export interface paths {
665
658
  patch?: never;
666
659
  trace?: never;
667
660
  };
668
- "/account/v1/billing-accounts/{accountKey}/billing-portal": {
661
+ "/account/v1/billing-accounts/{accountKey}/payment-methods/{paymentMethodId}": {
669
662
  parameters: {
670
663
  query?: never;
671
664
  header?: never;
@@ -674,26 +667,43 @@ export interface paths {
674
667
  };
675
668
  get?: never;
676
669
  put?: never;
670
+ post?: never;
677
671
  /**
678
- * Open the hosted billing portal
679
- * @description Returns a URL to the payment provider's own portal, where the card can be replaced or
680
- * removed, the billing address changed, and past invoices downloaded.
681
- *
682
- * ## Why replacing a card is not a form on this platform
672
+ * Remove a payment method
673
+ * @description Detaches it from this account. Removing the last one is allowed.
683
674
  *
684
- * A form would mean a card number field, and no card data ever reaches this platform. The
685
- * portal moves the whole interaction to the provider; only a session URL comes back.
675
+ * ## Why removing the last one is not blocked
686
676
  *
687
- * ## Something has to be able to replace an expiring card
677
+ * Blocking it leaves an account holder who wants to stop paying with no way out. The cost of
678
+ * allowing it is that later invoices cannot be collected — and that path has notice, a grace
679
+ * period and a way back. A card that cannot be removed is a dead end.
680
+ */
681
+ delete: operations["remove-payment-method"];
682
+ options?: never;
683
+ head?: never;
684
+ patch?: never;
685
+ trace?: never;
686
+ };
687
+ "/account/v1/billing-accounts/{accountKey}/payment-methods/{paymentMethodId}/default": {
688
+ parameters: {
689
+ query?: never;
690
+ header?: never;
691
+ path?: never;
692
+ cookie?: never;
693
+ };
694
+ get?: never;
695
+ /**
696
+ * Charge invoices to this one
697
+ * @description Makes this the method an invoice is collected from.
688
698
  *
689
- * Cards expire. Once one does, the invoices for a plan stop being collectable, dunning runs
690
- * out, and the projects paid for by this account are suspended for non-payment. Without this
691
- * operation the account holder watches that happen with nowhere to fix it — adding a card
692
- * does not help, since that operation only makes sense when there is none.
699
+ * ## It is stored at the provider, not here
693
700
  *
694
- * The URL is single-use and expires. Do not store it.
701
+ * The charge itself reads that setting from the provider, so keeping a second copy here would
702
+ * create two answers to the same question. When they disagree the visible symptom is that the
703
+ * account holder changed the default and the charge still went to the old one.
695
704
  */
696
- post: operations["start-billing-portal"];
705
+ put: operations["set-default-payment-method"];
706
+ post?: never;
697
707
  delete?: never;
698
708
  options?: never;
699
709
  head?: never;
@@ -783,26 +793,30 @@ export interface paths {
783
793
  cookie?: never;
784
794
  };
785
795
  /**
786
- * What I bought outright, and when it runs out
787
- * @description Everything this account paid a term for, across every product, soonest to expire first.
796
+ * What I bought outright
797
+ * @description Everything this account holds on a term, across every product.
798
+ *
799
+ * ## Nothing here expires on its own
788
800
  *
789
- * ## Why this is one list rather than a page inside each product
801
+ * A term renews for as long as the seat is held: the engine charges the next period, prorates
802
+ * any change to the second, and stops the moment the seat is given up. So there is no renewal
803
+ * to remember and no expiry to warn about — giving it up means deleting the resource, in the
804
+ * console that owns it.
790
805
  *
791
- * Renewal is the one thing a customer forgets, and forgetting it stops the machine. Splitting
792
- * the list per product means the instance about to lapse tomorrow is only visible to someone
793
- * who thought to go and look at instances. Sorting by expiry rather than by purchase date is
794
- * the same reason: the row that matters is the one at the top.
806
+ * What the next period costs and when it falls due is on the charges route. That is read
807
+ * straight from the engine rather than copied here, because a copy is a second answer that
808
+ * drifts without saying so.
795
809
  *
796
810
  * ## Metered resources are not here
797
811
  *
798
- * There is no term to run out. Listing them with an empty expiry would invite renewing
799
- * something that is already billed by the hour until it is deleted.
812
+ * They have no term. Listing them would invite renewing something that is already billed by
813
+ * the hour until it is deleted.
800
814
  *
801
815
  * ## `state` and `desired_state` are both reported
802
816
  *
803
- * A machine stopped because its term lapsed reads `suspended` for both. One that has just been
804
- * renewed reads `suspended` and `active` — it is on its way back. Without the second field
805
- * those look identical, and a customer who just paid concludes it did not work and pays again.
817
+ * A machine stopped for arrears reads `suspended` for both. One being brought back reads
818
+ * `suspended` and `active` — it is on its way. Without the second field those look identical,
819
+ * and a customer who just paid concludes it did not work and pays again.
806
820
  */
807
821
  get: operations["list-prepaid-assets"];
808
822
  put?: never;
@@ -813,88 +827,6 @@ export interface paths {
813
827
  patch?: never;
814
828
  trace?: never;
815
829
  };
816
- "/account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renewal-quote": {
817
- parameters: {
818
- query?: never;
819
- header?: never;
820
- path?: never;
821
- cookie?: never;
822
- };
823
- /**
824
- * What renewing this would cost
825
- * @description Priced the same way the charge is, from the same table, so the number shown is the number
826
- * taken. Quoting separately from charging is what lets a customer see the price before
827
- * committing; computing it twice in two places is what makes the two disagree, and a bill that
828
- * disagrees with the page that sold it is a complaint rather than a bug report.
829
- *
830
- * ## Both the current and the resulting expiry are returned
831
- *
832
- * Renewing early adds the term to what is left, not to today — otherwise renewing a month
833
- * ahead throws that month away, and everyone learns to wait until the last moment. Something
834
- * that lapsed long ago is counted from now instead, because adding to a date in the past
835
- * produces an expiry that is still in the past.
836
- *
837
- * Reporting only the new date leaves the customer unable to tell which of those happened.
838
- *
839
- * ## A withdrawn price still quotes
840
- *
841
- * Taking a product off sale means stop selling new ones. Refusing renewals as well would stop
842
- * a batch of existing machines on their expiry date, which is not what the operator pressed
843
- * that button for.
844
- */
845
- get: operations["quote-renewal"];
846
- put?: never;
847
- post?: never;
848
- delete?: never;
849
- options?: never;
850
- head?: never;
851
- patch?: never;
852
- trace?: never;
853
- };
854
- "/account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renew": {
855
- parameters: {
856
- query?: never;
857
- header?: never;
858
- path?: never;
859
- cookie?: never;
860
- };
861
- get?: never;
862
- put?: never;
863
- /**
864
- * Renew it
865
- * @description Takes the money from the balance and pushes the expiry out. The resource itself is not
866
- * touched — nothing is rebuilt, nothing restarts, the id stays the same.
867
- *
868
- * ## An idempotency key is required, not optional
869
- *
870
- * Renewal is a pure charge. Unlike creating something, there is no resource whose uniqueness
871
- * catches a repeat, so a double click is two charges and twice the term — and both calls
872
- * return success. Letting the field be omitted would mean losing that protection silently, in
873
- * the one case that looks completely normal until the books are reconciled.
874
- *
875
- * Sending the same key again returns the order that was already placed. It does not charge
876
- * again, and it is not an error: reporting a repeat as a failure makes the caller retry
877
- * forever, and makes the customer press the button a second time with a fresh key.
878
- *
879
- * ## What happens if the balance is short
880
- *
881
- * The order is recorded as failed and nothing else changes: no money moves, the expiry stays
882
- * where it was, and the resource keeps running until its existing term ends. Retrying with the
883
- * same key after topping up goes through.
884
- *
885
- * ## Renewing something that already lapsed brings it back
886
- *
887
- * Its term is counted from now, and it is asked to start again. Coming back is the
888
- * reconciliation loop's job, so it is not instant — which is what `desired_state` on the asset
889
- * list is for.
890
- */
891
- post: operations["renew-prepaid-asset"];
892
- delete?: never;
893
- options?: never;
894
- head?: never;
895
- patch?: never;
896
- trace?: never;
897
- };
898
830
  }
899
831
  export type webhooks = Record<string, never>;
900
832
  export interface components {
@@ -1123,7 +1055,6 @@ export interface components {
1123
1055
  quantity: number;
1124
1056
  };
1125
1057
  PrepaidAsset: {
1126
- /** @description Use this to quote and to renew. */
1127
1058
  id: string;
1128
1059
  project_id: string;
1129
1060
  /** @description Which service holds it. Also which console it is managed from. */
@@ -1141,16 +1072,19 @@ export interface components {
1141
1072
  */
1142
1073
  quantity: number;
1143
1074
  /**
1144
- * Format: date-time
1145
- * @description Paid up to this instant. It stops being served after it, not before.
1075
+ * @description How long one period buys, as an ISO 8601 duration (P1M, P1Y).
1076
+ *
1077
+ * There is no expiry to report. The engine keeps renewing this for as long as the seat is
1078
+ * held, so what runs out is not the term but the customer's decision to keep it. What the
1079
+ * next period costs, and when it is charged, is on the charges route — that is the engine's
1080
+ * own answer rather than a copy of it.
1146
1081
  */
1147
- term_end: string;
1082
+ term: string;
1148
1083
  /** @enum {string} */
1149
1084
  state: "pending" | "active" | "suspended" | "terminated";
1150
1085
  /**
1151
- * @description What it is being moved to. Differs from `state` while a change is still being applied
1152
- * in particular right after a renewal, which is the moment a customer is most likely to
1153
- * conclude that nothing happened.
1086
+ * @description What it is being moved to. Differs from `state` while a change is still being applied,
1087
+ * which is the moment a customer is most likely to conclude that nothing happened.
1154
1088
  * @enum {string}
1155
1089
  */
1156
1090
  desired_state: "active" | "suspended" | "terminated";
@@ -1158,26 +1092,6 @@ export interface components {
1158
1092
  PrepaidAssetList: {
1159
1093
  assets: components["schemas"]["PrepaidAsset"][];
1160
1094
  };
1161
- RenewalQuote: {
1162
- provision_id: string;
1163
- term: string;
1164
- /**
1165
- * @description A decimal string, not a float. Money that survives a round trip through binary floating
1166
- * point is money that stops adding up.
1167
- */
1168
- amount: string;
1169
- currency: string;
1170
- /**
1171
- * Format: date-time
1172
- * @description What it is paid up to now.
1173
- */
1174
- current_term_end: string;
1175
- /**
1176
- * Format: date-time
1177
- * @description What it would be paid up to after renewing.
1178
- */
1179
- term_end: string;
1180
- };
1181
1095
  RenewRequestBody: {
1182
1096
  /**
1183
1097
  * @description How long to renew for, as an ISO 8601 duration (P1M, P1Y). It does not have to match the
@@ -1372,40 +1286,60 @@ export interface components {
1372
1286
  };
1373
1287
  PaymentMethodSetupSession: {
1374
1288
  /**
1375
- * Format: uri
1376
- * @description Send the browser here. It expires, so do not store it
1289
+ * @description Initialises the provider's JavaScript, which mounts its form in an iframe on this page.
1290
+ *
1291
+ * Not a URL: the form is embedded rather than redirected to, so the account holder stays
1292
+ * on the console. It expires, so fetch it when the form is about to be shown rather than
1293
+ * when the page loads.
1377
1294
  */
1378
- url: string;
1379
- };
1380
- BillingPortalSession: {
1295
+ client_secret: string;
1381
1296
  /**
1382
- * Format: uri
1383
- * @description Send the browser here. It expires, so do not store it
1297
+ * @description The provider's id for this attempt.
1298
+ *
1299
+ * The browser does not need it — the callback carries the same id and is what actually
1300
+ * records the method. It is here so that a support conversation about one failed attempt
1301
+ * has something to look it up by.
1384
1302
  */
1385
- url: string;
1303
+ session_id?: string;
1386
1304
  };
1387
1305
  /**
1388
- * @description Whether money can be collected from this account later, without the account holder present.
1306
+ * @description One saved way of collecting money later, without the account holder present.
1389
1307
  *
1390
- * Deliberately not called a card: a card is one kind of payment method, and direct debit and
1391
- * the recurring mandates offered by regional wallets occupy the same slot.
1308
+ * Deliberately not called a card: a card is one kind, and direct debit and the recurring
1309
+ * mandates offered by regional wallets occupy the same slot.
1392
1310
  */
1393
1311
  PaymentMethod: {
1312
+ /** @description The provider's id for it. Used to remove it or make it the default */
1313
+ id: string;
1314
+ /** @description Visa, Mastercard, and so on. Empty for kinds that have no brand */
1315
+ brand?: string;
1394
1316
  /**
1395
- * @description True when the billing engine holds a default payment method for this account and can
1396
- * therefore collect an invoice.
1317
+ * @description The last four digits, for telling two saved methods apart.
1397
1318
  *
1398
- * This is the precondition for a paid plan. While it is false, starting a paid
1399
- * subscription is refused, and the refusal is about billing setup rather than about the
1400
- * plan — so check this first and say what is actually missing.
1319
+ * This and the expiry are the only parts of the instrument that exist here. The number,
1320
+ * the expiry the holder typed and the CVC never reach this platform.
1321
+ */
1322
+ last4?: string;
1323
+ /** Format: int32 */
1324
+ exp_month?: number;
1325
+ /**
1326
+ * Format: int32
1327
+ * @description Together with `exp_month`, when this stops working.
1401
1328
  *
1402
- * It says nothing about which kind is on file. To show or change that, send the account
1403
- * holder to the billing portal.
1329
+ * Worth showing because the failure is otherwise invisible: the card expires, the invoice
1330
+ * fails, dunning runs out, and the project stops — with nothing pointing at the card.
1331
+ */
1332
+ exp_year?: number;
1333
+ /**
1334
+ * @description True for the one an invoice is collected from.
1404
1335
  *
1405
- * A free plan does not require it, which is what allows a new account to be placed on the
1406
- * default tier before anyone has entered a card.
1336
+ * Exactly one is the default while any exist. An account whose only method was removed
1337
+ * has none, and its next invoice cannot be collected.
1407
1338
  */
1408
- ready: boolean;
1339
+ default: boolean;
1340
+ };
1341
+ PaymentMethodList: {
1342
+ payment_methods: components["schemas"]["PaymentMethod"][];
1409
1343
  };
1410
1344
  TopUpSession: {
1411
1345
  /**
@@ -2463,7 +2397,7 @@ export interface operations {
2463
2397
  };
2464
2398
  };
2465
2399
  };
2466
- "read-payment-method": {
2400
+ "list-payment-methods": {
2467
2401
  parameters: {
2468
2402
  query?: never;
2469
2403
  header?: never;
@@ -2484,7 +2418,7 @@ export interface operations {
2484
2418
  [name: string]: unknown;
2485
2419
  };
2486
2420
  content: {
2487
- "application/json": components["schemas"]["PaymentMethod"];
2421
+ "application/json": components["schemas"]["PaymentMethodList"];
2488
2422
  };
2489
2423
  };
2490
2424
  /** @description Error */
@@ -2533,7 +2467,7 @@ export interface operations {
2533
2467
  };
2534
2468
  };
2535
2469
  };
2536
- "start-billing-portal": {
2470
+ "remove-payment-method": {
2537
2471
  parameters: {
2538
2472
  query?: never;
2539
2473
  header?: never;
@@ -2543,19 +2477,18 @@ export interface operations {
2543
2477
  * which is why the key is what addresses the account.
2544
2478
  */
2545
2479
  accountKey: components["parameters"]["AccountKey"];
2480
+ paymentMethodId: string;
2546
2481
  };
2547
2482
  cookie?: never;
2548
2483
  };
2549
2484
  requestBody?: never;
2550
2485
  responses: {
2551
- /** @description OK */
2552
- 200: {
2486
+ /** @description Removed */
2487
+ 204: {
2553
2488
  headers: {
2554
2489
  [name: string]: unknown;
2555
2490
  };
2556
- content: {
2557
- "application/json": components["schemas"]["BillingPortalSession"];
2558
- };
2491
+ content?: never;
2559
2492
  };
2560
2493
  /** @description Error */
2561
2494
  default: {
@@ -2568,7 +2501,7 @@ export interface operations {
2568
2501
  };
2569
2502
  };
2570
2503
  };
2571
- "list-offers": {
2504
+ "set-default-payment-method": {
2572
2505
  parameters: {
2573
2506
  query?: never;
2574
2507
  header?: never;
@@ -2578,59 +2511,18 @@ export interface operations {
2578
2511
  * which is why the key is what addresses the account.
2579
2512
  */
2580
2513
  accountKey: components["parameters"]["AccountKey"];
2514
+ paymentMethodId: string;
2581
2515
  };
2582
2516
  cookie?: never;
2583
2517
  };
2584
2518
  requestBody?: never;
2585
2519
  responses: {
2586
- /** @description OK */
2587
- 200: {
2588
- headers: {
2589
- [name: string]: unknown;
2590
- };
2591
- content: {
2592
- "application/json": components["schemas"]["OfferList"];
2593
- };
2594
- };
2595
- /** @description Error */
2596
- default: {
2597
- headers: {
2598
- [name: string]: unknown;
2599
- };
2600
- content: {
2601
- "application/json": components["schemas"]["Error"];
2602
- };
2603
- };
2604
- };
2605
- };
2606
- "purchase-offer": {
2607
- parameters: {
2608
- query?: {
2609
- /** @description When the switch takes effect. Required if the account already has a plan, ignored otherwise */
2610
- timing?: components["schemas"]["PlanChangeTiming"];
2611
- };
2612
- header?: never;
2613
- path: {
2614
- /**
2615
- * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
2616
- * which is why the key is what addresses the account.
2617
- */
2618
- accountKey: components["parameters"]["AccountKey"];
2619
- /** @description Which offer */
2620
- offerKey: string;
2621
- };
2622
- cookie?: never;
2623
- };
2624
- requestBody?: never;
2625
- responses: {
2626
- /** @description OK */
2627
- 200: {
2520
+ /** @description Updated */
2521
+ 204: {
2628
2522
  headers: {
2629
2523
  [name: string]: unknown;
2630
2524
  };
2631
- content: {
2632
- "application/json": components["schemas"]["Purchase"];
2633
- };
2525
+ content?: never;
2634
2526
  };
2635
2527
  /** @description Error */
2636
2528
  default: {
@@ -2643,7 +2535,7 @@ export interface operations {
2643
2535
  };
2644
2536
  };
2645
2537
  };
2646
- "list-prepaid-assets": {
2538
+ "list-offers": {
2647
2539
  parameters: {
2648
2540
  query?: never;
2649
2541
  header?: never;
@@ -2664,7 +2556,7 @@ export interface operations {
2664
2556
  [name: string]: unknown;
2665
2557
  };
2666
2558
  content: {
2667
- "application/json": components["schemas"]["PrepaidAssetList"];
2559
+ "application/json": components["schemas"]["OfferList"];
2668
2560
  };
2669
2561
  };
2670
2562
  /** @description Error */
@@ -2678,14 +2570,11 @@ export interface operations {
2678
2570
  };
2679
2571
  };
2680
2572
  };
2681
- "quote-renewal": {
2573
+ "purchase-offer": {
2682
2574
  parameters: {
2683
- query: {
2684
- /**
2685
- * @description How long to renew for, as an ISO 8601 duration (P1M, P1Y). A duration rather than a
2686
- * number of months: months are not the same length.
2687
- */
2688
- term: string;
2575
+ query?: {
2576
+ /** @description When the switch takes effect. Required if the account already has a plan, ignored otherwise */
2577
+ timing?: components["schemas"]["PlanChangeTiming"];
2689
2578
  };
2690
2579
  header?: never;
2691
2580
  path: {
@@ -2694,8 +2583,8 @@ export interface operations {
2694
2583
  * which is why the key is what addresses the account.
2695
2584
  */
2696
2585
  accountKey: components["parameters"]["AccountKey"];
2697
- /** @description Which asset, from the prepaid list */
2698
- provisionId: components["parameters"]["ProvisionId"];
2586
+ /** @description Which offer */
2587
+ offerKey: string;
2699
2588
  };
2700
2589
  cookie?: never;
2701
2590
  };
@@ -2707,7 +2596,7 @@ export interface operations {
2707
2596
  [name: string]: unknown;
2708
2597
  };
2709
2598
  content: {
2710
- "application/json": components["schemas"]["RenewalQuote"];
2599
+ "application/json": components["schemas"]["Purchase"];
2711
2600
  };
2712
2601
  };
2713
2602
  /** @description Error */
@@ -2721,7 +2610,7 @@ export interface operations {
2721
2610
  };
2722
2611
  };
2723
2612
  };
2724
- "renew-prepaid-asset": {
2613
+ "list-prepaid-assets": {
2725
2614
  parameters: {
2726
2615
  query?: never;
2727
2616
  header?: never;
@@ -2731,16 +2620,10 @@ export interface operations {
2731
2620
  * which is why the key is what addresses the account.
2732
2621
  */
2733
2622
  accountKey: components["parameters"]["AccountKey"];
2734
- /** @description Which asset, from the prepaid list */
2735
- provisionId: components["parameters"]["ProvisionId"];
2736
2623
  };
2737
2624
  cookie?: never;
2738
2625
  };
2739
- requestBody: {
2740
- content: {
2741
- "application/json": components["schemas"]["RenewRequestBody"];
2742
- };
2743
- };
2626
+ requestBody?: never;
2744
2627
  responses: {
2745
2628
  /** @description OK */
2746
2629
  200: {
@@ -2748,7 +2631,7 @@ export interface operations {
2748
2631
  [name: string]: unknown;
2749
2632
  };
2750
2633
  content: {
2751
- "application/json": components["schemas"]["Order"];
2634
+ "application/json": components["schemas"]["PrepaidAssetList"];
2752
2635
  };
2753
2636
  };
2754
2637
  /** @description Error */
@@ -1477,6 +1477,31 @@ export interface components {
1477
1477
  * @description Restore from this snapshot. When given, the capacity need only be no smaller than the snapshot
1478
1478
  */
1479
1479
  snapshot_id?: string;
1480
+ /**
1481
+ * @description Buy the disk outright for this long, as an ISO 8601 duration (P1M, P1Y). Billed by the
1482
+ * hour when omitted.
1483
+ *
1484
+ * A disk bought outright can still be expanded: the difference is prorated over the days
1485
+ * left in the term, and the expiry date does not move. It is stopped, not deleted, when the
1486
+ * term runs out — the data stays and comes back once renewed.
1487
+ */
1488
+ term?: string;
1489
+ /**
1490
+ * @description How to pay for a term bought outright. Only meaningful together with `term`.
1491
+ *
1492
+ * `balance` takes it from the account balance and either succeeds or refuses on the spot.
1493
+ * `online` returns a `checkout_url` instead and **creates nothing** — the resource is only
1494
+ * created once the money arrives and the customer comes back to place it again. That last
1495
+ * part is deliberate: a successful payment should not silently turn into a machine, because
1496
+ * between paying and returning they may have changed their mind.
1497
+ *
1498
+ * Online payment is not a second wallet. What arrives lands in the balance first and the
1499
+ * order is settled from there, so money topped up and money paid at checkout are the same
1500
+ * pool.
1501
+ * @default balance
1502
+ * @enum {string}
1503
+ */
1504
+ payment_method?: "balance" | "online";
1480
1505
  };
1481
1506
  RenameDiskRequestBody: {
1482
1507
  name: string;
@@ -1642,6 +1667,22 @@ export interface components {
1642
1667
  * @description A private image. Exactly one of this, `image_id` and `boot_disk_id`
1643
1668
  */
1644
1669
  private_image_id?: string;
1670
+ /**
1671
+ * @description How to pay for a term bought outright. Only meaningful together with `term`.
1672
+ *
1673
+ * `balance` takes it from the account balance and either succeeds or refuses on the spot.
1674
+ * `online` returns a `checkout_url` instead and **creates nothing** — the resource is only
1675
+ * created once the money arrives and the customer comes back to place it again. That last
1676
+ * part is deliberate: a successful payment should not silently turn into a machine, because
1677
+ * between paying and returning they may have changed their mind.
1678
+ *
1679
+ * Online payment is not a second wallet. What arrives lands in the balance first and the
1680
+ * order is settled from there, so money topped up and money paid at checkout are the same
1681
+ * pool.
1682
+ * @default balance
1683
+ * @enum {string}
1684
+ */
1685
+ payment_method?: "balance" | "online";
1645
1686
  /**
1646
1687
  * @description Buy the instance outright for this long, as an ISO 8601 duration (P1M, P1Y). Billed by the
1647
1688
  * hour when omitted.
@@ -1680,6 +1721,15 @@ export interface components {
1680
1721
  instances: components["schemas"]["InstanceResource"][] | null;
1681
1722
  /** @description Returned only in this response; store it immediately. All instances of a batch share it */
1682
1723
  password: string;
1724
+ /**
1725
+ * @description Present only when `payment_method` was `online`: **nothing was created**. Send the
1726
+ * customer here to pay.
1727
+ *
1728
+ * What comes back is not a resource but a bill to settle. Treating this response as a
1729
+ * success and moving on is how something gets handed over without the money arriving —
1730
+ * and it looks exactly like a normal creation from the outside.
1731
+ */
1732
+ checkout_url?: string;
1683
1733
  };
1684
1734
  SetInstanceLabelsRequestBody: {
1685
1735
  /** @description The complete set of labels. Whatever is absent here is removed; send an empty object to clear them all. A key may not contain a colon, whitespace or control characters */
@@ -2487,6 +2537,33 @@ export interface operations {
2487
2537
  "application/json": components["schemas"]["DiskResource"];
2488
2538
  };
2489
2539
  };
2540
+ /**
2541
+ * @description Payment required: **nothing was created.**
2542
+ *
2543
+ * Returned when `payment_method` is `online`. `meta.checkout_url` is where to send the
2544
+ * customer; `meta.order_id` is the order waiting on it.
2545
+ *
2546
+ * ## Why this is a status and not a field on a 200
2547
+ *
2548
+ * A field on a success response is something a client can forget to read, and forgetting it
2549
+ * means treating "we created nothing and are waiting for money" as "created" — which looks
2550
+ * identical from the outside until the bill does not add up. A 402 fails loudly in any
2551
+ * client that handles errors at all.
2552
+ *
2553
+ * ## What happens after they pay
2554
+ *
2555
+ * The money lands in the balance and the order is settled from it. The resource is **not**
2556
+ * created automatically: placing it again is the customer's move, because between paying
2557
+ * and coming back they may have changed their mind. The balance is theirs either way.
2558
+ */
2559
+ 402: {
2560
+ headers: {
2561
+ [name: string]: unknown;
2562
+ };
2563
+ content: {
2564
+ "application/json": components["schemas"]["Error"];
2565
+ };
2566
+ };
2490
2567
  /** @description Error */
2491
2568
  default: {
2492
2569
  headers: {
@@ -2940,6 +3017,33 @@ export interface operations {
2940
3017
  "application/json": components["schemas"]["LaunchInstanceResponseBody"];
2941
3018
  };
2942
3019
  };
3020
+ /**
3021
+ * @description Payment required: **nothing was created.**
3022
+ *
3023
+ * Returned when `payment_method` is `online`. `meta.checkout_url` is where to send the
3024
+ * customer; `meta.order_id` is the order waiting on it.
3025
+ *
3026
+ * ## Why this is a status and not a field on a 200
3027
+ *
3028
+ * A field on a success response is something a client can forget to read, and forgetting it
3029
+ * means treating "we created nothing and are waiting for money" as "created" — which looks
3030
+ * identical from the outside until the bill does not add up. A 402 fails loudly in any
3031
+ * client that handles errors at all.
3032
+ *
3033
+ * ## What happens after they pay
3034
+ *
3035
+ * The money lands in the balance and the order is settled from it. The resource is **not**
3036
+ * created automatically: placing it again is the customer's move, because between paying
3037
+ * and coming back they may have changed their mind. The balance is theirs either way.
3038
+ */
3039
+ 402: {
3040
+ headers: {
3041
+ [name: string]: unknown;
3042
+ };
3043
+ content: {
3044
+ "application/json": components["schemas"]["Error"];
3045
+ };
3046
+ };
2943
3047
  /** @description Error */
2944
3048
  default: {
2945
3049
  headers: {
@@ -815,6 +815,12 @@ export interface components {
815
815
  /** @description The service that reports this type */
816
816
  service: string;
817
817
  severity: components["schemas"]["NotificationSeverity"];
818
+ /**
819
+ * @description A short name for this type, in the reader's language — what a settings screen puts on
820
+ * the row. It is not the subject line of the notification itself: a subject says what
821
+ * happened this time and carries the ticket number, while this names the kind of thing.
822
+ */
823
+ title: string;
818
824
  type: string;
819
825
  };
820
826
  NotificationTypeListResponseBody: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.49.0",
3
+ "version": "0.51.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {