add:contributors
This commit is contained in:
parent
73c2a16921
commit
ba6eebdd42
|
@ -762,7 +762,9 @@ func Routes() *web.Route {
|
|||
// m.Get("/src/commit/*", context.RepoRefByType(context.RepoRefCommit), repo.GetFileContents)
|
||||
m.Get("/src/commit/*", context.RepoRefByType(context.RepoRefCommit), repo.GetFileContents)
|
||||
//end by coder
|
||||
|
||||
m.Group("/contributors", func() {
|
||||
m.Get("", report.GetContributors) //获取仓库的所有构建者信息 ****
|
||||
})
|
||||
m.Group("/hooks", func() {
|
||||
m.Combo("").Get(repo.ListHooks).
|
||||
Post(bind(api.CreateHookOption{}), repo.CreateHook)
|
||||
|
|
|
@ -191,3 +191,38 @@ func GetParamOption(ctx *context.APIContext) (opt *models.GetGetActivityOptions)
|
|||
}
|
||||
return opt
|
||||
}
|
||||
|
||||
func GetContributors(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/contributors repository contributors
|
||||
// ---
|
||||
// summary: Get all builder information in the repository ***
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: owner
|
||||
// in: path
|
||||
// description: owner of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: repo
|
||||
// in: path
|
||||
// description: name of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/ContributorsDtoList"
|
||||
// "404":
|
||||
// "$ref": "#/responses/noFound"
|
||||
|
||||
opts := models.GetContributorsOptionsExt{
|
||||
UserId: ctx.Repo.Owner.ID,
|
||||
RepoId: ctx.Repo.Repository.ID,
|
||||
}
|
||||
list, err := models.GetContributors(opts)
|
||||
if err != nil {
|
||||
ctx.Error(http.StatusNotFound, "not found the contributors", err)
|
||||
return
|
||||
}
|
||||
ctx.JSON(http.StatusOK, list)
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
package swagger
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/models"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/routers/api/v1/viewfile"
|
||||
)
|
||||
|
@ -351,3 +352,10 @@ type swaggerSearchFileItemList struct {
|
|||
// in: body
|
||||
Body []viewfile.SearchFileItem `json:"body"`
|
||||
}
|
||||
|
||||
// ContributorsDtoList
|
||||
// swagger:response ContributorsDto
|
||||
type swaggerResponseContributorsDtoList struct {
|
||||
// in: body
|
||||
Body []models.ContributorsDto `json:"body"`
|
||||
}
|
||||
|
|
|
@ -132,7 +132,7 @@ func GetAuthenticatedUser(ctx *context.APIContext) {
|
|||
func GetUserHeatmapData(ctx *context.APIContext) {
|
||||
// swagger:operation GET /users/{username}/heatmap user userGetHeatmapData
|
||||
// ---
|
||||
// summary: Get a user's heatmap
|
||||
// summary: Get a user's heatmap ***
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
|
|
|
@ -3585,6 +3585,42 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/contributors": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Get all builder information in the repository ***",
|
||||
"operationId": "contributors",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "owner of the repo",
|
||||
"name": "owner",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of the repo",
|
||||
"name": "repo",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/ContributorsDtoList"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/noFound"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/editorconfig/{filepath}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
@ -12303,7 +12339,7 @@
|
|||
"tags": [
|
||||
"user"
|
||||
],
|
||||
"summary": "Get a user's heatmap",
|
||||
"summary": "Get a user's heatmap ***",
|
||||
"operationId": "userGetHeatmapData",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -13355,6 +13391,30 @@
|
|||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"ContributorsDto": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"contributions": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "Contributions"
|
||||
},
|
||||
"email": {
|
||||
"type": "string",
|
||||
"x-go-name": "Email"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"login": {
|
||||
"type": "string",
|
||||
"x-go-name": "Login"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/models"
|
||||
},
|
||||
"CreateAccessTokenOption": {
|
||||
"description": "CreateAccessTokenOption options when create access token",
|
||||
"type": "object",
|
||||
|
@ -18192,6 +18252,15 @@
|
|||
"$ref": "#/definitions/ContentsResponse"
|
||||
}
|
||||
},
|
||||
"ContributorsDto": {
|
||||
"description": "ContributorsDtoList",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/ContributorsDto"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CronList": {
|
||||
"description": "CronList",
|
||||
"schema": {
|
||||
|
|
Loading…
Reference in New Issue