RepositoriesControler.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <?php
  2. namespace OpenApi\LinkExample;
  3. class RepositoriesController
  4. {
  5. /**
  6. * @OA\Get(path="/2.0/repositories/{username}",
  7. * operationId="getRepositoriesByOwner",
  8. * @OA\Parameter(
  9. * name="username",
  10. * in="path",
  11. * required=true,
  12. * @OA\Schema(type="string")
  13. * ),
  14. * @OA\Response(response=200,
  15. * description="repositories owned by the supplied user",
  16. * @OA\JsonContent(type="array",
  17. * @OA\Items(ref="#/components/schemas/repository")
  18. * ),
  19. * @OA\Link(link="userRepository", ref="#/components/links/UserRepository")
  20. * )
  21. * )
  22. * @OA\Link(link="UserRepositories",
  23. * operationId="getRepositoriesByOwner",
  24. * parameters={"username"="$response.body#/username"}
  25. * )
  26. */
  27. public function getRepositoriesByOwner($username)
  28. {
  29. }
  30. /**
  31. ** @OA\Get(path="/2.0/repositories/{username}/{slug}",
  32. * operationId="getRepository",
  33. * @OA\Parameter(name="username",
  34. * in="path",
  35. * required=true,
  36. * @OA\Schema(type="string")
  37. * ),
  38. * @OA\Parameter(name="slug",
  39. * in="path",
  40. * required=true,
  41. * @OA\Schema(type="string")
  42. * ),
  43. * @OA\Response(response=200,
  44. * description="The repository",
  45. * @OA\JsonContent(ref="#/components/schemas/repository"),
  46. * @OA\Link(link="repositoryPullRequests", ref="#/components/links/RepositoryPullRequests")
  47. * )
  48. * )
  49. * )
  50. * @OA\Link(link="UserRepository",
  51. * operationId="getRepository",
  52. * parameters={
  53. * "username"="$response.body#/owner/username",
  54. * "slug"="$response.body#/slug"
  55. * }
  56. * )
  57. */
  58. public function getRepository()
  59. {
  60. }
  61. /**
  62. * @OA\Get(path="/2.0/repositories/{username}/{slug}/pullrequests",
  63. * operationId="getPullRequestsByRepository",
  64. * @OA\Parameter(name="username",
  65. * in="path",
  66. * required=true,
  67. * @OA\Schema(type="string")
  68. * ),
  69. * @OA\Parameter(name="slug",
  70. * in="path",
  71. * required=true,
  72. * @OA\Schema(type="string")
  73. * ),
  74. * @OA\Parameter(name="state",
  75. * in="query",
  76. * @OA\Schema(type="string",
  77. * enum={"open", "merged", "declined"}
  78. * )
  79. * ),
  80. * @OA\Response(response=200,
  81. * description="an array of pull request objects",
  82. * @OA\JsonContent(type="array",
  83. * @OA\Items(ref="#/components/schemas/pullrequest")
  84. * )
  85. * )
  86. * )
  87. * @OA\Link(link="RepositoryPullRequests",
  88. * operationId="getPullRequestsByRepository",
  89. * parameters={
  90. * "username"="$response.body#/owner/username",
  91. * "slug"="$response.body#/slug"
  92. * }
  93. * )
  94. */
  95. public function getPullRequestsByRepository()
  96. {
  97. }
  98. /**
  99. * @OA\Get(path="/2.0/repositories/{username}/{slug}/pullrequests/{pid}",
  100. * operationId="getPullRequestsById",
  101. * @OA\Parameter(name="username",
  102. * in="path",
  103. * required=true,
  104. * @OA\Schema(type="string")
  105. * ),
  106. * @OA\Parameter(name="slug",
  107. * in="path",
  108. * required=true,
  109. * @OA\Schema(type="string")
  110. * ),
  111. * @OA\Parameter(name="pid",
  112. * in="path",
  113. * required=true,
  114. * @OA\Schema(type="string")
  115. * ),
  116. * @OA\Response(response=200,
  117. * description="a pull request object",
  118. * @OA\JsonContent(ref="#/components/schemas/pullrequest"),
  119. * @OA\Link(link="pullRequestMerge", ref="#/components/links/PullRequestMerge")
  120. * )
  121. * )
  122. */
  123. public function getPullRequestsById()
  124. {
  125. }
  126. /**
  127. * @OA\Post(path="/2.0/repositories/{username}/{slug}/pullrequests/{pid}/merge",
  128. * operationId="mergePullRequest",
  129. * @OA\Parameter(name="username",
  130. * in="path",
  131. * required=true,
  132. * @OA\Schema(type="string")
  133. * ),
  134. * @OA\Parameter(name="slug",
  135. * in="path",
  136. * required=true,
  137. * @OA\Schema(type="string")
  138. * ),
  139. * @OA\Parameter(name="pid",
  140. * in="path",
  141. * required=true,
  142. * @OA\Schema(type="string")
  143. * ),
  144. * @OA\Response(response=204,
  145. * description="the PR was successfully merged"
  146. * )
  147. * )
  148. * @OA\Link(link="PullRequestMerge",
  149. * operationId="mergePullRequest",
  150. * parameters={
  151. * "username"="$response.body#/author/username",
  152. * "slug"="$response.body#/repository/slug",
  153. * "pid"="$response.body#/id"
  154. * }
  155. * )
  156. */
  157. public function mergePullRequest()
  158. {
  159. }
  160. }
  161. ?>