add api swagger
This commit is contained in:
parent
c019c6408a
commit
498a012e82
|
@ -228,7 +228,7 @@ func GetRefType() macaron.Handler {
|
|||
func CommitCount(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/count repository Count
|
||||
// ---
|
||||
// summary: Get commit quantity by branch
|
||||
// summary: Get commit quantity by branch which is a custom interface ****
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
|
@ -249,7 +249,7 @@ func CommitCount(ctx *context.APIContext) {
|
|||
// required: false
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/"
|
||||
// "$ref": "#/responses/CountDTO"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
|
@ -345,6 +345,27 @@ type CountDTO struct {
|
|||
|
||||
// LatestRelease redirects to the latest release
|
||||
func LatestRelease(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/releases/latest repository latest
|
||||
// ---
|
||||
// summary: Get the last updated Release version of the repository., which is a custom interface ****
|
||||
// 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/release"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
var err error
|
||||
if ctx.Repo.GitRepo == nil {
|
||||
fmt.Println("*****ctx.Repo.GitRepo is nil ")
|
||||
|
@ -364,7 +385,7 @@ func LatestRelease(ctx *context.APIContext) {
|
|||
}
|
||||
|
||||
release, err := models.GetLatestReleaseByRepoIDExt(ctx.Repo.Repository.ID)
|
||||
fmt.Println("****************ctx.Repo.Repository.ID:",ctx.Repo.Repository.ID," ",release," ",err)
|
||||
//fmt.Println("****************ctx.Repo.Repository.ID:",ctx.Repo.Repository.ID," ",release," ",err)
|
||||
if err != nil {
|
||||
if models.IsErrReleaseNotExist(err) {
|
||||
ctx.NotFound("LatestRelease", err)
|
||||
|
@ -387,7 +408,7 @@ func LatestRelease(ctx *context.APIContext) {
|
|||
func Readme(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/readme repository readme
|
||||
// ---
|
||||
// summary: Get the content of the readme.* file, which is a custom interface
|
||||
// summary: Get the content of the readme.* file, which is a custom interface *****
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
|
@ -975,8 +996,40 @@ func getReadmeFileFromPathExt(ctx *context.APIContext, treePath, ref string) (*n
|
|||
}
|
||||
|
||||
|
||||
// TO DO
|
||||
|
||||
func FindFiles(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/find repository find
|
||||
// ---
|
||||
// summary: The search file contains subdirectories, which is a custom interface *****
|
||||
// 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
|
||||
// - name: ref
|
||||
// in: query
|
||||
// description: "The name of the commit/branch/tag. Default the repository’s default branch (usually master)"
|
||||
// type: string
|
||||
// required: false
|
||||
// - name: q
|
||||
// in: query
|
||||
// description: "Search keywords"
|
||||
// type: string
|
||||
// required: false
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/[]*SearchFileItem"
|
||||
// "404":
|
||||
// "$ref": "#/responses/notFound"
|
||||
|
||||
treePath := ctx.Repo.TreePath
|
||||
ref:= ctx.QueryTrim("ref")
|
||||
if ref == "" {
|
||||
|
|
|
@ -2969,7 +2969,7 @@
|
|||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Get commit quantity by branch",
|
||||
"summary": "Get commit quantity by branch which is a custom interface ****",
|
||||
"operationId": "Count",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -2995,7 +2995,7 @@
|
|||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/"
|
||||
"$ref": "#/responses/CountDTO"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
|
@ -7426,7 +7426,7 @@
|
|||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Get the content of the readme.* file, which is a custom interface ****",
|
||||
"summary": "Get the content of the readme.* file, which is a custom interface *****",
|
||||
"operationId": "readme",
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -7555,6 +7555,42 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/releases/latest": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Get the last updated Release version of the repository., which is a custom interface ****",
|
||||
"operationId": "latest",
|
||||
"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/release"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/releases/{id}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
@ -15746,4 +15782,4 @@
|
|||
"TOTPHeader": []
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue