mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-20 08:51:01 +00:00
fix and lint swagger file (#3007)
Co-authored-by: qwerty287 <ndev@web.de>
This commit is contained in:
parent
7d43c29c20
commit
3f1f563180
18 changed files with 149 additions and 157 deletions
1
Makefile
1
Makefile
|
@ -105,6 +105,7 @@ generate: generate-swagger ## Run all code generations
|
|||
|
||||
generate-swagger: install-tools ## Run swagger code generation
|
||||
swag init -g server/api/ -g cmd/server/swagger.go --outputTypes go -output cmd/server/docs
|
||||
go generate cmd/server/swagger.go
|
||||
|
||||
generate-license-header: install-tools
|
||||
addlicense -c "Woodpecker Authors" -ignore "vendor/**" **/*.go
|
||||
|
|
|
@ -261,16 +261,9 @@ const docTemplate = `{
|
|||
"summary": "Provide pipeline status information to the CCMenu tool",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "the repository owner's name",
|
||||
"name": "owner",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "the repository name",
|
||||
"name": "name",
|
||||
"type": "integer",
|
||||
"description": "the repository id",
|
||||
"name": "repo_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
|
@ -989,6 +982,49 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"post": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Organization secrets"
|
||||
],
|
||||
"summary": "Persist/create an organization secret",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "Bearer \u003cpersonal access token\u003e",
|
||||
"description": "Insert your personal access token",
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "the org's id",
|
||||
"name": "org_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "the new secret",
|
||||
"name": "secretData",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Secret"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Secret"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/orgs/{org_id}/secrets/{secret}": {
|
||||
|
@ -1122,51 +1158,6 @@ const docTemplate = `{
|
|||
}
|
||||
}
|
||||
},
|
||||
"/orgs/{owner}/secrets": {
|
||||
"post": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"Organization secrets"
|
||||
],
|
||||
"summary": "Persist/create an organization secret",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"default": "Bearer \u003cpersonal access token\u003e",
|
||||
"description": "Insert your personal access token",
|
||||
"name": "Authorization",
|
||||
"in": "header",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "the org's id",
|
||||
"name": "org_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"description": "the new secret",
|
||||
"name": "secretData",
|
||||
"in": "body",
|
||||
"required": true,
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Secret"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Secret"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/pipelines": {
|
||||
"get": {
|
||||
"produces": [
|
||||
|
@ -2081,16 +2072,9 @@ const docTemplate = `{
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "the repository owner's name",
|
||||
"name": "owner",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "the repository name",
|
||||
"name": "name",
|
||||
"type": "integer",
|
||||
"description": "the repository id",
|
||||
"name": "repo_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
|
@ -2262,16 +2246,9 @@ const docTemplate = `{
|
|||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "the repository owner's name",
|
||||
"name": "owner",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "the repository name",
|
||||
"name": "name",
|
||||
"type": "integer",
|
||||
"description": "the repository id",
|
||||
"name": "repo_id",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
|
|
|
@ -21,6 +21,7 @@ import (
|
|||
|
||||
// generate docs/swagger.json via:
|
||||
//go:generate go run woodpecker_docs_gen.go swagger.go
|
||||
//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger@latest validate ../../docs/swagger.json
|
||||
|
||||
// setupSwaggerStaticConfig initializes static content only (contacts, title and description)
|
||||
// for dynamic configuration of e.g. hostname, etc. see router.setupSwaggerConfigAndRoutes
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
|
@ -38,8 +39,23 @@ func main() {
|
|||
panic(err)
|
||||
}
|
||||
defer f.Close()
|
||||
_, err = f.WriteString(docs.SwaggerInfo.ReadDoc())
|
||||
doc := docs.SwaggerInfo.ReadDoc()
|
||||
doc = removeHost(doc)
|
||||
_, err = f.WriteString(doc)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
func removeHost(jsonIn string) string {
|
||||
m := make(map[string]interface{})
|
||||
if err := json.Unmarshal([]byte(jsonIn), &m); err != nil {
|
||||
panic(err)
|
||||
}
|
||||
delete(m, "host")
|
||||
raw, err := json.Marshal(m)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
return string(raw)
|
||||
}
|
||||
|
|
|
@ -111,8 +111,8 @@ func GetAgentTasks(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Agent
|
||||
// @Tags Agents
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param agent path int true "the agent's id"
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param agent path int true "the agent's id"
|
||||
// @Param agentData body Agent true "the agent's data"
|
||||
func PatchAgent(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
|
@ -154,7 +154,7 @@ func PatchAgent(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Agent
|
||||
// @Tags Agents
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param agent body Agent true "the agent's data (only 'name' and 'no_schedule' are read)"
|
||||
func PostAgent(c *gin.Context) {
|
||||
in := &model.Agent{}
|
||||
|
|
|
@ -42,7 +42,7 @@ import (
|
|||
// @Produce image/svg+xml
|
||||
// @Success 200
|
||||
// @Tags Badges
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param repo_id path int true "the repository id"
|
||||
func GetBadge(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
|
||||
|
@ -97,8 +97,7 @@ func GetBadge(c *gin.Context) {
|
|||
// @Produce xml
|
||||
// @Success 200
|
||||
// @Tags Badges
|
||||
// @Param owner path string true "the repository owner's name"
|
||||
// @Param name path string true "the repository name"
|
||||
// @Param repo_id path int true "the repository id"
|
||||
func GetCC(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
var repo *model.Repo
|
||||
|
|
|
@ -102,7 +102,7 @@ func RunCron(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Cron
|
||||
// @Tags Repository cron jobs
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param cronJob body Cron true "the new cron job"
|
||||
func PostCron(c *gin.Context) {
|
||||
|
@ -158,9 +158,9 @@ func PostCron(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Cron
|
||||
// @Tags Repository cron jobs
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param cron path string true "the cron job id"
|
||||
// @Param cron path string true "the cron job id"
|
||||
// @Param cronJob body Cron true "the cron job data"
|
||||
func PatchCron(c *gin.Context) {
|
||||
repo := session.Repo(c)
|
||||
|
|
|
@ -75,7 +75,7 @@ func GetGlobalSecret(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Secret
|
||||
// @Tags Secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param secret body Secret true "the secret object data"
|
||||
func PostGlobalSecret(c *gin.Context) {
|
||||
in := new(model.Secret)
|
||||
|
@ -107,8 +107,8 @@ func PostGlobalSecret(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Secret
|
||||
// @Tags Secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param secret path string true "the secret's name"
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param secret path string true "the secret's name"
|
||||
// @Param secretData body Secret true "the secret's data"
|
||||
func PatchGlobalSecret(c *gin.Context) {
|
||||
name := c.Param("secret")
|
||||
|
|
|
@ -36,13 +36,13 @@ import (
|
|||
|
||||
// GetQueueInfo
|
||||
//
|
||||
// @Summary Get pipeline queue information
|
||||
// @Summary Get pipeline queue information
|
||||
// @Description TODO: link the InfoT response object - this is blocked, until the `swaggo/swag` tool dependency is v1.18.12 or newer
|
||||
// @Router /queue/info [get]
|
||||
// @Produce json
|
||||
// @Success 200 {object} map[string]string
|
||||
// @Tags Pipeline queues
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Router /queue/info [get]
|
||||
// @Produce json
|
||||
// @Success 200 {object} map[string]string
|
||||
// @Tags Pipeline queues
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
func GetQueueInfo(c *gin.Context) {
|
||||
c.IndentedJSON(http.StatusOK,
|
||||
server.Config.Services.Queue.Info(c),
|
||||
|
|
|
@ -32,7 +32,7 @@ import (
|
|||
// @Router /orgs/{org_id}/secrets/{secret} [get]
|
||||
// @Produce json
|
||||
// @Success 200 {object} Secret
|
||||
// @Tags Organization secrets
|
||||
// @Tags Organization secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param org_id path string true "the org's id"
|
||||
// @Param secret path string true "the secret's name"
|
||||
|
@ -59,11 +59,11 @@ func GetOrgSecret(c *gin.Context) {
|
|||
// @Router /orgs/{org_id}/secrets [get]
|
||||
// @Produce json
|
||||
// @Success 200 {array} Secret
|
||||
// @Tags Organization secrets
|
||||
// @Tags Organization secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param org_id path string true "the org's id"
|
||||
// @Param org_id path string true "the org's id"
|
||||
// @Param page query int false "for response pagination, page offset number" default(1)
|
||||
// @Param perPage query int false "for response pagination, max items per page" default(50)
|
||||
// @Param perPage query int false "for response pagination, max items per page" default(50)
|
||||
func GetOrgSecretList(c *gin.Context) {
|
||||
orgID, err := strconv.ParseInt(c.Param("org_id"), 10, 64)
|
||||
if err != nil {
|
||||
|
@ -87,12 +87,12 @@ func GetOrgSecretList(c *gin.Context) {
|
|||
// PostOrgSecret
|
||||
//
|
||||
// @Summary Persist/create an organization secret
|
||||
// @Router /orgs/{owner}/secrets [post]
|
||||
// @Router /orgs/{org_id}/secrets [post]
|
||||
// @Produce json
|
||||
// @Success 200 {object} Secret
|
||||
// @Tags Organization secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param org_id path string true "the org's id"
|
||||
// @Tags Organization secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param org_id path string true "the org's id"
|
||||
// @Param secretData body Secret true "the new secret"
|
||||
func PostOrgSecret(c *gin.Context) {
|
||||
orgID, err := strconv.ParseInt(c.Param("org_id"), 10, 64)
|
||||
|
@ -131,10 +131,10 @@ func PostOrgSecret(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Secret
|
||||
// @Tags Organization secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param org_id path string true "the org's id"
|
||||
// @Param secret path string true "the secret's name"
|
||||
// @Param secretData body Secret true "the update secret data"
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param org_id path string true "the org's id"
|
||||
// @Param secret path string true "the secret's name"
|
||||
// @Param secretData body Secret true "the update secret data"
|
||||
func PatchOrgSecret(c *gin.Context) {
|
||||
name := c.Param("secret")
|
||||
orgID, err := strconv.ParseInt(c.Param("org_id"), 10, 64)
|
||||
|
@ -184,8 +184,8 @@ func PatchOrgSecret(c *gin.Context) {
|
|||
// @Success 204
|
||||
// @Tags Organization secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param org_id path string true "the org's id"
|
||||
// @Param secret path string true "the secret's name"
|
||||
// @Param org_id path string true "the org's id"
|
||||
// @Param secret path string true "the secret's name"
|
||||
func DeleteOrgSecret(c *gin.Context) {
|
||||
name := c.Param("secret")
|
||||
orgID, err := strconv.ParseInt(c.Param("org_id"), 10, 64)
|
||||
|
|
|
@ -53,7 +53,7 @@ func GetOrgs(c *gin.Context) {
|
|||
// @Success 204
|
||||
// @Tags Orgs
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param id path string true "the org's id"
|
||||
// @Param id path string true "the org's id"
|
||||
func DeleteOrg(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
|
||||
|
|
|
@ -41,9 +41,9 @@ import (
|
|||
// @Router /repos/{repo_id}/pipelines [post]
|
||||
// @Produce json
|
||||
// @Success 200 {object} Pipeline
|
||||
// @Tags Pipelines
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Tags Pipelines
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param options body PipelineOptions true "the options for the pipeline to run"
|
||||
func CreatePipeline(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
|
@ -100,9 +100,9 @@ func createTmpPipeline(event model.WebhookEvent, commitSHA string, repo *model.R
|
|||
// @Success 200 {array} Pipeline
|
||||
// @Tags Pipelines
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param page query int false "for response pagination, page offset number" default(1)
|
||||
// @Param perPage query int false "for response pagination, max items per page" default(50)
|
||||
// @Param perPage query int false "for response pagination, max items per page" default(50)
|
||||
func GetPipelines(c *gin.Context) {
|
||||
repo := session.Repo(c)
|
||||
|
||||
|
@ -122,8 +122,8 @@ func GetPipelines(c *gin.Context) {
|
|||
// @Success 200 {object} Pipeline
|
||||
// @Tags Pipelines
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param number path int true "the number of the pipeline, OR 'latest'"
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param number path int true "the number of the pipeline, OR 'latest'"
|
||||
func GetPipeline(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
if c.Param("number") == "latest" {
|
||||
|
@ -174,12 +174,12 @@ func GetPipelineLast(c *gin.Context) {
|
|||
// @Summary Log information
|
||||
// @Router /repos/{repo_id}/logs/{number}/{stepID} [get]
|
||||
// @Produce json
|
||||
// @Success 200 {array} LogEntry
|
||||
// @Tags Pipeline logs
|
||||
// @Success 200 {array} LogEntry
|
||||
// @Tags Pipeline logs
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param number path int true "the number of the pipeline"
|
||||
// @Param stepID path int true "the step id"
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param number path int true "the number of the pipeline"
|
||||
// @Param stepID path int true "the step id"
|
||||
func GetStepLogs(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
repo := session.Repo(c)
|
||||
|
@ -231,7 +231,7 @@ func GetStepLogs(c *gin.Context) {
|
|||
// @Router /repos/{repo_id}/pipelines/{number}/config [get]
|
||||
// @Produce json
|
||||
// @Success 200 {array} Config
|
||||
// @Tags Pipelines
|
||||
// @Tags Pipelines
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param number path int true "the number of the pipeline"
|
||||
|
@ -378,8 +378,7 @@ func GetPipelineQueue(c *gin.Context) {
|
|||
// @Success 200 {object} Pipeline
|
||||
// @Tags Pipelines
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param owner path string true "the repository owner's name"
|
||||
// @Param name path string true "the repository name"
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param number path int true "the number of the pipeline"
|
||||
// @Param event query string false "override the event type"
|
||||
// @Param deploy_to query string false "override the target deploy value"
|
||||
|
|
|
@ -54,8 +54,8 @@ func GetRegistry(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Registry
|
||||
// @Tags Repository registries
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param registry body Registry true "the new registry data"
|
||||
func PostRegistry(c *gin.Context) {
|
||||
repo := session.Repo(c)
|
||||
|
@ -91,9 +91,9 @@ func PostRegistry(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Registry
|
||||
// @Tags Repository registries
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param registry path string true "the registry name"
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param registry path string true "the registry name"
|
||||
// @Param registryData body Registry true "the attributes for the registry"
|
||||
func PatchRegistry(c *gin.Context) {
|
||||
var (
|
||||
|
|
|
@ -42,8 +42,8 @@ import (
|
|||
// @Produce json
|
||||
// @Success 200 {object} Repo
|
||||
// @Tags Repositories
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param forge_remote_id query string true "the id of a repository at the forge"
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param forge_remote_id query string true "the id of a repository at the forge"
|
||||
func PostRepo(c *gin.Context) {
|
||||
forge := server.Config.Services.Forge
|
||||
_store := store.FromContext(c)
|
||||
|
@ -196,8 +196,8 @@ func PostRepo(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Repo
|
||||
// @Tags Repositories
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param repo body RepoPatch true "the repository's information"
|
||||
func PatchRepo(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
|
@ -318,8 +318,7 @@ func GetRepo(c *gin.Context) {
|
|||
// @Success 200 {object} Perm
|
||||
// @Tags Repositories
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param owner path string true "the repository owner's name"
|
||||
// @Param name path string true "the repository name"
|
||||
// @Param repo_id path int true "the repository id"
|
||||
func GetRepoPermissions(c *gin.Context) {
|
||||
perm := session.Perm(c)
|
||||
c.JSON(http.StatusOK, perm)
|
||||
|
@ -523,7 +522,7 @@ func MoveRepo(c *gin.Context) {
|
|||
// @Success 200 {array} Repo
|
||||
// @Tags Repositories
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param active query bool false "only list active repos"
|
||||
// @Param active query bool false "only list active repos"
|
||||
// @Param page query int false "for response pagination, page offset number" default(1)
|
||||
// @Param perPage query int false "for response pagination, max items per page" default(50)
|
||||
func GetAllRepos(c *gin.Context) {
|
||||
|
|
|
@ -55,7 +55,7 @@ func GetSecret(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Secret
|
||||
// @Tags Repository secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param secret body Secret true "the new secret"
|
||||
func PostSecret(c *gin.Context) {
|
||||
|
@ -91,9 +91,9 @@ func PostSecret(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} Secret
|
||||
// @Tags Repository secrets
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param secretName path string true "the secret name"
|
||||
// @Param secretName path string true "the secret name"
|
||||
// @Param secret body Secret true "the secret itself"
|
||||
func PatchSecret(c *gin.Context) {
|
||||
var (
|
||||
|
|
|
@ -36,11 +36,11 @@ import (
|
|||
|
||||
// EventStreamSSE
|
||||
//
|
||||
// @Summary Event stream
|
||||
// @Summary Event stream
|
||||
// @Description event source streaming for compatibility with quic and http2
|
||||
// @Router /stream/events [get]
|
||||
// @Produce plain
|
||||
// @Success 200
|
||||
// @Router /stream/events [get]
|
||||
// @Produce plain
|
||||
// @Success 200
|
||||
// @Tags Events
|
||||
func EventStreamSSE(c *gin.Context) {
|
||||
c.Header("Content-Type", "text/event-stream")
|
||||
|
@ -128,10 +128,10 @@ func EventStreamSSE(c *gin.Context) {
|
|||
// @Router /stream/logs/{repo_id}/{pipeline}/{stepID} [get]
|
||||
// @Produce plain
|
||||
// @Success 200
|
||||
// @Tags Pipeline logs
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param pipeline path int true "the number of the pipeline"
|
||||
// @Param stepID path int true "the step id"
|
||||
// @Tags Pipeline logs
|
||||
// @Param repo_id path int true "the repository id"
|
||||
// @Param pipeline path int true "the number of the pipeline"
|
||||
// @Param stepID path int true "the step id"
|
||||
func LogStreamSSE(c *gin.Context) {
|
||||
c.Header("Content-Type", "text/event-stream")
|
||||
c.Header("Cache-Control", "no-cache")
|
||||
|
|
|
@ -83,7 +83,7 @@ func GetFeed(c *gin.Context) {
|
|||
// @Success 200 {array} Repo
|
||||
// @Tags User
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param all query bool false "query all repos, including inactive ones"
|
||||
// @Param all query bool false "query all repos, including inactive ones"
|
||||
func GetRepos(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
_forge := server.Config.Services.Forge
|
||||
|
@ -141,12 +141,12 @@ func GetRepos(c *gin.Context) {
|
|||
|
||||
// PostToken
|
||||
//
|
||||
// @Summary Return the token of the current user as string
|
||||
// @Router /user/token [post]
|
||||
// @Produce plain
|
||||
// @Success 200
|
||||
// @Tags User
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Summary Return the token of the current user as string
|
||||
// @Router /user/token [post]
|
||||
// @Produce plain
|
||||
// @Success 200
|
||||
// @Tags User
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
func PostToken(c *gin.Context) {
|
||||
user := session.User(c)
|
||||
tokenString, err := token.New(token.UserToken, user.Login).Sign(user.Hash)
|
||||
|
|
|
@ -74,8 +74,8 @@ func GetUser(c *gin.Context) {
|
|||
// @Accept json
|
||||
// @Success 200 {object} User
|
||||
// @Tags Users
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param login path string true "the user's login name"
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param login path string true "the user's login name"
|
||||
// @Param user body User true "the user's data"
|
||||
func PatchUser(c *gin.Context) {
|
||||
_store := store.FromContext(c)
|
||||
|
@ -116,7 +116,7 @@ func PatchUser(c *gin.Context) {
|
|||
// @Produce json
|
||||
// @Success 200 {object} User
|
||||
// @Tags Users
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
|
||||
// @Param user body User true "the user's data"
|
||||
func PostUser(c *gin.Context) {
|
||||
in := &model.User{}
|
||||
|
|
Loading…
Reference in a new issue