mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-24 08:02:18 +02:00
document repository API methods
This commit is contained in:
parent
e728349265
commit
3b63d83d03
@ -78,6 +78,7 @@ func main() {
|
||||
api.Use(server.SetSession(session))
|
||||
api.Use(server.SetUser(session))
|
||||
api.Use(server.SetRunner(&runner_))
|
||||
api.OPTIONS("/*path", func(c *gin.Context) {})
|
||||
|
||||
user := api.Group("/user")
|
||||
{
|
||||
|
@ -46,6 +46,98 @@ paths:
|
||||
description: The repository.
|
||||
schema:
|
||||
$ref: "#/definitions/Repo"
|
||||
patch:
|
||||
parameters:
|
||||
- name: owner
|
||||
in: path
|
||||
type: string
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
description: Updates the repository.
|
||||
security:
|
||||
- accessToken: []
|
||||
responses:
|
||||
"200":
|
||||
description: The updated repository.
|
||||
schema:
|
||||
$ref: "#/definitions/Repo"
|
||||
delete:
|
||||
parameters:
|
||||
- name: owner
|
||||
in: path
|
||||
type: string
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
description: Deletes the repository.
|
||||
security:
|
||||
- accessToken: []
|
||||
/repos/{owner}/{name}/watch:
|
||||
post:
|
||||
parameters:
|
||||
- name: owner
|
||||
in: path
|
||||
type: string
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
description: Watches the named repository.
|
||||
security:
|
||||
- accessToken: []
|
||||
|
||||
/repos/{owner}/{name}/unwatch:
|
||||
delete:
|
||||
parameters:
|
||||
- name: owner
|
||||
in: path
|
||||
type: string
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
description: Unwatches the repository.
|
||||
security:
|
||||
- accessToken: []
|
||||
|
||||
/repos/{owner}/{name}/builds:
|
||||
get:
|
||||
parameters:
|
||||
- name: owner
|
||||
in: path
|
||||
type: string
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
description: Returns recent builds for the repository based on name.
|
||||
security:
|
||||
- accessToken: []
|
||||
responses:
|
||||
"200":
|
||||
description: The recent builds.
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/definitions/Build"
|
||||
/repos/{owner}/{name}/builds/{number}:
|
||||
get:
|
||||
parameters:
|
||||
- name: owner
|
||||
in: path
|
||||
type: string
|
||||
- name: name
|
||||
in: path
|
||||
type: string
|
||||
- name: number
|
||||
in: path
|
||||
type: integer
|
||||
description: Returns the repository build by number.
|
||||
security:
|
||||
- accessToken: []
|
||||
responses:
|
||||
"200":
|
||||
description: The build.
|
||||
schema:
|
||||
$ref: "#/definitions/Build"
|
||||
/user:
|
||||
get:
|
||||
description: Returns the currently authenticated user.
|
||||
@ -210,4 +302,4 @@ definitions:
|
||||
type: integer
|
||||
format: int64
|
||||
environment:
|
||||
type: object
|
||||
type: object
|
||||
|
@ -321,6 +321,15 @@ func SetHeaders() gin.HandlerFunc {
|
||||
c.Writer.Header().Add("Strict-Transport-Security", "max-age=31536000")
|
||||
}
|
||||
|
||||
if c.Request.Method == "OPTIONS" {
|
||||
c.Writer.Header().Set("Access-Control-Allow-Methods", "GET,POST,PUT,PATCH,DELETE,OPTIONS")
|
||||
c.Writer.Header().Set("Access-Control-Allow-Headers", "Authorization")
|
||||
c.Writer.Header().Set("Allow", "HEAD,GET,POST,PUT,PATCH,DELETE,OPTIONS")
|
||||
c.Writer.Header().Set("Content-Type", "application/json")
|
||||
c.Writer.WriteHeader(200)
|
||||
return
|
||||
}
|
||||
|
||||
c.Next()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user