api_swagger.yaml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836
  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. - 地址[Personal]
  232. /ab/peer/add/{guid}:
  233. delete:
  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. post:
  260. consumes:
  261. - application/json
  262. description: 添加地址
  263. parameters:
  264. - description: id
  265. in: path
  266. name: id
  267. required: true
  268. type: string
  269. produces:
  270. - application/json
  271. responses:
  272. "200":
  273. description: OK
  274. schema:
  275. type: string
  276. "500":
  277. description: Internal Server Error
  278. schema:
  279. $ref: '#/definitions/response.ErrorResponse'
  280. security:
  281. - BearerAuth: []
  282. summary: 添加地址
  283. tags:
  284. - 地址[Personal]
  285. /ab/peer/update/{guid}:
  286. put:
  287. consumes:
  288. - application/json
  289. description: 更新地址
  290. parameters:
  291. - description: id
  292. in: path
  293. name: id
  294. required: true
  295. type: string
  296. produces:
  297. - application/json
  298. responses:
  299. "200":
  300. description: OK
  301. schema:
  302. type: string
  303. "500":
  304. description: Internal Server Error
  305. schema:
  306. $ref: '#/definitions/response.ErrorResponse'
  307. security:
  308. - BearerAuth: []
  309. summary: 更新地址
  310. tags:
  311. - 地址[Personal]
  312. /ab/peers:
  313. post:
  314. consumes:
  315. - application/json
  316. description: 地址
  317. parameters:
  318. - description: string valid
  319. in: body
  320. name: string
  321. schema:
  322. type: string
  323. produces:
  324. - application/json
  325. responses:
  326. "200":
  327. description: OK
  328. schema:
  329. $ref: '#/definitions/response.Response'
  330. "500":
  331. description: Internal Server Error
  332. schema:
  333. $ref: '#/definitions/response.Response'
  334. security:
  335. - BearerAuth: []
  336. summary: 地址列表
  337. tags:
  338. - 地址[Personal]
  339. /ab/personal:
  340. post:
  341. consumes:
  342. - application/json
  343. description: 个人地址
  344. parameters:
  345. - description: string valid
  346. in: body
  347. name: string
  348. schema:
  349. type: string
  350. produces:
  351. - application/json
  352. responses:
  353. "200":
  354. description: OK
  355. schema:
  356. $ref: '#/definitions/response.Response'
  357. "500":
  358. description: Internal Server Error
  359. schema:
  360. $ref: '#/definitions/response.Response'
  361. security:
  362. - BearerAuth: []
  363. summary: 个人地址
  364. tags:
  365. - 地址[Personal]
  366. /ab/settings:
  367. post:
  368. consumes:
  369. - application/json
  370. description: 设置
  371. parameters:
  372. - description: string valid
  373. in: body
  374. name: string
  375. schema:
  376. type: string
  377. produces:
  378. - application/json
  379. responses:
  380. "200":
  381. description: OK
  382. schema:
  383. $ref: '#/definitions/response.Response'
  384. "500":
  385. description: Internal Server Error
  386. schema:
  387. $ref: '#/definitions/response.Response'
  388. security:
  389. - BearerAuth: []
  390. summary: 设置
  391. tags:
  392. - 地址[Personal]
  393. /ab/shared/profiles:
  394. post:
  395. consumes:
  396. - application/json
  397. description: 共享
  398. parameters:
  399. - description: string valid
  400. in: body
  401. name: string
  402. schema:
  403. type: string
  404. produces:
  405. - application/json
  406. responses:
  407. "200":
  408. description: OK
  409. schema:
  410. $ref: '#/definitions/response.Response'
  411. "500":
  412. description: Internal Server Error
  413. schema:
  414. $ref: '#/definitions/response.Response'
  415. security:
  416. - BearerAuth: []
  417. summary: 共享地址簿
  418. tags:
  419. - 地址[Personal]
  420. /ab/tag/{guid}:
  421. delete:
  422. consumes:
  423. - application/json
  424. description: 标签
  425. produces:
  426. - application/json
  427. responses:
  428. "200":
  429. description: OK
  430. schema:
  431. type: string
  432. "500":
  433. description: Internal Server Error
  434. schema:
  435. $ref: '#/definitions/response.ErrorResponse'
  436. security:
  437. - BearerAuth: []
  438. summary: 标签删除
  439. tags:
  440. - 地址[Personal]
  441. /ab/tag/rename/{guid}:
  442. put:
  443. consumes:
  444. - application/json
  445. description: 标签
  446. produces:
  447. - application/json
  448. responses:
  449. "200":
  450. description: OK
  451. schema:
  452. type: string
  453. "500":
  454. description: Internal Server Error
  455. schema:
  456. $ref: '#/definitions/response.ErrorResponse'
  457. security:
  458. - BearerAuth: []
  459. summary: 标签重命名
  460. tags:
  461. - 地址[Personal]
  462. /ab/tag/update/{guid}:
  463. put:
  464. consumes:
  465. - application/json
  466. description: 标签
  467. produces:
  468. - application/json
  469. responses:
  470. "200":
  471. description: OK
  472. schema:
  473. type: string
  474. "500":
  475. description: Internal Server Error
  476. schema:
  477. $ref: '#/definitions/response.ErrorResponse'
  478. security:
  479. - BearerAuth: []
  480. summary: 标签修改颜色
  481. tags:
  482. - 地址[Personal]
  483. /ab/tags/{guid}:
  484. post:
  485. consumes:
  486. - application/json
  487. description: 标签
  488. parameters:
  489. - description: id
  490. in: path
  491. name: id
  492. required: true
  493. type: string
  494. produces:
  495. - application/json
  496. responses:
  497. "200":
  498. description: OK
  499. schema:
  500. $ref: '#/definitions/model.TagList'
  501. "500":
  502. description: Internal Server Error
  503. schema:
  504. $ref: '#/definitions/response.ErrorResponse'
  505. security:
  506. - BearerAuth: []
  507. summary: 标签
  508. tags:
  509. - 地址[Personal]
  510. /api:
  511. get:
  512. consumes:
  513. - application/json
  514. description: 用户信息
  515. produces:
  516. - application/json
  517. responses:
  518. "200":
  519. description: OK
  520. schema:
  521. $ref: '#/definitions/api.UserPayload'
  522. "500":
  523. description: Internal Server Error
  524. schema:
  525. $ref: '#/definitions/response.Response'
  526. security:
  527. - token: []
  528. summary: 用户信息
  529. tags:
  530. - 用户
  531. /heartbeat:
  532. post:
  533. consumes:
  534. - application/json
  535. description: 心跳
  536. produces:
  537. - application/json
  538. responses:
  539. "200":
  540. description: OK
  541. "500":
  542. description: Internal Server Error
  543. schema:
  544. $ref: '#/definitions/response.Response'
  545. summary: 心跳
  546. tags:
  547. - 首页
  548. /login:
  549. post:
  550. consumes:
  551. - application/json
  552. description: 登录
  553. parameters:
  554. - description: 登录表单
  555. in: body
  556. name: body
  557. required: true
  558. schema:
  559. $ref: '#/definitions/api.LoginForm'
  560. produces:
  561. - application/json
  562. responses:
  563. "200":
  564. description: OK
  565. schema:
  566. $ref: '#/definitions/api.LoginRes'
  567. "500":
  568. description: Internal Server Error
  569. schema:
  570. $ref: '#/definitions/response.ErrorResponse'
  571. summary: 登录
  572. tags:
  573. - 登录
  574. /login-options:
  575. post:
  576. consumes:
  577. - application/json
  578. description: 登录选项
  579. produces:
  580. - application/json
  581. responses:
  582. "200":
  583. description: OK
  584. schema:
  585. items:
  586. type: string
  587. type: array
  588. "500":
  589. description: Internal Server Error
  590. schema:
  591. $ref: '#/definitions/response.ErrorResponse'
  592. summary: 登录选项
  593. tags:
  594. - 登录
  595. /logout:
  596. post:
  597. consumes:
  598. - application/json
  599. description: 登出
  600. produces:
  601. - application/json
  602. responses:
  603. "200":
  604. description: OK
  605. schema:
  606. type: string
  607. "500":
  608. description: Internal Server Error
  609. schema:
  610. $ref: '#/definitions/response.ErrorResponse'
  611. summary: 登出
  612. tags:
  613. - 登录
  614. /oauth/callback:
  615. get:
  616. consumes:
  617. - application/json
  618. description: OauthCallback
  619. produces:
  620. - application/json
  621. responses:
  622. "200":
  623. description: OK
  624. schema:
  625. $ref: '#/definitions/api.LoginRes'
  626. "500":
  627. description: Internal Server Error
  628. schema:
  629. $ref: '#/definitions/response.ErrorResponse'
  630. summary: OauthCallback
  631. tags:
  632. - Oauth
  633. /oidc/auth:
  634. post:
  635. consumes:
  636. - application/json
  637. description: OidcAuth
  638. produces:
  639. - application/json
  640. responses:
  641. "200":
  642. description: OK
  643. schema:
  644. $ref: '#/definitions/api.LoginRes'
  645. "500":
  646. description: Internal Server Error
  647. schema:
  648. $ref: '#/definitions/response.ErrorResponse'
  649. summary: OidcAuth
  650. tags:
  651. - Oauth
  652. /oidc/auth-query:
  653. get:
  654. consumes:
  655. - application/json
  656. description: OidcAuthQuery
  657. produces:
  658. - application/json
  659. responses:
  660. "200":
  661. description: OK
  662. schema:
  663. $ref: '#/definitions/api.LoginRes'
  664. "500":
  665. description: Internal Server Error
  666. schema:
  667. $ref: '#/definitions/response.ErrorResponse'
  668. summary: OidcAuthQuery
  669. tags:
  670. - Oauth
  671. /peers:
  672. get:
  673. consumes:
  674. - application/json
  675. description: 机器
  676. parameters:
  677. - description: 页码
  678. in: query
  679. name: page
  680. type: integer
  681. - description: 每页数量
  682. in: query
  683. name: pageSize
  684. type: integer
  685. - description: 状态
  686. in: query
  687. name: status
  688. type: integer
  689. - description: accessible
  690. in: query
  691. name: accessible
  692. type: string
  693. produces:
  694. - application/json
  695. responses:
  696. "200":
  697. description: OK
  698. schema:
  699. $ref: '#/definitions/response.DataResponse'
  700. "500":
  701. description: Internal Server Error
  702. schema:
  703. $ref: '#/definitions/response.Response'
  704. security:
  705. - BearerAuth: []
  706. summary: 机器
  707. tags:
  708. - 群组
  709. /server-config:
  710. get:
  711. consumes:
  712. - application/json
  713. description: 服务配置,给webclient提供api-server
  714. produces:
  715. - application/json
  716. responses:
  717. "200":
  718. description: OK
  719. schema:
  720. $ref: '#/definitions/response.Response'
  721. "500":
  722. description: Internal Server Error
  723. schema:
  724. $ref: '#/definitions/response.Response'
  725. security:
  726. - token: []
  727. summary: 服务配置
  728. tags:
  729. - WEBCLIENT
  730. /sysinfo:
  731. post:
  732. consumes:
  733. - application/json
  734. description: 提交系统信息
  735. parameters:
  736. - description: 系统信息表单
  737. in: body
  738. name: body
  739. required: true
  740. schema:
  741. $ref: '#/definitions/api.PeerForm'
  742. produces:
  743. - application/json
  744. responses:
  745. "200":
  746. description: SYSINFO_UPDATED,ID_NOT_FOUND
  747. schema:
  748. type: string
  749. "500":
  750. description: Internal Server Error
  751. schema:
  752. $ref: '#/definitions/response.ErrorResponse'
  753. security:
  754. - BearerAuth: []
  755. summary: 提交系统信息
  756. tags:
  757. - 地址
  758. /tags:
  759. post:
  760. consumes:
  761. - application/json
  762. description: 标签
  763. produces:
  764. - application/json
  765. responses:
  766. "200":
  767. description: OK
  768. schema:
  769. items:
  770. $ref: '#/definitions/model.Tag'
  771. type: array
  772. "500":
  773. description: Internal Server Error
  774. schema:
  775. $ref: '#/definitions/response.ErrorResponse'
  776. security:
  777. - BearerAuth: []
  778. summary: 标签
  779. tags:
  780. - 地址
  781. /users:
  782. get:
  783. consumes:
  784. - application/json
  785. description: 用户列表
  786. parameters:
  787. - description: 页码
  788. in: query
  789. name: page
  790. type: integer
  791. - description: 每页数量
  792. in: query
  793. name: pageSize
  794. type: integer
  795. - description: 状态
  796. in: query
  797. name: status
  798. type: integer
  799. - description: accessible
  800. in: query
  801. name: accessible
  802. type: string
  803. produces:
  804. - application/json
  805. responses:
  806. "200":
  807. description: OK
  808. schema:
  809. allOf:
  810. - $ref: '#/definitions/response.DataResponse'
  811. - properties:
  812. data:
  813. items:
  814. $ref: '#/definitions/api.UserPayload'
  815. type: array
  816. type: object
  817. "500":
  818. description: Internal Server Error
  819. schema:
  820. $ref: '#/definitions/response.ErrorResponse'
  821. security:
  822. - BearerAuth: []
  823. summary: 用户列表
  824. tags:
  825. - 群组
  826. securityDefinitions:
  827. BearerAuth:
  828. in: header
  829. name: Authorization
  830. type: apiKey
  831. token:
  832. in: header
  833. name: api-token
  834. type: apiKey
  835. swagger: "2.0"