@leaflow/sdk 0.48.0 → 0.50.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.
@@ -30,6 +30,8 @@ export type StartTopUpResult = operations["start-top-up"]["responses"][200]["con
30
30
  export type StartTopUpBody = NonNullable<operations["start-top-up"]["requestBody"]>["content"]["application/json"];
31
31
  /** `GET /account/v1/billing-accounts/{accountKey}/charges` 成功时的响应体。 */
32
32
  export type ListChargesResult = operations["list-charges"]["responses"][200]["content"]["application/json"];
33
+ /** `GET /account/v1/billing-accounts/{accountKey}/charges` 的查询参数。 */
34
+ export type ListChargesQuery = operations["list-charges"]["parameters"]["query"];
33
35
  /** `GET /account/v1/billing-accounts/{accountKey}/charges/{chargeId}/usage` 成功时的响应体。 */
34
36
  export type GetChargeUsageResult = operations["get-charge-usage"]["responses"][200]["content"]["application/json"];
35
37
  /** `GET /account/v1/billing-accounts/{accountKey}/invoices` 成功时的响应体。 */
@@ -68,6 +70,10 @@ export type PurchaseOfferResult = operations["purchase-offer"]["responses"][200]
68
70
  export type PurchaseOfferQuery = operations["purchase-offer"]["parameters"]["query"];
69
71
  /** `GET /account/v1/billing-accounts/{accountKey}/prepaid-assets` 成功时的响应体。 */
70
72
  export type ListPrepaidAssetsResult = operations["list-prepaid-assets"]["responses"][200]["content"]["application/json"];
73
+ /** `PUT /account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renewal` 成功时的响应体。 */
74
+ export type SetRenewalStatusResult = operations["set-renewal-status"]["responses"][200]["content"]["application/json"];
75
+ /** `PUT /account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renewal` 的请求体。 */
76
+ export type SetRenewalStatusBody = NonNullable<operations["set-renewal-status"]["requestBody"]>["content"]["application/json"];
71
77
  /** `GET /account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renewal-quote` 成功时的响应体。 */
72
78
  export type QuoteRenewalResult = operations["quote-renewal"]["responses"][200]["content"]["application/json"];
73
79
  /** `GET /account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renewal-quote` 的查询参数。 */
@@ -813,6 +813,45 @@ export interface paths {
813
813
  patch?: never;
814
814
  trace?: never;
815
815
  };
816
+ "/account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renewal": {
817
+ parameters: {
818
+ query?: never;
819
+ header?: never;
820
+ path?: never;
821
+ cookie?: never;
822
+ };
823
+ get?: never;
824
+ /**
825
+ * Choose what happens when it expires
826
+ * @description Three choices, not two.
827
+ *
828
+ * ## Why automatic renewal has to be opted into
829
+ *
830
+ * Charging someone automatically has to be something they chose. Defaulting to it means a
831
+ * person who wanted to try one month is charged for a second they never agreed to — and that
832
+ * is where chargebacks come from. So a resource bought outright starts on `manual`.
833
+ *
834
+ * ## And why "let it expire" is its own choice, not just "not automatic"
835
+ *
836
+ * `manual` keeps reminding: the notice before expiry is mandatory, because expiry stops the
837
+ * resource. Someone who has decided to let it go does not want those, and the cost of sending
838
+ * them anyway is not annoyance — it is that the reminders get filtered away, taking the ones
839
+ * that mattered with them.
840
+ *
841
+ * ## Turning it on needs a known cycle
842
+ *
843
+ * Renewing automatically has to know for how long, which comes from the last purchase or
844
+ * renewal. A resource adopted into billing, or bought before this was recorded, has no cycle
845
+ * yet: renew it manually once and the cycle is written down.
846
+ */
847
+ put: operations["set-renewal-status"];
848
+ post?: never;
849
+ delete?: never;
850
+ options?: never;
851
+ head?: never;
852
+ patch?: never;
853
+ trace?: never;
854
+ };
816
855
  "/account/v1/billing-accounts/{accountKey}/prepaid-assets/{provisionId}/renewal-quote": {
817
856
  parameters: {
818
857
  query?: never;
@@ -1154,6 +1193,19 @@ export interface components {
1154
1193
  * @enum {string}
1155
1194
  */
1156
1195
  desired_state: "active" | "suspended" | "terminated";
1196
+ /**
1197
+ * @description How long one renewal buys, as an ISO 8601 duration (P1M, P1Y). Empty on something adopted
1198
+ * into billing rather than bought through it — automatic renewal cannot be turned on until
1199
+ * one manual renewal records it.
1200
+ */
1201
+ billing_cycle?: string;
1202
+ /**
1203
+ * @description What happens at expiry. `manual` is where everything starts: charging automatically has
1204
+ * to be chosen. `none` also stops the reminders, which is a different thing from `manual`
1205
+ * — see the route that sets it.
1206
+ * @enum {string}
1207
+ */
1208
+ renewal_status: "manual" | "auto" | "none";
1157
1209
  };
1158
1210
  PrepaidAssetList: {
1159
1211
  assets: components["schemas"]["PrepaidAsset"][];
@@ -1178,6 +1230,10 @@ export interface components {
1178
1230
  */
1179
1231
  term_end: string;
1180
1232
  };
1233
+ SetRenewalStatusRequestBody: {
1234
+ /** @enum {string} */
1235
+ status: "manual" | "auto" | "none";
1236
+ };
1181
1237
  RenewRequestBody: {
1182
1238
  /**
1183
1239
  * @description How long to renew for, as an ISO 8601 duration (P1M, P1Y). It does not have to match the
@@ -1519,7 +1575,20 @@ export interface components {
1519
1575
  ChargeList: {
1520
1576
  currency: components["schemas"]["Currency"];
1521
1577
  charges: components["schemas"]["Charge"][];
1522
- /** @description The sum, which is the same number as `unsettled` on the balance */
1578
+ /**
1579
+ * Format: int64
1580
+ * @description How many charges there are in total, across every page.
1581
+ *
1582
+ * Without it, "is there another page" has to be guessed from whether this one came back
1583
+ * full — and that guess turns into one extra fetch of an empty page whenever the last page
1584
+ * happens to be exactly full.
1585
+ */
1586
+ total_count?: number;
1587
+ /**
1588
+ * @description The sum over the **whole period**, not this page — it is the same number as `unsettled`
1589
+ * on the balance, and paging must not change it. A page-scoped sum would disagree with the
1590
+ * balance card sitting next to it, and there would be no way to tell which one to believe.
1591
+ */
1523
1592
  total: string;
1524
1593
  };
1525
1594
  /** @enum {string} */
@@ -2082,7 +2151,18 @@ export interface operations {
2082
2151
  };
2083
2152
  "list-charges": {
2084
2153
  parameters: {
2085
- query?: never;
2154
+ query?: {
2155
+ /** @description 1-based page number; the first page when omitted. */
2156
+ page?: number;
2157
+ /**
2158
+ * @description How many charges per page. Defaults to a full page.
2159
+ *
2160
+ * Charge count grows with resource count — an account running dozens of machines produces
2161
+ * hundreds of lines in a period, and a screen shows a dozen. Fetching all of them on every
2162
+ * visit carries data nothing displays.
2163
+ */
2164
+ page_size?: number;
2165
+ };
2086
2166
  header?: never;
2087
2167
  path: {
2088
2168
  /**
@@ -2654,6 +2734,47 @@ export interface operations {
2654
2734
  };
2655
2735
  };
2656
2736
  };
2737
+ "set-renewal-status": {
2738
+ parameters: {
2739
+ query?: never;
2740
+ header?: never;
2741
+ path: {
2742
+ /**
2743
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
2744
+ * which is why the key is what addresses the account.
2745
+ */
2746
+ accountKey: components["parameters"]["AccountKey"];
2747
+ /** @description Which asset, from the prepaid list */
2748
+ provisionId: components["parameters"]["ProvisionId"];
2749
+ };
2750
+ cookie?: never;
2751
+ };
2752
+ requestBody: {
2753
+ content: {
2754
+ "application/json": components["schemas"]["SetRenewalStatusRequestBody"];
2755
+ };
2756
+ };
2757
+ responses: {
2758
+ /** @description OK */
2759
+ 200: {
2760
+ headers: {
2761
+ [name: string]: unknown;
2762
+ };
2763
+ content: {
2764
+ "application/json": components["schemas"]["PrepaidAsset"];
2765
+ };
2766
+ };
2767
+ /** @description Error */
2768
+ default: {
2769
+ headers: {
2770
+ [name: string]: unknown;
2771
+ };
2772
+ content: {
2773
+ "application/json": components["schemas"]["Error"];
2774
+ };
2775
+ };
2776
+ };
2777
+ };
2657
2778
  "quote-renewal": {
2658
2779
  parameters: {
2659
2780
  query: {
@@ -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.48.0",
3
+ "version": "0.50.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {