api_swagger.json 28 KB

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