@@ -141,7 +141,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
141
141
ctx .JSON (201 , repo .APIFormat (& api.Permission {true , true , true }))
142
142
}
143
143
144
- // Create create one repository of mine
144
+ // Create one repository of mine
145
145
// see https://github.com/gogits/go-gogs-client/wiki/Repositories#create
146
146
func Create (ctx * context.APIContext , opt api.CreateRepoOption ) {
147
147
// Shouldn't reach this condition, but just in case.
@@ -244,14 +244,29 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
244
244
ctx .JSON (201 , repo .APIFormat (& api.Permission {true , true , true }))
245
245
}
246
246
247
- // Get get one repository
247
+ // Get one repository
248
248
// see https://github.com/gogits/go-gogs-client/wiki/Repositories#get
249
249
func Get (ctx * context.APIContext ) {
250
250
repo := ctx .Repo .Repository
251
251
ctx .JSON (200 , repo .APIFormat (& api.Permission {true , true , true }))
252
252
}
253
253
254
- // Delete delete one repository
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
+
269
+ // Delete one repository
255
270
// see https://github.com/gogits/go-gogs-client/wiki/Repositories#delete
256
271
func Delete (ctx * context.APIContext ) {
257
272
owner := ctx .Repo .Owner
0 commit comments