register.go 17.7 KB
Newer Older
H
hongming 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
/*
 *
 * Copyright 2019 The KubeSphere Authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * /
 */
package v1

import (
	"github.com/emicklei/go-restful"
	"github.com/emicklei/go-restful-openapi"
	"k8s.io/apimachinery/pkg/runtime/schema"
H
hongming 已提交
24
	"kubesphere.io/kubesphere/pkg/api"
H
hongming 已提交
25 26 27
	"kubesphere.io/kubesphere/pkg/apiserver/runtime"
	"kubesphere.io/kubesphere/pkg/constants"
	"kubesphere.io/kubesphere/pkg/models"
H
hongming 已提交
28
	openpitrix2 "kubesphere.io/kubesphere/pkg/models/openpitrix"
H
hongming 已提交
29 30
	"kubesphere.io/kubesphere/pkg/server/errors"
	"kubesphere.io/kubesphere/pkg/server/params"
H
hongming 已提交
31 32
	"kubesphere.io/kubesphere/pkg/simple/client/k8s"
	op "kubesphere.io/kubesphere/pkg/simple/client/openpitrix"
H
hongming 已提交
33 34 35
	"net/http"
)

H
hongming 已提交
36 37 38
const (
	GroupName = "openpitrix.io"
)
H
hongming 已提交
39 40 41

var GroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1"}

