api_swagger.yaml 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977
  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.AuditConnForm:
  10. properties:
  11. action:
  12. type: string
  13. conn_id:
  14. type: integer
  15. id:
  16. type: string
  17. ip:
  18. type: string
  19. peer:
  20. items:
  21. type: string
  22. type: array
  23. session_id:
  24. type: number
  25. type:
  26. type: integer
  27. uuid:
  28. type: string
  29. type: object
  30. api.AuditFileForm:
  31. properties:
  32. id:
  33. type: string
  34. info:
  35. type: string
  36. is_file:
  37. type: boolean
  38. path:
  39. type: string
  40. peer_id:
  41. type: string
  42. type:
  43. type: integer
  44. uuid:
  45. type: string
  46. type: object
  47. api.DeviceInfoInLogin:
  48. properties:
  49. name:
  50. type: string
  51. os:
  52. type: string
  53. type:
  54. type: string
  55. type: object
  56. api.LoginForm:
  57. properties:
  58. autoLogin:
  59. type: boolean
  60. deviceInfo:
  61. $ref: '#/definitions/api.DeviceInfoInLogin'
  62. id:
  63. type: string
  64. password:
  65. maxLength: 20
  66. minLength: 4
  67. type: string
  68. type:
  69. type: string
  70. username:
  71. maxLength: 10
  72. minLength: 4
  73. type: string
  74. uuid:
  75. type: string
  76. required:
  77. - username
  78. type: object
  79. api.LoginRes:
  80. properties:
  81. access_token:
  82. type: string
  83. secret:
  84. type: string
  85. tfa_type:
  86. type: string
  87. type:
  88. type: string
  89. user:
  90. $ref: '#/definitions/api.UserPayload'
  91. type: object
  92. api.PeerForm:
  93. properties:
  94. cpu:
  95. type: string
  96. hostname:
  97. type: string
  98. id:
  99. type: string
  100. memory:
  101. type: string
  102. os:
  103. type: string
  104. username:
  105. type: string
  106. uuid:
  107. type: string
  108. version:
  109. type: string
  110. type: object
  111. api.UserPayload:
  112. properties:
  113. email:
  114. type: string
  115. info:
  116. additionalProperties: true
  117. type: object
  118. is_admin:
  119. type: boolean
  120. name:
  121. type: string
  122. note:
  123. type: string
  124. status:
  125. type: integer
  126. type: object
  127. model.Tag:
  128. properties:
  129. color:
  130. description: color 是flutter的颜色值,从0x00000000 到 0xFFFFFFFF; 前两位表示透明度,后面6位表示颜色,
  131. 可以转成rgba
  132. type: integer
  133. created_at:
  134. type: string
  135. id:
  136. type: integer
  137. name:
  138. type: string
  139. updated_at:
  140. type: string
  141. user_id:
  142. type: integer
  143. type: object
  144. model.TagList:
  145. properties:
  146. list:
  147. items:
  148. $ref: '#/definitions/model.Tag'
  149. type: array
  150. page:
  151. type: integer
  152. page_size:
  153. type: integer
  154. total:
  155. type: integer
  156. type: object
  157. response.DataResponse:
  158. properties:
  159. data: {}
  160. total:
  161. type: integer
  162. type: object
  163. response.ErrorResponse:
  164. properties:
  165. error:
  166. type: string
  167. type: object
  168. response.Response:
  169. properties:
  170. code:
  171. type: integer
  172. data: {}
  173. message:
  174. type: string
  175. type: object
  176. info:
  177. contact: {}
  178. description: 接口
  179. title: 管理系统API
  180. version: "1.0"
  181. paths:
  182. /:
  183. get:
  184. consumes:
  185. - application/json
  186. description: 首页
  187. produces:
  188. - application/json
  189. responses:
  190. "200":
  191. description: OK
  192. schema:
  193. $ref: '#/definitions/response.Response'
  194. "500":
  195. description: Internal Server Error
  196. schema:
  197. $ref: '#/definitions/response.Response'
  198. summary: 首页
  199. tags:
  200. - 首页
  201. /ab:
  202. get:
  203. consumes:
  204. - application/json
  205. description: 地址列表
  206. produces:
  207. - application/json
  208. responses:
  209. "200":
  210. description: OK
  211. schema:
  212. $ref: '#/definitions/response.Response'
  213. "500":
  214. description: Internal Server Error
  215. schema:
  216. $ref: '#/definitions/response.ErrorResponse'
  217. security:
  218. - BearerAuth: []
  219. summary: 地址列表
  220. tags:
  221. - 地址
  222. post:
  223. consumes:
  224. - application/json
  225. description: 地址更新
  226. parameters:
  227. - description: 地址表单
  228. in: body
  229. name: body
  230. required: true
  231. schema:
  232. $ref: '#/definitions/api.AddressBookForm'
  233. produces:
  234. - application/json
  235. responses:
  236. "200":
  237. description: "null"
  238. schema:
  239. type: string
  240. "500":
  241. description: Internal Server Error
  242. schema:
  243. $ref: '#/definitions/response.ErrorResponse'
  244. security:
  245. - BearerAuth: []
  246. summary: 地址更新
  247. tags:
  248. - 地址
  249. /ab/peer/add/{guid}:
  250. delete:
  251. consumes:
  252. - application/json
  253. description: 删除地址
  254. parameters:
  255. - description: guid
  256. in: path
  257. name: guid
  258. required: true
  259. type: string
  260. produces:
  261. - application/json
  262. responses:
  263. "200":
  264. description: OK
  265. schema:
  266. type: string
  267. "500":
  268. description: Internal Server Error
  269. schema:
  270. $ref: '#/definitions/response.ErrorResponse'
  271. security:
  272. - BearerAuth: []
  273. summary: 删除地址
  274. tags:
  275. - 地址[Personal]
  276. post:
  277. consumes:
  278. - application/json
  279. description: 添加地址
  280. parameters:
  281. - description: guid
  282. in: path
  283. name: guid
  284. required: true
  285. type: string
  286. produces:
  287. - application/json
  288. responses:
  289. "200":
  290. description: OK
  291. schema:
  292. type: string
  293. "500":
  294. description: Internal Server Error
  295. schema:
  296. $ref: '#/definitions/response.ErrorResponse'
  297. security:
  298. - BearerAuth: []
  299. summary: 添加地址
  300. tags:
  301. - 地址[Personal]
  302. /ab/peer/update/{guid}:
  303. put:
  304. consumes:
  305. - application/json
  306. description: 更新地址
  307. parameters:
  308. - description: guid
  309. in: path
  310. name: guid
  311. required: true
  312. type: string
  313. produces:
  314. - application/json
  315. responses:
  316. "200":
  317. description: OK
  318. schema:
  319. type: string
  320. "500":
  321. description: Internal Server Error
  322. schema:
  323. $ref: '#/definitions/response.ErrorResponse'
  324. security:
  325. - BearerAuth: []
  326. summary: 更新地址
  327. tags:
  328. - 地址[Personal]
  329. /ab/peers:
  330. post:
  331. consumes:
  332. - application/json
  333. description: 地址
  334. parameters:
  335. - description: 页码
  336. in: query
  337. name: current
  338. type: integer
  339. - description: 每页数量
  340. in: query
  341. name: pageSize
  342. type: integer
  343. - description: guid
  344. in: query
  345. name: ab
  346. type: string
  347. produces:
  348. - application/json
  349. responses:
  350. "200":
  351. description: OK
  352. schema:
  353. $ref: '#/definitions/response.Response'
  354. "500":
  355. description: Internal Server Error
  356. schema:
  357. $ref: '#/definitions/response.Response'
  358. security:
  359. - BearerAuth: []
  360. summary: 地址列表
  361. tags:
  362. - 地址[Personal]
  363. /ab/personal:
  364. post:
  365. consumes:
  366. - application/json
  367. description: 个人地址
  368. parameters:
  369. - description: string valid
  370. in: body
  371. name: string
  372. schema:
  373. type: string
  374. produces:
  375. - application/json
  376. responses:
  377. "200":
  378. description: OK
  379. schema:
  380. $ref: '#/definitions/response.Response'
  381. "500":
  382. description: Internal Server Error
  383. schema:
  384. $ref: '#/definitions/response.Response'
  385. security:
  386. - BearerAuth: []
  387. summary: 个人地址
  388. tags:
  389. - 地址[Personal]
  390. /ab/settings:
  391. post:
  392. consumes:
  393. - application/json
  394. description: 设置
  395. parameters:
  396. - description: string valid
  397. in: body
  398. name: string
  399. schema:
  400. type: string
  401. produces:
  402. - application/json
  403. responses:
  404. "200":
  405. description: OK
  406. schema:
  407. $ref: '#/definitions/response.Response'
  408. "500":
  409. description: Internal Server Error
  410. schema:
  411. $ref: '#/definitions/response.Response'
  412. security:
  413. - BearerAuth: []
  414. summary: 设置
  415. tags:
  416. - 地址[Personal]
  417. /ab/shared/profiles:
  418. post:
  419. consumes:
  420. - application/json
  421. description: 共享
  422. parameters:
  423. - description: 页码
  424. in: query
  425. name: current
  426. type: integer
  427. - description: 每页数量
  428. in: query
  429. name: pageSize
  430. type: integer
  431. produces:
  432. - application/json
  433. responses:
  434. "200":
  435. description: OK
  436. schema:
  437. $ref: '#/definitions/response.Response'
  438. "500":
  439. description: Internal Server Error
  440. schema:
  441. $ref: '#/definitions/response.Response'
  442. security:
  443. - BearerAuth: []
  444. summary: 共享地址簿
  445. tags:
  446. - 地址[Personal]
  447. /ab/tag/{guid}:
  448. delete:
  449. consumes:
  450. - application/json
  451. description: 标签
  452. parameters:
  453. - description: guid
  454. in: path
  455. name: guid
  456. required: true
  457. type: string
  458. produces:
  459. - application/json
  460. responses:
  461. "200":
  462. description: OK
  463. schema:
  464. type: string
  465. "500":
  466. description: Internal Server Error
  467. schema:
  468. $ref: '#/definitions/response.ErrorResponse'
  469. security:
  470. - BearerAuth: []
  471. summary: 标签删除
  472. tags:
  473. - 地址[Personal]
  474. /ab/tag/add/{guid}:
  475. post:
  476. consumes:
  477. - application/json
  478. description: 标签
  479. parameters:
  480. - description: guid
  481. in: path
  482. name: guid
  483. required: true
  484. type: string
  485. produces:
  486. - application/json
  487. responses:
  488. "200":
  489. description: OK
  490. schema:
  491. type: string
  492. "500":
  493. description: Internal Server Error
  494. schema:
  495. $ref: '#/definitions/response.ErrorResponse'
  496. security:
  497. - BearerAuth: []
  498. summary: 标签添加
  499. tags:
  500. - 地址[Personal]
  501. /ab/tag/rename/{guid}:
  502. put:
  503. consumes:
  504. - application/json
  505. description: 标签
  506. parameters:
  507. - description: guid
  508. in: path
  509. name: guid
  510. required: true
  511. type: string
  512. produces:
  513. - application/json
  514. responses:
  515. "200":
  516. description: OK
  517. schema:
  518. type: string
  519. "500":
  520. description: Internal Server Error
  521. schema:
  522. $ref: '#/definitions/response.ErrorResponse'
  523. security:
  524. - BearerAuth: []
  525. summary: 标签重命名
  526. tags:
  527. - 地址[Personal]
  528. /ab/tag/update/{guid}:
  529. put:
  530. consumes:
  531. - application/json
  532. description: 标签
  533. parameters:
  534. - description: guid
  535. in: path
  536. name: guid
  537. required: true
  538. type: string
  539. produces:
  540. - application/json
  541. responses:
  542. "200":
  543. description: OK
  544. schema:
  545. type: string
  546. "500":
  547. description: Internal Server Error
  548. schema:
  549. $ref: '#/definitions/response.ErrorResponse'
  550. security:
  551. - BearerAuth: []
  552. summary: 标签修改颜色
  553. tags:
  554. - 地址[Personal]
  555. /ab/tags/{guid}:
  556. post:
  557. consumes:
  558. - application/json
  559. description: 标签
  560. parameters:
  561. - description: guid
  562. in: path
  563. name: guid
  564. required: true
  565. type: string
  566. produces:
  567. - application/json
  568. responses:
  569. "200":
  570. description: OK
  571. schema:
  572. $ref: '#/definitions/model.TagList'
  573. "500":
  574. description: Internal Server Error
  575. schema:
  576. $ref: '#/definitions/response.ErrorResponse'
  577. security:
  578. - BearerAuth: []
  579. summary: 标签
  580. tags:
  581. - 地址[Personal]
  582. /api:
  583. get:
  584. consumes:
  585. - application/json
  586. description: 用户信息
  587. produces:
  588. - application/json
  589. responses:
  590. "200":
  591. description: OK
  592. schema:
  593. $ref: '#/definitions/api.UserPayload'
  594. "500":
  595. description: Internal Server Error
  596. schema:
  597. $ref: '#/definitions/response.Response'
  598. security:
  599. - token: []
  600. summary: 用户信息
  601. tags:
  602. - 用户
  603. /audit/conn:
  604. post:
  605. consumes:
  606. - application/json
  607. description: 审计连接
  608. parameters:
  609. - description: 审计连接
  610. in: body
  611. name: body
  612. required: true
  613. schema:
  614. $ref: '#/definitions/api.AuditConnForm'
  615. produces:
  616. - application/json
  617. responses:
  618. "200":
  619. description: OK
  620. schema:
  621. type: string
  622. "500":
  623. description: Internal Server Error
  624. schema:
  625. $ref: '#/definitions/response.Response'
  626. summary: 审计连接
  627. tags:
  628. - 审计
  629. /audit/file:
  630. post:
  631. consumes:
  632. - application/json
  633. description: 审计文件
  634. parameters:
  635. - description: 审计文件
  636. in: body
  637. name: body
  638. required: true
  639. schema:
  640. $ref: '#/definitions/api.AuditFileForm'
  641. produces:
  642. - application/json
  643. responses:
  644. "200":
  645. description: OK
  646. schema:
  647. type: string
  648. "500":
  649. description: Internal Server Error
  650. schema:
  651. $ref: '#/definitions/response.Response'
  652. summary: 审计文件
  653. tags:
  654. - 审计
  655. /heartbeat:
  656. post:
  657. consumes:
  658. - application/json
  659. description: 心跳
  660. produces:
  661. - application/json
  662. responses:
  663. "200":
  664. description: OK
  665. "500":
  666. description: Internal Server Error
  667. schema:
  668. $ref: '#/definitions/response.Response'
  669. summary: 心跳
  670. tags:
  671. - 首页
  672. /login:
  673. post:
  674. consumes:
  675. - application/json
  676. description: 登录
  677. parameters:
  678. - description: 登录表单
  679. in: body
  680. name: body
  681. required: true
  682. schema:
  683. $ref: '#/definitions/api.LoginForm'
  684. produces:
  685. - application/json
  686. responses:
  687. "200":
  688. description: OK
  689. schema:
  690. $ref: '#/definitions/api.LoginRes'
  691. "500":
  692. description: Internal Server Error
  693. schema:
  694. $ref: '#/definitions/response.ErrorResponse'
  695. summary: 登录
  696. tags:
  697. - 登录
  698. /login-options:
  699. post:
  700. consumes:
  701. - application/json
  702. description: 登录选项
  703. produces:
  704. - application/json
  705. responses:
  706. "200":
  707. description: OK
  708. schema:
  709. items:
  710. type: string
  711. type: array
  712. "500":
  713. description: Internal Server Error
  714. schema:
  715. $ref: '#/definitions/response.ErrorResponse'
  716. summary: 登录选项
  717. tags:
  718. - 登录
  719. /logout:
  720. post:
  721. consumes:
  722. - application/json
  723. description: 登出
  724. produces:
  725. - application/json
  726. responses:
  727. "200":
  728. description: OK
  729. schema:
  730. type: string
  731. "500":
  732. description: Internal Server Error
  733. schema:
  734. $ref: '#/definitions/response.ErrorResponse'
  735. summary: 登出
  736. tags:
  737. - 登录
  738. /oauth/callback:
  739. get:
  740. consumes:
  741. - application/json
  742. description: OauthCallback
  743. produces:
  744. - application/json
  745. responses:
  746. "200":
  747. description: OK
  748. schema:
  749. $ref: '#/definitions/api.LoginRes'
  750. "500":
  751. description: Internal Server Error
  752. schema:
  753. $ref: '#/definitions/response.ErrorResponse'
  754. summary: OauthCallback
  755. tags:
  756. - Oauth
  757. /oidc/auth:
  758. post:
  759. consumes:
  760. - application/json
  761. description: OidcAuth
  762. produces:
  763. - application/json
  764. responses:
  765. "200":
  766. description: OK
  767. schema:
  768. $ref: '#/definitions/api.LoginRes'
  769. "500":
  770. description: Internal Server Error
  771. schema:
  772. $ref: '#/definitions/response.ErrorResponse'
  773. summary: OidcAuth
  774. tags:
  775. - Oauth
  776. /oidc/auth-query:
  777. get:
  778. consumes:
  779. - application/json
  780. description: OidcAuthQuery
  781. produces:
  782. - application/json
  783. responses:
  784. "200":
  785. description: OK
  786. schema:
  787. $ref: '#/definitions/api.LoginRes'
  788. "500":
  789. description: Internal Server Error
  790. schema:
  791. $ref: '#/definitions/response.ErrorResponse'
  792. summary: OidcAuthQuery
  793. tags:
  794. - Oauth
  795. /peers:
  796. get:
  797. consumes:
  798. - application/json
  799. description: 机器
  800. parameters:
  801. - description: 页码
  802. in: query
  803. name: page
  804. type: integer
  805. - description: 每页数量
  806. in: query
  807. name: pageSize
  808. type: integer
  809. - description: 状态
  810. in: query
  811. name: status
  812. type: integer
  813. - description: accessible
  814. in: query
  815. name: accessible
  816. type: string
  817. produces:
  818. - application/json
  819. responses:
  820. "200":
  821. description: OK
  822. schema:
  823. $ref: '#/definitions/response.DataResponse'
  824. "500":
  825. description: Internal Server Error
  826. schema:
  827. $ref: '#/definitions/response.Response'
  828. security:
  829. - BearerAuth: []
  830. summary: 机器
  831. tags:
  832. - 群组
  833. /server-config:
  834. get:
  835. consumes:
  836. - application/json
  837. description: 服务配置,给webclient提供api-server
  838. produces:
  839. - application/json
  840. responses:
  841. "200":
  842. description: OK
  843. schema:
  844. $ref: '#/definitions/response.Response'
  845. "500":
  846. description: Internal Server Error
  847. schema:
  848. $ref: '#/definitions/response.Response'
  849. security:
  850. - token: []
  851. summary: 服务配置
  852. tags:
  853. - WEBCLIENT
  854. /shared-peer:
  855. post:
  856. consumes:
  857. - application/json
  858. description: 分享的peer
  859. produces:
  860. - application/json
  861. responses:
  862. "200":
  863. description: OK
  864. schema:
  865. $ref: '#/definitions/response.Response'
  866. "500":
  867. description: Internal Server Error
  868. schema:
  869. $ref: '#/definitions/response.Response'
  870. summary: 分享的peer
  871. tags:
  872. - WEBCLIENT
  873. /sysinfo:
  874. post:
  875. consumes:
  876. - application/json
  877. description: 提交系统信息
  878. parameters:
  879. - description: 系统信息表单
  880. in: body
  881. name: body
  882. required: true
  883. schema:
  884. $ref: '#/definitions/api.PeerForm'
  885. produces:
  886. - application/json
  887. responses:
  888. "200":
  889. description: SYSINFO_UPDATED,ID_NOT_FOUND
  890. schema:
  891. type: string
  892. "500":
  893. description: Internal Server Error
  894. schema:
  895. $ref: '#/definitions/response.ErrorResponse'
  896. summary: 提交系统信息
  897. tags:
  898. - 地址
  899. /tags:
  900. post:
  901. consumes:
  902. - application/json
  903. description: 标签
  904. produces:
  905. - application/json
  906. responses:
  907. "200":
  908. description: OK
  909. schema:
  910. items:
  911. $ref: '#/definitions/model.Tag'
  912. type: array
  913. "500":
  914. description: Internal Server Error
  915. schema:
  916. $ref: '#/definitions/response.ErrorResponse'
  917. security:
  918. - BearerAuth: []
  919. summary: 标签
  920. tags:
  921. - 地址
  922. /users:
  923. get:
  924. consumes:
  925. - application/json
  926. description: 用户列表
  927. parameters:
  928. - description: 页码
  929. in: query
  930. name: page
  931. type: integer
  932. - description: 每页数量
  933. in: query
  934. name: pageSize
  935. type: integer
  936. - description: 状态
  937. in: query
  938. name: status
  939. type: integer
  940. - description: accessible
  941. in: query
  942. name: accessible
  943. type: string
  944. produces:
  945. - application/json
  946. responses:
  947. "200":
  948. description: OK
  949. schema:
  950. allOf:
  951. - $ref: '#/definitions/response.DataResponse'
  952. - properties:
  953. data:
  954. items:
  955. $ref: '#/definitions/api.UserPayload'
  956. type: array
  957. type: object
  958. "500":
  959. description: Internal Server Error
  960. schema:
  961. $ref: '#/definitions/response.ErrorResponse'
  962. security:
  963. - BearerAuth: []
  964. summary: 用户列表
  965. tags:
  966. - 群组
  967. securityDefinitions:
  968. BearerAuth:
  969. in: header
  970. name: Authorization
  971. type: apiKey
  972. token:
  973. in: header
  974. name: api-token
  975. type: apiKey
  976. swagger: "2.0"