api_swagger.json 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805
  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. "/currentUser": {
  230. "get": {
  231. "security": [
  232. {
  233. "token": []
  234. }
  235. ],
  236. "description": "用户信息",
  237. "consumes": [
  238. "application/json"
  239. ],
  240. "produces": [
  241. "application/json"
  242. ],
  243. "tags": [
  244. "用户"
  245. ],
  246. "summary": "用户信息",
  247. "responses": {
  248. "200": {
  249. "description": "OK",
  250. "schema": {
  251. "$ref": "#/definitions/api.UserPayload"
  252. }
  253. },
  254. "500": {
  255. "description": "Internal Server Error",
  256. "schema": {
  257. "$ref": "#/definitions/response.Response"
  258. }
  259. }
  260. }
  261. }
  262. },
  263. "/heartbeat": {
  264. "post": {
  265. "description": "心跳",
  266. "consumes": [
  267. "application/json"
  268. ],
  269. "produces": [
  270. "application/json"
  271. ],
  272. "tags": [
  273. "首页"
  274. ],
  275. "summary": "心跳",
  276. "responses": {
  277. "200": {
  278. "description": "OK"
  279. },
  280. "500": {
  281. "description": "Internal Server Error",
  282. "schema": {
  283. "$ref": "#/definitions/response.Response"
  284. }
  285. }
  286. }
  287. }
  288. },
  289. "/login": {
  290. "post": {
  291. "description": "登录",
  292. "consumes": [
  293. "application/json"
  294. ],
  295. "produces": [
  296. "application/json"
  297. ],
  298. "tags": [
  299. "登录"
  300. ],
  301. "summary": "登录",
  302. "parameters": [
  303. {
  304. "description": "登录表单",
  305. "name": "body",
  306. "in": "body",
  307. "required": true,
  308. "schema": {
  309. "$ref": "#/definitions/api.LoginForm"
  310. }
  311. }
  312. ],
  313. "responses": {
  314. "200": {
  315. "description": "OK",
  316. "schema": {
  317. "$ref": "#/definitions/api.LoginRes"
  318. }
  319. },
  320. "500": {
  321. "description": "Internal Server Error",
  322. "schema": {
  323. "$ref": "#/definitions/response.ErrorResponse"
  324. }
  325. }
  326. }
  327. }
  328. },
  329. "/login-options": {
  330. "post": {
  331. "description": "登录选项",
  332. "consumes": [
  333. "application/json"
  334. ],
  335. "produces": [
  336. "application/json"
  337. ],
  338. "tags": [
  339. "登录"
  340. ],
  341. "summary": "登录选项",
  342. "responses": {
  343. "200": {
  344. "description": "OK",
  345. "schema": {
  346. "type": "array",
  347. "items": {
  348. "type": "string"
  349. }
  350. }
  351. },
  352. "500": {
  353. "description": "Internal Server Error",
  354. "schema": {
  355. "$ref": "#/definitions/response.ErrorResponse"
  356. }
  357. }
  358. }
  359. }
  360. },
  361. "/logout": {
  362. "post": {
  363. "description": "登出",
  364. "consumes": [
  365. "application/json"
  366. ],
  367. "produces": [
  368. "application/json"
  369. ],
  370. "tags": [
  371. "登录"
  372. ],
  373. "summary": "登出",
  374. "responses": {
  375. "200": {
  376. "description": "OK",
  377. "schema": {
  378. "type": "string"
  379. }
  380. },
  381. "500": {
  382. "description": "Internal Server Error",
  383. "schema": {
  384. "$ref": "#/definitions/response.ErrorResponse"
  385. }
  386. }
  387. }
  388. }
  389. },
  390. "/peers": {
  391. "get": {
  392. "security": [
  393. {
  394. "BearerAuth": []
  395. }
  396. ],
  397. "description": "机器",
  398. "consumes": [
  399. "application/json"
  400. ],
  401. "produces": [
  402. "application/json"
  403. ],
  404. "tags": [
  405. "群组"
  406. ],
  407. "summary": "机器",
  408. "parameters": [
  409. {
  410. "type": "integer",
  411. "description": "页码",
  412. "name": "page",
  413. "in": "query"
  414. },
  415. {
  416. "type": "integer",
  417. "description": "每页数量",
  418. "name": "pageSize",
  419. "in": "query"
  420. },
  421. {
  422. "type": "integer",
  423. "description": "状态",
  424. "name": "status",
  425. "in": "query"
  426. },
  427. {
  428. "type": "string",
  429. "description": "accessible",
  430. "name": "accessible",
  431. "in": "query"
  432. }
  433. ],
  434. "responses": {
  435. "200": {
  436. "description": "OK",
  437. "schema": {
  438. "$ref": "#/definitions/response.DataResponse"
  439. }
  440. },
  441. "500": {
  442. "description": "Internal Server Error",
  443. "schema": {
  444. "$ref": "#/definitions/response.Response"
  445. }
  446. }
  447. }
  448. }
  449. },
  450. "/server-config": {
  451. "get": {
  452. "security": [
  453. {
  454. "token": []
  455. }
  456. ],
  457. "description": "服务配置,给webclient提供api-server",
  458. "consumes": [
  459. "application/json"
  460. ],
  461. "produces": [
  462. "application/json"
  463. ],
  464. "tags": [
  465. "WEBCLIENT"
  466. ],
  467. "summary": "服务配置",
  468. "responses": {
  469. "200": {
  470. "description": "OK",
  471. "schema": {
  472. "$ref": "#/definitions/response.Response"
  473. }
  474. },
  475. "500": {
  476. "description": "Internal Server Error",
  477. "schema": {
  478. "$ref": "#/definitions/response.Response"
  479. }
  480. }
  481. }
  482. }
  483. },
  484. "/sysinfo": {
  485. "post": {
  486. "security": [
  487. {
  488. "BearerAuth": []
  489. }
  490. ],
  491. "description": "提交系统信息",
  492. "consumes": [
  493. "application/json"
  494. ],
  495. "produces": [
  496. "application/json"
  497. ],
  498. "tags": [
  499. "地址"
  500. ],
  501. "summary": "提交系统信息",
  502. "parameters": [
  503. {
  504. "description": "系统信息表单",
  505. "name": "body",
  506. "in": "body",
  507. "required": true,
  508. "schema": {
  509. "$ref": "#/definitions/api.PeerForm"
  510. }
  511. }
  512. ],
  513. "responses": {
  514. "200": {
  515. "description": "SYSINFO_UPDATED,ID_NOT_FOUND",
  516. "schema": {
  517. "type": "string"
  518. }
  519. },
  520. "500": {
  521. "description": "Internal Server Error",
  522. "schema": {
  523. "$ref": "#/definitions/response.ErrorResponse"
  524. }
  525. }
  526. }
  527. }
  528. },
  529. "/tags": {
  530. "post": {
  531. "security": [
  532. {
  533. "BearerAuth": []
  534. }
  535. ],
  536. "description": "标签",
  537. "consumes": [
  538. "application/json"
  539. ],
  540. "produces": [
  541. "application/json"
  542. ],
  543. "tags": [
  544. "地址"
  545. ],
  546. "summary": "标签",
  547. "responses": {
  548. "200": {
  549. "description": "OK",
  550. "schema": {
  551. "type": "array",
  552. "items": {
  553. "$ref": "#/definitions/model.Tag"
  554. }
  555. }
  556. },
  557. "500": {
  558. "description": "Internal Server Error",
  559. "schema": {
  560. "$ref": "#/definitions/response.ErrorResponse"
  561. }
  562. }
  563. }
  564. }
  565. },
  566. "/users": {
  567. "get": {
  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. "type": "integer",
  587. "description": "页码",
  588. "name": "page",
  589. "in": "query"
  590. },
  591. {
  592. "type": "integer",
  593. "description": "每页数量",
  594. "name": "pageSize",
  595. "in": "query"
  596. },
  597. {
  598. "type": "integer",
  599. "description": "状态",
  600. "name": "status",
  601. "in": "query"
  602. },
  603. {
  604. "type": "string",
  605. "description": "accessible",
  606. "name": "accessible",
  607. "in": "query"
  608. }
  609. ],
  610. "responses": {
  611. "200": {
  612. "description": "OK",
  613. "schema": {
  614. "allOf": [
  615. {
  616. "$ref": "#/definitions/response.DataResponse"
  617. },
  618. {
  619. "type": "object",
  620. "properties": {
  621. "data": {
  622. "type": "array",
  623. "items": {
  624. "$ref": "#/definitions/api.UserPayload"
  625. }
  626. }
  627. }
  628. }
  629. ]
  630. }
  631. },
  632. "500": {
  633. "description": "Internal Server Error",
  634. "schema": {
  635. "$ref": "#/definitions/response.ErrorResponse"
  636. }
  637. }
  638. }
  639. }
  640. }
  641. },
  642. "definitions": {
  643. "api.AddressBookForm": {
  644. "type": "object",
  645. "properties": {
  646. "data": {
  647. "type": "string",
  648. "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}\"}"
  649. }
  650. }
  651. },
  652. "api.LoginForm": {
  653. "type": "object",
  654. "required": [
  655. "username"
  656. ],
  657. "properties": {
  658. "password": {
  659. "type": "string",
  660. "maxLength": 20,
  661. "minLength": 4
  662. },
  663. "username": {
  664. "type": "string",
  665. "maxLength": 10,
  666. "minLength": 4
  667. }
  668. }
  669. },
  670. "api.LoginRes": {
  671. "type": "object",
  672. "properties": {
  673. "access_token": {
  674. "type": "string"
  675. },
  676. "secret": {
  677. "type": "string"
  678. },
  679. "tfa_type": {
  680. "type": "string"
  681. },
  682. "type": {
  683. "type": "string"
  684. },
  685. "user": {
  686. "$ref": "#/definitions/api.UserPayload"
  687. }
  688. }
  689. },
  690. "api.PeerForm": {
  691. "type": "object",
  692. "properties": {
  693. "cpu": {
  694. "type": "string"
  695. },
  696. "hostname": {
  697. "type": "string"
  698. },
  699. "id": {
  700. "type": "string"
  701. },
  702. "memory": {
  703. "type": "string"
  704. },
  705. "os": {
  706. "type": "string"
  707. },
  708. "username": {
  709. "type": "string"
  710. },
  711. "uuid": {
  712. "type": "string"
  713. },
  714. "version": {
  715. "type": "string"
  716. }
  717. }
  718. },
  719. "api.UserPayload": {
  720. "type": "object",
  721. "properties": {
  722. "email": {
  723. "type": "string"
  724. },
  725. "is_admin": {
  726. "type": "boolean"
  727. },
  728. "name": {
  729. "type": "string"
  730. },
  731. "note": {
  732. "type": "string"
  733. },
  734. "status": {
  735. "type": "integer"
  736. }
  737. }
  738. },
  739. "model.Tag": {
  740. "type": "object",
  741. "properties": {
  742. "color": {
  743. "description": "color 是flutter的颜色值,从0x00000000 到 0xFFFFFFFF; 前两位表示透明度,后面6位表示颜色, 可以转成rgba",
  744. "type": "integer"
  745. },
  746. "created_at": {
  747. "type": "string"
  748. },
  749. "id": {
  750. "type": "integer"
  751. },
  752. "name": {
  753. "type": "string"
  754. },
  755. "updated_at": {
  756. "type": "string"
  757. },
  758. "user_id": {
  759. "type": "integer"
  760. }
  761. }
  762. },
  763. "response.DataResponse": {
  764. "type": "object",
  765. "properties": {
  766. "data": {},
  767. "total": {
  768. "type": "integer"
  769. }
  770. }
  771. },
  772. "response.ErrorResponse": {
  773. "type": "object",
  774. "properties": {
  775. "error": {
  776. "type": "string"
  777. }
  778. }
  779. },
  780. "response.Response": {
  781. "type": "object",
  782. "properties": {
  783. "code": {
  784. "type": "integer"
  785. },
  786. "data": {},
  787. "message": {
  788. "type": "string"
  789. }
  790. }
  791. }
  792. },
  793. "securityDefinitions": {
  794. "BearerAuth": {
  795. "type": "apiKey",
  796. "name": "Authorization",
  797. "in": "header"
  798. },
  799. "token": {
  800. "type": "apiKey",
  801. "name": "api-token",
  802. "in": "header"
  803. }
  804. }
  805. }