H
hongming 已提交
42
func AddToContainer(c *restful.Container, k8s k8s.Client, op op.Client) error {
H
hongming 已提交
43 44 45

	mimePatch := []string{restful.MIME_JSON, runtime.MimeMergePatchJson, runtime.MimeJsonPatchJson}
	webservice := runtime.NewWebService(GroupVersion)
H
hongming 已提交
46
	handler := newOpenpitrixHandler(k8s, op)
H
hongming 已提交
47 48

	webservice.Route(webservice.GET("/applications").
H
hongming 已提交
49 50
		To(handler.ListApplications).
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
H
hongming 已提交
51 52 53 54 55 56 57 58 59 60 61 62 63
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
		Doc("List all applications").
		Param(webservice.QueryParameter(params.ConditionsParam, "query conditions, connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a").
			Required(false).
			DataFormat("key=value,key~value").
			DefaultValue("")).
		Param(webservice.PathParameter("namespace", "the name of the project")).
		Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
			Required(false).
			DataFormat("limit=%d,page=%d").
			DefaultValue("limit=10,page=1")))

	webservice.Route(webservice.GET("/namespaces/{namespace}/applications").
H
hongming 已提交
64 65
		To(handler.ListApplications).
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
H
hongming 已提交
66 67 68 69 70 71 72 73 74 75 76 77 78
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
		Doc("List all applications within the specified namespace").
		Param(webservice.QueryParameter(params.ConditionsParam, "query conditions, connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a").
			Required(false).
			DataFormat("key=value,key~value").
			DefaultValue("")).
		Param(webservice.PathParameter("namespace", "the name of the project")).
		Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
			Required(false).
			DataFormat("limit=%d,page=%d").
			DefaultValue("limit=10,page=1")))

	webservice.Route(webservice.GET("/namespaces/{namespace}/applications/{application}").
H
hongming 已提交
79 80
		To(handler.DescribeApplication).
		Returns(http.StatusOK, api.StatusOK, openpitrix2.Application{}).
H
hongming 已提交
81 82 83 84 85 86
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
		Doc("Describe the specified application of the namespace").
		Param(webservice.PathParameter("namespace", "the name of the project")).
		Param(webservice.PathParameter("application", "application ID")))

	webservice.Route(webservice.POST("/namespaces/{namespace}/applications").
H
hongming 已提交
87
		To(handler.CreateApplication).
H
hongming 已提交
88 89
		Doc("Deploy a new application").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
H
hongming 已提交
90 91
		Reads(openpitrix2.CreateClusterRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
92 93 94 95
		Param(webservice.PathParameter("namespace", "the name of the project")))

	webservice.Route(webservice.PATCH("/namespaces/{namespace}/applications/{application}").
		Consumes(mimePatch...).
H
hongming 已提交
96
		To(handler.ModifyApplication).
H
hongming 已提交
97 98
		Doc("Modify application").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
H
hongming 已提交
99 100
		Reads(openpitrix2.ModifyClusterAttributesRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
101 102 103 104
		Param(webservice.PathParameter("namespace", "the name of the project")).
		Param(webservice.PathParameter("application", "the id of the application cluster")))

	webservice.Route(webservice.DELETE("/namespaces/{namespace}/applications/{application}").
H
hongming 已提交
105
		To(handler.DeleteApplication).
H
hongming 已提交
106 107
		Doc("Delete the specified application").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
H
hongming 已提交
108
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
109 110 111 112
		Param(webservice.PathParameter("namespace", "the name of the project")).
		Param(webservice.PathParameter("application", "the id of the application cluster")))

	webservice.Route(webservice.POST("/apps/{app}/versions").
H
hongming 已提交
113
		To(handler.CreateAppVersion).
H
hongming 已提交
114 115
		Doc("Create a new app template version").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
116
		Reads(openpitrix2.CreateAppVersionRequest{}).
H
hongming 已提交
117
		Param(webservice.QueryParameter("validate", "Validate format of package(pack by op tool)")).
H
hongming 已提交
118
		Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateAppVersionResponse{}).
H
hongming 已提交
119 120
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.DELETE("/apps/{app}/versions/{version}").
H
hongming 已提交
121
		To(handler.DeleteAppVersion).
H
hongming 已提交
122 123
		Doc("Delete the specified app template version").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
124
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
125 126 127 128
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.PATCH("/apps/{app}/versions/{version}").
		Consumes(mimePatch...).
H
hongming 已提交
129
		To(handler.ModifyAppVersion).
H
hongming 已提交
130 131
		Doc("Patch the specified app template version").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
132 133
		Reads(openpitrix2.ModifyAppVersionRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
134 135 136
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/apps/{app}/versions/{version}").
H
hongming 已提交
137
		To(handler.DescribeAppVersion).
H
hongming 已提交
138 139
		Doc("Describe the specified app template version").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
140
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersion{}).
H
hongming 已提交
141 142 143
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/apps/{app}/versions").
H
hongming 已提交
144
		To(handler.ListAppVersions).
H
hongming 已提交
145 146 147 148 149 150 151 152 153 154 155
		Doc("Get active versions of app, can filter with these fields(version_id, app_id, name, owner, description, package_name, status, type), default return all active app versions").
		Param(webservice.QueryParameter(params.ConditionsParam, "query conditions,connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a").
			Required(false).
			DataFormat("key=%s,key~%s")).
		Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
			Required(false).
			DataFormat("limit=%d,page=%d").
			DefaultValue("limit=10,page=1")).
		Param(webservice.PathParameter("app", "app template id")).
		Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
		Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
H
hongming 已提交
156
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
H
hongming 已提交
157
	webservice.Route(webservice.GET("/apps/{app}/versions/{version}/audits").
H
hongming 已提交
158
		To(handler.ListAppVersionAudits).
H
hongming 已提交
159
		Doc("List audits information of version-specific app template").
H
hongming 已提交
160
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionAudit{}).
H
hongming 已提交
161 162 163
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/apps/{app}/versions/{version}/package").
H
hongming 已提交
164
		To(handler.GetAppVersionPackage).
H
hongming 已提交
165
		Doc("Get packages of version-specific app").
H
hongming 已提交
166
		Returns(http.StatusOK, api.StatusOK, openpitrix2.GetAppVersionPackageResponse{}).
H
hongming 已提交
167 168 169
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.POST("/apps/{app}/versions/{version}/action").
H
hongming 已提交
170
		To(handler.DoAppVersionAction).
H
hongming 已提交
171
		Doc("Perform submit or other operations on app").
H
hongming 已提交
172
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
173 174 175
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/apps/{app}/versions/{version}/files").
H
hongming 已提交
176
		To(handler.GetAppVersionFiles).
H
hongming 已提交
177
		Doc("Get app template package files").
H
hongming 已提交
178
		Returns(http.StatusOK, api.StatusOK, openpitrix2.GetAppVersionPackageFilesResponse{}).
H
hongming 已提交
179 180 181
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/reviews").
H
hongming 已提交
182
		To(handler.ListReviews).
H
hongming 已提交
183 184 185 186 187 188 189 190
		Doc("Get reviews of version-specific app").
		Param(webservice.QueryParameter(params.ConditionsParam, "query conditions,connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a").
			Required(false).
			DataFormat("key=%s,key~%s")).
		Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
			Required(false).
			DataFormat("limit=%d,page=%d").
			DefaultValue("limit=10,page=1")).
