@leaflow/sdk 0.28.0 → 0.29.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.
@@ -6,10 +6,20 @@ export type ListBillingAccountsResult = operations["list-billing-accounts"]["res
6
6
  export type CreateBillingAccountResult = operations["create-billing-account"]["responses"][200]["content"]["application/json"];
7
7
  /** `POST /account/v1/billing-accounts` 的请求体。 */
8
8
  export type CreateBillingAccountBody = NonNullable<operations["create-billing-account"]["requestBody"]>["content"]["application/json"];
9
+ /** `GET /account/v1/billing-accounts/{accountKey}` 成功时的响应体。 */
10
+ export type GetBillingAccountResult = operations["get-billing-account"]["responses"][200]["content"]["application/json"];
11
+ /** `PUT /account/v1/billing-accounts/{accountKey}` 成功时的响应体。 */
12
+ export type UpdateBillingAccountResult = operations["update-billing-account"]["responses"][200]["content"]["application/json"];
13
+ /** `PUT /account/v1/billing-accounts/{accountKey}` 的请求体。 */
14
+ export type UpdateBillingAccountBody = NonNullable<operations["update-billing-account"]["requestBody"]>["content"]["application/json"];
15
+ /** `GET /account/v1/billing-accounts/{accountKey}/credit-transactions` 成功时的响应体。 */
16
+ export type ListCreditTransactionsResult = operations["list-credit-transactions"]["responses"][200]["content"]["application/json"];
9
17
  /** `GET /account/v1/billing-accounts/{accountKey}/balance` 成功时的响应体。 */
10
18
  export type ReadBillingAccountBalanceResult = operations["read-billing-account-balance"]["responses"][200]["content"]["application/json"];
11
19
  /** `PUT /account/v1/billing-accounts/{accountKey}/projects/{projectId}` 成功时的响应体。 */
12
20
  export type BindProjectToBillingAccountResult = operations["bind-project-to-billing-account"]["responses"][200]["content"]["application/json"];
21
+ /** `GET /account/v1/billing-accounts/{accountKey}/top-ups` 成功时的响应体。 */
22
+ export type ListTopUpsResult = operations["list-top-ups"]["responses"][200]["content"]["application/json"];
13
23
  /** `POST /account/v1/billing-accounts/{accountKey}/top-ups` 成功时的响应体。 */
14
24
  export type StartTopUpResult = operations["start-top-up"]["responses"][200]["content"]["application/json"];
15
25
  /** `POST /account/v1/billing-accounts/{accountKey}/top-ups` 的请求体。 */
@@ -38,6 +38,63 @@ export interface paths {
38
38
  patch?: never;
39
39
  trace?: never;
40
40
  };
41
+ "/account/v1/billing-accounts/{accountKey}": {
42
+ parameters: {
43
+ query?: never;
44
+ header?: never;
45
+ path?: never;
46
+ cookie?: never;
47
+ };
48
+ /**
49
+ * Read one of my billing accounts
50
+ * @description One account, with the projects it currently pays for.
51
+ *
52
+ * The list returns the same objects, so this exists for the case the list cannot serve: a link
53
+ * straight to one account. Making the caller fetch every account and filter turns a bookmarked
54
+ * page into a request whose cost grows with how many accounts they hold.
55
+ */
56
+ get: operations["get-billing-account"];
57
+ /**
58
+ * Rename a billing account
59
+ * @description Changes the display name. Nothing else about the account can be changed here.
60
+ *
61
+ * The key is not among the fields and never will be: ownership is stated by the key, and
62
+ * invoices already issued refer to it. The name is what tells two accounts apart in a list, so
63
+ * a mistake made while creating one is otherwise permanent.
64
+ */
65
+ put: operations["update-billing-account"];
66
+ post?: never;
67
+ delete?: never;
68
+ options?: never;
69
+ head?: never;
70
+ patch?: never;
71
+ trace?: never;
72
+ };
73
+ "/account/v1/billing-accounts/{accountKey}/credit-transactions": {
74
+ parameters: {
75
+ query?: never;
76
+ header?: never;
77
+ path?: never;
78
+ cookie?: never;
79
+ };
80
+ /**
81
+ * How the balance got to where it is
82
+ * @description Every movement of credit on this account: what was added, what was spent, what expired, what
83
+ * was voided. Newest first.
84
+ *
85
+ * The balance on its own is a number with no account of itself. Asked why it is lower than
86
+ * expected, it cannot answer, and the holder is left to guess between "I was charged" and
87
+ * "something expired" — which lead to different next steps.
88
+ */
89
+ get: operations["list-credit-transactions"];
90
+ put?: never;
91
+ post?: never;
92
+ delete?: never;
93
+ options?: never;
94
+ head?: never;
95
+ patch?: never;
96
+ trace?: never;
97
+ };
41
98
  "/account/v1/billing-accounts/{accountKey}/balance": {
42
99
  parameters: {
43
100
  query?: never;
@@ -90,7 +147,21 @@ export interface paths {
90
147
  */
91
148
  put: operations["bind-project-to-billing-account"];
92
149
  post?: never;
93
- delete?: never;
150
+ /**
151
+ * Stop paying for a project
152
+ * @description Unbinds the project from this account. Nothing pays for it afterwards, and **everything in it
153
+ * is refused admission** until some account takes it on — no new machines, no forwarded
154
+ * requests.
155
+ *
156
+ * That consequence is the reason this exists rather than an argument against it: a project
157
+ * bound to the wrong account has no other way out, and moving it to another of the caller's
158
+ * accounts is not a correction when the answer is that this account should not be paying for
159
+ * it at all.
160
+ *
161
+ * Charges already accrued stay where they are. They were incurred while this account held the
162
+ * project, and an invoice has to keep pointing at what it was based on.
163
+ */
164
+ delete: operations["unbind-project-from-billing-account"];
94
165
  options?: never;
95
166
  head?: never;
96
167
  patch?: never;
@@ -103,7 +174,16 @@ export interface paths {
103
174
  path?: never;
104
175
  cookie?: never;
105
176
  };
106
- get?: never;
177
+ /**
178
+ * My top-ups
179
+ * @description Every top-up this account has made, newest first.
180
+ *
181
+ * Reading one top-up requires already holding its identifier, and the only place that
182
+ * identifier appears is the redirect that started it — so without this list a top-up becomes
183
+ * unfindable the moment the browser tab is closed, which is exactly when somebody wants to
184
+ * check whether their money arrived.
185
+ */
186
+ get: operations["list-top-ups"];
107
187
  put?: never;
108
188
  /**
109
189
  * Start a top-up
@@ -485,6 +565,43 @@ export interface components {
485
565
  */
486
566
  one_time?: boolean;
487
567
  };
568
+ UpdateBillingAccountRequestBody: {
569
+ display_name: string;
570
+ };
571
+ TopUpList: {
572
+ top_ups: components["schemas"]["TopUpStatus"][];
573
+ };
574
+ CreditTransactionList: {
575
+ transactions: components["schemas"]["CreditTransaction"][];
576
+ };
577
+ /**
578
+ * @description One movement of credit. Immutable — a correction is another movement, never an edit of this
579
+ * one, which is what lets the balance be recomputed from the list at any time
580
+ */
581
+ CreditTransaction: {
582
+ id: string;
583
+ type: components["schemas"]["CreditTransactionType"];
584
+ /** @description A decimal string. Never a float — a balance that rounds is a balance that drifts */
585
+ amount: string;
586
+ currency: string;
587
+ /**
588
+ * Format: date-time
589
+ * @description When it landed on the ledger, which is not always when it was requested
590
+ */
591
+ booked_at: string;
592
+ /**
593
+ * @description What the balance became. Recorded by the metering engine rather than recomputed here —
594
+ * recomputing assumes our understanding of the burn-down order matches its own, and this
595
+ * is its own account of it
596
+ */
597
+ balance_after: string;
598
+ };
599
+ /**
600
+ * @description `funded` is credit arriving, `consumed` is it being spent, `expired` is a grant reaching the
601
+ * end of its life unspent, and `voided` is one cancelled — a refund, or a correction
602
+ * @enum {string}
603
+ */
604
+ CreditTransactionType: "funded" | "consumed" | "expired" | "voided";
488
605
  /**
489
606
  * @description What a top-up bundle costs and what it grants. Present only on offers that sell credit.
490
607
  *
@@ -818,6 +935,115 @@ export interface operations {
818
935
  };
819
936
  };
820
937
  };
938
+ "get-billing-account": {
939
+ parameters: {
940
+ query?: never;
941
+ header?: never;
942
+ path: {
943
+ /**
944
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
945
+ * which is why the key is what addresses the account.
946
+ */
947
+ accountKey: components["parameters"]["AccountKey"];
948
+ };
949
+ cookie?: never;
950
+ };
951
+ requestBody?: never;
952
+ responses: {
953
+ /** @description OK */
954
+ 200: {
955
+ headers: {
956
+ [name: string]: unknown;
957
+ };
958
+ content: {
959
+ "application/json": components["schemas"]["BillingAccount"];
960
+ };
961
+ };
962
+ /** @description Error */
963
+ default: {
964
+ headers: {
965
+ [name: string]: unknown;
966
+ };
967
+ content: {
968
+ "application/json": components["schemas"]["Error"];
969
+ };
970
+ };
971
+ };
972
+ };
973
+ "update-billing-account": {
974
+ parameters: {
975
+ query?: never;
976
+ header?: never;
977
+ path: {
978
+ /**
979
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
980
+ * which is why the key is what addresses the account.
981
+ */
982
+ accountKey: components["parameters"]["AccountKey"];
983
+ };
984
+ cookie?: never;
985
+ };
986
+ requestBody: {
987
+ content: {
988
+ "application/json": components["schemas"]["UpdateBillingAccountRequestBody"];
989
+ };
990
+ };
991
+ responses: {
992
+ /** @description OK */
993
+ 200: {
994
+ headers: {
995
+ [name: string]: unknown;
996
+ };
997
+ content: {
998
+ "application/json": components["schemas"]["BillingAccount"];
999
+ };
1000
+ };
1001
+ /** @description Error */
1002
+ default: {
1003
+ headers: {
1004
+ [name: string]: unknown;
1005
+ };
1006
+ content: {
1007
+ "application/json": components["schemas"]["Error"];
1008
+ };
1009
+ };
1010
+ };
1011
+ };
1012
+ "list-credit-transactions": {
1013
+ parameters: {
1014
+ query?: never;
1015
+ header?: never;
1016
+ path: {
1017
+ /**
1018
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1019
+ * which is why the key is what addresses the account.
1020
+ */
1021
+ accountKey: components["parameters"]["AccountKey"];
1022
+ };
1023
+ cookie?: never;
1024
+ };
1025
+ requestBody?: never;
1026
+ responses: {
1027
+ /** @description OK */
1028
+ 200: {
1029
+ headers: {
1030
+ [name: string]: unknown;
1031
+ };
1032
+ content: {
1033
+ "application/json": components["schemas"]["CreditTransactionList"];
1034
+ };
1035
+ };
1036
+ /** @description Error */
1037
+ default: {
1038
+ headers: {
1039
+ [name: string]: unknown;
1040
+ };
1041
+ content: {
1042
+ "application/json": components["schemas"]["Error"];
1043
+ };
1044
+ };
1045
+ };
1046
+ };
821
1047
  "read-billing-account-balance": {
822
1048
  parameters: {
823
1049
  query?: never;
@@ -890,6 +1116,76 @@ export interface operations {
890
1116
  };
891
1117
  };
892
1118
  };
