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
	"kubesphere.io/kubesphere/pkg/apiserver/runtime"
	"kubesphere.io/kubesphere/pkg/constants"
27
	"kubesphere.io/kubesphere/pkg/informers"
H
hongming 已提交
28
	"kubesphere.io/kubesphere/pkg/models"
H
hongming 已提交
29
	openpitrix2 "kubesphere.io/kubesphere/pkg/models/openpitrix"
H
hongming 已提交
30 31
	"kubesphere.io/kubesphere/pkg/server/errors"
	"kubesphere.io/kubesphere/pkg/server/params"
H
hongming 已提交
32
	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"}

42
func AddToContainer(c *restful.Container, factory informers.InformerFactory, op op.Client) error {
P
pengcong06 已提交
43 44 45
	if op == nil {
		return nil
	}
H
hongming 已提交
46 47
	mimePatch := []string{restful.MIME_JSON, runtime.MimeMergePatchJson, runtime.MimeJsonPatchJson}
	webservice := runtime.NewWebService(GroupVersion)
48
	handler := newOpenpitrixHandler(factory, op)
H
hongming 已提交
49 50

	webservice.Route(webservice.GET("/applications").
H
hongming 已提交
51 52
		To(handler.ListApplications).
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
H
hongming 已提交
53 54 55 56 57 58 59 60 61 62 63 64 65
		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 已提交
66 67
		To(handler.ListApplications).
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
H
hongming 已提交
68 69 70 71 72 73 74 75 76 77 78 79 80
		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 已提交
81 82
		To(handler.DescribeApplication).
		Returns(http.StatusOK, api.StatusOK, openpitrix2.Application{}).
H
hongming 已提交
83 84 85 86 87 88
		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 已提交
89
		To(handler.CreateApplication).
H
hongming 已提交
90 91
		Doc("Deploy a new application").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
H
hongming 已提交
92 93
		Reads(openpitrix2.CreateClusterRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
94 95 96 97
		Param(webservice.PathParameter("namespace", "the name of the project")))

	webservice.Route(webservice.PATCH("/namespaces/{namespace}/applications/{application}").
		Consumes(mimePatch...).
H
hongming 已提交
98
		To(handler.ModifyApplication).
H
hongming 已提交
99 100
		Doc("Modify application").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
H
hongming 已提交
101 102
		Reads(openpitrix2.ModifyClusterAttributesRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
103 104 105 106
		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 已提交
107
		To(handler.DeleteApplication).
H
hongming 已提交
108 109
		Doc("Delete the specified application").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.NamespaceResourcesTag}).
H
hongming 已提交
110
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
111 112 113 114
		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 已提交
115
		To(handler.CreateAppVersion).
H
hongming 已提交
116 117
		Doc("Create a new app template version").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
118
		Reads(openpitrix2.CreateAppVersionRequest{}).
H
hongming 已提交
119
		Param(webservice.QueryParameter("validate", "Validate format of package(pack by op tool)")).
H
hongming 已提交
120
		Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateAppVersionResponse{}).
H
hongming 已提交
121 122
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.DELETE("/apps/{app}/versions/{version}").
H
hongming 已提交
123
		To(handler.DeleteAppVersion).
H
hongming 已提交
124 125
		Doc("Delete the specified app template version").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
126
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
127 128 129 130
		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 已提交
131
		To(handler.ModifyAppVersion).
H
hongming 已提交
132 133
		Doc("Patch the specified app template version").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
134 135
		Reads(openpitrix2.ModifyAppVersionRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
136 137 138
		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 已提交
139
		To(handler.DescribeAppVersion).
H
hongming 已提交
140 141
		Doc("Describe the specified app template version").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
142
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersion{}).
H
hongming 已提交
143 144 145
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/apps/{app}/versions").
H
hongming 已提交
146
		To(handler.ListAppVersions).
H
hongming 已提交
147 148 149 150 151 152 153 154 155 156 157
		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 已提交
158
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
H
hongming 已提交
159
	webservice.Route(webservice.GET("/apps/{app}/versions/{version}/audits").
H
hongming 已提交
160
		To(handler.ListAppVersionAudits).
H
hongming 已提交
161
		Doc("List audits information of version-specific app template").
H
hongming 已提交
162
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionAudit{}).
H
hongming 已提交
163 164 165
		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 已提交
166
		To(handler.GetAppVersionPackage).
H
hongming 已提交
167
		Doc("Get packages of version-specific app").
H
hongming 已提交
168
		Returns(http.StatusOK, api.StatusOK, openpitrix2.GetAppVersionPackageResponse{}).
H
hongming 已提交
169 170 171
		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 已提交
172
		To(handler.DoAppVersionAction).
H
hongming 已提交
173
		Doc("Perform submit or other operations on app").
H
hongming 已提交
174
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
175 176 177
		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 已提交
178
		To(handler.GetAppVersionFiles).
H
hongming 已提交
179
		Doc("Get app template package files").
H
hongming 已提交
180
		Returns(http.StatusOK, api.StatusOK, openpitrix2.GetAppVersionPackageFilesResponse{}).
H
hongming 已提交
181 182 183
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/reviews").
H
hongming 已提交
184
		To(handler.ListReviews).
H
hongming 已提交
185 186 187 188 189 190 191 192
		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 已提交
193
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionReview{}))
H
hongming 已提交
194
	webservice.Route(webservice.GET("/apps/{app}/audits").
H
hongming 已提交
195
		To(handler.ListAppVersionAudits).
H
hongming 已提交
196 197
		Doc("List audits information of the specific app template").
		Param(webservice.PathParameter("app", "app template id")).
H
hongming 已提交
198
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersionAudit{}))
H
hongming 已提交
199
	webservice.Route(webservice.POST("/apps").
H
hongming 已提交
200
		To(handler.CreateApp).
H
hongming 已提交
201 202
		Doc("Create a new app template").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
203 204
		Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateAppResponse{}).
		Reads(openpitrix2.CreateAppRequest{}).
