@leaflow/sdk 0.54.2 → 0.54.4

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.
@@ -74,6 +74,8 @@ export type ListInvoicesQuery = operations["list-invoices"]["parameters"]["query
74
74
  export type GetInvoiceResult = operations["get-invoice"]["responses"][200]["content"]["application/json"];
75
75
  /** `GET /account/v1/invoices/{invoiceId}/items` 成功时的响应体。 */
76
76
  export type ListInvoiceItemsResult = operations["list-invoice-items"]["responses"][200]["content"]["application/json"];
77
+ /** `GET /account/v1/invoices/{invoiceId}/refund-quote` 成功时的响应体。 */
78
+ export type GetInvoiceRefundQuoteResult = operations["get-invoice-refund-quote"]["responses"][200]["content"]["application/json"];
77
79
  /** `GET /account/v1/transactions` 成功时的响应体。 */
78
80
  export type ListTransactionsResult = operations["list-transactions"]["responses"][200]["content"]["application/json"];
79
81
  /** `GET /account/v1/credit-grants` 成功时的响应体。 */
@@ -166,6 +168,8 @@ export type ListOrdersQuery = operations["list-orders"]["parameters"]["query"];
166
168
  export type GetOrderResult = operations["get-order"]["responses"][200]["content"]["application/json"];
167
169
  /** `GET /account/v1/orders/{orderId}/items` 成功时的响应体。 */
168
170
  export type ListOrderItemsResult = operations["list-order-items"]["responses"][200]["content"]["application/json"];
171
+ /** `GET /account/v1/orders/{orderId}/refund-quote` 成功时的响应体。 */
172
+ export type GetOrderRefundQuoteResult = operations["get-order-refund-quote"]["responses"][200]["content"]["application/json"];
169
173
  /** `GET /api/v1/projects/{projectId}/orders/{orderId}/items` 成功时的响应体。 */
170
174
  export type ListProjectOrderItemsResult = operations["list-project-order-items"]["responses"][200]["content"]["application/json"];
171
175
  /** `GET /api/v1/projects/{projectId}/allowances` 成功时的响应体。 */
@@ -336,8 +336,9 @@ export interface paths {
336
336
  put?: never;
337
337
  /**
338
338
  * Begin adding a payment method
339
- * @description Returns an address at which the payment provider collects the card details. Nothing is
340
- * charged. The method appears in the list once the provider confirms it.
339
+ * @description Returns what is needed to hand the browser over to the payment provider's own card
340
+ * form. Nothing is charged, and the method appears in the list once the provider
341
+ * confirms it.
341
342
  *
342
343
  * Card numbers are never sent to or stored by this service.
343
344
  */
@@ -497,6 +498,33 @@ export interface paths {
497
498
  patch?: never;
498
499
  trace?: never;
499
500
  };
501
+ "/account/v1/invoices/{invoiceId}/refund-quote": {
502
+ parameters: {
503
+ query?: never;
504
+ header?: never;
505
+ path: {
506
+ invoiceId: components["parameters"]["InvoiceId"];
507
+ };
508
+ cookie?: never;
509
+ };
510
+ /**
511
+ * What refunding this invoice would give back
512
+ * @description Show this before asking for a refund. Nothing is recorded and nothing is reserved; the
513
+ * answer follows from what has been paid and what has already been returned, so it may
514
+ * be read as often as required.
515
+ *
516
+ * `refundable_amount` is `"0"` once nothing is left, which is also the answer for an
517
+ * invoice already refunded in full.
518
+ */
519
+ get: operations["get-invoice-refund-quote"];
520
+ put?: never;
521
+ post?: never;
522
+ delete?: never;
523
+ options?: never;
524
+ head?: never;
525
+ patch?: never;
526
+ trace?: never;
527
+ };
500
528
  "/account/v1/transactions": {
501
529
  parameters: {
502
530
  query?: never;
@@ -546,6 +574,9 @@ export interface paths {
546
574
  * Where each amount went
547
575
  * @description Give `source_id` to follow one top-up or grant through to everything it paid for. Give
548
576
  * `target_id` to see which sources paid for one line of an invoice.
577
+ *
578
+ * Give `source_type` on its own to separate what cash paid for from what granted credit
579
+ * paid for.
549
580
  */
550
581
  get: operations["list-allocations"];
551
582
  put?: never;
@@ -1077,6 +1108,36 @@ export interface paths {
1077
1108
  patch?: never;
1078
1109
  trace?: never;
1079
1110
  };
1111
+ "/account/v1/orders/{orderId}/refund-quote": {
1112
+ parameters: {
1113
+ query?: never;
1114
+ header?: never;
1115
+ path: {
1116
+ orderId: components["parameters"]["OrderId"];
1117
+ };
1118
+ cookie?: never;
1119
+ };
1120
+ /**
1121
+ * What refunding this order would give back
1122
+ * @description Show this before asking for a refund. Nothing is recorded and nothing is reserved; the
1123
+ * answer follows from what has been paid and what has already been returned, so it may
1124
+ * be read as often as required.
1125
+ *
1126
+ * `refundable_amount` is `"0"` once nothing is left, which is also the answer for an
1127
+ * order already refunded in full.
1128
+ *
1129
+ * Refunding an order also ends what it bought and reclaims whatever it provisioned. That
1130
+ * is not reflected in the amounts here.
1131
+ */
1132
+ get: operations["get-order-refund-quote"];
1133
+ put?: never;
1134
+ post?: never;
1135
+ delete?: never;
1136
+ options?: never;
1137
+ head?: never;
1138
+ patch?: never;
1139
+ trace?: never;
1140
+ };
1080
1141
  "/api/v1/projects/{projectId}/orders/{orderId}/items": {
1081
1142
  parameters: {
1082
1143
  query?: never;
@@ -1248,11 +1309,13 @@ export interface components {
1248
1309
  /** @description Present for `per_unit`. */
1249
1310
  unit_amount?: components["schemas"]["Money"];
1250
1311
  /**
1251
- * @description Present for `tiered`. `graduated` charges each band at its own rate; `volume`
1252
- * charges everything at the rate of the band the total falls in.
1312
+ * @description `none` for a price that is not tiered, which is most of them.
1313
+ *
1314
+ * Otherwise `graduated` charges each band at its own rate, and `volume` charges
1315
+ * everything at the rate of the band the total falls in.
1253
1316
  * @enum {string}
1254
1317
  */
1255
- tiers_mode?: "graduated" | "volume";
1318
+ tiers_mode?: "none" | "graduated" | "volume";
1256
1319
  /** @description Present for `tiered`, in ascending order. */
1257
1320
  tiers?: components["schemas"]["Tier"][];
1258
1321
  /**
@@ -1624,17 +1687,47 @@ export interface components {
1624
1687
  id: string;
1625
1688
  /** Format: int64 */
1626
1689
  billing_account_id: number;
1690
+ /** @description What is credited to the account, in the account's own currency. */
1627
1691
  amount: components["schemas"]["Money"];
1628
1692
  currency: string;
1693
+ /**
1694
+ * @description How much of this top-up has not been spent yet. This is the part that can still be
1695
+ * returned to where it was paid from.
1696
+ */
1697
+ remaining_amount?: components["schemas"]["Money"];
1629
1698
  /**
1630
1699
  * @description `pending` until the payment provider confirms. The balance increases on `succeeded`.
1700
+ *
1701
+ * A checkout the payer abandoned ends up `failed` too, with `failure_reason` saying
1702
+ * so. Nothing was charged in that case.
1631
1703
  * @enum {string}
1632
1704
  */
1633
1705
  status: "pending" | "succeeded" | "failed";
1706
+ /** @description Which payment provider collected it. */
1707
+ provider?: string;
1708
+ /**
1709
+ * @description The currency the payer was actually charged in, when the checkout page collected a
1710
+ * local one. Absent when it was the same as the account's.
1711
+ */
1712
+ presentment_currency?: string;
1713
+ /**
1714
+ * @description What was charged, in `presentment_currency`. It will not equal `amount`, and it is
1715
+ * the figure that appears on the payer's card or wallet statement.
1716
+ */
1717
+ presentment_amount?: components["schemas"]["Money"];
1718
+ /** @description Why it did not go through. Present with `failed`. */
1719
+ failure_reason?: string;
1634
1720
  /** @description Where the payer completes the payment. Absent once it has completed. */
1635
1721
  checkout_url?: string;
1636
1722
  /** Format: date-time */
1637
1723
  created_at: string;
1724
+ /**
1725
+ * Format: date-time
1726
+ * @description When the funds arrived. Later than `created_at` — by days for a bank transfer — so
1727
+ * reconciling against a statement uses this rather than the moment it was started.
1728
+ * Absent until the payment completes.
1729
+ */
1730
+ settled_at?: string | null;
1638
1731
  };
1639
1732
  TopUpCreate: {
1640
1733
  /** Format: int64 */
@@ -1692,9 +1785,27 @@ export interface components {
1692
1785
  billing_account_id: number;
1693
1786
  return_url?: string;
1694
1787
  };
1788
+ /**
1789
+ * @description What the payment provider's browser library needs in order to collect a card. There is
1790
+ * no address to redirect to: the form is rendered in the page, and the card goes straight
1791
+ * from the browser to the provider.
1792
+ */
1695
1793
  PaymentMethodSetupResult: {
1696
- /** @description Where the payer enters their card details. */
1697
- setup_url: string;
1794
+ /**
1795
+ * @description The provider's identifier for this attempt. Use it to tell a reloaded page apart
1796
+ * from a second attempt.
1797
+ */
1798
+ setup_id: string;
1799
+ /**
1800
+ * @description Authorises this one attempt with the provider, and nothing else. Pass it to the
1801
+ * provider's library; it is not an API credential and grants no access here.
1802
+ */
1803
+ client_secret: string;
1804
+ /**
1805
+ * @description The provider's public key to initialise its library with. It differs between test
1806
+ * and live, so read it from here rather than compiling it in.
1807
+ */
1808
+ publishable_key: string;
1698
1809
  /** Format: date-time */
1699
1810
  expires_at?: string;
1700
1811
  };
@@ -1888,9 +1999,13 @@ export interface components {
1888
1999
  /**
1889
2000
  * @description `pending` is a payment still with the provider. Only one may be pending against any
1890
2001
  * one invoice or order.
2002
+ *
2003
+ * `failed` covers a payment the provider refused and one the payer walked away from
2004
+ * alike; `failure_reason` says which. There is no separate cancelled state, because
2005
+ * what to do next is the same either way — start a new one.
1891
2006
  * @enum {string}
1892
2007
  */
1893
- status: "pending" | "succeeded" | "failed" | "canceled";
2008
+ status: "pending" | "succeeded" | "failed";
1894
2009
  /** Format: date-time */
1895
2010
  created_at: string;
1896
2011
  };
@@ -1904,8 +2019,12 @@ export interface components {
1904
2019
  id: string;
1905
2020
  /** Format: int64 */
1906
2021
  billing_account_id?: number;
1907
- /** @enum {string} */
1908
- source_type?: "promotional" | "voucher" | "compensation" | "membership";
2022
+ /**
2023
+ * @description Where it came from. `voucher` was redeemed from a code and carries its own
2024
+ * restrictions; `manual` was issued directly, typically to put something right.
2025
+ * @enum {string}
2026
+ */
2027
+ source_type?: "promotion" | "voucher" | "manual" | "membership";
1909
2028
  name: string;
1910
2029
  amount: components["schemas"]["Money"];
1911
2030
  remaining_amount: components["schemas"]["Money"];
@@ -1915,7 +2034,7 @@ export interface components {
1915
2034
  /** @description The restrictions in one sentence, ready to display. */
1916
2035
  applies_to_summary?: string;
1917
2036
  /** @enum {string} */
1918
- status: "active" | "exhausted" | "expired" | "voided";
2037
+ status: "active" | "depleted" | "expired" | "voided";
1919
2038
  /** Format: date-time */
1920
2039
  valid_from: string;
1921
2040
  /** Format: date-time */
@@ -1933,13 +2052,10 @@ export interface components {
1933
2052
  source_type: "transaction" | "credit_grant";
1934
2053
  /** Format: uuid */
1935
2054
  source_id: string;
1936
- /** @description A readable line, such as "Top-up of 100.00 on 3 September". */
1937
- source_description?: string;
1938
2055
  /** @enum {string} */
1939
2056
  target_type: "hold" | "order_item" | "invoice_item";
1940
2057
  /** Format: uuid */
1941
2058
  target_id: string;
1942
- target_description?: string;
1943
2059
  amount: components["schemas"]["Money"];
1944
2060
  currency: string;
1945
2061
  /** Format: date-time */
@@ -1990,14 +2106,28 @@ export interface components {
1990
2106
  requested_amount: components["schemas"]["Money"];
1991
2107
  /** @description What has actually been returned. */
1992
2108
  settled_amount?: components["schemas"]["Money"];
2109
+ /**
2110
+ * @description Withheld from what reaches the payer. It applies only to cash returned to a payment
2111
+ * method, so it is zero when `destination` is `balance`, and it is never taken out of
2112
+ * credit or a voucher.
2113
+ *
2114
+ * `settled_amount` is the amount put back against what was paid; the payer receives
2115
+ * that less this.
2116
+ */
2117
+ fee_amount?: components["schemas"]["Money"];
1993
2118
  currency: string;
1994
2119
  /**
1995
2120
  * @description Where the cash went.
1996
2121
  * @enum {string}
1997
2122
  */
1998
2123
  destination?: "balance" | "provider";
1999
- /** @enum {string} */
2000
- status: "pending" | "succeeded" | "failed";
2124
+ /**
2125
+ * @description `pending` accepted, not yet sent to the payment provider. `processing` — with the
2126
+ * provider and awaiting its answer, which takes days for some methods. Neither is
2127
+ * final, and neither means the money has moved.
2128
+ * @enum {string}
2129
+ */
2130
+ status: "pending" | "processing" | "succeeded" | "failed";
2001
2131
  reason?: string;
2002
2132
  /** Format: date-time */
2003
2133
  created_at: string;
@@ -2007,6 +2137,51 @@ export interface components {
2007
2137
  /** Format: int64 */
2008
2138
  total_count?: number;
2009
2139
  };
2140
+ RefundSource: {
2141
+ /**
2142
+ * @description Where this part of the money came from, and therefore where it goes back to.
2143
+ * Only `cash` can reach a card or a spendable balance; credit and vouchers return
2144
+ * to themselves and never become cash.
2145
+ * @enum {string}
2146
+ */
2147
+ type: "cash" | "credit" | "voucher";
2148
+ amount: components["schemas"]["Money"];
2149
+ };
2150
+ /** @description What a full refund would return, and where each part of it would go. */
2151
+ RefundQuote: {
2152
+ /** @description The most that can still be returned, before any fee. */
2153
+ refundable_amount: components["schemas"]["Money"];
2154
+ /**
2155
+ * @description Withheld from the cash part. Zero when `destination` is `balance`, and never taken
2156
+ * out of credit or a voucher.
2157
+ */
2158
+ fee_amount: components["schemas"]["Money"];
2159
+ /** @description `refundable_amount` less `fee_amount`. */
2160
+ net_amount: components["schemas"]["Money"];
2161
+ currency: string;
2162
+ /**
2163
+ * @description Where the cash part would go. `provider` returns it to the method it was paid
2164
+ * with; `balance` credits the account instead, which is the answer whenever the cash
2165
+ * came from more than one place or never went through a provider at all.
2166
+ * @enum {string}
2167
+ */
2168
+ destination: "balance" | "provider";
2169
+ /**
2170
+ * @description How `refundable_amount` splits by where the money came from. The amounts sum to it.
2171
+ *
2172
+ * Show this rather than a single figure. A part returned as credit or as a voucher
2173
+ * does not appear on a card statement, so a customer told only the net amount will
2174
+ * ask why less than that arrived.
2175
+ */
2176
+ sources: components["schemas"]["RefundSource"][];
2177
+ /**
2178
+ * Format: date-time
2179
+ * @description The last moment a refund can be asked for here. Measured from when the purchase was
2180
+ * paid for, not from today. Absent when this cannot be refunded without support at
2181
+ * all — metered usage, for one, which is never self-service.
2182
+ */
2183
+ self_service_until?: string | null;
2184
+ };
2010
2185
  UsageCharge: {
2011
2186
  /** Format: uuid */
2012
2187
  id: string;
@@ -2081,8 +2256,12 @@ export interface components {
2081
2256
  /** Format: uuid */
2082
2257
  product_id: string;
2083
2258
  product_key?: string;
2084
- /** @enum {string} */
2085
- status: "active" | "suspended" | "cancelled";
2259
+ /**
2260
+ * @description `pending` is a subscription created by an order that has not completed, so it
2261
+ * appears in the list before anything under it is running.
2262
+ * @enum {string}
2263
+ */
2264
+ status: "pending" | "active" | "suspended" | "canceled" | "terminated";
2086
2265
  /** Format: int64 */
2087
2266
  item_count?: number;
2088
2267
  };
@@ -2117,7 +2296,7 @@ export interface components {
2117
2296
  paid_until?: string | null;
2118
2297
  auto_renew?: boolean;
2119
2298
  /** @enum {string} */
2120
- status: "pending" | "active" | "suspended" | "cancelled" | "terminated";
2299
+ status: "pending" | "active" | "suspended" | "canceled" | "terminated";
2121
2300
  /** Format: date-time */
2122
2301
  started_at?: string | null;
2123
2302
  /** Format: date-time */
@@ -2395,6 +2574,12 @@ export interface components {
2395
2574
  id: string;
2396
2575
  /** Format: int64 */
2397
2576
  billing_account_id?: number;
2577
+ /**
2578
+ * @description Which service it covers, such as `compute`. Read it alongside `meter_key`: a meter
2579
+ * name is unique only within its own service, so two allowances for `egress_bytes`
2580
+ * may belong to different services and cover different traffic.
2581
+ */
2582
+ product_key: string;
2398
2583
  /** @description What it covers, such as `egress_bytes`. */
2399
2584
  meter_key: string;
2400
2585
  /** @description The unit it is counted in, such as `MiB`. */
@@ -3334,6 +3519,29 @@ export interface operations {
3334
3519
  default: components["responses"]["Error"];
3335
3520
  };
3336
3521
  };
3522
+ "get-invoice-refund-quote": {
3523
+ parameters: {
3524
+ query?: never;
3525
+ header?: never;
3526
+ path: {
3527
+ invoiceId: components["parameters"]["InvoiceId"];
3528
+ };
3529
+ cookie?: never;
3530
+ };
3531
+ requestBody?: never;
3532
+ responses: {
3533
+ /** @description OK */
3534
+ 200: {
3535
+ headers: {
3536
+ [name: string]: unknown;
3537
+ };
3538
+ content: {
3539
+ "application/json": components["schemas"]["RefundQuote"];
3540
+ };
3541
+ };
3542
+ default: components["responses"]["Error"];
3543
+ };
3544
+ };
3337
3545
  "list-transactions": {
3338
3546
  parameters: {
3339
3547
  query?: {
@@ -3374,7 +3582,7 @@ export interface operations {
3374
3582
  page_size?: components["parameters"]["PageSize"];
3375
3583
  /** @description Restrict to one of your accounts. All of them when omitted. */
3376
3584
  billing_account_id?: components["parameters"]["AccountIdQuery"];
3377
- status?: "active" | "exhausted" | "expired" | "voided";
3585
+ status?: "active" | "depleted" | "expired" | "voided";
3378
3586
  };
3379
3587
  header?: never;
3380
3588
  path?: never;
@@ -3403,6 +3611,8 @@ export interface operations {
3403
3611
  page_size?: components["parameters"]["PageSize"];
3404
3612
  /** @description Restrict to one of your accounts. All of them when omitted. */
3405
3613
  billing_account_id?: components["parameters"]["AccountIdQuery"];
3614
+ /** @description `transaction` is money paid in, `credit_grant` is granted credit or a voucher. */
3615
+ source_type?: "transaction" | "credit_grant";
3406
3616
  source_id?: string;
3407
3617
  target_id?: string;
3408
3618
  };
@@ -3487,6 +3697,8 @@ export interface operations {
3487
3697
  /** @description Restrict to one of your accounts. All of them when omitted. */
3488
3698
  billing_account_id?: components["parameters"]["AccountIdQuery"];
3489
3699
  project_id?: string;
3700
+ /** @description Restrict to one service, such as `compute`. */
3701
+ product_key?: string;
3490
3702
  resource_id?: string;
3491
3703
  from?: components["parameters"]["From"];
3492
3704
  /** @description Exclusive. */
@@ -3743,6 +3955,12 @@ export interface operations {
3743
3955
  /** @description How many per page, 100 at most. */
3744
3956
  page_size?: components["parameters"]["PageSize"];
3745
3957
  resource_id?: string;
3958
+ /**
3959
+ * @description Restrict to one service, such as `compute`. Give it alongside `meter_key`: a meter
3960
+ * name is unique only within its own service, and more than one service may measure
3961
+ * `traffic_bytes`, so `meter_key` on its own can return charges from several.
3962
+ */
3963
+ product_key?: string;
3746
3964
  meter_key?: string;
3747
3965
  from?: components["parameters"]["From"];
3748
3966
  /** @description Exclusive. */
@@ -4107,6 +4325,29 @@ export interface operations {
4107
4325
  default: components["responses"]["Error"];
4108
4326
  };
4109
4327
  };
4328
+ "get-order-refund-quote": {
4329
+ parameters: {
4330
+ query?: never;
4331
+ header?: never;
4332
+ path: {
4333
+ orderId: components["parameters"]["OrderId"];
4334
+ };
4335
+ cookie?: never;
4336
+ };
4337
+ requestBody?: never;
4338
+ responses: {
4339
+ /** @description OK */
4340
+ 200: {
4341
+ headers: {
4342
+ [name: string]: unknown;
4343
+ };
4344
+ content: {
4345
+ "application/json": components["schemas"]["RefundQuote"];
4346
+ };
4347
+ };
4348
+ default: components["responses"]["Error"];
4349
+ };
4350
+ };
4110
4351
  "list-project-order-items": {
4111
4352
  parameters: {
4112
4353
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.54.2",
3
+ "version": "0.54.4",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {