Advertisement
Guest User

Untitled

a guest
Oct 25th, 2018
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.66 KB | None | 0 0
  1. swagger: "2.0"
  2. info:
  3. version: 1.0.0
  4. title: "framebyfra.me"
  5.  
  6. host: "localhost:4040"
  7. basePath: "/api/v1"
  8.  
  9. schemes:
  10. - http
  11.  
  12. securityDefinitions:
  13. AuthHeader:
  14. type: "apiKey"
  15. in: "header"
  16. name: "Authorization"
  17.  
  18. paths:
  19. /auth/login:
  20. post:
  21. summary: Authenticates a user through username/password
  22. parameters:
  23. - name: "auth"
  24. in: "body"
  25. description: "User auth details"
  26. schema:
  27. type: "object"
  28. required:
  29. - "email"
  30. - "password"
  31. properties:
  32. email:
  33. type: "string"
  34. example: "email@example.com"
  35. password:
  36. type: "string"
  37. example: "example"
  38.  
  39. consumes:
  40. - "application/json"
  41. produces:
  42. - "application/json"
  43. responses:
  44. 200:
  45. description: "User is logged in"
  46. schema:
  47. type: "object"
  48. properties:
  49. user:
  50. $ref: "#/definitions/User"
  51. token:
  52. type: "string"
  53. 403:
  54. description: "Incorrect email or password"
  55. /anim/{id}:
  56. parameters:
  57. - name: id
  58. in: path
  59. required: true
  60. type: string
  61. format: uuid
  62.  
  63. get:
  64. summary: Gets an animation by ID
  65. responses:
  66. 200:
  67. description: OK
  68. schema:
  69. $ref: '#/definitions/Animation'
  70.  
  71. post:
  72. summary: Modifies an animation by ID
  73. security:
  74. - AuthHeader: []
  75. responses:
  76. 200:
  77. description: OK
  78. schema:
  79. $ref: '#/definitions/Animation'
  80. 403:
  81. description: Forbidden
  82.  
  83. delete:
  84. summary: Deletes an animation by ID
  85. description: >
  86. Deletes an animation by it's **ID**.
  87. Only works if at least one of these conditions are met:
  88. * [user that created it]
  89. * moderator
  90. * administrator
  91. security:
  92. - AuthHeader: []
  93. responses:
  94. 200:
  95. description: Animation was successfully deleted
  96. schema:
  97. $ref: '#/definitions/Animation'
  98. 403:
  99. description: >
  100. The user who called this does not have permission to delete the animation, this happens when all of these conditions are met:
  101.  
  102. * user is not creator of the animation
  103.  
  104. * user is not a moderator
  105.  
  106. * user is not an administrator
  107.  
  108. /user/{id}:
  109. parameters:
  110. - name: id
  111. in: path
  112. required: true
  113. type: string
  114. format: uuid
  115. get:
  116. summary: Gets a user by ID
  117. responses:
  118. 200:
  119. description: OK
  120.  
  121.  
  122.  
  123. definitions:
  124. User:
  125. description: "Only the user it belongs to can see this"
  126. required:
  127. - username
  128. - displayname
  129. - roles
  130. properties:
  131. email:
  132. type: "string"
  133. example: "email@example.com"
  134. format: email
  135. username:
  136. type: "string"
  137. example: "example-username"
  138. displayname:
  139. type: "string"
  140. default: "same as username"
  141. createdAt:
  142. type: "string"
  143. example: "2018-10-25 22:55:32.868"
  144. format: "date-time"
  145. roles:
  146. $ref: '#/definitions/Roles'
  147.  
  148. Animation:
  149. description: "An animation uploaded by a user"
  150. type: object
  151. required:
  152. - id
  153. - creator
  154. - framerate
  155. - start
  156. - end
  157. - keyframes
  158. properties:
  159. id:
  160. type: string
  161. format: uuid
  162. name:
  163. type: string
  164. example: "My Animation"
  165. description:
  166. type: string
  167. example: "Check out my new animation"
  168. creator:
  169. type: string
  170. format: uuid
  171. framerate:
  172. type: number
  173. example: 24
  174. start:
  175. type: integer
  176. example: 0
  177. end:
  178. type: integer
  179. example: 0
  180. keyframes:
  181. minItems: 1
  182. type: array
  183. items:
  184. type: object
  185. properties:
  186. frame:
  187. type: integer
  188. example: 3
  189. media-ref:
  190. type: string
  191. format: uuid
  192. example: f2ac0f4c-d8c9-11e8-9f8b-f2801f1b9fd1
  193. tags:
  194. type: array
  195. items:
  196. type: string
  197.  
  198.  
  199.  
  200. Roles:
  201. type: array
  202. uniqueItems: true
  203. items:
  204. type: string
  205. enum:
  206. - admin
  207. - moderator
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement