api_swagger.yaml 11 KB

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