H
hongming 已提交
205 206
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.DELETE("/apps/{app}").
H
hongming 已提交
207
		To(handler.DeleteApp).
H
hongming 已提交
208 209
		Doc("Delete the specified app template").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
210
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
211 212 213
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.PATCH("/apps/{app}").
		Consumes(mimePatch...).
H
hongming 已提交
214
		To(handler.ModifyApp).
H
hongming 已提交
215 216
		Doc("Patch the specified app template").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
217 218
		Reads(openpitrix2.ModifyAppVersionRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
219 220
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/apps/{app}").
H
hongming 已提交
221
		To(handler.DescribeApp).
H
hongming 已提交
222 223
		Doc("Describe the specified app template").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
224
		Returns(http.StatusOK, api.StatusOK, openpitrix2.AppVersion{}).
H
hongming 已提交
225 226
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.POST("/apps/{app}/action").
H
hongming 已提交
227
		To(handler.DoAppAction).
H
hongming 已提交
228
		Doc("Perform recover or suspend operation on app").
H
hongming 已提交
229
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
230 231 232
		Param(webservice.PathParameter("version", "app template version id")).
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.GET("/apps").
H
hongming 已提交
233
		To(handler.ListApps).
H
hongming 已提交
234 235 236 237 238 239 240 241 242 243
		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 已提交
244
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
H
hongming 已提交
245
	webservice.Route(webservice.POST("/categories").
H
hongming 已提交
246
		To(handler.CreateCategory).
H
hongming 已提交
247 248
		Doc("Create app template category").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
249 250
		Reads(openpitrix2.CreateCategoryRequest{}).
		Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateCategoryResponse{}).
H
hongming 已提交
251 252
		Param(webservice.PathParameter("app", "app template id")))
	webservice.Route(webservice.DELETE("/categories/{category}").
H
hongming 已提交
253
		To(handler.DeleteCategory).
H
hongming 已提交
254 255
		Doc("Delete the specified category").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
256
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
257 258 259
		Param(webservice.PathParameter("category", "category id")))
	webservice.Route(webservice.PATCH("/categories/{category}").
		Consumes(mimePatch...).
H
hongming 已提交
260
		To(handler.ModifyCategory).
H
hongming 已提交
261 262
		Doc("Patch the specified category").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
263 264
		Reads(openpitrix2.ModifyCategoryRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
265 266
		Param(webservice.PathParameter("category", "category id")))
	webservice.Route(webservice.GET("/categories/{category}").
H
hongming 已提交
267
		To(handler.DescribeCategory).
H
hongming 已提交
268 269
		Doc("Describe the specified category").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
270
		Returns(http.StatusOK, api.StatusOK, openpitrix2.Category{}).
H
hongming 已提交
271 272
		Param(webservice.PathParameter("category", "category id")))
	webservice.Route(webservice.GET("/categories").
H
hongming 已提交
273
		To(handler.ListCategories).
H
hongming 已提交
274 275 276 277 278 279 280 281 282 283
		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 已提交
284
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
H
hongming 已提交
285 286

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

	webservice.Route(webservice.POST("/repos").
H
hongming 已提交
293
		To(handler.CreateRepo).
H
hongming 已提交
294 295 296
		Doc("Create repository, repository used to store package of app").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
		Param(webservice.QueryParameter("validate", "Validate repository")).
H
hongming 已提交
297 298
		Returns(http.StatusOK, api.StatusOK, openpitrix2.CreateRepoResponse{}).
		Reads(openpitrix2.CreateRepoRequest{}))
H
hongming 已提交
299
	webservice.Route(webservice.DELETE("/repos/{repo}").
H
hongming 已提交
300
		To(handler.DeleteRepo).
H
hongming 已提交
301 302
		Doc("Delete the specified repository").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
303
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
304 305 306
		Param(webservice.PathParameter("repo", "repo id")))
	webservice.Route(webservice.PATCH("/repos/{repo}").
		Consumes(mimePatch...).
H
hongming 已提交
307
		To(handler.ModifyRepo).
H
hongming 已提交
308 309
		Doc("Patch the specified repository").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
310 311
		Reads(openpitrix2.ModifyRepoRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
312 313
		Param(webservice.PathParameter("repo", "repo id")))
	webservice.Route(webservice.GET("/repos/{repo}").
H
hongming 已提交
314
		To(handler.DescribeRepo).
H
hongming 已提交
315 316
		Doc("Describe the specified repository").
		Metadata(restfulspec.KeyOpenAPITags, []string{constants.OpenpitrixTag}).
H
hongming 已提交
317
		Returns(http.StatusOK, api.StatusOK, openpitrix2.Repo{}).
H
hongming 已提交
318 319
		Param(webservice.PathParameter("repo", "repo id")))
	webservice.Route(webservice.GET("/repos").
H
hongming 已提交
320
		To(handler.ListRepos).
H
hongming 已提交
321 322 323 324 325 326 327 328 329 330
		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 已提交
331
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}))
H
hongming 已提交
332
	webservice.Route(webservice.POST("/repos/{repo}/action").
H
hongming 已提交
333
		To(handler.DoRepoAction).
H
hongming 已提交
334
		Doc("Start index repository event").
H
hongming 已提交
335 336
		Reads(openpitrix2.RepoActionRequest{}).
		Returns(http.StatusOK, api.StatusOK, errors.Error{}).
H
hongming 已提交
337 338
		Param(webservice.PathParameter("repo", "repo id")))
	webservice.Route(webservice.GET("/repos/{repo}/events").
H
hongming 已提交
339
		To(handler.ListRepoEvents).
H
hongming 已提交
340
		Doc("Get repository events").
H
hongming 已提交
341
		Returns(http.StatusOK, api.StatusOK, models.PageableResponse{}).
H
hongming 已提交
342 343 344 345 346 347
		Param(webservice.PathParameter("repo", "repo id")))

	c.Add(webservice)

	return nil
}