Advertisement
Guest User

Untitled

a guest
Jul 5th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. swagger: "2.0"
  2. info:
  3. version: "0.0.1"
  4. title: Demo app
  5. # during dev, should point to your local machine
  6. host: localhost:3000
  7. # basePath prefixes all resource paths
  8. basePath: /
  9. #
  10. schemes:
  11. # tip: remove http to make production-grade
  12. - http
  13. # format of bodies a client can send (Content-Type)
  14. consumes:
  15. - application/json
  16. # format of the responses to the client (Accepts)
  17. produces:
  18. - application/json
  19. securityDefinitions:
  20. api_key:
  21. type: apiKey
  22. in: query
  23. name: api_key
  24. paths:
  25. /users/register:
  26. # binds a127 app logic to a route
  27. x-swagger-router-controller: users
  28. post:
  29. description: Register a new user
  30. # used as the method name of the controller
  31. operationId: register
  32. parameters:
  33. - in: body
  34. name: body
  35. description: The user data to register
  36. required: true
  37. schema:
  38. $ref: '#/definitions/RegisterUser'
  39. responses:
  40. "200":
  41. description: Success
  42. schema:
  43. # a pointer to a definition
  44. $ref: "#/definitions/BasicResponse"
  45. # responses may fall through to errors
  46. default:
  47. description: Error
  48. schema:
  49. $ref: "#/definitions/BasicResponse"
  50. /users/authenticate:
  51. # binds a127 app logic to a route
  52. x-swagger-router-controller: users
  53. post:
  54. description: Retrieve JWT token for user
  55. # used as the method name of the controller
  56. operationId: authenticate
  57. parameters:
  58. - in: body
  59. name: body
  60. description: The user data to authenticate with
  61. required: true
  62. schema:
  63. $ref: '#/definitions/AuthenticateUser'
  64. responses:
  65. "200":
  66. description: Success
  67. schema:
  68. # a pointer to a definition
  69. $ref: "#/definitions/AuthenticateResponse"
  70. # responses may fall through to errors
  71. default:
  72. description: Error
  73. schema:
  74. $ref: "#/definitions/BasicResponse"
  75. /users/heartbeat:
  76. # binds a127 app logic to a route
  77. x-swagger-router-controller: users
  78. post:
  79. security:
  80. - api_key: [ ]
  81. description: Update the users checkin time
  82. # used as the method name of the controller
  83. operationId: heartbeat
  84. parameters:
  85. - in: body
  86. name: body
  87. description: The user data to update
  88. required: true
  89. schema:
  90. $ref: '#/definitions/User'
  91. responses:
  92. "200":
  93. description: Success
  94. schema:
  95. $ref: "#/definitions/BasicResponse"
  96. # responses may fall through to errors
  97. default:
  98. description: Error
  99. schema:
  100. $ref: "#/definitions/BasicResponse"
  101. /logs/addLog:
  102. # binds a127 app logic to a route
  103. x-swagger-router-controller: logs
  104. post:
  105. security:
  106. - api_key: [ ]
  107. description: Log an action
  108. # used as the method name of the controller
  109. operationId: addLog
  110. parameters:
  111. - in: body
  112. name: body
  113. description: The action data to log
  114. required: true
  115. schema:
  116. $ref: '#/definitions/ActionLog'
  117. responses:
  118. "200":
  119. description: Success
  120. schema:
  121. $ref: "#/definitions/BasicResponse"
  122. # responses may fall through to errors
  123. default:
  124. description: Error
  125. schema:
  126. $ref: "#/definitions/BasicResponse"
  127. /ping:
  128. x-swagger-router-controller: ping
  129. post:
  130. security:
  131. - api_key: [ ]
  132. description: Returns 'Pong' to the authenticated caller
  133. # used as the method name of the controller
  134. operationId: ping
  135. parameters:
  136. - in: body
  137. name: body
  138. description: The user
  139. required: true
  140. schema:
  141. $ref: '#/definitions/User'
  142. responses:
  143. "200":
  144. description: Success
  145. schema:
  146. # a pointer to a definition
  147. $ref: "#/definitions/BasicResponse"
  148. # responses may fall through to errors
  149. default:
  150. description: Error
  151. schema:
  152. $ref: "#/definitions/BasicResponse"
  153.  
  154. /swagger:
  155. x-swagger-pipe: swagger_raw
  156. # complex objects have schema definitions
  157. definitions:
  158. User:
  159. required:
  160. - email
  161. properties:
  162. email:
  163. type: string
  164. ActionLog:
  165. required:
  166. - action
  167. - email
  168. properties:
  169. email:
  170. type: string
  171. action:
  172. type: string
  173. time:
  174. type: string
  175. trigger:
  176. type: string
  177. AuthenticateUser:
  178. required:
  179. - email
  180. - password
  181. properties:
  182. email:
  183. type: string
  184. password:
  185. type: string
  186. RegisterUser:
  187. required:
  188. - email
  189. - phone
  190. - password
  191. properties:
  192. email:
  193. type: string
  194. password:
  195. type: string
  196. phone:
  197. type: string
  198. BasicResponse:
  199. required:
  200. - message
  201. properties:
  202. message:
  203. type: string
  204. AuthenticateResponse:
  205. required:
  206. - token
  207. properties:
  208. token:
  209. type: string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement