api_swagger.yaml 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  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. model.TagList:
  107. properties:
  108. list:
  109. items:
  110. $ref: '#/definitions/model.Tag'
  111. type: array
  112. page:
  113. type: integer
  114. page_size:
  115. type: integer
  116. total:
  117. type: integer
  118. type: object
  119. response.DataResponse:
  120. properties:
  121. data: {}
  122. total:
  123. type: integer
  124. type: object
  125. response.ErrorResponse:
  126. properties:
  127. error:
  128. type: string
  129. type: object
  130. response.Response:
  131. properties:
  132. code:
  133. type: integer
  134. data: {}
  135. message:
  136. type: string
  137. type: object
  138. info:
  139. contact: {}
  140. description: 接口
  141. title: 管理系统API
  142. version: "1.0"
  143. paths:
  144. /:
  145. get:
  146. consumes:
  147. - application/json
  148. description: 首页
  149. produces:
  150. - application/json
  151. responses:
  152. "200":
  153. description: OK
  154. schema:
  155. $ref: '#/definitions/response.Response'
  156. "500":
  157. description: Internal Server Error
  158. schema:
  159. $ref: '#/definitions/response.Response'
  160. summary: 首页
  161. tags:
  162. - 首页
  163. /ab:
  164. get:
  165. consumes:
  166. - application/json
  167. description: 地址列表
  168. produces:
  169. - application/json
  170. responses:
  171. "200":
  172. description: OK
  173. schema:
  174. $ref: '#/definitions/response.Response'
  175. "500":
  176. description: Internal Server Error
  177. schema:
  178. $ref: '#/definitions/response.ErrorResponse'
  179. security:
  180. - BearerAuth: []
  181. summary: 地址列表
  182. tags:
  183. - 地址
  184. post:
  185. consumes:
  186. - application/json
  187. description: 地址更新
  188. parameters:
  189. - description: 地址表单
  190. in: body
  191. name: body
  192. required: true
  193. schema:
  194. $ref: '#/definitions/api.AddressBookForm'
  195. produces:
  196. - application/json
  197. responses:
  198. "200":
  199. description: "null"
  200. schema:
  201. type: string
  202. "500":
  203. description: Internal Server Error
  204. schema:
  205. $ref: '#/definitions/response.ErrorResponse'
  206. security:
  207. - BearerAuth: []
  208. summary: 地址更新
  209. tags:
  210. - 地址
  211. /ab/add:
  212. post:
  213. consumes:
  214. - application/json
  215. description: 标签
  216. produces:
  217. - application/json
  218. responses:
  219. "200":
  220. description: OK
  221. schema:
  222. type: string
  223. "500":
  224. description: Internal Server Error
  225. schema:
  226. $ref: '#/definitions/response.ErrorResponse'
  227. security:
  228. - BearerAuth: []
  229. summary: 标签添加
  230. tags:
  231. - 地址
  232. /ab/peer/add/{id}:
  233. post:
  234. consumes:
  235. - application/json
  236. description: 添加地址
  237. parameters:
  238. - description: id
  239. in: path
  240. name: id
  241. required: true
  242. type: string
  243. produces:
  244. - application/json
  245. responses:
  246. "200":
  247. description: OK
  248. schema:
  249. type: string
  250. "500":
  251. description: Internal Server Error
  252. schema:
  253. $ref: '#/definitions/response.ErrorResponse'
  254. security:
  255. - BearerAuth: []
  256. summary: 添加地址
  257. tags:
  258. - 地址[Personal]
  259. /ab/peers:
  260. post:
  261. consumes:
  262. - application/json
  263. description: 地址
  264. parameters:
  265. - description: string valid
  266. in: body
  267. name: string
  268. schema:
  269. type: string
  270. produces:
  271. - application/json
  272. responses:
  273. "200":
  274. description: OK
  275. schema:
  276. $ref: '#/definitions/response.Response'
  277. "500":
  278. description: Internal Server Error
  279. schema:
  280. $ref: '#/definitions/response.Response'
  281. security:
  282. - BearerAuth: []
  283. summary: 地址列表
  284. tags:
  285. - 地址[Personal]
  286. /ab/personal:
  287. post:
  288. consumes:
  289. - application/json
  290. description: 个人地址
  291. parameters:
  292. - description: string valid
  293. in: body
  294. name: string
  295. schema:
  296. type: string
  297. produces:
  298. - application/json
  299. responses:
  300. "200":
  301. description: OK
  302. schema:
  303. $ref: '#/definitions/response.Response'
  304. "500":
  305. description: Internal Server Error
  306. schema:
  307. $ref: '#/definitions/response.Response'
  308. security:
  309. - BearerAuth: []
  310. summary: 个人地址
  311. tags:
  312. - 地址[Personal]
  313. /ab/settings:
  314. post:
  315. consumes:
  316. - application/json
  317. description: 设置
  318. parameters:
  319. - description: string valid
  320. in: body
  321. name: string
  322. schema:
  323. type: string
  324. produces:
  325. - application/json
  326. responses:
  327. "200":
  328. description: OK
  329. schema:
  330. $ref: '#/definitions/response.Response'
  331. "500":
  332. description: Internal Server Error
  333. schema:
  334. $ref: '#/definitions/response.Response'
  335. security:
  336. - BearerAuth: []
  337. summary: 设置
  338. tags:
  339. - 地址[Personal]
  340. /ab/shared/profiles:
  341. post:
  342. consumes:
  343. - application/json
  344. description: 共享
  345. parameters:
  346. - description: string valid
  347. in: body
  348. name: string
  349. schema:
  350. type: string
  351. produces:
  352. - application/json
  353. responses:
  354. "200":
  355. description: OK
  356. schema:
  357. $ref: '#/definitions/response.Response'
  358. "500":
  359. description: Internal Server Error
  360. schema:
  361. $ref: '#/definitions/response.Response'
  362. security:
  363. - BearerAuth: []
  364. summary: 共享地址簿
  365. tags:
  366. - 地址[Personal]
  367. /ab/tags/{id}:
  368. post:
  369. consumes:
  370. - application/json
  371. description: 标签
  372. parameters:
  373. - description: id
  374. in: path
  375. name: id
  376. required: true
  377. type: string
  378. produces:
  379. - application/json
  380. responses:
  381. "200":
  382. description: OK
  383. schema:
  384. $ref: '#/definitions/model.TagList'
  385. "500":
  386. description: Internal Server Error
  387. schema:
  388. $ref: '#/definitions/response.ErrorResponse'
  389. security:
  390. - BearerAuth: []
  391. summary: 标签
  392. tags:
  393. - 地址[Personal]
  394. /api:
  395. get:
  396. consumes:
  397. - application/json
  398. description: 用户信息
  399. produces:
  400. - application/json
  401. responses:
  402. "200":
  403. description: OK
  404. schema:
  405. $ref: '#/definitions/api.UserPayload'
  406. "500":
  407. description: Internal Server Error
  408. schema:
  409. $ref: '#/definitions/response.Response'
  410. security:
  411. - token: []
  412. summary: 用户信息
  413. tags:
  414. - 用户
  415. /heartbeat:
  416. post:
  417. consumes:
  418. - application/json
  419. description: 心跳
  420. produces:
  421. - application/json
  422. responses:
  423. "200":
  424. description: OK
  425. "500":
  426. description: Internal Server Error
  427. schema:
  428. $ref: '#/definitions/response.Response'
  429. summary: 心跳
  430. tags:
  431. - 首页
  432. /login:
  433. post:
  434. consumes:
  435. - application/json
  436. description: 登录
  437. parameters:
  438. - description: 登录表单
  439. in: body
  440. name: body
  441. required: true
  442. schema:
  443. $ref: '#/definitions/api.LoginForm'
  444. produces:
  445. - application/json
  446. responses:
  447. "200":
  448. description: OK
  449. schema:
  450. $ref: '#/definitions/api.LoginRes'
  451. "500":
  452. description: Internal Server Error
  453. schema:
  454. $ref: '#/definitions/response.ErrorResponse'
  455. summary: 登录
  456. tags:
  457. - 登录
  458. /login-options:
  459. post:
  460. consumes:
  461. - application/json
  462. description: 登录选项
  463. produces:
  464. - application/json
  465. responses:
  466. "200":
  467. description: OK
  468. schema:
  469. items:
  470. type: string
  471. type: array
  472. "500":
  473. description: Internal Server Error
  474. schema:
  475. $ref: '#/definitions/response.ErrorResponse'
  476. summary: 登录选项
  477. tags:
  478. - 登录
  479. /logout:
  480. post:
  481. consumes:
  482. - application/json
  483. description: 登出
  484. produces:
  485. - application/json
  486. responses:
  487. "200":
  488. description: OK
  489. schema:
  490. type: string
  491. "500":
  492. description: Internal Server Error
  493. schema:
  494. $ref: '#/definitions/response.ErrorResponse'
  495. summary: 登出
  496. tags:
  497. - 登录
  498. /oauth/callback:
  499. get:
  500. consumes:
  501. - application/json
  502. description: OauthCallback
  503. produces:
  504. - application/json
  505. responses:
  506. "200":
  507. description: OK
  508. schema:
  509. $ref: '#/definitions/api.LoginRes'
  510. "500":
  511. description: Internal Server Error
  512. schema:
  513. $ref: '#/definitions/response.ErrorResponse'
  514. summary: OauthCallback
  515. tags:
  516. - Oauth
  517. /oidc/auth:
  518. post:
  519. consumes:
  520. - application/json
  521. description: OidcAuth
  522. produces:
  523. - application/json
  524. responses:
  525. "200":
  526. description: OK
  527. schema:
  528. $ref: '#/definitions/api.LoginRes'
  529. "500":
  530. description: Internal Server Error
  531. schema:
  532. $ref: '#/definitions/response.ErrorResponse'
  533. summary: OidcAuth
  534. tags:
  535. - Oauth
  536. /oidc/auth-query:
  537. get:
  538. consumes:
  539. - application/json
  540. description: OidcAuthQuery
  541. produces:
  542. - application/json
  543. responses:
  544. "200":
  545. description: OK
  546. schema:
  547. $ref: '#/definitions/api.LoginRes'
  548. "500":
  549. description: Internal Server Error
  550. schema:
  551. $ref: '#/definitions/response.ErrorResponse'
  552. summary: OidcAuthQuery
  553. tags:
  554. - Oauth
  555. /peers:
  556. get:
  557. consumes:
  558. - application/json
  559. description: 机器
  560. parameters:
  561. - description: 页码
  562. in: query
  563. name: page
  564. type: integer
  565. - description: 每页数量
  566. in: query
  567. name: pageSize
  568. type: integer
  569. - description: 状态
  570. in: query
  571. name: status
  572. type: integer
  573. - description: accessible
  574. in: query
  575. name: accessible
  576. type: string
  577. produces:
  578. - application/json
  579. responses:
  580. "200":
  581. description: OK
  582. schema:
  583. $ref: '#/definitions/response.DataResponse'
  584. "500":
  585. description: Internal Server Error
  586. schema:
  587. $ref: '#/definitions/response.Response'
  588. security:
  589. - BearerAuth: []
  590. summary: 机器
  591. tags:
  592. - 群组
  593. /server-config:
  594. get:
  595. consumes:
  596. - application/json
  597. description: 服务配置,给webclient提供api-server
  598. produces:
  599. - application/json
  600. responses:
  601. "200":
  602. description: OK
  603. schema:
  604. $ref: '#/definitions/response.Response'
  605. "500":
  606. description: Internal Server Error
  607. schema:
  608. $ref: '#/definitions/response.Response'
  609. security:
  610. - token: []
  611. summary: 服务配置
  612. tags:
  613. - WEBCLIENT
  614. /sysinfo:
  615. post:
  616. consumes:
  617. - application/json
  618. description: 提交系统信息
  619. parameters:
  620. - description: 系统信息表单
  621. in: body
  622. name: body
  623. required: true
  624. schema:
  625. $ref: '#/definitions/api.PeerForm'
  626. produces:
  627. - application/json
  628. responses:
  629. "200":
  630. description: SYSINFO_UPDATED,ID_NOT_FOUND
  631. schema:
  632. type: string
  633. "500":
  634. description: Internal Server Error
  635. schema:
  636. $ref: '#/definitions/response.ErrorResponse'
  637. security:
  638. - BearerAuth: []
  639. summary: 提交系统信息
  640. tags:
  641. - 地址
  642. /tags:
  643. post:
  644. consumes:
  645. - application/json
  646. description: 标签
  647. produces:
  648. - application/json
  649. responses:
  650. "200":
  651. description: OK
  652. schema:
  653. items:
  654. $ref: '#/definitions/model.Tag'
  655. type: array
  656. "500":
  657. description: Internal Server Error
  658. schema:
  659. $ref: '#/definitions/response.ErrorResponse'
  660. security:
  661. - BearerAuth: []
  662. summary: 标签
  663. tags:
  664. - 地址
  665. /users:
  666. get:
  667. consumes:
  668. - application/json
  669. description: 用户列表
  670. parameters:
  671. - description: 页码
  672. in: query
  673. name: page
  674. type: integer
  675. - description: 每页数量
  676. in: query
  677. name: pageSize
  678. type: integer
  679. - description: 状态
  680. in: query
  681. name: status
  682. type: integer
  683. - description: accessible
  684. in: query
  685. name: accessible
  686. type: string
  687. produces:
  688. - application/json
  689. responses:
  690. "200":
  691. description: OK
  692. schema:
  693. allOf:
  694. - $ref: '#/definitions/response.DataResponse'
  695. - properties:
  696. data:
  697. items:
  698. $ref: '#/definitions/api.UserPayload'
  699. type: array
  700. type: object
  701. "500":
  702. description: Internal Server Error
  703. schema:
  704. $ref: '#/definitions/response.ErrorResponse'
  705. security:
  706. - BearerAuth: []
  707. summary: 用户列表
  708. tags:
  709. - 群组
  710. securityDefinitions:
  711. BearerAuth:
  712. in: header
  713. name: Authorization
  714. type: apiKey
  715. token:
  716. in: header
  717. name: api-token
  718. type: apiKey
  719. swagger: "2.0"