@@ -141,7 +141,7 @@ func CreateUserRepo(ctx *context.APIContext, owner *models.User, opt api.CreateR
141141 ctx .JSON (201 , repo .APIFormat (& api.Permission {true , true , true }))
142142}
143143
144- // Create create one repository of mine
144+ // Create one repository of mine
145145// see https://github.com/gogits/go-gogs-client/wiki/Repositories#create
146146func Create (ctx * context.APIContext , opt api.CreateRepoOption ) {
147147 // Shouldn't reach this condition, but just in case.
@@ -244,14 +244,29 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
244244 ctx .JSON (201 , repo .APIFormat (& api.Permission {true , true , true }))
245245}
246246
247- // Get get one repository
247+ // Get one repository
248248// see https://github.com/gogits/go-gogs-client/wiki/Repositories#get
249249func Get (ctx * context.APIContext ) {
250250 repo := ctx .Repo .Repository
251251 ctx .JSON (200 , repo .APIFormat (& api.Permission {true , true , true }))
252252}
253253
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
255270// see https://github.com/gogits/go-gogs-client/wiki/Repositories#delete
256271func Delete (ctx * context.APIContext ) {
257272 owner := ctx .Repo .Owner
0 commit comments