swagger.json 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218
  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. }
  114. },
  115. "definitions": {
  116. "github_com_go-nunu_nunu-layout-advanced_api_v1.GetProfileResponse": {
  117. "type": "object",
  118. "properties": {
  119. "code": {
  120. "type": "integer"
  121. },
  122. "data": {
  123. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.GetProfileResponseData"
  124. },
  125. "message": {
  126. "type": "string"
  127. }
  128. }
  129. },
  130. "github_com_go-nunu_nunu-layout-advanced_api_v1.GetProfileResponseData": {
  131. "type": "object",
  132. "properties": {
  133. "nickname": {
  134. "type": "string",
  135. "example": "alan"
  136. },
  137. "userId": {
  138. "type": "string"
  139. }
  140. }
  141. },
  142. "github_com_go-nunu_nunu-layout-advanced_api_v1.LoginRequest": {
  143. "type": "object",
  144. "required": [
  145. "email",
  146. "password"
  147. ],
  148. "properties": {
  149. "email": {
  150. "type": "string",
  151. "example": "1234@gmail.com"
  152. },
  153. "password": {
  154. "type": "string",
  155. "example": "123456"
  156. }
  157. }
  158. },
  159. "github_com_go-nunu_nunu-layout-advanced_api_v1.LoginResponse": {
  160. "type": "object",
  161. "properties": {
  162. "code": {
  163. "type": "integer"
  164. },
  165. "data": {
  166. "$ref": "#/definitions/github_com_go-nunu_nunu-layout-advanced_api_v1.LoginResponseData"
  167. },
  168. "message": {
  169. "type": "string"
  170. }
  171. }
  172. },
  173. "github_com_go-nunu_nunu-layout-advanced_api_v1.LoginResponseData": {
  174. "type": "object",
  175. "properties": {
  176. "accessToken": {
  177. "type": "string"
  178. }
  179. }
  180. },
  181. "github_com_go-nunu_nunu-layout-advanced_api_v1.RegisterRequest": {
  182. "type": "object",
  183. "required": [
  184. "email",
  185. "password"
  186. ],
  187. "properties": {
  188. "email": {
  189. "type": "string",
  190. "example": "1234@gmail.com"
  191. },
  192. "password": {
  193. "type": "string",
  194. "example": "123456"
  195. }
  196. }
  197. },
  198. "github_com_go-nunu_nunu-layout-advanced_api_v1.Response": {
  199. "type": "object",
  200. "properties": {
  201. "code": {
  202. "type": "integer"
  203. },
  204. "data": {},
  205. "message": {
  206. "type": "string"
  207. }
  208. }
  209. }
  210. },
  211. "securityDefinitions": {
  212. "Bearer": {
  213. "type": "apiKey",
  214. "name": "Authorization",
  215. "in": "header"
  216. }
  217. }
  218. }