1119
+ "unbind-project-from-billing-account": {
1120
+ parameters: {
1121
+ query?: never;
1122
+ header?: never;
1123
+ path: {
1124
+ /**
1125
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1126
+ * which is why the key is what addresses the account.
1127
+ */
1128
+ accountKey: components["parameters"]["AccountKey"];
1129
+ /** @description The project to stop paying for */
1130
+ projectId: string;
1131
+ };
1132
+ cookie?: never;
1133
+ };
1134
+ requestBody?: never;
1135
+ responses: {
1136
+ /** @description Unbound */
1137
+ 204: {
1138
+ headers: {
1139
+ [name: string]: unknown;
1140
+ };
1141
+ content?: never;
1142
+ };
1143
+ /** @description Error */
1144
+ default: {
1145
+ headers: {
1146
+ [name: string]: unknown;
1147
+ };
1148
+ content: {
1149
+ "application/json": components["schemas"]["Error"];
1150
+ };
1151
+ };
1152
+ };
1153
+ };
1154
+ "list-top-ups": {
1155
+ parameters: {
1156
+ query?: never;
1157
+ header?: never;
1158
+ path: {
1159
+ /**
1160
+ * @description The account's key, of the form `u_<user_id>_<seq>`. Ownership is stated by the key itself,
1161
+ * which is why the key is what addresses the account.
1162
+ */
1163
+ accountKey: components["parameters"]["AccountKey"];
1164
+ };
1165
+ cookie?: never;
1166
+ };
1167
+ requestBody?: never;
1168
+ responses: {
1169
+ /** @description OK */
1170
+ 200: {
1171
+ headers: {
1172
+ [name: string]: unknown;
1173
+ };
1174
+ content: {
1175
+ "application/json": components["schemas"]["TopUpList"];
1176
+ };
1177
+ };
1178
+ /** @description Error */
1179
+ default: {
1180
+ headers: {
1181
+ [name: string]: unknown;
1182
+ };
1183
+ content: {
1184
+ "application/json": components["schemas"]["Error"];
1185
+ };
1186
+ };
1187
+ };
1188
+ };
893
1189
  "start-top-up": {
894
1190
  parameters: {
895
1191
  query?: never;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {