@leaflow/sdk 0.30.0 → 0.31.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.
- package/dist/billing/v1/index.d.ts +4 -0
- package/dist/billing/v1/schema.d.ts +151 -1
- package/package.json +65 -65
|
@@ -38,8 +38,12 @@ export type CancelSubscriptionResult = operations["cancel-subscription"]["respon
|
|
|
38
38
|
export type CancelSubscriptionQuery = operations["cancel-subscription"]["parameters"]["query"];
|
|
39
39
|
/** `GET /account/v1/billing-accounts/{accountKey}/top-ups/{paymentId}` 成功时的响应体。 */
|
|
40
40
|
export type ReadTopUpResult = operations["read-top-up"]["responses"][200]["content"]["application/json"];
|
|
41
|
+
/** `GET /account/v1/billing-accounts/{accountKey}/card` 成功时的响应体。 */
|
|
42
|
+
export type ReadPaymentMethodResult = operations["read-payment-method"]["responses"][200]["content"]["application/json"];
|
|
41
43
|
/** `POST /account/v1/billing-accounts/{accountKey}/card` 成功时的响应体。 */
|
|
42
44
|
export type StartCardSetupResult = operations["start-card-setup"]["responses"][200]["content"]["application/json"];
|
|
45
|
+
/** `POST /account/v1/billing-accounts/{accountKey}/billing-portal` 成功时的响应体。 */
|
|
46
|
+
export type StartBillingPortalResult = operations["start-billing-portal"]["responses"][200]["content"]["application/json"];
|
|
43
47
|
/** `GET /account/v1/billing-accounts/{accountKey}/offers` 成功时的响应体。 */
|
|
44
48
|
export type ListOffersResult = operations["list-offers"]["responses"][200]["content"]["application/json"];
|
|
45
49
|
/** `POST /account/v1/billing-accounts/{accountKey}/offers/{offerKey}/purchase` 成功时的响应体。 */
|
|
@@ -370,7 +370,30 @@ export interface paths {
|
|
|
370
370
|
path?: never;
|
|
371
371
|
cookie?: never;
|
|
372
372
|
};
|
|
373
|
-
|
|
373
|
+
/**
|
|
374
|
+
* Whether this account can be charged
|
|
375
|
+
* @description Answers whether a card is on file, and nothing else.
|
|
376
|
+
*
|
|
377
|
+
* ## Why there is no brand, no last four digits, no expiry
|
|
378
|
+
*
|
|
379
|
+
* Those would have to be read from the payment provider, and the two answers can disagree: a
|
|
380
|
+
* card present at the provider that the billing engine has not recorded as the default is
|
|
381
|
+
* exactly the state in which money cannot be collected — while a page built on the provider's
|
|
382
|
+
* answer would be showing a card. What matters here is whether the party that will run the
|
|
383
|
+
* charge believes it can, so the answer comes from that party alone.
|
|
384
|
+
*
|
|
385
|
+
* To see the card, replace it, or remove it, open the billing portal.
|
|
386
|
+
*
|
|
387
|
+
* ## Read this before offering a paid plan, not after
|
|
388
|
+
*
|
|
389
|
+
* `ready` being false is why the engine refuses to start a paid subscription. Discovering it
|
|
390
|
+
* at purchase time turns a missing card into a rejection whose wording is about something
|
|
391
|
+
* else entirely.
|
|
392
|
+
*
|
|
393
|
+
* An account that has never had a card returns `ready: false`. That is the normal state of a
|
|
394
|
+
* new account, not an error.
|
|
395
|
+
*/
|
|
396
|
+
get: operations["read-payment-method"];
|
|
374
397
|
put?: never;
|
|
375
398
|
/**
|
|
376
399
|
* Add or replace the card on file
|
|
@@ -395,6 +418,41 @@ export interface paths {
|
|
|
395
418
|
patch?: never;
|
|
396
419
|
trace?: never;
|
|
397
420
|
};
|
|
421
|
+
"/account/v1/billing-accounts/{accountKey}/billing-portal": {
|
|
422
|
+
parameters: {
|
|
423
|
+
query?: never;
|
|
424
|
+
header?: never;
|
|
425
|
+
path?: never;
|
|
426
|
+
cookie?: never;
|
|
427
|
+
};
|
|
428
|
+
get?: never;
|
|
429
|
+
put?: never;
|
|
430
|
+
/**
|
|
431
|
+
* Open the hosted billing portal
|
|
432
|
+
* @description Returns a URL to the payment provider's own portal, where the card can be replaced or
|
|
433
|
+
* removed, the billing address changed, and past invoices downloaded.
|
|
434
|
+
*
|
|
435
|
+
* ## Why replacing a card is not a form on this platform
|
|
436
|
+
*
|
|
437
|
+
* A form would mean a card number field, and no card data ever reaches this platform. The
|
|
438
|
+
* portal moves the whole interaction to the provider; only a session URL comes back.
|
|
439
|
+
*
|
|
440
|
+
* ## Something has to be able to replace an expiring card
|
|
441
|
+
*
|
|
442
|
+
* Cards expire. Once one does, the invoices for a plan stop being collectable, dunning runs
|
|
443
|
+
* out, and the projects paid for by this account are suspended for non-payment. Without this
|
|
444
|
+
* operation the account holder watches that happen with nowhere to fix it — adding a card
|
|
445
|
+
* does not help, since that operation only makes sense when there is none.
|
|
446
|
+
*
|
|
447
|
+
* The URL is single-use and expires. Do not store it.
|
|
448
|
+
*/
|
|
449
|
+
post: operations["start-billing-portal"];
|
|
450
|
+
delete?: never;
|
|
451
|
+
options?: never;
|
|
452
|
+
head?: never;
|
|
453
|
+
patch?: never;
|
|
454
|
+
trace?: never;
|
|
455
|
+
};
|
|
398
456
|
"/account/v1/billing-accounts/{accountKey}/offers": {
|
|
399
457
|
parameters: {
|
|
400
458
|
query?: never;
|
|
@@ -739,6 +797,28 @@ export interface components {
|
|
|
739
797
|
*/
|
|
740
798
|
url: string;
|
|
741
799
|
};
|
|
800
|
+
BillingPortalSession: {
|
|
801
|
+
/**
|
|
802
|
+
* Format: uri
|
|
803
|
+
* @description Send the browser here. It expires, so do not store it
|
|
804
|
+
*/
|
|
805
|
+
url: string;
|
|
806
|
+
};
|
|
807
|
+
/** @description Whether money can be collected from this account */
|
|
808
|
+
PaymentMethod: {
|
|
809
|
+
/**
|
|
810
|
+
* @description True when the billing engine holds a default payment method for this account and can
|
|
811
|
+
* therefore collect an invoice.
|
|
812
|
+
*
|
|
813
|
+
* This is the precondition for a paid plan. While it is false, starting a paid
|
|
814
|
+
* subscription is refused, and the refusal is about billing setup rather than about the
|
|
815
|
+
* plan — so check this first and say what is actually missing.
|
|
816
|
+
*
|
|
817
|
+
* A free plan does not require it, which is what allows a new account to be placed on the
|
|
818
|
+
* default tier before anyone has entered a card.
|
|
819
|
+
*/
|
|
820
|
+
ready: boolean;
|
|
821
|
+
};
|
|
742
822
|
TopUpSession: {
|
|
743
823
|
/**
|
|
744
824
|
* @description Identifies this attempt. Quote it in a support conversation — it is what ties the payment
|
|
@@ -1441,6 +1521,41 @@ export interface operations {
|
|
|
1441
1521
|
};
|
|
1442
1522
|
};
|
|
1443
1523
|
};
|
|
1524
|
+
"read-payment-method": {
|
|
1525
|
+
parameters: {
|
|
1526
|
+
query?: never;
|
|
1527
|
+
header?: never;
|
|
1528
|
+
path: {
|
|
1529
|
+
/**
|
|
1530
|
+
* @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
|
|
1531
|
+
* which is why the key is what addresses the account.
|
|
1532
|
+
*/
|
|
1533
|
+
accountKey: components["parameters"]["AccountKey"];
|
|
1534
|
+
};
|
|
1535
|
+
cookie?: never;
|
|
1536
|
+
};
|
|
1537
|
+
requestBody?: never;
|
|
1538
|
+
responses: {
|
|
1539
|
+
/** @description OK */
|
|
1540
|
+
200: {
|
|
1541
|
+
headers: {
|
|
1542
|
+
[name: string]: unknown;
|
|
1543
|
+
};
|
|
1544
|
+
content: {
|
|
1545
|
+
"application/json": components["schemas"]["PaymentMethod"];
|
|
1546
|
+
};
|
|
1547
|
+
};
|
|
1548
|
+
/** @description Error */
|
|
1549
|
+
default: {
|
|
1550
|
+
headers: {
|
|
1551
|
+
[name: string]: unknown;
|
|
1552
|
+
};
|
|
1553
|
+
content: {
|
|
1554
|
+
"application/json": components["schemas"]["Error"];
|
|
1555
|
+
};
|
|
1556
|
+
};
|
|
1557
|
+
};
|
|
1558
|
+
};
|
|
1444
1559
|
"start-card-setup": {
|
|
1445
1560
|
parameters: {
|
|
1446
1561
|
query?: never;
|
|
@@ -1476,6 +1591,41 @@ export interface operations {
|
|
|
1476
1591
|
};
|
|
1477
1592
|
};
|
|
1478
1593
|
};
|
|
1594
|
+
"start-billing-portal": {
|
|
1595
|
+
parameters: {
|
|
1596
|
+
query?: never;
|
|
1597
|
+
header?: never;
|
|
1598
|
+
path: {
|
|
1599
|
+
/**
|
|
1600
|
+
* @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
|
|
1601
|
+
* which is why the key is what addresses the account.
|
|
1602
|
+
*/
|
|
1603
|
+
accountKey: components["parameters"]["AccountKey"];
|
|
1604
|
+
};
|
|
1605
|
+
cookie?: never;
|
|
1606
|
+
};
|
|
1607
|
+
requestBody?: never;
|
|
1608
|
+
responses: {
|
|
1609
|
+
/** @description OK */
|
|
1610
|
+
200: {
|
|
1611
|
+
headers: {
|
|
1612
|
+
[name: string]: unknown;
|
|
1613
|
+
};
|
|
1614
|
+
content: {
|
|
1615
|
+
"application/json": components["schemas"]["BillingPortalSession"];
|
|
1616
|
+
};
|
|
1617
|
+
};
|
|
1618
|
+
/** @description Error */
|
|
1619
|
+
default: {
|
|
1620
|
+
headers: {
|
|
1621
|
+
[name: string]: unknown;
|
|
1622
|
+
};
|
|
1623
|
+
content: {
|
|
1624
|
+
"application/json": components["schemas"]["Error"];
|
|
1625
|
+
};
|
|
1626
|
+
};
|
|
1627
|
+
};
|
|
1628
|
+
};
|
|
1479
1629
|
"list-offers": {
|
|
1480
1630
|
parameters: {
|
|
1481
1631
|
query?: never;
|
package/package.json
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
},
|
|
10
|
-
"type": "module",
|
|
11
|
-
"main": "./dist/index.js",
|
|
12
|
-
"types": "./dist/index.d.ts",
|
|
13
|
-
"exports": {
|
|
14
|
-
".": {
|
|
15
|
-
"types": "./dist/index.d.ts",
|
|
16
|
-
"default": "./dist/index.js"
|
|
2
|
+
"name": "@leaflow/sdk",
|
|
3
|
+
"version": "0.31.0",
|
|
4
|
+
"description": "Leaflow 平台 API 的 TypeScript SDK",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/leaflowapis/leaflow-ts.git"
|
|
17
9
|
},
|
|
18
|
-
"
|
|
19
|
-
|
|
20
|
-
|
|
10
|
+
"type": "module",
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./account/v1": {
|
|
19
|
+
"types": "./dist/account/v1/index.d.ts",
|
|
20
|
+
"default": "./dist/account/v1/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./assistant/v1": {
|
|
23
|
+
"types": "./dist/assistant/v1/index.d.ts",
|
|
24
|
+
"default": "./dist/assistant/v1/index.js"
|
|
25
|
+
},
|
|
26
|
+
"./canopy/v1": {
|
|
27
|
+
"types": "./dist/canopy/v1/index.d.ts",
|
|
28
|
+
"default": "./dist/canopy/v1/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./compute/v1": {
|
|
31
|
+
"types": "./dist/compute/v1/index.d.ts",
|
|
32
|
+
"default": "./dist/compute/v1/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./iam/v1": {
|
|
35
|
+
"types": "./dist/iam/v1/index.d.ts",
|
|
36
|
+
"default": "./dist/iam/v1/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./monitoring/v1": {
|
|
39
|
+
"types": "./dist/monitoring/v1/index.d.ts",
|
|
40
|
+
"default": "./dist/monitoring/v1/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./tunnel/v1": {
|
|
43
|
+
"types": "./dist/tunnel/v1/index.d.ts",
|
|
44
|
+
"default": "./dist/tunnel/v1/index.js"
|
|
45
|
+
}
|
|
21
46
|
},
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
|
|
47
|
+
"files": [
|
|
48
|
+
"dist"
|
|
49
|
+
],
|
|
50
|
+
"sideEffects": false,
|
|
51
|
+
"scripts": {
|
|
52
|
+
"generate": "node scripts/generate.mjs",
|
|
53
|
+
"build": "tsc -p tsconfig.build.json",
|
|
54
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
55
|
+
"prepublishOnly": "npm run build"
|
|
25
56
|
},
|
|
26
|
-
"
|
|
27
|
-
|
|
28
|
-
|
|
57
|
+
"devDependencies": {
|
|
58
|
+
"openapi-typescript": "7.13.0",
|
|
59
|
+
"typescript": "^5.9.3",
|
|
60
|
+
"openapi-fetch": "^0.17.0",
|
|
61
|
+
"yaml": "^2.8.1"
|
|
29
62
|
},
|
|
30
|
-
"
|
|
31
|
-
|
|
32
|
-
"default": "./dist/compute/v1/index.js"
|
|
63
|
+
"publishConfig": {
|
|
64
|
+
"access": "public"
|
|
33
65
|
},
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
"default": "./dist/iam/v1/index.js"
|
|
66
|
+
"peerDependencies": {
|
|
67
|
+
"openapi-fetch": ">=0.14"
|
|
37
68
|
},
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
"./tunnel/v1": {
|
|
43
|
-
"types": "./dist/tunnel/v1/index.d.ts",
|
|
44
|
-
"default": "./dist/tunnel/v1/index.js"
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
"files": [
|
|
48
|
-
"dist"
|
|
49
|
-
],
|
|
50
|
-
"sideEffects": false,
|
|
51
|
-
"scripts": {
|
|
52
|
-
"generate": "node scripts/generate.mjs",
|
|
53
|
-
"build": "tsc -p tsconfig.build.json",
|
|
54
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
55
|
-
"prepublishOnly": "npm run build"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"openapi-typescript": "7.13.0",
|
|
59
|
-
"typescript": "^5.9.3",
|
|
60
|
-
"openapi-fetch": "^0.17.0",
|
|
61
|
-
"yaml": "^2.8.1"
|
|
62
|
-
},
|
|
63
|
-
"publishConfig": {
|
|
64
|
-
"access": "public"
|
|
65
|
-
},
|
|
66
|
-
"peerDependencies": {
|
|
67
|
-
"openapi-fetch": ">=0.14"
|
|
68
|
-
},
|
|
69
|
-
"peerDependenciesMeta": {
|
|
70
|
-
"openapi-fetch": {
|
|
71
|
-
"optional": true
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"openapi-fetch": {
|
|
71
|
+
"optional": true
|
|
72
|
+
}
|
|
72
73
|
}
|
|
73
|
-
}
|
|
74
74
|
}
|