workout.yaml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. get:
  2. summary: List all workouts for the current user
  3. operationId: listWorkouts
  4. tags:
  5. - Workouts
  6. security:
  7. - cookieAuth: []
  8. responses:
  9. '200':
  10. description: Array of workouts belonging to the authenticated user.
  11. content:
  12. application/json:
  13. schema:
  14. type: array
  15. items:
  16. type: object
  17. required:
  18. - id
  19. - name
  20. properties:
  21. id:
  22. type: string
  23. format: uuid
  24. example: 0191a23b-dead-7000-beef-000000000002
  25. name:
  26. type: string
  27. example: Push Day
  28. example:
  29. - id: 0191a23b-dead-7000-beef-000000000002
  30. name: Push Day
  31. - id: 0191a23b-dead-7000-beef-000000000005
  32. name: Pull Day
  33. '401':
  34. description: Missing or invalid auth token.
  35. content:
  36. application/json:
  37. schema:
  38. $ref: '../components/schemas/ErrorResponse.yaml'
  39. examples:
  40. missing:
  41. summary: No cookie present
  42. value:
  43. error: Missing auth token
  44. invalid:
  45. summary: Token invalid or expired
  46. value:
  47. error: Invalid auth token
  48. '500':
  49. description: Internal server error.
  50. content:
  51. application/json:
  52. schema:
  53. $ref: '../components/schemas/ErrorResponse.yaml'
  54. post:
  55. summary: Create a new workout
  56. operationId: createWorkout
  57. tags:
  58. - Workouts
  59. security:
  60. - cookieAuth: []
  61. requestBody:
  62. required: true
  63. content:
  64. application/json:
  65. schema:
  66. type: object
  67. required:
  68. - name
  69. - exercises
  70. properties:
  71. name:
  72. type: string
  73. example: Push Day
  74. exercises:
  75. type: array
  76. items:
  77. type: object
  78. required:
  79. - name
  80. - exercise_type
  81. - position
  82. properties:
  83. name:
  84. type: string
  85. example: Bench Press
  86. exercise_type:
  87. $ref: '../components/schemas/ExerciseType.yaml'
  88. position:
  89. type: integer
  90. description: 1-based position of the exercise within the workout.
  91. example: 1
  92. example:
  93. name: Push Day
  94. exercises:
  95. - name: Bench Press
  96. exercise_type: WeightedReps
  97. position: 1
  98. - name: Push-ups
  99. exercise_type: BodyweightReps
  100. position: 2
  101. - name: Treadmill
  102. exercise_type: Cardio
  103. position: 3
  104. responses:
  105. '201':
  106. description: Workout created. Returns the generated workout ID.
  107. content:
  108. application/json:
  109. schema:
  110. type: object
  111. required:
  112. - id
  113. properties:
  114. id:
  115. type: string
  116. format: uuid
  117. example: 0191a23b-dead-7000-beef-000000000002
  118. '401':
  119. description: Missing or invalid auth token.
  120. content:
  121. application/json:
  122. schema:
  123. $ref: '../components/schemas/ErrorResponse.yaml'
  124. examples:
  125. missing:
  126. summary: No cookie present
  127. value:
  128. error: Missing auth token
  129. invalid:
  130. summary: Token invalid or expired
  131. value:
  132. error: Invalid auth token
  133. '500':
  134. description: Internal server error.
  135. content:
  136. application/json:
  137. schema:
  138. $ref: '../components/schemas/ErrorResponse.yaml'