@leaflow/sdk 0.5.1 → 0.6.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.
Files changed (122) hide show
  1. package/dist/generated/assistant/index.d.ts +8 -7
  2. package/dist/generated/assistant/index.js +6 -5
  3. package/dist/generated/assistant/models/bindingCodeResponseBody.d.ts +34 -0
  4. package/dist/generated/assistant/models/bindingCodeResponseBody.js +31 -0
  5. package/dist/generated/assistant/models/bindingResource.d.ts +4 -1
  6. package/dist/generated/assistant/models/bindingResourceConnState.d.ts +37 -0
  7. package/dist/generated/assistant/models/bindingResourceConnState.js +37 -0
  8. package/dist/generated/assistant/models/bindingResourceStatus.d.ts +36 -0
  9. package/dist/generated/assistant/models/bindingResourceStatus.js +36 -0
  10. package/dist/generated/assistant/models/channelResource.d.ts +10 -2
  11. package/dist/generated/assistant/models/channelResourceConnState.d.ts +40 -0
  12. package/dist/generated/assistant/models/channelResourceConnState.js +37 -0
  13. package/dist/generated/assistant/models/channelResourceRuntimeState.d.ts +38 -0
  14. package/dist/generated/assistant/models/channelResourceRuntimeState.js +35 -0
  15. package/dist/generated/assistant/models/channelResourceSenderPolicy.d.ts +35 -0
  16. package/dist/generated/assistant/models/channelResourceSenderPolicy.js +35 -0
  17. package/dist/generated/assistant/models/channelResourceStatus.d.ts +36 -0
  18. package/dist/generated/assistant/models/channelResourceStatus.js +36 -0
  19. package/dist/generated/assistant/models/channelWithSecretResponseBody.d.ts +57 -0
  20. package/dist/generated/assistant/models/channelWithSecretResponseBody.js +1 -0
  21. package/dist/generated/assistant/models/channelWithSecretResponseBodyAllowFrom.d.ts +31 -0
  22. package/dist/generated/assistant/models/channelWithSecretResponseBodyAllowFrom.js +31 -0
  23. package/dist/generated/assistant/models/channelWithSecretResponseBodyConnState.d.ts +40 -0
  24. package/dist/generated/assistant/models/channelWithSecretResponseBodyConnState.js +37 -0
  25. package/dist/generated/assistant/models/channelWithSecretResponseBodyRuntimeState.d.ts +38 -0
  26. package/dist/generated/assistant/models/channelWithSecretResponseBodyRuntimeState.js +35 -0
  27. package/dist/generated/assistant/models/channelWithSecretResponseBodySenderPolicy.d.ts +35 -0
  28. package/dist/generated/assistant/models/channelWithSecretResponseBodySenderPolicy.js +35 -0
  29. package/dist/generated/assistant/models/channelWithSecretResponseBodyStatus.d.ts +36 -0
  30. package/dist/generated/assistant/models/channelWithSecretResponseBodyStatus.js +36 -0
  31. package/dist/generated/assistant/models/channelWithSecretResponseBodyWebhookSecret.d.ts +34 -0
  32. package/dist/generated/assistant/models/channelWithSecretResponseBodyWebhookSecret.js +31 -0
  33. package/dist/generated/assistant/models/channelWithSecretResponseBodyWebhookUrl.d.ts +34 -0
  34. package/dist/generated/assistant/models/channelWithSecretResponseBodyWebhookUrl.js +31 -0
  35. package/dist/generated/assistant/models/createChannelRequestBody.d.ts +3 -2
  36. package/dist/generated/assistant/models/createChannelRequestBodySenderPolicy.d.ts +35 -0
  37. package/dist/generated/assistant/models/createChannelRequestBodySenderPolicy.js +35 -0
  38. package/dist/generated/assistant/models/index.d.ts +17 -1
  39. package/dist/generated/assistant/models/index.js +17 -1
  40. package/dist/generated/assistant/models/itemResourceStatus.d.ts +1 -1
  41. package/dist/generated/assistant/models/itemResourceStatus.js +1 -1
  42. package/dist/generated/assistant/models/itemResourceType.d.ts +1 -0
  43. package/dist/generated/assistant/models/itemResourceType.js +1 -0
  44. package/dist/generated/assistant/models/loginResource.d.ts +5 -2
  45. package/dist/generated/assistant/models/loginResource.js +0 -30
  46. package/dist/generated/assistant/models/loginResourceStatus.d.ts +39 -0
  47. package/dist/generated/assistant/models/loginResourceStatus.js +39 -0
  48. package/dist/generated/assistant/models/updateChannelRequestBodySenderPolicy.d.ts +2 -2
  49. package/dist/generated/assistant/models/updateChannelRequestBodySenderPolicy.js +2 -2
  50. package/dist/generated/tunnel/index.d.ts +142 -0
  51. package/dist/generated/tunnel/index.js +149 -0
  52. package/dist/generated/tunnel/models/actOnTunnelRequestBody.d.ts +28 -0
  53. package/dist/generated/tunnel/models/actOnTunnelRequestBody.js +1 -0
  54. package/dist/generated/tunnel/models/actOnTunnelRequestBodyAction.d.ts +29 -0
  55. package/dist/generated/tunnel/models/actOnTunnelRequestBodyAction.js +29 -0
  56. package/dist/generated/tunnel/models/changeTunnelPlanRequestBody.d.ts +27 -0
  57. package/dist/generated/tunnel/models/changeTunnelPlanRequestBody.js +25 -0
  58. package/dist/generated/tunnel/models/error.d.ts +31 -0
  59. package/dist/generated/tunnel/models/error.js +1 -0
  60. package/dist/generated/tunnel/models/errorMeta.d.ts +27 -0
  61. package/dist/generated/tunnel/models/errorMeta.js +25 -0
  62. package/dist/generated/tunnel/models/index.d.ts +54 -0
  63. package/dist/generated/tunnel/models/index.js +54 -0
  64. package/dist/generated/tunnel/models/lengthAwarePageOperationLogResource.d.ts +35 -0
  65. package/dist/generated/tunnel/models/lengthAwarePageOperationLogResource.js +1 -0
  66. package/dist/generated/tunnel/models/listTunnelOperationLogsParams.d.ts +43 -0
  67. package/dist/generated/tunnel/models/listTunnelOperationLogsParams.js +25 -0
  68. package/dist/generated/tunnel/models/listTunnelUsageSeriesParams.d.ts +32 -0
  69. package/dist/generated/tunnel/models/listTunnelUsageSeriesParams.js +25 -0
  70. package/dist/generated/tunnel/models/openTunnelRequestBody.d.ts +38 -0
  71. package/dist/generated/tunnel/models/openTunnelRequestBody.js +25 -0
  72. package/dist/generated/tunnel/models/operationLogResource.d.ts +38 -0
  73. package/dist/generated/tunnel/models/operationLogResource.js +1 -0
  74. package/dist/generated/tunnel/models/operationLogResourceActor.d.ts +28 -0
  75. package/dist/generated/tunnel/models/operationLogResourceActor.js +25 -0
  76. package/dist/generated/tunnel/models/operationLogResourcePayload.d.ts +27 -0
  77. package/dist/generated/tunnel/models/operationLogResourcePayload.js +25 -0
  78. package/dist/generated/tunnel/models/subscriptionResource.d.ts +33 -0
  79. package/dist/generated/tunnel/models/subscriptionResource.js +1 -0
  80. package/dist/generated/tunnel/models/subscriptionResourceStatus.d.ts +32 -0
  81. package/dist/generated/tunnel/models/subscriptionResourceStatus.js +29 -0
  82. package/dist/generated/tunnel/models/tunnelPlanListResponseBody.d.ts +28 -0
  83. package/dist/generated/tunnel/models/tunnelPlanListResponseBody.js +1 -0
  84. package/dist/generated/tunnel/models/tunnelPlanResource.d.ts +33 -0
  85. package/dist/generated/tunnel/models/tunnelPlanResource.js +25 -0
  86. package/dist/generated/tunnel/models/tunnelResource.d.ts +54 -0
  87. package/dist/generated/tunnel/models/tunnelResource.js +1 -0
  88. package/dist/generated/tunnel/models/tunnelResourceEmail.d.ts +28 -0
  89. package/dist/generated/tunnel/models/tunnelResourceEmail.js +25 -0
  90. package/dist/generated/tunnel/models/tunnelResourceFailure.d.ts +28 -0
  91. package/dist/generated/tunnel/models/tunnelResourceFailure.js +25 -0
  92. package/dist/generated/tunnel/models/tunnelResourceStatus.d.ts +32 -0
  93. package/dist/generated/tunnel/models/tunnelResourceStatus.js +29 -0
  94. package/dist/generated/tunnel/models/tunnelResourceSubscriptionStatus.d.ts +32 -0
  95. package/dist/generated/tunnel/models/tunnelResourceSubscriptionStatus.js +29 -0
  96. package/dist/generated/tunnel/models/tunnelResourceSuspendedAt.d.ts +28 -0
  97. package/dist/generated/tunnel/models/tunnelResourceSuspendedAt.js +25 -0
  98. package/dist/generated/tunnel/models/tunnelUsageSnapshot.d.ts +38 -0
  99. package/dist/generated/tunnel/models/tunnelUsageSnapshot.js +1 -0
  100. package/dist/generated/tunnel/models/tunnelUsageSnapshotSyncedAt.d.ts +28 -0
  101. package/dist/generated/tunnel/models/tunnelUsageSnapshotSyncedAt.js +25 -0
  102. package/dist/generated/tunnel/models/updateTunnelProfileRequestBody.d.ts +34 -0
  103. package/dist/generated/tunnel/models/updateTunnelProfileRequestBody.js +1 -0
  104. package/dist/generated/tunnel/models/updateTunnelProfileRequestBodyEmail.d.ts +29 -0
  105. package/dist/generated/tunnel/models/updateTunnelProfileRequestBodyEmail.js +25 -0
  106. package/dist/generated/tunnel/models/usageDayResource.d.ts +30 -0
  107. package/dist/generated/tunnel/models/usageDayResource.js +25 -0
  108. package/dist/generated/tunnel/models/usageResource.d.ts +43 -0
  109. package/dist/generated/tunnel/models/usageResource.js +1 -0
  110. package/dist/generated/tunnel/models/usageResourceQuotaExceededAt.d.ts +28 -0
  111. package/dist/generated/tunnel/models/usageResourceQuotaExceededAt.js +25 -0
  112. package/dist/generated/tunnel/models/usageSeriesResource.d.ts +30 -0
  113. package/dist/generated/tunnel/models/usageSeriesResource.js +1 -0
  114. package/dist/index.d.ts +14 -0
  115. package/dist/index.js +18 -3
  116. package/openapi/assistant.version +1 -1
  117. package/openapi/assistant.yaml +147 -25
  118. package/openapi/compute.version +1 -1
  119. package/openapi/monitoring.version +1 -1
  120. package/openapi/tunnel.version +1 -0
  121. package/openapi/tunnel.yaml +773 -0
  122. package/package.json +1 -1