H
hongming 已提交
191
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionReview{}))
H
hongming 已提交
192
	webservice.Route(webservice.GET("/apps/{app}/audits").
H
hongming 已提交
193
		To(handler.ListAppVersionAudits).
H
hongming 已提交
194 195
		Doc("List audits information of the specific app template").
		Param(webservice.PathParameter("app", "app template id")).
H
hongming 已提交
196
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionAudit{}))
H
hongming 已提交
197
	webservice.Route(webservice.POST("/apps").
H
hongming 已提交
198
		To(handler.CreateApp).
H
hongming 已提交
199 200
		Doc("Create a new app template").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
201 202
		Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateAppResponse{}).
		Reads(openpitrix2.CreateAppRequest{}).
H
hongming 已提交
203 204
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.DELETE("/apps/{app}").
H
hongming 已提交
205
		To(handler.DeleteApp).
H
hongming 已提交
206 207
		Doc("Delete the specified app template").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
208
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
209 210 211
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.PATCH("/apps/{app}").
		Consumes(mimePatch...).
H
hongming 已提交
212
		To(handler.ModifyApp).
H
hongming 已提交
213 214
		Doc("Patch the specified app template").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
215 216
		Reads(openpitrix2.ModifyAppVersionRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
217 218
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/apps/{app}").
H
hongming 已提交
219
		To(handler.DescribeApp).
H
hongming 已提交
220 221
		Doc("Describe the specified app template").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
222
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersion{}).
H
hongming 已提交
223 224
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.POST("/apps/{app}/action").
H
hongming 已提交
225
		To(handler.DoAppAction).
H
hongming 已提交
226
		Doc("Perform recover or suspend operation on app").
H
hongming 已提交
227
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
228 229 230
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/apps").
H
hongming 已提交
231
		To(handler.ListApps).
H
hongming 已提交
232 233 234 235 236 237 238 239 240 241
		Doc("List app templates").
		Param(webservice.QueryParameter(params.ConditionsParam, "query conditions,connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a").
			Required(false).
			DataFormat("key=%s,key~%s")).
		Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
			Required(false).
			DataFormat("limit=%d,page=%d").
			DefaultValue("limit=10,page=1")).
		Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
		Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
H
hongming 已提交
242
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
H
hongming 已提交
243
	webservice.Route(webservice.POST("/categories").
H
hongming 已提交
244
		To(handler.CreateCategory).
H
hongming 已提交
245 246
		Doc("Create app template category").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
247 248
		Reads(openpitrix2.CreateCategoryRequest{}).
		Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateCategoryResponse{}).
H
hongming 已提交
249 250
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.DELETE("/categories/{category}").
H
hongming 已提交
251
		To(handler.DeleteCategory).
H
hongming 已提交
252 253
		Doc("Delete the specified category").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
