You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

262 lines
5.0 KiB

Add Attachment API (#3478) * Add Attachment API * repos/:owner/:repo/releases (add attachments) * repos/:owner/:repo/releases/:id (add attachments) * repos/:owner/:repo/releases/:id/attachments * repos/:owner/:repo/releases/:id/attachments/:attachment_id Signed-off-by: Jonas Franz <info@jonasfranz.de> * Add unit tests for new attachment functions Fix comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * fix lint * Update vendor.json Signed-off-by: Jonas Franz <info@jonasfranz.software> * remove version of sdk Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit tests Add missing license header Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add CreateReleaseAttachment Add EditReleaseAttachment Add DeleteReleaseAttachment Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add filename query parameter for choosing another name for an attachment Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix order of imports Signed-off-by: Jonas Franz <info@jonasfranz.software> * Restricting updatable attachment columns Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update go-sdk Replace Attachments with Assets Signed-off-by: Jonas Franz <info@jonasfranz.de> * Update go-sdk Signed-off-by: Jonas Franz <info@jonasfranz.de> * Updating go-sdk and regenerating swagger Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add missing file of go-sdk Signed-off-by: Jonas Franz <info@jonasfranz.software> * Change origin of code.gitea.io/sdk to code.gitea.io/sdk Update code.gitea.io/sdk Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update swagger Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update updateAttachment
6 years ago
Add Attachment API (#3478) * Add Attachment API * repos/:owner/:repo/releases (add attachments) * repos/:owner/:repo/releases/:id (add attachments) * repos/:owner/:repo/releases/:id/attachments * repos/:owner/:repo/releases/:id/attachments/:attachment_id Signed-off-by: Jonas Franz <info@jonasfranz.de> * Add unit tests for new attachment functions Fix comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * fix lint * Update vendor.json Signed-off-by: Jonas Franz <info@jonasfranz.software> * remove version of sdk Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit tests Add missing license header Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add CreateReleaseAttachment Add EditReleaseAttachment Add DeleteReleaseAttachment Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add filename query parameter for choosing another name for an attachment Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix order of imports Signed-off-by: Jonas Franz <info@jonasfranz.software> * Restricting updatable attachment columns Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update go-sdk Replace Attachments with Assets Signed-off-by: Jonas Franz <info@jonasfranz.de> * Update go-sdk Signed-off-by: Jonas Franz <info@jonasfranz.de> * Updating go-sdk and regenerating swagger Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add missing file of go-sdk Signed-off-by: Jonas Franz <info@jonasfranz.software> * Change origin of code.gitea.io/sdk to code.gitea.io/sdk Update code.gitea.io/sdk Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update swagger Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update updateAttachment
6 years ago
Add Attachment API (#3478) * Add Attachment API * repos/:owner/:repo/releases (add attachments) * repos/:owner/:repo/releases/:id (add attachments) * repos/:owner/:repo/releases/:id/attachments * repos/:owner/:repo/releases/:id/attachments/:attachment_id Signed-off-by: Jonas Franz <info@jonasfranz.de> * Add unit tests for new attachment functions Fix comments Signed-off-by: Jonas Franz <info@jonasfranz.software> * fix lint * Update vendor.json Signed-off-by: Jonas Franz <info@jonasfranz.software> * remove version of sdk Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix unit tests Add missing license header Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add CreateReleaseAttachment Add EditReleaseAttachment Add DeleteReleaseAttachment Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add filename query parameter for choosing another name for an attachment Signed-off-by: Jonas Franz <info@jonasfranz.software> * Fix order of imports Signed-off-by: Jonas Franz <info@jonasfranz.software> * Restricting updatable attachment columns Signed-off-by: Jonas Franz <info@jonasfranz.software> * gofmt Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update go-sdk Replace Attachments with Assets Signed-off-by: Jonas Franz <info@jonasfranz.de> * Update go-sdk Signed-off-by: Jonas Franz <info@jonasfranz.de> * Updating go-sdk and regenerating swagger Signed-off-by: Jonas Franz <info@jonasfranz.software> * Add missing file of go-sdk Signed-off-by: Jonas Franz <info@jonasfranz.software> * Change origin of code.gitea.io/sdk to code.gitea.io/sdk Update code.gitea.io/sdk Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update swagger Signed-off-by: Jonas Franz <info@jonasfranz.software> * Update updateAttachment
6 years ago
Add API endpoint for accessing repo topics (#7963) * Create API endpoints for repo topics. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Generate swagger Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add documentation to functions Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Grammar fix Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix function comment Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Can't use FindTopics when looking for a single repo topic, as it doesnt use exact match Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add PUT ​/repos​/{owner}​/{repo}​/topics and remove GET ​/repos​/{owner}​/{repo}​/topics * Ignore if topic is sent twice in same request, refactoring. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix topic dropdown with api changes. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Style fix Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Update API documentation Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Better way to handle duplicate topics in slice Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Make response element TopicName an array of strings, instead of using an array of TopicName Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add test cases for API Repo Topics. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix format of tests Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix comments Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix unit tests after adding some more topics to the test fixture. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Update models/topic.go Limit multiple if else if ... Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com> * Engine as first parameter in function Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com> * Replace magic numbers with http status code constants. Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix variable scope Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Test one read with login and one with token Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Add some more tests Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Apply suggestions from code review Use empty struct for efficiency Co-Authored-By: Lauris BH <lauris@nix.lv> * Add test case to check access for user with write access Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Fix access, repo admin required to change topics Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Correct first test to be without token Signed-off-by: David Svantesson <davidsvantesson@gmail.com> * Any repo reader should be able to access topics. * No need for string pointer Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
5 years ago
  1. // Copyright 2017 The Gitea Authors. All rights reserved.
  2. // Use of this source code is governed by a MIT-style
  3. // license that can be found in the LICENSE file.
  4. package swagger
  5. import (
  6. api "code.gitea.io/gitea/modules/structs"
  7. )
  8. // Repository
  9. // swagger:response Repository
  10. type swaggerResponseRepository struct {
  11. // in:body
  12. Body api.Repository `json:"body"`
  13. }
  14. // RepositoryList
  15. // swagger:response RepositoryList
  16. type swaggerResponseRepositoryList struct {
  17. // in:body
  18. Body []api.Repository `json:"body"`
  19. }
  20. // Branch
  21. // swagger:response Branch
  22. type swaggerResponseBranch struct {
  23. // in:body
  24. Body api.Branch `json:"body"`
  25. }
  26. // BranchList
  27. // swagger:response BranchList
  28. type swaggerResponseBranchList struct {
  29. // in:body
  30. Body []api.Branch `json:"body"`
  31. }
  32. // TagList
  33. // swagger:response TagList
  34. type swaggerResponseTagList struct {
  35. // in:body
  36. Body []api.Tag `json:"body"`
  37. }
  38. // Tag
  39. // swagger:response Tag
  40. type swaggerResponseTag struct {
  41. // in:body
  42. Body api.Tag `json:"body"`
  43. }
  44. // AnnotatedTag
  45. // swagger:response AnnotatedTag
  46. type swaggerResponseAnnotatedTag struct {
  47. // in:body
  48. Body api.AnnotatedTag `json:"body"`
  49. }
  50. // Reference
  51. // swagger:response Reference
  52. type swaggerResponseReference struct {
  53. // in:body
  54. Body api.Reference `json:"body"`
  55. }
  56. // ReferenceList
  57. // swagger:response ReferenceList
  58. type swaggerResponseReferenceList struct {
  59. // in:body
  60. Body []api.Reference `json:"body"`
  61. }
  62. // Hook
  63. // swagger:response Hook
  64. type swaggerResponseHook struct {
  65. // in:body
  66. Body api.Hook `json:"body"`
  67. }
  68. // HookList
  69. // swagger:response HookList
  70. type swaggerResponseHookList struct {
  71. // in:body
  72. Body []api.Hook `json:"body"`
  73. }
  74. // GitHook
  75. // swagger:response GitHook
  76. type swaggerResponseGitHook struct {
  77. // in:body
  78. Body api.GitHook `json:"body"`
  79. }
  80. // GitHookList
  81. // swagger:response GitHookList
  82. type swaggerResponseGitHookList struct {
  83. // in:body
  84. Body []api.GitHook `json:"body"`
  85. }
  86. // Release
  87. // swagger:response Release
  88. type swaggerResponseRelease struct {
  89. // in:body
  90. Body api.Release `json:"body"`
  91. }
  92. // ReleaseList
  93. // swagger:response ReleaseList
  94. type swaggerResponseReleaseList struct {
  95. // in:body
  96. Body []api.Release `json:"body"`
  97. }
  98. // PullRequest
  99. // swagger:response PullRequest
  100. type swaggerResponsePullRequest struct {
  101. // in:body
  102. Body api.PullRequest `json:"body"`
  103. }
  104. // PullRequestList
  105. // swagger:response PullRequestList
  106. type swaggerResponsePullRequestList struct {
  107. // in:body
  108. Body []api.PullRequest `json:"body"`
  109. }
  110. // Status
  111. // swagger:response Status
  112. type swaggerResponseStatus struct {
  113. // in:body
  114. Body api.Status `json:"body"`
  115. }
  116. // StatusList
  117. // swagger:response StatusList
  118. type swaggerResponseStatusList struct {
  119. // in:body
  120. Body []api.Status `json:"body"`
  121. }
  122. // WatchInfo
  123. // swagger:response WatchInfo
  124. type swaggerResponseWatchInfo struct {
  125. // in:body
  126. Body api.WatchInfo `json:"body"`
  127. }
  128. // SearchResults
  129. // swagger:response SearchResults
  130. type swaggerResponseSearchResults struct {
  131. // in:body
  132. Body api.SearchResults `json:"body"`
  133. }
  134. // AttachmentList
  135. // swagger:response AttachmentList
  136. type swaggerResponseAttachmentList struct {
  137. //in: body
  138. Body []api.Attachment `json:"body"`
  139. }
  140. // Attachment
  141. // swagger:response Attachment
  142. type swaggerResponseAttachment struct {
  143. //in: body
  144. Body api.Attachment `json:"body"`
  145. }
  146. // GitTreeResponse
  147. // swagger:response GitTreeResponse
  148. type swaggerGitTreeResponse struct {
  149. //in: body
  150. Body api.GitTreeResponse `json:"body"`
  151. }
  152. // GitBlobResponse
  153. // swagger:response GitBlobResponse
  154. type swaggerGitBlobResponse struct {
  155. //in: body
  156. Body api.GitBlobResponse `json:"body"`
  157. }
  158. // Commit
  159. // swagger:response Commit
  160. type swaggerCommit struct {
  161. //in: body
  162. Body api.Commit `json:"body"`
  163. }
  164. // CommitList
  165. // swagger:response CommitList
  166. type swaggerCommitList struct {
  167. // The current page
  168. Page int `json:"X-Page"`
  169. // Commits per page
  170. PerPage int `json:"X-PerPage"`
  171. // Total commit count
  172. Total int `json:"X-Total"`
  173. // Total number of pages
  174. PageCount int `json:"X-PageCount"`
  175. // True if there is another page
  176. HasMore bool `json:"X-HasMore"`
  177. //in: body
  178. Body []api.Commit `json:"body"`
  179. }
  180. // EmptyRepository
  181. // swagger:response EmptyRepository
  182. type swaggerEmptyRepository struct {
  183. //in: body
  184. Body api.APIError `json:"body"`
  185. }
  186. // FileResponse
  187. // swagger:response FileResponse
  188. type swaggerFileResponse struct {
  189. //in: body
  190. Body api.FileResponse `json:"body"`
  191. }
  192. // ContentsResponse
  193. // swagger:response ContentsResponse
  194. type swaggerContentsResponse struct {
  195. //in: body
  196. Body api.ContentsResponse `json:"body"`
  197. }
  198. // ContentsListResponse
  199. // swagger:response ContentsListResponse
  200. type swaggerContentsListResponse struct {
  201. // in:body
  202. Body []api.ContentsResponse `json:"body"`
  203. }
  204. // FileDeleteResponse
  205. // swagger:response FileDeleteResponse
  206. type swaggerFileDeleteResponse struct {
  207. //in: body
  208. Body api.FileDeleteResponse `json:"body"`
  209. }
  210. // TopicListResponse
  211. // swagger:response TopicListResponse
  212. type swaggerTopicListResponse struct {
  213. //in: body
  214. Body []api.TopicResponse `json:"body"`
  215. }
  216. // TopicNames
  217. // swagger:response TopicNames
  218. type swaggerTopicNames struct {
  219. //in: body
  220. Body api.TopicName `json:"body"`
  221. }