@@ -0,0 +1,773 @@
1
+ components:
2
+ schemas:
3
+ ActOnTunnelRequestBody:
4
+ additionalProperties: false
5
+ properties:
6
+ action:
7
+ enum:
8
+ - enable
9
+ - disable
10
+ type: string
11
+ required:
12
+ - action
13
+ type: object
14
+ ChangeTunnelPlanRequestBody:
15
+ additionalProperties: false
16
+ properties:
17
+ plan_id:
18
+ format: uuid
19
+ type: string
20
+ required:
21
+ - plan_id
22
+ type: object
23
+ Error:
24
+ additionalProperties: false
25
+ properties:
26
+ code:
27
+ type: string
28
+ message:
29
+ type: string
30
+ meta:
31
+ additionalProperties: {}
32
+ type: object
33
+ status:
34
+ format: int64
35
+ type: integer
36
+ required:
37
+ - status
38
+ - message
39
+ type: object
40
+ LengthAwarePageOperationLogResource:
41
+ additionalProperties: false
42
+ properties:
43
+ items:
44
+ description: 这一页的内容
45
+ items:
46
+ $ref: "#/components/schemas/OperationLogResource"
47
+ type: array
48
+ limit:
49
+ description: 这一页最多几条,回显请求里的值
50
+ format: int64
51
+ type: integer
52
+ offset:
53
+ description: 跳过了多少条,回显请求里的值
54
+ format: int64
55
+ type: integer
56
+ total:
57
+ description: 命中的总条数,不只是这一页
58
+ format: int64
59
+ type: integer
60
+ required:
61
+ - items
62
+ - total
63
+ - limit
64
+ - offset
65
+ type: object
66
+ OpenTunnelRequestBody:
67
+ additionalProperties: false
68
+ properties:
69
+ display_name:
70
+ description: 这条隧道的名字,只影响显示
71
+ maxLength: 128
72
+ type: string
73
+ email:
74
+ description: 转发给上游面板的联系邮箱,可留空
75
+ format: email
76
+ maxLength: 255
77
+ type: string
78
+ plan_id:
79
+ description: 套餐 id,取自 GET /plans
80
+ format: uuid
81
+ type: string
82
+ required:
83
+ - plan_id
84
+ - display_name
85
+ type: object
86
+ OperationLogResource:
87
+ additionalProperties: false
88
+ properties:
89
+ action:
90
+ type: string
91
+ actor:
92
+ description: 操作者的用户 id;null 表示由平台执行
93
+ type:
94
+ - string
95
+ - "null"
96
+ created_at:
97
+ format: date-time
98
+ type: string
99
+ failure:
100
+ type: string
101
+ id:
102
+ format: uuid
103
+ type: string
104
+ payload:
105
+ additionalProperties: {}
106
+ type: object
107
+ subject_id:
108
+ type: string
109
+ subject_type:
110
+ type: string
111
+ succeeded:
112
+ type: boolean
113
+ required:
114
+ - id
115
+ - actor
116
+ - action
117
+ - subject_type
118
+ - subject_id
119
+ - payload
120
+ - succeeded
121
+ - failure
122
+ - created_at
123
+ type: object
124
+ SubscriptionResource:
125
+ additionalProperties: false
126
+ properties:
127
+ status:
128
+ description: ready 表示节点已全部下发;preparing 表示仍在下发——此时链接照样可用
129
+ enum:
130
+ - preparing
131
+ - ready
132
+ type: string
133
+ updated_at:
134
+ format: date-time
135
+ type: string
136
+ url:
137
+ description: 订阅地址。这是一条长期有效的凭据,等同于密码,请勿转发或截图分享
138
+ type: string
139
+ version:
140
+ format: int64
141
+ type: integer
142
+ required:
143
+ - url
144
+ - version
145
+ - status
146
+ - updated_at
147
+ type: object
148
+ TunnelPlanListResponseBody:
149
+ additionalProperties: false
150
+ properties:
151
+ items:
152
+ items:
153
+ $ref: "#/components/schemas/TunnelPlanResource"
154
+ type: array
155
+ required:
156
+ - items
157
+ type: object
158
+ TunnelPlanResource:
159
+ additionalProperties: false
160
+ properties:
161
+ description:
162
+ type: string
163
+ id:
164
+ format: uuid
165
+ type: string
166
+ name:
167
+ type: string
168
+ quota_bytes:
169
+ description: 套餐标称的流量额度,仅供比较。实际额度以隧道用量接口返回的 quota_bytes 为准
170
+ format: int64
171
+ type: integer
172
+ sort:
173
+ description: 货架上的排列顺序,越小越靠前
174
+ format: int64
175
+ type: integer
176
+ required:
177
+ - id
178
+ - name
179
+ - description
180
+ - quota_bytes
181
+ - sort
182
+ type: object
183
+ TunnelResource:
184
+ additionalProperties: false
185
+ properties:
186
+ created_at:
187
+ format: date-time
188
+ type: string
189
+ display_name:
190
+ type: string
191
+ email:
192
+ description: 转发给上游面板的联系邮箱;平台不使用它
193
+ type:
194
+ - string
195
+ - "null"
196
+ enabled:
197
+ description: 用户自己的开关。停用会把实例从调度器撤下,但端口保留,启用后原样回来
198
+ type: boolean
199
+ failure:
200
+ description: 最近一次上游拒绝的说明,仅在存在时非空
201
+ type:
202
+ - string
203
+ - "null"
204
+ id:
205
+ format: uuid
206
+ type: string
207
+ plan_id:
208
+ format: uuid
209
+ type: string
210
+ plan_name:
211
+ type: string
212
+ status:
213
+ description: deleting 表示已退订但上游尚未删除完成
214
+ enum:
215
+ - active
216
+ - deleting
217
+ type: string
218
+ subscription_status:
219
+ description: preparing 表示节点仍在下发;订阅链接此时照样可用
220
+ enum:
221
+ - preparing
222
+ - ready
223
+ type: string
224
+ subscription_version:
225
+ description: 每次重置订阅后递增
226
+ format: int64
227
+ type: integer
228
+ suspended:
229
+ description: 被平台停用(欠费、违规或项目停服)。为 true 时无法自行启用
230
+ type: boolean
231
+ suspended_at:
232
+ description: 被平台停用的时刻
233
+ format: date-time
234
+ type:
235
+ - string
236
+ - "null"
237
+ usage:
238
+ $ref: "#/components/schemas/TunnelUsageSnapshot"
239
+ required:
240
+ - id
241
+ - display_name
242
+ - plan_id
243
+ - plan_name
244
+ - email
245
+ - enabled
246
+ - suspended
247
+ - suspended_at
248
+ - status
249
+ - subscription_status
250
+ - subscription_version
251
+ - usage
252
+ - failure
253
+ - created_at
254
+ type: object
255
+ TunnelUsageSnapshot:
256
+ additionalProperties: false
257
+ properties:
258
+ billed_bytes:
259
+ description: 按线路倍率折算后的用量,配额比对以此为准
260
+ format: int64
261
+ type: integer
262
+ over_quota:
263
+ description: billed_bytes 是否已超过 quota_bytes;配额为 0 时恒为 false
264
+ type: boolean
265
+ quota_bytes:
266
+ description: 上游给出的真实配额,0 表示不限量
267
+ format: int64
268
+ type: integer
269
+ raw_bytes:
270
+ description: 实际传输的字节,不用于配额比对
271
+ format: int64
272
+ type: integer
273
+ synced_at:
274
+ description: 这份用量是什么时候采集的;null 表示尚未采集
275
+ format: date-time
276
+ type:
277
+ - string
278
+ - "null"
279
+ upload_bytes:
280
+ format: int64
281
+ type: integer
282
+ required:
283
+ - quota_bytes
284
+ - billed_bytes
285
+ - raw_bytes
286
+ - upload_bytes
287
+ - over_quota
288
+ - synced_at
289
+ type: object
290
+ UpdateTunnelProfileRequestBody:
291
+ additionalProperties: false
292
+ properties:
293
+ display_name:
294
+ maxLength: 128
295
+ type: string
296
+ email:
297
+ description: 联系邮箱。不传表示不改动,传空字符串表示清空
298
+ maxLength: 255
299
+ type:
300
+ - string
301
+ - "null"
302
+ required:
303
+ - display_name
304
+ type: object
305
+ UsageDayResource:
306
+ additionalProperties: false
307
+ properties:
308
+ billed_bytes:
309
+ format: int64
310
+ type: integer
311
+ day:
312
+ description: YYYY-MM-DD
313
+ type: string
314
+ raw_bytes:
315
+ format: int64
316
+ type: integer
317
+ required:
318
+ - day
319
+ - raw_bytes
320
+ - billed_bytes
321
+ type: object
322
+ UsageResource:
323
+ additionalProperties: false
324
+ properties:
325
+ billed_bytes:
326
+ description: 按线路倍率折算后的用量,配额比对以此为准
327
+ format: int64
328
+ type: integer
329
+ over_quota:
330
+ type: boolean
331
+ period_end:
332
+ description: 本期计费周期的结束日(YYYY-MM-DD)
333
+ type: string
334
+ period_start:
335
+ description: 本期计费周期的起始日(YYYY-MM-DD)
336
+ type: string
337
+ quota_bytes:
338
+ description: 上游给出的真实配额,0 表示不限量
339
+ format: int64
340
+ type: integer
341
+ quota_exceeded_at:
342
+ description: 上游判定超额的时刻;null 表示未超额
343
+ format: date-time
344
+ type:
345
+ - string
346
+ - "null"
347
+ raw_bytes:
348
+ description: 实际传输的字节,不用于配额比对
349
+ format: int64
350
+ type: integer
351
+ upload_bytes:
352
+ format: int64
353
+ type: integer
354
+ usage_percent:
355
+ description: 上游给出的用量百分比
356
+ format: double
357
+ type: number
358
+ required:
359
+ - quota_bytes
360
+ - billed_bytes
361
+ - raw_bytes
362
+ - upload_bytes
363
+ - usage_percent
364
+ - over_quota
365
+ - period_start
366
+ - period_end
367
+ - quota_exceeded_at
368
+ type: object
369
+ UsageSeriesResource:
370
+ additionalProperties: false
371
+ properties:
372
+ days:
373
+ description: 上游实际采用的天数,可能被它夹到 1–365
374
+ format: int64
375
+ type: integer
376
+ points:
377
+ items:
378
+ $ref: "#/components/schemas/UsageDayResource"
379
+ type: array
380
+ required:
381
+ - days
382
+ - points
383
+ type: object
384
+ securitySchemes:
385
+ bearerAuth:
386
+ bearerFormat: JWT
387
+ description: 项目令牌。先在 auth.leaflow.net 登录拿到账号令牌,再用它向 IAM 换取项目令牌(POST /api/v1/projects/{projectId}/token)——一张项目令牌同时说明当前用户和当前项目。
388
+ scheme: bearer
389
+ type: http
390
+ info:
391
+ description: |-
392
+ Leaflow 隧道的用户接口,用于开通与管理项目的加速隧道、订阅地址和流量用量。
393
+
394
+ ## 身份与鉴权
395
+
396
+ 每个请求需携带 `Authorization: Bearer <项目令牌>`。先在 auth.leaflow.net 登录获取账号令牌,再用它向 IAM 换取项目令牌(`POST /api/v1/projects/{projectId}/token`)。一张项目令牌同时说明当前用户和当前项目。
397
+
398
+ **路径和请求头上都没有 `project_id`**:当前项目由令牌决定。
399
+
400
+ 鉴权在网关完成,失败的请求不会到达这些接口。按错误码区分处理方式:`TOKEN_MISSING` 表示没带令牌;`TOKEN_EXPIRED` 表示令牌过期,用账号令牌重新换取即可,无需重新登录;`TOKEN_INVALID` 表示令牌验不过;`NOT_A_MEMBER` 表示当前账号不是该项目成员;`USER_SUSPENDED` / `USER_BANNED` 表示账号本身不能操作。
401
+
402
+ ## 通用约定
403
+
404
+ - **一个项目一条隧道。** 所以路径是单数的 `/tunnel`,不带 id。已经有一条时再开通会被拒绝(`TUNNEL_ALREADY_OPEN`)。
405
+ - **订阅地址是凭据。** 它等同于密码,只由 `GET /tunnel/subscription` 单独返回,不出现在隧道详情或任何列表里。怀疑泄露时用重置接口,它会让已分发的每一份订阅立即失效。
406
+ - **停用不是退订。** 停用保留端口和订阅地址,重新启用后原样回来;退订不可逆,重新开通得到的是全新的地址。
407
+ - **判断超额只看 `billed_bytes`。** 线路可以设置倍率(如 1.5× 或 0×),`raw_bytes` 是实际传输量,两者不一定相等。
408
+ - **用量最多滞后一个采集周期。** 适合用量管控,不适合作为计费结算依据。隧道详情里那份还额外经过一层缓存,`usage.synced_at` 说明它有多旧。
409
+ - **换套餐不是瞬时的。** 多出来的线路马上可用,少掉的那些有宽限期,到期才真正释放。
410
+ title: Leaflow 隧道用户 API
411
+ version: 1.0.0
412
+ openapi: 3.1.0
413
+ paths:
414
+ /api/v1/operation-logs:
415
+ get:
416
+ description: |-
417
+ 记录每一次**写**操作:谁、什么时候、做了什么、成功还是失败。读操作不记录。
418
+
419
+ `actor` 为 null 表示该操作由平台执行(例如自动重试删除、项目停服)——平台做了什么是看得到的,但具体是哪位运营人员不会展示。
420
+
421
+ `payload` 只包含路径参数与查询串,且其中像凭据的字段已被替换为占位符。
422
+ operationId: list-tunnel-operation-logs
423
+ parameters:
424
+ - description: 这一页最多返回多少条
425
+ explode: false
426
+ in: query
427
+ name: limit
428
+ schema:
429
+ default: 50
430
+ description: 这一页最多返回多少条
431
+ format: int64
432
+ maximum: 200
433
+ minimum: 1
434
+ type: integer
435
+ - description: 跳过多少条。要翻得更深请改用游标翻页的接口
436
+ explode: false
437
+ in: query
438
+ name: offset
439
+ schema:
440
+ description: 跳过多少条。要翻得更深请改用游标翻页的接口
441
+ format: int64
442
+ maximum: 10000
443
+ minimum: 0
444
+ type: integer
445
+ - description: 只看某一种操作,取值是接口的 operation id,比如 open-tunnel
446
+ explode: false
447
+ in: query
448
+ name: action
449
+ schema:
450
+ description: 只看某一种操作,取值是接口的 operation id,比如 open-tunnel
451
+ maxLength: 128
452
+ type: string
453
+ responses:
454
+ "200":
455
+ content:
456
+ application/json:
457
+ schema:
458
+ $ref: "#/components/schemas/LengthAwarePageOperationLogResource"
459
+ description: OK
460
+ default:
461
+ content:
462
+ application/json:
463
+ schema:
464
+ $ref: "#/components/schemas/Error"
465
+ description: Error
466
+ summary: 查看本项目的操作日志
467
+ tags:
468
+ - OperationLog
469
+ /api/v1/plans:
470
+ get:
471
+ description: |-
472
+ 只返回在售的套餐,按 `sort` 升序。已下架的不在其中——但正在用它的隧道仍然正常,下架只是不再接新单。
473
+
474
+ `quota_bytes` 是套餐**标称**的额度,仅供比较;实际额度由上游按线路分组决定,以隧道用量接口返回的 `quota_bytes` 为准。
475
+ operationId: list-tunnel-plans
476
+ responses:
477
+ "200":
478
+ content:
479
+ application/json:
480
+ schema:
481
+ $ref: "#/components/schemas/TunnelPlanListResponseBody"
482
+ description: OK
483
+ default:
484
+ content:
485
+ application/json:
486
+ schema:
487
+ $ref: "#/components/schemas/Error"
488
+ description: Error
489
+ summary: 列出可开通的套餐
490
+ tags:
491
+ - Plan
492
+ /api/v1/tunnel:
493
+ delete:
494
+ description: |-
495
+ **不可逆。** 上游账户会被删除,订阅地址立刻失效,重新开通得到的是一条全新的隧道和一条全新的订阅地址。
496
+
497
+ 删除是异步的:返回时 `status` 可能仍是 `deleting`,表示上游还没删干净(通常是某台服务器暂时连不上)。平台会自动重试,期间这条隧道仍然出现在查询接口里。退订完成前无法重新开通。
498
+
499
+ 只是暂时不用的话请用停用,它保留端口和订阅地址。
500
+ operationId: close-tunnel
501
+ responses:
502
+ "200":
503
+ content:
504
+ application/json:
505
+ schema:
506
+ $ref: "#/components/schemas/TunnelResource"
507
+ description: OK
508
+ default:
509
+ content:
510
+ application/json:
511
+ schema:
512
+ $ref: "#/components/schemas/Error"
513
+ description: Error
514
+ summary: 退订隧道
515
+ tags:
516
+ - Tunnel
517
+ get:
518
+ description: |-
519
+ 每个项目最多一条隧道。尚未开通时返回 404(`TUNNEL_NOT_FOUND`)。
520
+
521
+ 响应里的 `usage` 是**缓存**的用量,`usage.synced_at` 说明它是什么时候采集的;为 null 表示尚未采集过,而不是用量为零。需要当前值请调用量接口。
522
+
523
+ **订阅地址不在这里**,它是一条长期有效的凭据,只由订阅接口单独返回。
524
+ operationId: get-tunnel
525
+ responses:
526
+ "200":
527
+ content:
528
+ application/json:
529
+ schema:
530
+ $ref: "#/components/schemas/TunnelResource"
531
+ description: OK
532
+ default:
533
+ content:
534
+ application/json:
535
+ schema:
536
+ $ref: "#/components/schemas/Error"
537
+ description: Error
538
+ summary: 查看本项目的隧道
539
+ tags:
540
+ - Tunnel
541
+ patch:
542
+ description: |-
543
+ 改显示名和联系邮箱,**不影响订阅、用量或线路**。
544
+
545
+ `email` 不传表示不改动,传空字符串表示清空。它会被转发给上游面板——上游拿它做什么由面板决定,平台不使用它。
546
+ operationId: update-tunnel-profile
547
+ requestBody:
548
+ content:
549
+ application/json:
550
+ schema:
551
+ $ref: "#/components/schemas/UpdateTunnelProfileRequestBody"
552
+ required: true
553
+ responses:
554
+ "200":
555
+ content:
556
+ application/json:
557
+ schema:
558
+ $ref: "#/components/schemas/TunnelResource"
559
+ description: OK
560
+ default:
561
+ content:
562
+ application/json:
563
+ schema:
564
+ $ref: "#/components/schemas/Error"
565
+ description: Error
566
+ summary: 修改隧道的显示信息
567
+ tags:
568
+ - Tunnel
569
+ post:
570
+ description: |-
571
+ 为当前项目开通一条隧道,返回时订阅通常处于 `preparing`——节点仍在下发,但**订阅地址此时已经可用**,内容会在拉取那一刻按当时的状态重新派生。
572
+
573
+ 一个项目只能有一条。已经有了返回 `TUNNEL_ALREADY_OPEN`;上一条还在退订中返回 `TUNNEL_CLOSING`,稍后重试即可。
574
+
575
+ 套餐必须处于在售状态,已下架的返回 `TUNNEL_PLAN_RETIRED`。若返回 `TUNNEL_PLAN_GROUPS_MISSING`,说明该套餐在上游对应的线路分组不存在——这是一个配置问题,请联系运营,换一款套餐或稍后重试都不会有帮助。
576
+ operationId: open-tunnel
577
+ requestBody:
578
+ content:
579
+ application/json:
580
+ schema:
581
+ $ref: "#/components/schemas/OpenTunnelRequestBody"
582
+ required: true
583
+ responses:
584
+ "201":
585
+ content:
586
+ application/json:
587
+ schema:
588
+ $ref: "#/components/schemas/TunnelResource"
589
+ description: Created
590
+ default:
591
+ content:
592
+ application/json:
593
+ schema:
594
+ $ref: "#/components/schemas/Error"
595
+ description: Error
596
+ summary: 开通隧道
597
+ tags:
598
+ - Tunnel
599
+ /api/v1/tunnel/actions:
600
+ post:
601
+ description: |-
602
+ **停用不是退订。** 停用会把这条隧道的实例从上游调度器撤下,但端口保留,重新启用后原样回来,订阅地址也不变。适合「这段时间不用」。
603
+
604
+ 被平台停用的隧道(`suspended` 为 true)无法自行启用,会返回 `TUNNEL_SUSPENDED`——那通常是欠费或违规,需要先处理对应的问题。
605
+ operationId: act-on-tunnel
606
+ requestBody:
607
+ content:
608
+ application/json:
609
+ schema:
610
+ $ref: "#/components/schemas/ActOnTunnelRequestBody"
611
+ required: true
612
+ responses:
613
+ "200":
614
+ content:
615
+ application/json:
616
+ schema:
617
+ $ref: "#/components/schemas/TunnelResource"
618
+ description: OK
619
+ default:
620
+ content:
621
+ application/json:
622
+ schema:
623
+ $ref: "#/components/schemas/Error"
624
+ description: Error
625
+ summary: 启用或停用隧道
626
+ tags:
627
+ - Tunnel
628
+ /api/v1/tunnel/plan:
629
+ put:
630
+ description: |-
631
+ 换套餐会立刻重判线路资格:多出来的线路马上可用,**少掉的那些进入删除队列——宽限期内照常可用,到期才真正释放**。所以换套餐不是一次瞬时切换,订阅内容会在接下来一段时间内变化。
632
+
633
+ 换完之后建议重新拉取一次订阅。
634
+ operationId: change-tunnel-plan
635
+ requestBody:
636
+ content:
637
+ application/json:
638
+ schema:
639
+ $ref: "#/components/schemas/ChangeTunnelPlanRequestBody"
640
+ required: true
641
+ responses:
642
+ "200":
643
+ content:
644
+ application/json:
645
+ schema:
646
+ $ref: "#/components/schemas/TunnelResource"
647
+ description: OK
648
+ default:
649
+ content:
650
+ application/json:
651
+ schema:
652
+ $ref: "#/components/schemas/Error"
653
+ description: Error
654
+ summary: 更换套餐
655
+ tags:
656
+ - Tunnel
657
+ /api/v1/tunnel/subscription:
658
+ get:
659
+ description: |-
660
+ **返回的是一条长期有效的凭据,等同于密码。** 拿到它就能取得本项目全部节点与密码,请勿转发、截图或提交到工单。
661
+
662
+ 它不会出现在隧道详情或任何列表里,只由这个接口返回。
663
+
664
+ `status` 为 `preparing` 时链接**照样可用**,内容会在拉取那一刻按当时的状态重新派生。
665
+
666
+ 怀疑泄露时请调用重置接口。
667
+ operationId: get-tunnel-subscription
668
+ responses:
669
+ "200":
670
+ content:
671
+ application/json:
672
+ schema:
673
+ $ref: "#/components/schemas/SubscriptionResource"
674
+ description: OK
675
+ default:
676
+ content:
677
+ application/json:
678
+ schema:
679
+ $ref: "#/components/schemas/Error"
680
+ description: Error
681
+ summary: 获取订阅地址
682
+ tags:
683
+ - Tunnel
684
+ /api/v1/tunnel/subscription/rotate:
685
+ post:
686
+ description: |-
687
+ **这是凭据泄露时的处置手段,会让已分发出去的每一份订阅立即失效。**
688
+
689
+ 订阅 token 和节点密码同时更换,所有客户端都必须重新拉取一次订阅才能继续使用。调用前请确认这确实是想要的结果。
690
+
691
+ 重置后再调订阅接口取新地址。
692
+ operationId: rotate-tunnel-subscription
693
+ responses:
694
+ "200":
695
+ content:
696
+ application/json:
697
+ schema:
698
+ $ref: "#/components/schemas/TunnelResource"
699
+ description: OK
700
+ default:
701
+ content:
702
+ application/json:
703
+ schema:
704
+ $ref: "#/components/schemas/Error"
705
+ description: Error
706
+ summary: 重置订阅地址与节点密码
707
+ tags:
708
+ - Tunnel
709
+ /api/v1/tunnel/usage:
710
+ get:
711
+ description: |-
712
+ 现场向上游查询,比隧道详情里那份缓存新。
713
+
714
+ **判断是否超额只看 `billed_bytes`**:线路可以设置倍率(如 1.5× 或 0×),`raw_bytes` 是实际传输量,两者不一定相等。`over_quota` 已经算好。
715
+
716
+ 用量由上游定期采集,**最多滞后一个采集周期**,适合用量管控,不适合作为计费结算依据。
717
+ operationId: get-tunnel-usage
718
+ responses:
719
+ "200":
720
+ content:
721
+ application/json:
722
+ schema:
723
+ $ref: "#/components/schemas/UsageResource"
724
+ description: OK
725
+ default:
726
+ content:
727
+ application/json:
728
+ schema:
729
+ $ref: "#/components/schemas/Error"
730
+ description: Error
731
+ summary: 查看本期用量
732
+ tags:
733
+ - Tunnel
734
+ /api/v1/tunnel/usage/series:
735
+ get:
736
+ description: |-
737
+ 按**自然日**切分,用于画趋势图。
738
+
739
+ **没有流量的日子不会出现在结果里**(不补零),画图前需要自行补齐日期轴,否则空档会被连成一条斜线。
740
+
741
+ **把这里的天加起来不等于本期用量**,这是有意的:本期用量按计费周期切,而且「重置本期用量」只作用于本期,日汇总一行都不删。两者回答的是不同的问题。
742
+ operationId: list-tunnel-usage-series
743
+ parameters:
744
+ - description: 取最近多少天,0 表示用上游的默认值(30)。上游只接受 1–365,超出会被它夹住
745
+ explode: false
746
+ in: query
747
+ name: days
748
+ schema:
749
+ default: 30
750
+ description: 取最近多少天,0 表示用上游的默认值(30)。上游只接受 1–365,超出会被它夹住
751
+ format: int64
752
+ maximum: 3650
753
+ minimum: 0
754
+ type: integer
755
+ responses:
756
+ "200":
757
+ content:
758
+ application/json:
759
+ schema:
760
+ $ref: "#/components/schemas/UsageSeriesResource"
761
+ description: OK
762
+ default:
763
+ content:
764
+ application/json:
765
+ schema:
766
+ $ref: "#/components/schemas/Error"
767
+ description: Error
768
+ summary: 查看按天用量
769
+ tags:
770
+ - Tunnel
771
+ security:
772
+ - bearerAuth: []
773
+