You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

swagger.json 32 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962
  1. {
  2. "swagger": "2.0",
  3. "info": {
  4. "description": "OpenKF Server API Docs.",
  5. "title": "OpenKF Server",
  6. "contact": {},
  7. "version": "v0.2.0"
  8. },
  9. "paths": {
  10. "/api/v1/admin/bot/create": {
  11. "post": {
  12. "security": [
  13. {
  14. "ApiKeyAuth": []
  15. }
  16. ],
  17. "description": "Create a new bot",
  18. "produces": [
  19. "application/json"
  20. ],
  21. "tags": [
  22. "bot"
  23. ],
  24. "summary": "CreateBot",
  25. "parameters": [
  26. {
  27. "description": "CreateBotParams",
  28. "name": "data",
  29. "in": "body",
  30. "required": true,
  31. "schema": {
  32. "$ref": "#/definitions/requestparams.CreateBotParams"
  33. }
  34. }
  35. ],
  36. "responses": {
  37. "200": {
  38. "description": "Success",
  39. "schema": {
  40. "allOf": [
  41. {
  42. "$ref": "#/definitions/response.Response"
  43. },
  44. {
  45. "type": "object",
  46. "properties": {
  47. "msg": {
  48. "type": "string"
  49. }
  50. }
  51. }
  52. ]
  53. }
  54. }
  55. }
  56. }
  57. },
  58. "/api/v1/admin/bot/delete": {
  59. "post": {
  60. "security": [
  61. {
  62. "ApiKeyAuth": []
  63. }
  64. ],
  65. "description": "delete bot",
  66. "tags": [
  67. "bot"
  68. ],
  69. "summary": "DeleteBot",
  70. "responses": {
  71. "200": {
  72. "description": "Success",
  73. "schema": {
  74. "allOf": [
  75. {
  76. "$ref": "#/definitions/response.Response"
  77. },
  78. {
  79. "type": "object",
  80. "properties": {
  81. "msg": {
  82. "type": "string"
  83. }
  84. }
  85. }
  86. ]
  87. }
  88. }
  89. }
  90. }
  91. },
  92. "/api/v1/admin/bot/list": {
  93. "post": {
  94. "security": [
  95. {
  96. "ApiKeyAuth": []
  97. }
  98. ],
  99. "description": "get community bot info",
  100. "tags": [
  101. "bot"
  102. ],
  103. "summary": "ListBot",
  104. "responses": {
  105. "200": {
  106. "description": "Success",
  107. "schema": {
  108. "allOf": [
  109. {
  110. "$ref": "#/definitions/response.Response"
  111. },
  112. {
  113. "type": "object",
  114. "properties": {
  115. "msg": {
  116. "type": "string"
  117. }
  118. }
  119. }
  120. ]
  121. }
  122. }
  123. }
  124. }
  125. },
  126. "/api/v1/admin/bot/update": {
  127. "post": {
  128. "security": [
  129. {
  130. "ApiKeyAuth": []
  131. }
  132. ],
  133. "description": "update bot info",
  134. "tags": [
  135. "bot"
  136. ],
  137. "summary": "UpdateBot",
  138. "responses": {
  139. "200": {
  140. "description": "Success",
  141. "schema": {
  142. "allOf": [
  143. {
  144. "$ref": "#/definitions/response.Response"
  145. },
  146. {
  147. "type": "object",
  148. "properties": {
  149. "msg": {
  150. "type": "string"
  151. }
  152. }
  153. }
  154. ]
  155. }
  156. }
  157. }
  158. }
  159. },
  160. "/api/v1/admin/staff/create": {
  161. "post": {
  162. "security": [
  163. {
  164. "ApiKeyAuth": []
  165. }
  166. ],
  167. "description": "Create a new staff",
  168. "produces": [
  169. "application/json"
  170. ],
  171. "tags": [
  172. "user"
  173. ],
  174. "summary": "CreateStaff",
  175. "parameters": [
  176. {
  177. "description": "RegisterStaffParams",
  178. "name": "data",
  179. "in": "body",
  180. "required": true,
  181. "schema": {
  182. "$ref": "#/definitions/requestparams.RegisterStaffParams"
  183. }
  184. }
  185. ],
  186. "responses": {
  187. "200": {
  188. "description": "Success",
  189. "schema": {
  190. "allOf": [
  191. {
  192. "$ref": "#/definitions/response.Response"
  193. },
  194. {
  195. "type": "object",
  196. "properties": {
  197. "msg": {
  198. "type": "string"
  199. }
  200. }
  201. }
  202. ]
  203. }
  204. }
  205. }
  206. }
  207. },
  208. "/api/v1/admin/staff/delete": {
  209. "post": {
  210. "description": "Delete a new staff",
  211. "produces": [
  212. "application/json"
  213. ],
  214. "tags": [
  215. "user"
  216. ],
  217. "summary": "DeleteStaff",
  218. "parameters": [
  219. {
  220. "description": "DeleteUserParams",
  221. "name": "data",
  222. "in": "body",
  223. "required": true,
  224. "schema": {
  225. "$ref": "#/definitions/requestparams.DeleteUserParams"
  226. }
  227. }
  228. ],
  229. "responses": {
  230. "200": {
  231. "description": "Success",
  232. "schema": {
  233. "allOf": [
  234. {
  235. "$ref": "#/definitions/response.Response"
  236. },
  237. {
  238. "type": "object",
  239. "properties": {
  240. "msg": {
  241. "type": "string"
  242. }
  243. }
  244. }
  245. ]
  246. }
  247. }
  248. }
  249. }
  250. },
  251. "/api/v1/common/file/upload": {
  252. "post": {
  253. "description": "upload a file",
  254. "produces": [
  255. "application/json"
  256. ],
  257. "tags": [
  258. "common"
  259. ],
  260. "summary": "UploadFile",
  261. "parameters": [
  262. {
  263. "type": "file",
  264. "description": "file",
  265. "name": "file",
  266. "in": "formData",
  267. "required": true
  268. }
  269. ],
  270. "responses": {
  271. "200": {
  272. "description": "Success",
  273. "schema": {
  274. "allOf": [
  275. {
  276. "$ref": "#/definitions/response.Response"
  277. },
  278. {
  279. "type": "object",
  280. "properties": {
  281. "msg": {
  282. "type": "string"
  283. }
  284. }
  285. }
  286. ]
  287. }
  288. }
  289. }
  290. }
  291. },
  292. "/api/v1/community/create": {
  293. "post": {
  294. "description": "Create a new community",
  295. "produces": [
  296. "application/json"
  297. ],
  298. "tags": [
  299. "community"
  300. ],
  301. "summary": "CreateCommunity",
  302. "parameters": [
  303. {
  304. "description": "Community",
  305. "name": "data",
  306. "in": "body",
  307. "required": true,
  308. "schema": {
  309. "$ref": "#/definitions/requestparams.CommunityParams"
  310. }
  311. }
  312. ],
  313. "responses": {
  314. "200": {
  315. "description": "Success",
  316. "schema": {
  317. "allOf": [
  318. {
  319. "$ref": "#/definitions/response.Response"
  320. },
  321. {
  322. "type": "object",
  323. "properties": {
  324. "msg": {
  325. "type": "string"
  326. }
  327. }
  328. }
  329. ]
  330. }
  331. }
  332. }
  333. }
  334. },
  335. "/api/v1/community/info": {
  336. "post": {
  337. "description": "get community info",
  338. "produces": [
  339. "application/json"
  340. ],
  341. "tags": [
  342. "community"
  343. ],
  344. "summary": "GetCommunityInfo",
  345. "parameters": [
  346. {
  347. "description": "GetCommunityInfoParams",
  348. "name": "data",
  349. "in": "body",
  350. "required": true,
  351. "schema": {
  352. "$ref": "#/definitions/requestparams.GetCommunityInfoParams"
  353. }
  354. }
  355. ],
  356. "responses": {
  357. "200": {
  358. "description": "Success",
  359. "schema": {
  360. "allOf": [
  361. {
  362. "$ref": "#/definitions/response.Response"
  363. },
  364. {
  365. "type": "object",
  366. "properties": {
  367. "msg": {
  368. "type": "string"
  369. }
  370. }
  371. }
  372. ]
  373. }
  374. }
  375. }
  376. }
  377. },
  378. "/api/v1/community/me": {
  379. "get": {
  380. "security": [
  381. {
  382. "ApiKeyAuth": []
  383. }
  384. ],
  385. "description": "get my community info",
  386. "produces": [
  387. "application/json"
  388. ],
  389. "tags": [
  390. "community"
  391. ],
  392. "summary": "GetMyCommunityInfo",
  393. "responses": {
  394. "200": {
  395. "description": "Success",
  396. "schema": {
  397. "allOf": [
  398. {
  399. "$ref": "#/definitions/response.Response"
  400. },
  401. {
  402. "type": "object",
  403. "properties": {
  404. "msg": {
  405. "type": "string"
  406. }
  407. }
  408. }
  409. ]
  410. }
  411. }
  412. }
  413. }
  414. },
  415. "/api/v1/community/update": {
  416. "post": {
  417. "security": [
  418. {
  419. "ApiKeyAuth": []
  420. }
  421. ],
  422. "description": "get my community info",
  423. "produces": [
  424. "application/json"
  425. ],
  426. "tags": [
  427. "community"
  428. ],
  429. "summary": "GetMyCommunityInfo",
  430. "responses": {
  431. "200": {
  432. "description": "Success",
  433. "schema": {
  434. "allOf": [
  435. {
  436. "$ref": "#/definitions/response.Response"
  437. },
  438. {
  439. "type": "object",
  440. "properties": {
  441. "msg": {
  442. "type": "string"
  443. }
  444. }
  445. }
  446. ]
  447. }
  448. }
  449. }
  450. }
  451. },
  452. "/api/v1/email/code": {
  453. "post": {
  454. "description": "Use email to send verification code",
  455. "produces": [
  456. "application/json"
  457. ],
  458. "tags": [
  459. "mail"
  460. ],
  461. "summary": "SendCode",
  462. "parameters": [
  463. {
  464. "description": "Email address",
  465. "name": "data",
  466. "in": "body",
  467. "required": true,
  468. "schema": {
  469. "$ref": "#/definitions/requestparams.SendToParams"
  470. }
  471. }
  472. ],
  473. "responses": {
  474. "200": {
  475. "description": "Success",
  476. "schema": {
  477. "allOf": [
  478. {
  479. "$ref": "#/definitions/response.Response"
  480. },
  481. {
  482. "type": "object",
  483. "properties": {
  484. "msg": {
  485. "type": "string"
  486. }
  487. }
  488. }
  489. ]
  490. }
  491. }
  492. }
  493. }
  494. },
  495. "/api/v1/login/account": {
  496. "post": {
  497. "description": "login with account",
  498. "produces": [
  499. "application/json"
  500. ],
  501. "tags": [
  502. "user"
  503. ],
  504. "summary": "AccountLogin",
  505. "parameters": [
  506. {
  507. "description": "LoginParamsWithAccount",
  508. "name": "data",
  509. "in": "body",
  510. "required": true,
  511. "schema": {
  512. "$ref": "#/definitions/requestparams.LoginParamsWithAccount"
  513. }
  514. }
  515. ],
  516. "responses": {
  517. "200": {
  518. "description": "Success",
  519. "schema": {
  520. "allOf": [
  521. {
  522. "$ref": "#/definitions/response.Response"
  523. },
  524. {
  525. "type": "object",
  526. "properties": {
  527. "msg": {
  528. "type": "string"
  529. }
  530. }
  531. }
  532. ]
  533. }
  534. }
  535. }
  536. }
  537. },
  538. "/api/v1/openim/callback": {
  539. "post": {
  540. "description": "Support OpenIM callback",
  541. "produces": [
  542. "application/json"
  543. ],
  544. "tags": [
  545. "openim"
  546. ],
  547. "summary": "OpenIMCallback",
  548. "responses": {
  549. "200": {
  550. "description": "Success",
  551. "schema": {
  552. "allOf": [
  553. {
  554. "$ref": "#/definitions/response.Response"
  555. },
  556. {
  557. "type": "object",
  558. "properties": {
  559. "msg": {
  560. "type": "string"
  561. }
  562. }
  563. }
  564. ]
  565. }
  566. }
  567. }
  568. }
  569. },
  570. "/api/v1/register/admin": {
  571. "post": {
  572. "description": "Create a new admin",
  573. "produces": [
  574. "application/json"
  575. ],
  576. "tags": [
  577. "user"
  578. ],
  579. "summary": "AdminRegister",
  580. "parameters": [
  581. {
  582. "description": "RegisterAdminParams",
  583. "name": "data",
  584. "in": "body",
  585. "required": true,
  586. "schema": {
  587. "$ref": "#/definitions/requestparams.RegisterAdminParams"
  588. }
  589. }
  590. ],
  591. "responses": {
  592. "200": {
  593. "description": "Success",
  594. "schema": {
  595. "allOf": [
  596. {
  597. "$ref": "#/definitions/response.Response"
  598. },
  599. {
  600. "type": "object",
  601. "properties": {
  602. "msg": {
  603. "type": "string"
  604. }
  605. }
  606. }
  607. ]
  608. }
  609. }
  610. }
  611. }
  612. },
  613. "/api/v1/user/info": {
  614. "post": {
  615. "security": [
  616. {
  617. "ApiKeyAuth": []
  618. }
  619. ],
  620. "description": "get user info",
  621. "tags": [
  622. "user"
  623. ],
  624. "summary": "GetUserInfo",
  625. "responses": {
  626. "200": {
  627. "description": "Success",
  628. "schema": {
  629. "allOf": [
  630. {
  631. "$ref": "#/definitions/response.Response"
  632. },
  633. {
  634. "type": "object",
  635. "properties": {
  636. "msg": {
  637. "type": "string"
  638. }
  639. }
  640. }
  641. ]
  642. }
  643. }
  644. }
  645. }
  646. },
  647. "/api/v1/user/me": {
  648. "get": {
  649. "security": [
  650. {
  651. "ApiKeyAuth": []
  652. }
  653. ],
  654. "description": "get my user info",
  655. "tags": [
  656. "user"
  657. ],
  658. "summary": "GetMyInfo",
  659. "responses": {
  660. "200": {
  661. "description": "Success",
  662. "schema": {
  663. "allOf": [
  664. {
  665. "$ref": "#/definitions/response.Response"
  666. },
  667. {
  668. "type": "object",
  669. "properties": {
  670. "msg": {
  671. "type": "string"
  672. }
  673. }
  674. }
  675. ]
  676. }
  677. }
  678. }
  679. }
  680. },
  681. "/api/v1/user/update": {
  682. "post": {
  683. "security": [
  684. {
  685. "ApiKeyAuth": []
  686. }
  687. ],
  688. "description": "update user info",
  689. "tags": [
  690. "user"
  691. ],
  692. "summary": "UpdateInfo",
  693. "responses": {
  694. "200": {
  695. "description": "Success",
  696. "schema": {
  697. "allOf": [
  698. {
  699. "$ref": "#/definitions/response.Response"
  700. },
  701. {
  702. "type": "object",
  703. "properties": {
  704. "msg": {
  705. "type": "string"
  706. }
  707. }
  708. }
  709. ]
  710. }
  711. }
  712. }
  713. }
  714. },
  715. "/api/v1/user/update-password": {
  716. "post": {
  717. "security": [
  718. {
  719. "ApiKeyAuth": []
  720. }
  721. ],
  722. "description": "update user password",
  723. "tags": [
  724. "user"
  725. ],
  726. "summary": "UpdatePassword",
  727. "responses": {
  728. "200": {
  729. "description": "Success",
  730. "schema": {
  731. "allOf": [
  732. {
  733. "$ref": "#/definitions/response.Response"
  734. },
  735. {
  736. "type": "object",
  737. "properties": {
  738. "msg": {
  739. "type": "string"
  740. }
  741. }
  742. }
  743. ]
  744. }
  745. }
  746. }
  747. }
  748. },
  749. "/api/v1/user/userlist": {
  750. "post": {
  751. "security": [
  752. {
  753. "ApiKeyAuth": []
  754. }
  755. ],
  756. "description": "get community user info",
  757. "tags": [
  758. "user"
  759. ],
  760. "summary": "GetCommunityUserList",
  761. "responses": {
  762. "200": {
  763. "description": "Success",
  764. "schema": {
  765. "allOf": [
  766. {
  767. "$ref": "#/definitions/response.Response"
  768. },
  769. {
  770. "type": "object",
  771. "properties": {
  772. "msg": {
  773. "type": "string"
  774. }
  775. }
  776. }
  777. ]
  778. }
  779. }
  780. }
  781. }
  782. }
  783. },
  784. "definitions": {
  785. "requestparams.CommunityParams": {
  786. "type": "object",
  787. "required": [
  788. "avatar",
  789. "email",
  790. "name"
  791. ],
  792. "properties": {
  793. "avatar": {
  794. "description": "Avatar is optional.",
  795. "type": "string"
  796. },
  797. "description": {
  798. "description": "Description is optional.",
  799. "type": "string"
  800. },
  801. "email": {
  802. "type": "string"
  803. },
  804. "name": {
  805. "type": "string"
  806. }
  807. }
  808. },
  809. "requestparams.CreateBotParams": {
  810. "type": "object",
  811. "required": [
  812. "avatar",
  813. "bot_addr",
  814. "bot_port",
  815. "bot_token",
  816. "description",
  817. "nickname"
  818. ],
  819. "properties": {
  820. "avatar": {
  821. "type": "string"
  822. },
  823. "bot_addr": {
  824. "type": "string"
  825. },
  826. "bot_port": {
  827. "type": "integer"
  828. },
  829. "bot_token": {
  830. "type": "string"
  831. },
  832. "description": {
  833. "type": "string"
  834. },
  835. "nickname": {
  836. "type": "string"
  837. }
  838. }
  839. },
  840. "requestparams.CreateUserParams": {
  841. "type": "object",
  842. "required": [
  843. "avatar",
  844. "email",
  845. "nickname",
  846. "password"
  847. ],
  848. "properties": {
  849. "avatar": {
  850. "description": "Avatar is optional.",
  851. "type": "string"
  852. },
  853. "email": {
  854. "type": "string"
  855. },
  856. "nickname": {
  857. "type": "string"
  858. },
  859. "password": {
  860. "type": "string"
  861. }
  862. }
  863. },
  864. "requestparams.DeleteUserParams": {
  865. "type": "object",
  866. "required": [
  867. "uuid"
  868. ],
  869. "properties": {
  870. "uuid": {
  871. "type": "string"
  872. }
  873. }
  874. },
  875. "requestparams.GetCommunityInfoParams": {
  876. "type": "object",
  877. "required": [
  878. "uuid"
  879. ],
  880. "properties": {
  881. "uuid": {
  882. "type": "string"
  883. }
  884. }
  885. },
  886. "requestparams.LoginParamsWithAccount": {
  887. "type": "object",
  888. "required": [
  889. "email",
  890. "password"
  891. ],
  892. "properties": {
  893. "email": {
  894. "type": "string"
  895. },
  896. "password": {
  897. "type": "string"
  898. }
  899. }
  900. },
  901. "requestparams.RegisterAdminParams": {
  902. "type": "object",
  903. "required": [
  904. "code",
  905. "community_info",
  906. "user_info"
  907. ],
  908. "properties": {
  909. "code": {
  910. "type": "string"
  911. },
  912. "community_info": {
  913. "$ref": "#/definitions/requestparams.CommunityParams"
  914. },
  915. "user_info": {
  916. "$ref": "#/definitions/requestparams.CreateUserParams"
  917. }
  918. }
  919. },
  920. "requestparams.RegisterStaffParams": {
  921. "type": "object",
  922. "required": [
  923. "user_info"
  924. ],
  925. "properties": {
  926. "user_info": {
  927. "$ref": "#/definitions/requestparams.CreateUserParams"
  928. }
  929. }
  930. },
  931. "requestparams.SendToParams": {
  932. "type": "object",
  933. "required": [
  934. "email"
  935. ],
  936. "properties": {
  937. "email": {
  938. "type": "string"
  939. }
  940. }
  941. },
  942. "response.Response": {
  943. "type": "object",
  944. "properties": {
  945. "code": {
  946. "type": "integer"
  947. },
  948. "data": {},
  949. "msg": {
  950. "type": "string"
  951. }
  952. }
  953. }
  954. },
  955. "securityDefinitions": {
  956. "ApiKeyAuth": {
  957. "type": "apiKey",
  958. "name": "Authorization",
  959. "in": "header"
  960. }
  961. }
  962. }