254
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
255 256 257
		Param(webservice.PathParameter("category", "category id")))
	webservice.Route(webservice.PATCH("/categories/{category}").
		Consumes(mimePatch...).
H
hongming 已提交
258
		To(handler.ModifyCategory).
H
hongming 已提交
259 260
		Doc("Patch the specified category").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
261 262
		Reads(openpitrix2.ModifyCategoryRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
263 264
		Param(webservice.PathParameter("category", "category id")))
	webservice.Route(webservice.GET("/categories/{category}").
H
hongming 已提交
265
		To(handler.DescribeCategory).
H
hongming 已提交
266 267
		Doc("Describe the specified category").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
268
		Returns(http.StatusOK, api.StatusOK, openpitrix2.Category{}).
H
hongming 已提交
269 270
		Param(webservice.PathParameter("category", "category id")))
	webservice.Route(webservice.GET("/categories").
H
hongming 已提交
271
		To(handler.ListCategories).
H
hongming 已提交
272 273 274 275 276 277 278 279 280 281
		Doc("List categories").
		Param(webservice.QueryParameter(params.ConditionsParam, "query conditions,connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a").
			Required(false).
			DataFormat("key=%s,key~%s")).
		Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
			Required(false).
			DataFormat("limit=%d,page=%d").
			DefaultValue("limit=10,page=1")).
		Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
		Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
H
hongming 已提交
282
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
H
hongming 已提交
283 284

	webservice.Route(webservice.GET("/attachments/{attachment}").
H
hongming 已提交
285
		To(handler.DescribeAttachment).
H
hongming 已提交
286 287
		Doc("Get attachment by attachment id").
		Param(webservice.PathParameter("attachment", "attachment id")).
H
hongming 已提交
288
		Returns(http.StatusOK, api.StatusOK, openpitrix2.Attachment{}))
H
hongming 已提交
289 290

	webservice.Route(webservice.POST("/repos").
H
hongming 已提交
291
		To(handler.CreateRepo).
H
hongming 已提交
292 293 294
		Doc("Create repository, repository used to store package of app").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
		Param(webservice.QueryParameter("validate", "Validate repository")).
H
hongming 已提交
295 296
		Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateRepoResponse{}).
		Reads(openpitrix2.CreateRepoRequest{}))
H
hongming 已提交
297
	webservice.Route(webservice.DELETE("/repos/{repo}").
H
hongming 已提交
298
		To(handler.DeleteRepo).
H
hongming 已提交
299 300
		Doc("Delete the specified repository").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
301
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
302 303 304
		Param(webservice.PathParameter("repo", "repo id")))
	webservice.Route(webservice.PATCH("/repos/{repo}").
		Consumes(mimePatch...).
H
hongming 已提交
305
		To(handler.ModifyRepo).
H
hongming 已提交
306 307
		Doc("Patch the specified repository").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
308 309
		Reads(openpitrix2.ModifyRepoRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
310 311
		Param(webservice.PathParameter("repo", "repo id")))
	webservice.Route(webservice.GET("/repos/{repo}").
H
hongming 已提交
312
		To(handler.DescribeRepo).
H
hongming 已提交
313 314
		Doc("Describe the specified repository").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
315
		Returns(http.StatusOK, api.StatusOK, openpitrix2.Repo{}).
H
hongming 已提交
316 317
		Param(webservice.PathParameter("repo", "repo id")))
	webservice.Route(webservice.GET("/repos").
H
hongming 已提交
318
		To(handler.ListRepos).
H
hongming 已提交
319 320 321 322 323 324 325 326 327 328
		Doc("List repositories").
		Param(webservice.QueryParameter(params.ConditionsParam, "query conditions,connect multiple conditions with commas, equal symbol for exact query, wave symbol for fuzzy query e.g. name~a").
			Required(false).
			DataFormat("key=%s,key~%s")).
		Param(webservice.QueryParameter(params.PagingParam, "paging query, e.g. limit=100,page=1").
			Required(false).
			DataFormat("limit=%d,page=%d").
			DefaultValue("limit=10,page=1")).
		Param(webservice.QueryParameter(params.ReverseParam, "sort parameters, e.g. reverse=true")).
		Param(webservice.QueryParameter(params.OrderByParam, "sort parameters, e.g. orderBy=createTime")).
H
hongming 已提交
329
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
H
hongming 已提交
330
	webservice.Route(webservice.POST("/repos/{repo}/action").
H
hongming 已提交
331
		To(handler.DoRepoAction).
H
hongming 已提交
332
		Doc("Start index repository event").
H
hongming 已提交
333 334
		Reads(openpitrix2.RepoActionRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
335 336
		Param(webservice.PathParameter("repo", "repo id")))
	webservice.Route(webservice.GET("/repos/{repo}/events").
H
hongming 已提交
337
		To(handler.ListRepoEvents).
H
hongming 已提交
338
		Doc("Get repository events").
H
hongming 已提交
339
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
H
hongming 已提交
340 341 342 343 344 345
		Param(webservice.PathParameter("repo", "repo id")))

	c.Add(webservice)

	return nil
}