api_swagger.yaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. basePath: /api
  2. definitions:
  3. api.AddressBookForm:
  4. properties:
  5. data:
  6. example: '{"tags":["tag1","tag2","tag3"],"peers":[{"id":"abc","username":"abv-l","hostname":"","platform":"Windows","alias":"","tags":["tag1","tag2"],"hash":"hash"}],"tag_colors":"{\"tag1\":4288585374,\"tag2\":4278238420,\"tag3\":4291681337}"}'
  7. type: string
  8. type: object
  9. api.DeviceInfoInLogin:
  10. properties:
  11. name:
  12. type: string
  13. os:
  14. type: string
  15. type:
  16. type: string
  17. type: object
  18. api.LoginForm:
  19. properties:
  20. autoLogin:
  21. type: boolean
  22. deviceInfo:
  23. $ref: '#/definitions/api.DeviceInfoInLogin'
  24. id:
  25. type: string
  26. password:
  27. maxLength: 20
  28. minLength: 4
  29. type: string
  30. type:
  31. type: string
  32. username:
  33. maxLength: 10
  34. minLength: 4
  35. type: string
  36. uuid:
  37. type: string
  38. required:
  39. - username
  40. type: object
  41. api.LoginRes:
  42. properties:
  43. access_token:
  44. type: string
  45. secret:
  46. type: string
  47. tfa_type:
  48. type: string
  49. type:
  50. type: string
  51. user:
  52. $ref: '#/definitions/api.UserPayload'
  53. type: object
  54. api.PeerForm:
  55. properties:
  56. cpu:
  57. type: string
  58. hostname:
  59. type: string
  60. id:
  61. type: string
  62. memory:
  63. type: string
  64. os:
  65. type: string
  66. username:
  67. type: string
  68. uuid:
  69. type: string
  70. version:
  71. type: string
  72. type: object
  73. api.UserPayload:
  74. properties:
  75. email:
  76. type: string
  77. info:
  78. additionalProperties: true
  79. type: object
  80. is_admin:
  81. type: boolean
  82. name:
  83. type: string
  84. note:
  85. type: string
  86. status:
  87. type: integer
  88. type: object
  89. model.Tag:
  90. properties:
  91. color:
  92. description: color 是flutter的颜色值,从0x00000000 到 0xFFFFFFFF; 前两位表示透明度,后面6位表示颜色,
  93. 可以转成rgba
  94. type: integer
  95. created_at:
  96. type: string
  97. id:
  98. type: integer
  99. name:
  100. type: string
  101. updated_at:
  102. type: string
  103. user_id:
  104. type: integer
  105. type: object
  106. response.DataResponse:
  107. properties:
  108. data: {}
  109. total:
  110. type: integer
  111. type: object
  112. response.ErrorResponse:
  113. properties:
  114. error:
  115. type: string
  116. type: object
  117. response.Response:
  118. properties:
  119. code:
  120. type: integer
  121. data: {}
  122. message:
  123. type: string
  124. type: object
  125. info:
  126. contact: {}
  127. description: 接口
  128. title: 管理系统API
  129. version: "1.0"
  130. paths:
  131. /:
  132. get:
  133. consumes:
  134. - application/json
  135. description: 首页
  136. produces:
  137. - application/json
  138. responses:
  139. "200":
  140. description: OK
  141. schema:
  142. $ref: '#/definitions/response.Response'
  143. "500":
  144. description: Internal Server Error
  145. schema:
  146. $ref: '#/definitions/response.Response'
  147. summary: 首页
  148. tags:
  149. - 首页
  150. /ab:
  151. get:
  152. consumes:
  153. - application/json
  154. description: 地址列表
  155. produces:
  156. - application/json
  157. responses:
  158. "200":
  159. description: OK
  160. schema:
  161. $ref: '#/definitions/response.Response'
  162. "500":
  163. description: Internal Server Error
  164. schema:
  165. $ref: '#/definitions/response.ErrorResponse'
  166. security:
  167. - BearerAuth: []
  168. summary: 地址列表
  169. tags:
  170. - 地址
  171. post:
  172. consumes:
  173. - application/json
  174. description: 地址更新
  175. parameters:
  176. - description: 地址表单
  177. in: body
  178. name: body
  179. required: true
  180. schema:
  181. $ref: '#/definitions/api.AddressBookForm'
  182. produces:
  183. - application/json
  184. responses:
  185. "200":
  186. description: "null"
  187. schema:
  188. type: string
  189. "500":
  190. description: Internal Server Error
  191. schema:
  192. $ref: '#/definitions/response.ErrorResponse'
  193. security:
  194. - BearerAuth: []
  195. summary: 地址更新
  196. tags:
  197. - 地址
  198. /ab/add:
  199. post:
  200. consumes:
  201. - application/json
  202. description: 标签
  203. produces:
  204. - application/json
  205. responses:
  206. "200":
  207. description: OK
  208. schema:
  209. type: string
  210. "500":
  211. description: Internal Server Error
  212. schema:
  213. $ref: '#/definitions/response.ErrorResponse'
  214. security:
  215. - BearerAuth: []
  216. summary: 标签添加
  217. tags:
  218. - 地址
  219. /ab/personal:
  220. post:
  221. consumes:
  222. - application/json
  223. description: 个人信息
  224. parameters:
  225. - description: string valid
  226. in: body
  227. name: string
  228. schema:
  229. type: string
  230. produces:
  231. - application/json
  232. responses:
  233. "200":
  234. description: OK
  235. schema:
  236. $ref: '#/definitions/response.Response'
  237. "500":
  238. description: Internal Server Error
  239. schema:
  240. $ref: '#/definitions/response.Response'
  241. security:
  242. - BearerAuth: []
  243. summary: 个人信息
  244. tags:
  245. - 用户
  246. /api:
  247. get:
  248. consumes:
  249. - application/json
  250. description: 用户信息
  251. produces:
  252. - application/json
  253. responses:
  254. "200":
  255. description: OK
  256. schema:
  257. $ref: '#/definitions/api.UserPayload'
  258. "500":
  259. description: Internal Server Error
  260. schema:
  261. $ref: '#/definitions/response.Response'
  262. security:
  263. - token: []
  264. summary: 用户信息
  265. tags:
  266. - 用户
  267. /heartbeat:
  268. post:
  269. consumes:
  270. - application/json
  271. description: 心跳
  272. produces:
  273. - application/json
  274. responses:
  275. "200":
  276. description: OK
  277. "500":
  278. description: Internal Server Error
  279. schema:
  280. $ref: '#/definitions/response.Response'
  281. summary: 心跳
  282. tags:
  283. - 首页
  284. /login:
  285. post:
  286. consumes:
  287. - application/json
  288. description: 登录
  289. parameters:
  290. - description: 登录表单
  291. in: body
  292. name: body
  293. required: true
  294. schema:
  295. $ref: '#/definitions/api.LoginForm'
  296. produces:
  297. - application/json
  298. responses:
  299. "200":
  300. description: OK
  301. schema:
  302. $ref: '#/definitions/api.LoginRes'
  303. "500":
  304. description: Internal Server Error
  305. schema:
  306. $ref: '#/definitions/response.ErrorResponse'
  307. summary: 登录
  308. tags:
  309. - 登录
  310. /login-options:
  311. post:
  312. consumes:
  313. - application/json
  314. description: 登录选项
  315. produces:
  316. - application/json
  317. responses:
  318. "200":
  319. description: OK
  320. schema:
  321. items:
  322. type: string
  323. type: array
  324. "500":
  325. description: Internal Server Error
  326. schema:
  327. $ref: '#/definitions/response.ErrorResponse'
  328. summary: 登录选项
  329. tags:
  330. - 登录
  331. /logout:
  332. post:
  333. consumes:
  334. - application/json
  335. description: 登出
  336. produces:
  337. - application/json
  338. responses:
  339. "200":
  340. description: OK
  341. schema:
  342. type: string
  343. "500":
  344. description: Internal Server Error
  345. schema:
  346. $ref: '#/definitions/response.ErrorResponse'
  347. summary: 登出
  348. tags:
  349. - 登录
  350. /oauth/callback:
  351. get:
  352. consumes:
  353. - application/json
  354. description: OauthCallback
  355. produces:
  356. - application/json
  357. responses:
  358. "200":
  359. description: OK
  360. schema:
  361. $ref: '#/definitions/api.LoginRes'
  362. "500":
  363. description: Internal Server Error
  364. schema:
  365. $ref: '#/definitions/response.ErrorResponse'
  366. summary: OauthCallback
  367. tags:
  368. - Oauth
  369. /oauth/login:
  370. get:
  371. consumes:
  372. - application/json
  373. description: WebOauthLogin
  374. produces:
  375. - application/json
  376. responses:
  377. "200":
  378. description: OK
  379. schema:
  380. type: string
  381. "500":
  382. description: Internal Server Error
  383. schema:
  384. type: string
  385. summary: WebOauthLogin
  386. tags:
  387. - Oauth
  388. /oidc/auth:
  389. post:
  390. consumes:
  391. - application/json
  392. description: OidcAuth
  393. produces:
  394. - application/json
  395. responses:
  396. "200":
  397. description: OK
  398. schema:
  399. $ref: '#/definitions/api.LoginRes'
  400. "500":
  401. description: Internal Server Error
  402. schema:
  403. $ref: '#/definitions/response.ErrorResponse'
  404. summary: OidcAuth
  405. tags:
  406. - Oauth
  407. /oidc/auth-query:
  408. get:
  409. consumes:
  410. - application/json
  411. description: OidcAuthQuery
  412. produces:
  413. - application/json
  414. responses:
  415. "200":
  416. description: OK
  417. schema:
  418. $ref: '#/definitions/api.LoginRes'
  419. "500":
  420. description: Internal Server Error
  421. schema:
  422. $ref: '#/definitions/response.ErrorResponse'
  423. summary: OidcAuthQuery
  424. tags:
  425. - Oauth
  426. /peers:
  427. get:
  428. consumes:
  429. - application/json
  430. description: 机器
  431. parameters:
  432. - description: 页码
  433. in: query
  434. name: page
  435. type: integer
  436. - description: 每页数量
  437. in: query
  438. name: pageSize
  439. type: integer
  440. - description: 状态
  441. in: query
  442. name: status
  443. type: integer
  444. - description: accessible
  445. in: query
  446. name: accessible
  447. type: string
  448. produces:
  449. - application/json
  450. responses:
  451. "200":
  452. description: OK
  453. schema:
  454. $ref: '#/definitions/response.DataResponse'
  455. "500":
  456. description: Internal Server Error
  457. schema:
  458. $ref: '#/definitions/response.Response'
  459. security:
  460. - BearerAuth: []
  461. summary: 机器
  462. tags:
  463. - 群组
  464. /server-config:
  465. get:
  466. consumes:
  467. - application/json
  468. description: 服务配置,给webclient提供api-server
  469. produces:
  470. - application/json
  471. responses:
  472. "200":
  473. description: OK
  474. schema:
  475. $ref: '#/definitions/response.Response'
  476. "500":
  477. description: Internal Server Error
  478. schema:
  479. $ref: '#/definitions/response.Response'
  480. security:
  481. - token: []
  482. summary: 服务配置
  483. tags:
  484. - WEBCLIENT
  485. /sysinfo:
  486. post:
  487. consumes:
  488. - application/json
  489. description: 提交系统信息
  490. parameters:
  491. - description: 系统信息表单
  492. in: body
  493. name: body
  494. required: true
  495. schema:
  496. $ref: '#/definitions/api.PeerForm'
  497. produces:
  498. - application/json
  499. responses:
  500. "200":
  501. description: SYSINFO_UPDATED,ID_NOT_FOUND
  502. schema:
  503. type: string
  504. "500":
  505. description: Internal Server Error
  506. schema:
  507. $ref: '#/definitions/response.ErrorResponse'
  508. security:
  509. - BearerAuth: []
  510. summary: 提交系统信息
  511. tags:
  512. - 地址
  513. /tags:
  514. post:
  515. consumes:
  516. - application/json
  517. description: 标签
  518. produces:
  519. - application/json
  520. responses:
  521. "200":
  522. description: OK
  523. schema:
  524. items:
  525. $ref: '#/definitions/model.Tag'
  526. type: array
  527. "500":
  528. description: Internal Server Error
  529. schema:
  530. $ref: '#/definitions/response.ErrorResponse'
  531. security:
  532. - BearerAuth: []
  533. summary: 标签
  534. tags:
  535. - 地址
  536. /users:
  537. get:
  538. consumes:
  539. - application/json
  540. description: 用户列表
  541. parameters:
  542. - description: 页码
  543. in: query
  544. name: page
  545. type: integer
  546. - description: 每页数量
  547. in: query
  548. name: pageSize
  549. type: integer
  550. - description: 状态
  551. in: query
  552. name: status
  553. type: integer
  554. - description: accessible
  555. in: query
  556. name: accessible
  557. type: string
  558. produces:
  559. - application/json
  560. responses:
  561. "200":
  562. description: OK
  563. schema:
  564. allOf:
  565. - $ref: '#/definitions/response.DataResponse'
  566. - properties:
  567. data:
  568. items:
  569. $ref: '#/definitions/api.UserPayload'
  570. type: array
  571. type: object
  572. "500":
  573. description: Internal Server Error
  574. schema:
  575. $ref: '#/definitions/response.ErrorResponse'
  576. security:
  577. - BearerAuth: []
  578. summary: 用户列表
  579. tags:
  580. - 群组
  581. securityDefinitions:
  582. BearerAuth:
  583. in: header
  584. name: Authorization
  585. type: apiKey
  586. token:
  587. in: header
  588. name: api-token
  589. type: apiKey
  590. swagger: "2.0"