@leaflow/sdk 0.28.0 → 0.30.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;
@@ -58,6 +58,8 @@ export type GetServerSnapshotResult = operations["get-server-snapshot"]["respons
58
58
  export type ListProjectTopItemsResult = operations["list-project-top-items"]["responses"][200]["content"]["application/json"];
59
59
  /** `GET /api/v1/top-items` 的查询参数。 */
60
60
  export type ListProjectTopItemsQuery = operations["list-project-top-items"]["parameters"]["query"];
61
+ /** `GET /api/v1/templates` 成功时的响应体。 */
62
+ export type ListTemplatesResult = operations["list-templates"]["responses"][200]["content"]["application/json"];
61
63
  /** `GET /api/v1/servers` 成功时的响应体。 */
62
64
  export type ListServersResult = operations["list-servers"]["responses"][200]["content"]["application/json"];
63
65
  /** `GET /api/v1/servers` 的查询参数。 */
@@ -331,6 +331,26 @@ export interface paths {
331
331
  patch?: never;
332
332
  trace?: never;
333
333
  };
334
+ "/api/v1/templates": {
335
+ parameters: {
336
+ query?: never;
337
+ header?: never;
338
+ path?: never;
339
+ cookie?: never;
340
+ };
341
+ /**
342
+ * List the monitoring templates that can be bound to a machine
343
+ * @description The catalog every template binding is validated against — which templates exist, which parameters each of them accepts, and what each parameter defaults to. It is identical for every project and changes only when this deployment is upgraded. Read it rather than keeping a copy. A copy drifts, and only one of the ways it drifts fails loudly — an unknown parameter name is rejected, but a stale `default` and a stale `required` both look correct on screen.
344
+ */
345
+ get: operations["list-templates"];
346
+ put?: never;
347
+ post?: never;
348
+ delete?: never;
349
+ options?: never;
350
+ head?: never;
351
+ patch?: never;
352
+ trace?: never;
353
+ };
334
354
  "/api/v1/servers": {
335
355
  parameters: {
336
356
  query?: never;
@@ -366,6 +386,8 @@ export interface paths {
366
386
  * A failed call leaves the machine recorded with `monitoring_status: FAILED`; the reason is reported in `last_error` via `GET /servers/{serverId}`.
367
387
  *
368
388
  * The `tls_psk` in the response is **returned only this once**; store it immediately. If it is lost, it must be rotated.
389
+ *
390
+ * It is also how collection is resumed after `/disable`. On a machine that already exists, **omitting `template_bindings` keeps the bindings it already has**; it does not fall back to the default of Linux alone, which would silently drop every other template together with its parameters. Secret parameters are likewise carried over — see `parameters` on the binding.
369
391
  */
370
392
  put: operations["enable-server-monitoring"];
371
393
  post?: never;
@@ -1291,6 +1313,46 @@ export interface components {
1291
1313
  TopItemListResponseBody: {
1292
1314
  items: components["schemas"]["TopItemResource"][] | null;
1293
1315
  };
1316
+ TemplateCatalogParameterResource: {
1317
+ /** @description The value that takes effect when the parameter is omitted. An empty string is a real default, not an absent one */
1318
+ default: string;
1319
+ /**
1320
+ * @description The shape of the accepted value. Surrounding whitespace is trimmed before the value is checked, and an omitted or empty value is replaced by `default` and not checked at all.
1321
+ *
1322
+ * - `string` — no constraint; empty is accepted
1323
+ * - `non_empty_string` — must not be empty once trimmed
1324
+ * - `percent` — a number in the **closed** interval 0 to 100; fractions are accepted
1325
+ * - `positive_number` — a number **strictly** greater than 0; fractions are accepted
1326
+ * - `port` — an integer from 1 to 65535 inclusive; `8080/tcp` is not a port
1327
+ * - `host` — an IP address, or a hostname of at most 255 characters whose dot-separated labels are at most 63 characters of `A-Z a-z 0-9 - _` and neither begin nor end with `-`. A single label such as `localhost` is accepted, as is a trailing dot
1328
+ * - `ip_or_empty` — an IP address, or empty to mean "not specified"
1329
+ * - `regexp` — must compile as a **Go RE2** pattern. RE2 has no backreferences and no lookaround, so a pattern that a browser's `new RegExp()` accepts may still be rejected here. Validating client-side narrows the gap but does not close it
1330
+ * @enum {string}
1331
+ */
1332
+ kind: "string" | "non_empty_string" | "percent" | "positive_number" | "port" | "host" | "ip_or_empty" | "regexp";
1333
+ /** @description The key to use in `template_bindings[].parameters`. It is not the Zabbix macro name, which is internal and changes between Zabbix versions */
1334
+ name: string;
1335
+ /** @description Independent of `default`. The three NGINX connection parameters carry a default and are still required, because the template's own default (localhost:80/basic_status) is almost never right */
1336
+ required: boolean;
1337
+ /** @description Supplied in clear text and never returned. A configured one is reported by name only, through `configured_secret_parameters` on the bound template. When updating a machine that already has one stored, omit it to keep the stored value and supply it only to replace it — a caller cannot read it back, so requiring it on every write would make resuming collection impossible */
1338
+ secret: boolean;
1339
+ };
1340
+ TemplateCatalogEntryResource: {
1341
+ /** @description Exactly one template with this set must be bound to every machine. Binding none enrolls a machine that can never alert; binding both loads the Linux and Windows items onto one machine, half of which must fail */
1342
+ is_base: boolean;
1343
+ /** @description False means the template collects without an agent on the machine — ICMP_PING is pinged by the Zabbix server, PROXMOX_VE is polled over the PVE API */
1344
+ needs_agent: boolean;
1345
+ /** @description In declaration order — connection parameters first, thresholds after — and meant to be rendered in that order. It is deliberately not alphabetical, which would split a template's connection parameters apart with thresholds between them even though they only make sense filled in together */
1346
+ parameters: components["schemas"]["TemplateCatalogParameterResource"][] | null;
1347
+ /** @description Templates that must be bound alongside this one. Values are `template_key`s */
1348
+ requires: string[] | null;
1349
+ /** @description Whether this template may be bound when `agent_mode` is ACTIVE. It already combines both reasons it may not be — no active variant exists, or this deployment does not have one installed — because the two are rejected identically and call for the same fix */
1350
+ supports_active_mode: boolean;
1351
+ template_key: string;
1352
+ };
1353
+ TemplateCatalogResponseBody: {
1354
+ items: components["schemas"]["TemplateCatalogEntryResource"][] | null;
1355
+ };
1294
1356
  ServerTemplateResource: {
1295
1357
  configured_secret_parameters: string[] | null;
1296
1358
  parameters: {
@@ -1348,7 +1410,11 @@ export interface components {
1348
1410
  total: number;
1349
1411
  };
1350
1412
  TemplateBindingRequest: {
1351
- /** @description Parameters declared by the template. Secret parameters are supplied in clear text and returned by name only */
1413
+ /**
1414
+ * @description Parameters declared by the template, keyed by `name` from `GET /templates`. This is a full replacement: a parameter that is omitted takes the `default` reported there, so send back the whole `parameters` map read from the machine rather than only the field being changed.
1415
+ *
1416
+ * Secret parameters are the one exception, because they are never returned and so cannot be sent back. Omit one to keep the value already stored, and supply it only to replace it. An empty or blank value counts as omitted.
1417
+ */
1352
1418
  parameters?: {
1353
1419
  [key: string]: string;
1354
1420
  };
@@ -2625,6 +2691,35 @@ export interface operations {
2625
2691
  };
2626
2692
  };
2627
2693
  };
2694
+ "list-templates": {
2695
+ parameters: {
2696
+ query?: never;
2697
+ header?: never;
2698
+ path?: never;
2699
+ cookie?: never;
2700
+ };
2701
+ requestBody?: never;
2702
+ responses: {
2703
+ /** @description OK */
2704
+ 200: {
2705
+ headers: {
2706
+ [name: string]: unknown;
2707
+ };
2708
+ content: {
2709
+ "application/json": components["schemas"]["TemplateCatalogResponseBody"];
2710
+ };
2711
+ };
2712
+ /** @description Error */
2713
+ default: {
2714
+ headers: {
2715
+ [name: string]: unknown;
2716
+ };
2717
+ content: {
2718
+ "application/json": components["schemas"]["Error"];
2719
+ };
2720
+ };
2721
+ };
2722
+ };
2628
2723
  "list-servers": {
2629
2724
  parameters: {
2630
2725
  query?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.28.0",
3
+ "version": "0.30.0",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {