api_swagger.yaml 21 KB

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