|
|
@ -9,17 +9,17 @@ import ( |
|
|
|
|
|
|
|
|
|
|
|
log "gopkg.in/clog.v1" |
|
|
|
log "gopkg.in/clog.v1" |
|
|
|
|
|
|
|
|
|
|
|
api "github.com/gogits/go-gogs-client" |
|
|
|
api "github.com/gogs/go-gogs-client" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/gogits/gogs/models" |
|
|
|
"github.com/gogs/gogs/models" |
|
|
|
"github.com/gogits/gogs/models/errors" |
|
|
|
"github.com/gogs/gogs/models/errors" |
|
|
|
"github.com/gogits/gogs/pkg/context" |
|
|
|
"github.com/gogs/gogs/pkg/context" |
|
|
|
"github.com/gogits/gogs/pkg/form" |
|
|
|
"github.com/gogs/gogs/pkg/form" |
|
|
|
"github.com/gogits/gogs/pkg/setting" |
|
|
|
"github.com/gogs/gogs/pkg/setting" |
|
|
|
"github.com/gogits/gogs/routes/api/v1/convert" |
|
|
|
"github.com/gogs/gogs/routes/api/v1/convert" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/gogits/go-gogs-client/wiki/Repositories#search-repositories
|
|
|
|
// https://github.com/gogs/go-gogs-client/wiki/Repositories#search-repositories
|
|
|
|
func Search(c *context.APIContext) { |
|
|
|
func Search(c *context.APIContext) { |
|
|
|
opts := &models.SearchRepoOptions{ |
|
|
|
opts := &models.SearchRepoOptions{ |
|
|
|
Keyword: path.Base(c.Query("q")), |
|
|
|
Keyword: path.Base(c.Query("q")), |
|
|
@ -182,7 +182,7 @@ func CreateUserRepo(c *context.APIContext, owner *models.User, opt api.CreateRep |
|
|
|
c.JSON(201, repo.APIFormat(&api.Permission{true, true, true})) |
|
|
|
c.JSON(201, repo.APIFormat(&api.Permission{true, true, true})) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/gogits/go-gogs-client/wiki/Repositories#create
|
|
|
|
// https://github.com/gogs/go-gogs-client/wiki/Repositories#create
|
|
|
|
func Create(c *context.APIContext, opt api.CreateRepoOption) { |
|
|
|
func Create(c *context.APIContext, opt api.CreateRepoOption) { |
|
|
|
// Shouldn't reach this condition, but just in case.
|
|
|
|
// Shouldn't reach this condition, but just in case.
|
|
|
|
if c.User.IsOrganization() { |
|
|
|
if c.User.IsOrganization() { |
|
|
@ -210,7 +210,7 @@ func CreateOrgRepo(c *context.APIContext, opt api.CreateRepoOption) { |
|
|
|
CreateUserRepo(c, org, opt) |
|
|
|
CreateUserRepo(c, org, opt) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/gogits/go-gogs-client/wiki/Repositories#migrate
|
|
|
|
// https://github.com/gogs/go-gogs-client/wiki/Repositories#migrate
|
|
|
|
func Migrate(c *context.APIContext, f form.MigrateRepo) { |
|
|
|
func Migrate(c *context.APIContext, f form.MigrateRepo) { |
|
|
|
ctxUser := c.User |
|
|
|
ctxUser := c.User |
|
|
|
// Not equal means context user is an organization,
|
|
|
|
// Not equal means context user is an organization,
|
|
|
@ -314,7 +314,7 @@ func parseOwnerAndRepo(c *context.APIContext) (*models.User, *models.Repository) |
|
|
|
return owner, repo |
|
|
|
return owner, repo |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/gogits/go-gogs-client/wiki/Repositories#get
|
|
|
|
// https://github.com/gogs/go-gogs-client/wiki/Repositories#get
|
|
|
|
func Get(c *context.APIContext) { |
|
|
|
func Get(c *context.APIContext) { |
|
|
|
_, repo := parseOwnerAndRepo(c) |
|
|
|
_, repo := parseOwnerAndRepo(c) |
|
|
|
if c.Written() { |
|
|
|
if c.Written() { |
|
|
@ -328,7 +328,7 @@ func Get(c *context.APIContext) { |
|
|
|
})) |
|
|
|
})) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// https://github.com/gogits/go-gogs-client/wiki/Repositories#delete
|
|
|
|
// https://github.com/gogs/go-gogs-client/wiki/Repositories#delete
|
|
|
|
func Delete(c *context.APIContext) { |
|
|
|
func Delete(c *context.APIContext) { |
|
|
|
owner, repo := parseOwnerAndRepo(c) |
|
|
|
owner, repo := parseOwnerAndRepo(c) |
|
|
|
if c.Written() { |
|
|
|
if c.Written() { |
|
|
|