swagger.json 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. {
  2. "swagger": "2.0",
  3. "info": {
  4. "description": "This is a sample server celler server.",
  5. "title": "Nunu Example API",
  6. "termsOfService": "http://swagger.io/terms/",
  7. "contact": {
  8. "name": "API Support",
  9. "url": "http://www.swagger.io/support",
  10. "email": "support@swagger.io"
  11. },
  12. "license": {
  13. "name": "Apache 2.0",
  14. "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
  15. },
  16. "version": "1.0.0"
  17. },
  18. "host": "localhost:8000",
  19. "paths": {
  20. "/login": {
  21. "post": {
  22. "consumes": [
  23. "application/json"
  24. ],
  25. "produces": [
  26. "application/json"
  27. ],
  28. "tags": [
  29. "用户模块"
  30. ],
  31. "summary": "账号登录",
  32. "parameters": [
  33. {
  34. "description": "params",
  35. "name": "request",
  36. "in": "body",
  37. "required": true,
  38. "schema": {
  39. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.LoginRequest"
  40. }
  41. }
  42. ],
  43. "responses": {
  44. "200": {
  45. "description": "OK",
  46. "schema": {
  47. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.LoginResponse"
  48. }
  49. }
  50. }
  51. }
  52. },
  53. "/register": {
  54. "post": {
  55. "description": "目前只支持邮箱登录",
  56. "consumes": [
  57. "application/json"
  58. ],
  59. "produces": [
  60. "application/json"
  61. ],
  62. "tags": [
  63. "用户模块"
  64. ],
  65. "summary": "用户注册",
  66. "parameters": [
  67. {
  68. "description": "params",
  69. "name": "request",
  70. "in": "body",
  71. "required": true,
  72. "schema": {
  73. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.RegisterRequest"
  74. }
  75. }
  76. ],
  77. "responses": {
  78. "200": {
  79. "description": "OK",
  80. "schema": {
  81. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.Response"
  82. }
  83. }
  84. }
  85. }
  86. },
  87. "/user": {
  88. "get": {
  89. "security": [
  90. {
  91. "Bearer": []
  92. }
  93. ],
  94. "consumes": [
  95. "application/json"
  96. ],
  97. "produces": [
  98. "application/json"
  99. ],
  100. "tags": [
  101. "用户模块"
  102. ],
  103. "summary": "获取用户信息",
  104. "responses": {
  105. "200": {
  106. "description": "OK",
  107. "schema": {
  108. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.GetProfileResponse"
  109. }
  110. }
  111. }
  112. },
  113. "put": {
  114. "security": [
  115. {
  116. "Bearer": []
  117. }
  118. ],
  119. "consumes": [
  120. "application/json"
  121. ],
  122. "produces": [
  123. "application/json"
  124. ],
  125. "tags": [
  126. "用户模块"
  127. ],
  128. "summary": "修改用户信息",
  129. "parameters": [
  130. {
  131. "description": "params",
  132. "name": "request",
  133. "in": "body",
  134. "required": true,
  135. "schema": {
  136. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.UpdateProfileRequest"
  137. }
  138. }
  139. ],
  140. "responses": {
  141. "200": {
  142. "description": "OK",
  143. "schema": {
  144. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.Response"
  145. }
  146. }
  147. }
  148. }
  149. }
  150. },
  151. "definitions": {
  152. "github_com_go-nunu_nunu-layout-advanced_api_v1.GetProfileResponse": {
  153. "type": "object",
  154. "properties": {
  155. "code": {
  156. "type": "integer"
  157. },
  158. "data": {
  159. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.GetProfileResponseData"
  160. },
  161. "message": {
  162. "type": "string"
  163. }
  164. }
  165. },
  166. "github_com_go-nunu_nunu-layout-advanced_api_v1.GetProfileResponseData": {
  167. "type": "object",
  168. "properties": {
  169. "nickname": {
  170. "type": "string",
  171. "example": "alan"
  172. },
  173. "userId": {
  174. "type": "string"
  175. }
  176. }
  177. },
  178. "github_com_go-nunu_nunu-layout-advanced_api_v1.LoginRequest": {
  179. "type": "object",
  180. "required": [
  181. "email",
  182. "password"
  183. ],
  184. "properties": {
  185. "email": {
  186. "type": "string",
  187. "example": "1234@gmail.com"
  188. },
  189. "password": {
  190. "type": "string",
  191. "example": "123456"
  192. }
  193. }
  194. },
  195. "github_com_go-nunu_nunu-layout-advanced_api_v1.LoginResponse": {
  196. "type": "object",
  197. "properties": {
  198. "code": {
  199. "type": "integer"
  200. },
  201. "data": {
  202. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.LoginResponseData"
  203. },
  204. "message": {
  205. "type": "string"
  206. }
  207. }
  208. },
  209. "github_com_go-nunu_nunu-layout-advanced_api_v1.LoginResponseData": {
  210. "type": "object",
  211. "properties": {
  212. "accessToken": {
  213. "type": "string"
  214. }
  215. }
  216. },
  217. "github_com_go-nunu_nunu-layout-advanced_api_v1.RegisterRequest": {
  218. "type": "object",
  219. "required": [
  220. "email",
  221. "password"
  222. ],
  223. "properties": {
  224. "email": {
  225. "type": "string",
  226. "example": "1234@gmail.com"
  227. },
  228. "password": {
  229. "type": "string",
  230. "example": "123456"
  231. }
  232. }
  233. },
  234. "github_com_go-nunu_nunu-layout-advanced_api_v1.Response": {
  235. "type": "object",
  236. "properties": {
  237. "code": {
  238. "type": "integer"
  239. },
  240. "data": {},
  241. "message": {
  242. "type": "string"
  243. }
  244. }
  245. },
  246. "github_com_go-nunu_nunu-layout-advanced_api_v1.UpdateProfileRequest": {
  247. "type": "object",
  248. "required": [
  249. "email"
  250. ],
  251. "properties": {
  252. "email": {
  253. "type": "string",
  254. "example": "1234@gmail.com"
  255. },
  256. "nickname": {
  257. "type": "string",
  258. "example": "alan"
  259. }
  260. }
  261. }
  262. },
  263. "securityDefinitions": {
  264. "Bearer": {
  265. "type": "apiKey",
  266. "name": "Authorization",
  267. "in": "header"
  268. }
  269. }
  270. }