File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -243,6 +243,8 @@ func RegisterRoutes(m *macaron.Macaron) {
243
243
m .Get ("/search" , repo .Search )
244
244
})
245
245
246
+ m .Combo ("/repositories/:id" , reqToken ()).Get (repo .GetByID )
247
+
246
248
m .Group ("/repos" , func () {
247
249
m .Post ("/migrate" , bind (auth.MigrateRepoForm {}), repo .Migrate )
248
250
m .Combo ("/:username/:reponame" , context .ExtractOwnerAndRepo ()).
Original file line number Diff line number Diff line change @@ -251,6 +251,21 @@ func Get(ctx *context.APIContext) {
251
251
ctx .JSON (200 , repo .APIFormat (& api.Permission {true , true , true }))
252
252
}
253
253
254
+ // GetByID returns a single Repository
255
+ func GetByID (ctx * context.APIContext ) {
256
+ repo , err := models .GetRepositoryByID (ctx .ParamsInt64 (":id" ))
257
+ if err != nil {
258
+ if models .IsErrRepoNotExist (err ) {
259
+ ctx .Status (404 )
260
+ } else {
261
+ ctx .Error (500 , "GetRepositoryByID" , err )
262
+ }
263
+ return
264
+ }
265
+
266
+ ctx .JSON (200 , repo .APIFormat (& api.Permission {true , true , true }))
267
+ }
268
+
254
269
// Delete delete one repository
255
270
// see https://github.com/gogits/go-gogs-client/wiki/Repositories#delete
256
271
func Delete (ctx * context.APIContext ) {
You can’t perform that action at this time.
0 commit comments