api_docs.go 29 KB

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