@leaflow/sdk 0.54.1 → 0.54.2

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.
@@ -84,6 +84,10 @@ export type ListCreditGrantsQuery = operations["list-credit-grants"]["parameters
84
84
  export type ListAllocationsResult = operations["list-allocations"]["responses"][200]["content"]["application/json"];
85
85
  /** `GET /account/v1/allocations` 的查询参数。 */
86
86
  export type ListAllocationsQuery = operations["list-allocations"]["parameters"]["query"];
87
+ /** `POST /account/v1/refunds` 成功时的响应体。 */
88
+ export type RequestRefundResult = operations["request-refund"]["responses"][201]["content"]["application/json"];
89
+ /** `POST /account/v1/refunds` 的请求体。 */
90
+ export type RequestRefundBody = NonNullable<operations["request-refund"]["requestBody"]>["content"]["application/json"];
87
91
  /** `GET /account/v1/refunds` 成功时的响应体。 */
88
92
  export type ListRefundsResult = operations["list-refunds"]["responses"][200]["content"]["application/json"];
89
93
  /** `GET /account/v1/usage-charges` 成功时的响应体。 */
@@ -565,7 +565,20 @@ export interface paths {
565
565
  };
566
566
  get: operations["list-refunds"];
567
567
  put?: never;
568
- post?: never;
568
+ /**
569
+ * Ask for a refund
570
+ * @description Refunding ends the subscription and reclaims whatever it provisioned. That is the
571
+ * difference from letting a period lapse: a lapsed period keeps the machine around
572
+ * for a while so that topping up brings it back, whereas a refund returns the money
573
+ * and therefore cannot leave the thing running.
574
+ *
575
+ * What can be refunded, for how long, and how much, is decided here rather than by
576
+ * the caller. A request outside those bounds is refused with the reason.
577
+ *
578
+ * The money goes back the way it came: card charges to the card, balance to the
579
+ * balance, credit to credit. A grant never turns into cash.
580
+ */
581
+ post: operations["request-refund"];
569
582
  delete?: never;
570
583
  options?: never;
571
584
  head?: never;
@@ -1393,17 +1406,38 @@ export interface components {
1393
1406
  QuoteLineResult: {
1394
1407
  /** @description Which line of the request this answers. */
1395
1408
  index: number;
1409
+ /**
1410
+ * @description Whether a price was found for this line. Read this before anything else.
1411
+ *
1412
+ * A single item with no price no longer fails the whole request. A catalogue
1413
+ * almost always has something not yet priced, and refusing the request would
1414
+ * leave no way to render a list in which a few entries are simply not on sale.
1415
+ *
1416
+ * When false, `price_id`, `unit_amount` and `amount` are absent and
1417
+ * `unpriced_reason` states what is missing.
1418
+ */
1419
+ priced: boolean;
1420
+ /**
1421
+ * @description Why no price was found; `none` while `priced` is true.
1422
+ *
1423
+ * The last four are told apart because their remedies differ: the price points
1424
+ * at no price list, the list holds no rate for that meter, that exact combination
1425
+ * of attributes is not configured, or it is configured but nothing is in effect
1426
+ * at the moment asked about.
1427
+ * @enum {string}
1428
+ */
1429
+ unpriced_reason?: "none" | "no_price" | "no_rate_card" | "no_meter" | "no_dimensions" | "no_effective_rule";
1396
1430
  /**
1397
1431
  * Format: uuid
1398
- * @description The price selected. Always returned, including when the request identified the item
1399
- * indirectly, so that the choice can be confirmed.
1432
+ * @description The price selected. Returned whenever `priced` is true, including when the
1433
+ * request identified the item indirectly, so that the choice can be confirmed.
1400
1434
  */
1401
- price_id: string;
1435
+ price_id?: string;
1402
1436
  plan_name?: string;
1403
1437
  unit_amount?: components["schemas"]["Money"];
1404
1438
  quantity?: string;
1405
1439
  /** @description Not rounded. Round only for display. */
1406
- amount: components["schemas"]["Money"];
1440
+ amount?: components["schemas"]["Money"];
1407
1441
  currency: string;
1408
1442
  };
1409
1443
  QuoteChangeResult: {
@@ -1605,7 +1639,16 @@ export interface components {
1605
1639
  TopUpCreate: {
1606
1640
  /** Format: int64 */
1607
1641
  billing_account_id: number;
1608
- /** @description In the account's currency. */
1642
+ /**
1643
+ * @description In the account's currency, and no finer than that currency's smallest unit:
1644
+ * two decimals for most, none for the yen. A finer amount is refused here rather
1645
+ * than at the checkout page, where the payer would see the provider's own wording
1646
+ * instead of an explanation.
1647
+ *
1648
+ * There is a minimum, which differs by currency. Below it the provider's fee
1649
+ * exceeds the top-up itself, so such a payment costs more to accept than it brings.
1650
+ * The minimum in force is returned with the rejection.
1651
+ */
1609
1652
  amount: components["schemas"]["Money"];
1610
1653
  /**
1611
1654
  * Format: uuid
@@ -1745,7 +1788,7 @@ export interface components {
1745
1788
  /** Format: int64 */
1746
1789
  billing_account_id: number;
1747
1790
  /** @description Numbered per account and per month. */
1748
- number?: string;
1791
+ number: string;
1749
1792
  /**
1750
1793
  * @description What produced it — metered usage for a period, a purchase, or a correction.
1751
1794
  * @enum {string}
@@ -1909,6 +1952,32 @@ export interface components {
1909
1952
  /** Format: int64 */
1910
1953
  total_count?: number;
1911
1954
  };
1955
+ /**
1956
+ * @description Name exactly one of the three targets. Naming none leaves the amount undecided;
1957
+ * naming two leaves it ambiguous, and both would have to be resolved by guessing.
1958
+ */
1959
+ RefundRequest: {
1960
+ /** Format: uuid */
1961
+ invoice_id?: string;
1962
+ /** Format: uuid */
1963
+ order_id?: string;
1964
+ /**
1965
+ * Format: uuid
1966
+ * @description The period to end early. Use this to give back a prepaid term that still has
1967
+ * time left on it.
1968
+ */
1969
+ subscription_period_id?: string;
1970
+ /**
1971
+ * @description How much to give back. Absent asks for everything still refundable on the target.
1972
+ *
1973
+ * More than what remains is refused rather than reduced to the remainder: a caller
1974
+ * asking for more than it can have has miscounted, and quietly giving it less
1975
+ * hides that.
1976
+ */
1977
+ amount?: components["schemas"]["Money"];
1978
+ reason: string;
1979
+ idempotency_key: string;
1980
+ };
1912
1981
  Refund: {
1913
1982
  /** Format: uuid */
1914
1983
  id: string;
@@ -1918,7 +1987,7 @@ export interface components {
1918
1987
  invoice_id?: string | null;
1919
1988
  /** Format: uuid */
1920
1989
  order_id?: string | null;
1921
- requested_amount?: components["schemas"]["Money"];
1990
+ requested_amount: components["schemas"]["Money"];
1922
1991
  /** @description What has actually been returned. */
1923
1992
  settled_amount?: components["schemas"]["Money"];
1924
1993
  currency: string;
@@ -3383,6 +3452,31 @@ export interface operations {
3383
3452
  default: components["responses"]["Error"];
3384
3453
  };
3385
3454
  };
3455
+ "request-refund": {
3456
+ parameters: {
3457
+ query?: never;
3458
+ header?: never;
3459
+ path?: never;
3460
+ cookie?: never;
3461
+ };
3462
+ requestBody: {
3463
+ content: {
3464
+ "application/json": components["schemas"]["RefundRequest"];
3465
+ };
3466
+ };
3467
+ responses: {
3468
+ /** @description Accepted for processing */
3469
+ 201: {
3470
+ headers: {
3471
+ [name: string]: unknown;
3472
+ };
3473
+ content: {
3474
+ "application/json": components["schemas"]["Refund"];
3475
+ };
3476
+ };
3477
+ default: components["responses"]["Error"];
3478
+ };
3479
+ };
3386
3480
  "list-usage-charges": {
3387
3481
  parameters: {
3388
3482
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.54.1",
3
+ "version": "0.54.2",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {