Cleanup api docs and ts api-client options (#3663)

This commit is contained in:
Anbraten 2024-05-01 11:50:41 +02:00 committed by GitHub
parent 4d2610c22e
commit dbd91d3884
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
34 changed files with 207 additions and 189 deletions

View file

@ -78,11 +78,11 @@ func FormatFlag(tmpl string, hidden ...bool) *cli.StringFlag {
var RepoFlag = &cli.StringFlag{
Name: "repository",
Aliases: []string{"repo"},
Usage: "repository id or full-name (e.g. 134 or octocat/hello-world)",
Usage: "repository id or full name (e.g. 134 or octocat/hello-world)",
}
var OrgFlag = &cli.StringFlag{
Name: "organization",
Aliases: []string{"org"},
Usage: "organization id or full-name (e.g. 123 or octocat)",
Usage: "organization id or full name (e.g. 123 or octocat)",
}

View file

@ -26,7 +26,7 @@ const docTemplate = `{
"tags": [
"Agents"
],
"summary": "Get agent list",
"summary": "List agents",
"parameters": [
{
"type": "string",
@ -64,13 +64,14 @@ const docTemplate = `{
}
},
"post": {
"description": "Creates a new agent with a random token",
"produces": [
"application/json"
],
"tags": [
"Agents"
],
"summary": "Create a new agent with a random token so a new agent can connect to the server",
"summary": "Create a new agent",
"parameters": [
{
"type": "string",
@ -108,7 +109,7 @@ const docTemplate = `{
"tags": [
"Agents"
],
"summary": "Get agent information",
"summary": "Get an agent",
"parameters": [
{
"type": "string",
@ -173,7 +174,7 @@ const docTemplate = `{
"tags": [
"Agents"
],
"summary": "Update agent information",
"summary": "Update an agent",
"parameters": [
{
"type": "string",
@ -218,7 +219,7 @@ const docTemplate = `{
"tags": [
"Agents"
],
"summary": "Get agent tasks",
"summary": "List agent tasks",
"parameters": [
{
"type": "string",
@ -283,7 +284,7 @@ const docTemplate = `{
"tags": [
"Badges"
],
"summary": "Get status badge, SVG format",
"summary": "Get status of pipeline as SVG badge",
"parameters": [
{
"type": "integer",
@ -744,7 +745,7 @@ const docTemplate = `{
"tags": [
"Organizations"
],
"summary": "Lookup organization by full-name",
"summary": "Lookup an organization by full name",
"parameters": [
{
"type": "string",
@ -756,7 +757,7 @@ const docTemplate = `{
},
{
"type": "string",
"description": "the organizations full-name / slug",
"description": "the organizations full name / slug",
"name": "org_full_name",
"in": "path",
"required": true
@ -781,7 +782,7 @@ const docTemplate = `{
"tags": [
"Orgs"
],
"summary": "Get all orgs",
"summary": "List organizations",
"parameters": [
{
"type": "string",
@ -828,7 +829,7 @@ const docTemplate = `{
"tags": [
"Orgs"
],
"summary": "Delete an org",
"summary": "Delete an organization",
"parameters": [
{
"type": "string",
@ -861,7 +862,7 @@ const docTemplate = `{
"tags": [
"Organization"
],
"summary": "Get organization by id",
"summary": "Get an organization",
"parameters": [
{
"type": "string",
@ -900,7 +901,7 @@ const docTemplate = `{
"tags": [
"Organization permissions"
],
"summary": "Get the permissions of the current user in the given organization",
"summary": "Get the permissions of the currently authenticated user for the given organization",
"parameters": [
{
"type": "string",
@ -939,7 +940,7 @@ const docTemplate = `{
"tags": [
"Organization secrets"
],
"summary": "Get the organization secret list",
"summary": "List organization secrets",
"parameters": [
{
"type": "string",
@ -990,7 +991,7 @@ const docTemplate = `{
"tags": [
"Organization secrets"
],
"summary": "Persist/create an organization secret",
"summary": "Create an organization secret",
"parameters": [
{
"type": "string",
@ -1035,7 +1036,7 @@ const docTemplate = `{
"tags": [
"Organization secrets"
],
"summary": "Get the named organization secret",
"summary": "Get a organization secret by name",
"parameters": [
{
"type": "string",
@ -1076,7 +1077,7 @@ const docTemplate = `{
"tags": [
"Organization secrets"
],
"summary": "Delete the named secret from an organization",
"summary": "Delete an organization secret by name",
"parameters": [
{
"type": "string",
@ -1114,7 +1115,7 @@ const docTemplate = `{
"tags": [
"Organization secrets"
],
"summary": "Update an organization secret",
"summary": "Update an organization secret by name",
"parameters": [
{
"type": "string",
@ -1166,7 +1167,7 @@ const docTemplate = `{
"tags": [
"Pipeline queues"
],
"summary": "List pipeline queues",
"summary": "List pipelines in queue",
"parameters": [
{
"type": "string",
@ -1257,7 +1258,7 @@ const docTemplate = `{
"tags": [
"Pipeline queues"
],
"summary": "Pause a pipeline queue",
"summary": "Pause the pipeline queue",
"parameters": [
{
"type": "string",
@ -1283,7 +1284,7 @@ const docTemplate = `{
"tags": [
"Pipeline queues"
],
"summary": "Resume a pipeline queue",
"summary": "Resume the pipeline queue",
"parameters": [
{
"type": "string",
@ -1303,13 +1304,14 @@ const docTemplate = `{
},
"/repos": {
"get": {
"description": "Returns a list of all repositories. Requires admin rights.",
"produces": [
"application/json"
],
"tags": [
"Repositories"
],
"summary": "List all repositories on the server. Requires admin rights.",
"summary": "List all repositories on the server",
"parameters": [
{
"type": "string",
@ -1395,7 +1397,7 @@ const docTemplate = `{
"tags": [
"Repositories"
],
"summary": "Get repository by full-name",
"summary": "Lookup a repository by full name",
"parameters": [
{
"type": "string",
@ -1407,7 +1409,7 @@ const docTemplate = `{
},
{
"type": "string",
"description": "the repository full-name / slug",
"description": "the repository full name / slug",
"name": "repo_full_name",
"in": "path",
"required": true
@ -1425,13 +1427,14 @@ const docTemplate = `{
},
"/repos/repair": {
"post": {
"description": "Executes a repair process on all repositories. Requires admin rights.",
"produces": [
"text/plain"
],
"tags": [
"Repositories"
],
"summary": "Repair all repositories on the server. Requires admin rights.",
"summary": "Repair all repositories on the server",
"parameters": [
{
"type": "string",
@ -1457,7 +1460,7 @@ const docTemplate = `{
"tags": [
"Repositories"
],
"summary": "Get repository information",
"summary": "Get a repository",
"parameters": [
{
"type": "string",
@ -1525,7 +1528,7 @@ const docTemplate = `{
"tags": [
"Repositories"
],
"summary": "Change a repository",
"summary": "Update a repository",
"parameters": [
{
"type": "string",
@ -1570,7 +1573,7 @@ const docTemplate = `{
"tags": [
"Repositories"
],
"summary": "Get repository branches",
"summary": "Get branches of a repository",
"parameters": [
{
"type": "string",
@ -1623,7 +1626,7 @@ const docTemplate = `{
"tags": [
"Repositories"
],
"summary": "Change a repository's owner, to the one holding the access token",
"summary": "Change a repository's owner to the currently authenticated user",
"parameters": [
{
"type": "string",
@ -1659,7 +1662,7 @@ const docTemplate = `{
"tags": [
"Repository cron jobs"
],
"summary": "Get the cron job list",
"summary": "List cron jobs",
"parameters": [
{
"type": "string",
@ -1710,7 +1713,7 @@ const docTemplate = `{
"tags": [
"Repository cron jobs"
],
"summary": "Persist/creat a cron job",
"summary": "Create a cron job",
"parameters": [
{
"type": "string",
@ -1755,7 +1758,7 @@ const docTemplate = `{
"tags": [
"Repository cron jobs"
],
"summary": "Get a cron job by id",
"summary": "Get a cron job",
"parameters": [
{
"type": "string",
@ -1837,7 +1840,7 @@ const docTemplate = `{
"tags": [
"Repository cron jobs"
],
"summary": "Delete a cron job by id",
"summary": "Delete a cron job",
"parameters": [
{
"type": "string",
@ -1927,7 +1930,7 @@ const docTemplate = `{
"tags": [
"Pipeline logs"
],
"summary": "Deletes log",
"summary": "Deletes all logs of a pipeline",
"parameters": [
{
"type": "string",
@ -1967,7 +1970,7 @@ const docTemplate = `{
"tags": [
"Pipeline logs"
],
"summary": "Log information",
"summary": "Get logs for a pipeline step",
"parameters": [
{
"type": "string",
@ -2020,7 +2023,7 @@ const docTemplate = `{
"tags": [
"Pipeline logs"
],
"summary": "Deletes step log",
"summary": "Delete step logs of a pipeline",
"parameters": [
{
"type": "string",
@ -2108,7 +2111,7 @@ const docTemplate = `{
"tags": [
"Repositories"
],
"summary": "Repository permission information",
"summary": "Check current authenticated users access to the repository",
"parameters": [
{
"type": "string",
@ -2138,13 +2141,14 @@ const docTemplate = `{
},
"/repos/{repo_id}/pipelines": {
"get": {
"description": "Get a list of pipelines for a repository.",
"produces": [
"application/json"
],
"tags": [
"Pipelines"
],
"summary": "Get pipelines, current running and past ones",
"summary": "List repository pipelines",
"parameters": [
{
"type": "string",
@ -2207,7 +2211,7 @@ const docTemplate = `{
"tags": [
"Pipelines"
],
"summary": "Run/trigger a pipelines",
"summary": "Trigger a manual pipeline",
"parameters": [
{
"type": "string",
@ -2252,7 +2256,7 @@ const docTemplate = `{
"tags": [
"Pipelines"
],
"summary": "Pipeline information by number",
"summary": "Get a repositories pipeline",
"parameters": [
{
"type": "string",
@ -2347,7 +2351,7 @@ const docTemplate = `{
"tags": [
"Pipelines"
],
"summary": "Delete pipeline",
"summary": "Delete a pipeline",
"parameters": [
{
"type": "string",
@ -2387,7 +2391,7 @@ const docTemplate = `{
"tags": [
"Pipelines"
],
"summary": "Start pipelines in gated repos",
"summary": "Approve and start a pipeline",
"parameters": [
{
"type": "string",
@ -2430,7 +2434,7 @@ const docTemplate = `{
"tags": [
"Pipelines"
],
"summary": "Cancels a pipeline",
"summary": "Cancel a pipeline",
"parameters": [
{
"type": "string",
@ -2470,7 +2474,7 @@ const docTemplate = `{
"tags": [
"Pipelines"
],
"summary": "Pipeline configuration",
"summary": "Get configuration files for a pipeline",
"parameters": [
{
"type": "string",
@ -2516,7 +2520,7 @@ const docTemplate = `{
"tags": [
"Pipelines"
],
"summary": "Decline pipelines in gated repos",
"summary": "Decline a pipeline",
"parameters": [
{
"type": "string",
@ -2559,7 +2563,7 @@ const docTemplate = `{
"tags": [
"Repositories"
],
"summary": "List active pull requests",
"summary": "List active pull requests of a repository",
"parameters": [
{
"type": "string",
@ -2612,7 +2616,7 @@ const docTemplate = `{
"tags": [
"Repository registries"
],
"summary": "Get the registry list",
"summary": "List registries",
"parameters": [
{
"type": "string",
@ -2663,7 +2667,7 @@ const docTemplate = `{
"tags": [
"Repository registries"
],
"summary": "Persist/create a registry",
"summary": "Create a registry",
"parameters": [
{
"type": "string",
@ -2708,7 +2712,7 @@ const docTemplate = `{
"tags": [
"Repository registries"
],
"summary": "Get a named registry",
"summary": "Get a registry by name",
"parameters": [
{
"type": "string",
@ -2749,7 +2753,7 @@ const docTemplate = `{
"tags": [
"Repository registries"
],
"summary": "Delete a named registry",
"summary": "Delete a registry by name",
"parameters": [
{
"type": "string",
@ -2787,7 +2791,7 @@ const docTemplate = `{
"tags": [
"Repository registries"
],
"summary": "Update a named registry",
"summary": "Update a registry by name",
"parameters": [
{
"type": "string",
@ -2872,7 +2876,7 @@ const docTemplate = `{
"tags": [
"Repository secrets"
],
"summary": "Get the secret list",
"summary": "List repository secrets",
"parameters": [
{
"type": "string",
@ -2923,7 +2927,7 @@ const docTemplate = `{
"tags": [
"Repository secrets"
],
"summary": "Persist/create a secret",
"summary": "Create a repository secret",
"parameters": [
{
"type": "string",
@ -2968,7 +2972,7 @@ const docTemplate = `{
"tags": [
"Repository secrets"
],
"summary": "Get a named secret",
"summary": "Get a repository secret by name",
"parameters": [
{
"type": "string",
@ -3009,7 +3013,7 @@ const docTemplate = `{
"tags": [
"Repository secrets"
],
"summary": "Delete a named secret",
"summary": "Delete a repository secret by name",
"parameters": [
{
"type": "string",
@ -3047,7 +3051,7 @@ const docTemplate = `{
"tags": [
"Repository secrets"
],
"summary": "Update a named secret",
"summary": "Update a repository secret by name",
"parameters": [
{
"type": "string",
@ -3099,7 +3103,7 @@ const docTemplate = `{
"tags": [
"Secrets"
],
"summary": "Get the global secret list",
"summary": "List global secrets",
"parameters": [
{
"type": "string",
@ -3143,7 +3147,7 @@ const docTemplate = `{
"tags": [
"Secrets"
],
"summary": "Persist/create a global secret",
"summary": "Create a global secret",
"parameters": [
{
"type": "string",
@ -3311,14 +3315,14 @@ const docTemplate = `{
},
"/stream/events": {
"get": {
"description": "event source streaming for compatibility with quic and http2",
"description": "With quic and http2 support",
"produces": [
"text/plain"
],
"tags": [
"Events"
],
"summary": "Event stream",
"summary": "Stream events like pipeline updates",
"responses": {
"200": {
"description": "OK"
@ -3334,7 +3338,7 @@ const docTemplate = `{
"tags": [
"Pipeline logs"
],
"summary": "Log stream",
"summary": "Stream logs of a pipeline step",
"parameters": [
{
"type": "integer",
@ -3373,7 +3377,7 @@ const docTemplate = `{
"tags": [
"User"
],
"summary": "Returns the currently authenticated user.",
"summary": "Get the currently authenticated user",
"parameters": [
{
"type": "string",
@ -3396,14 +3400,14 @@ const docTemplate = `{
},
"/user/feed": {
"get": {
"description": "Feed entries can be used to display information on the latest builds.",
"description": "The feed lists the most recent pipeline for the currently authenticated user.",
"produces": [
"application/json"
],
"tags": [
"User"
],
"summary": "A feed entry for a build.",
"summary": "Get the currently authenticaed users pipeline feed",
"parameters": [
{
"type": "string",
@ -3418,7 +3422,10 @@ const docTemplate = `{
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/Feed"
"type": "array",
"items": {
"$ref": "#/definitions/Feed"
}
}
}
}
@ -3433,7 +3440,7 @@ const docTemplate = `{
"tags": [
"User"
],
"summary": "Get user's repos",
"summary": "Get user's repositories",
"parameters": [
{
"type": "string",
@ -3523,7 +3530,7 @@ const docTemplate = `{
"tags": [
"Users"
],
"summary": "Get all users",
"summary": "List users",
"parameters": [
{
"type": "string",
@ -3677,7 +3684,7 @@ const docTemplate = `{
"tags": [
"Users"
],
"summary": "Change a user",
"summary": "Update a user",
"parameters": [
{
"type": "string",

8
go.sum
View file

@ -540,8 +540,6 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30=
golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
@ -575,8 +573,6 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc=
golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w=
golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@ -623,8 +619,6 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o=
golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
@ -633,8 +627,6 @@ golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuX
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.15.0/go.mod h1:BDl952bC7+uMoWR75FIrCDx79TPU9oHkTZ9yRbYOrX0=
golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q=
golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View file

@ -30,7 +30,7 @@ import (
// GetAgents
//
// @Summary Get agent list
// @Summary List agents
// @Router /agents [get]
// @Produce json
// @Success 200 {array} Agent
@ -49,7 +49,7 @@ func GetAgents(c *gin.Context) {
// GetAgent
//
// @Summary Get agent information
// @Summary Get an agent
// @Router /agents/{agent} [get]
// @Produce json
// @Success 200 {object} Agent
@ -73,7 +73,7 @@ func GetAgent(c *gin.Context) {
// GetAgentTasks
//
// @Summary Get agent tasks
// @Summary List agent tasks
// @Router /agents/{agent}/tasks [get]
// @Produce json
// @Success 200 {array} Task
@ -106,7 +106,7 @@ func GetAgentTasks(c *gin.Context) {
// PatchAgent
//
// @Summary Update agent information
// @Summary Update an agent
// @Router /agents/{agent} [patch]
// @Produce json
// @Success 200 {object} Agent
@ -152,7 +152,8 @@ func PatchAgent(c *gin.Context) {
// PostAgent
//
// @Summary Create a new agent with a random token so a new agent can connect to the server
// @Summary Create a new agent
// @Description Creates a new agent with a random token
// @Router /agents [post]
// @Produce json
// @Success 200 {object} Agent

View file

@ -37,7 +37,7 @@ import (
// GetBadge
//
// @Summary Get status badge, SVG format
// @Summary Get status of pipeline as SVG badge
// @Router /badges/{repo_id}/status.svg [get]
// @Produce image/svg+xml
// @Success 200

View file

@ -32,7 +32,7 @@ import (
// GetCron
//
// @Summary Get a cron job by id
// @Summary Get a cron job
// @Router /repos/{repo_id}/cron/{cron} [get]
// @Produce json
// @Success 200 {object} Cron
@ -98,7 +98,7 @@ func RunCron(c *gin.Context) {
// PostCron
//
// @Summary Persist/creat a cron job
// @Summary Create a cron job
// @Router /repos/{repo_id}/cron [post]
// @Produce json
// @Success 200 {object} Cron
@ -233,7 +233,7 @@ func PatchCron(c *gin.Context) {
// GetCronList
//
// @Summary Get the cron job list
// @Summary List cron jobs
// @Router /repos/{repo_id}/cron [get]
// @Produce json
// @Success 200 {array} Cron
@ -254,7 +254,7 @@ func GetCronList(c *gin.Context) {
// DeleteCron
//
// @Summary Delete a cron job by id
// @Summary Delete a cron job
// @Router /repos/{repo_id}/cron/{cron} [delete]
// @Produce plain
// @Success 204

View file

@ -26,7 +26,7 @@ import (
// GetGlobalSecretList
//
// @Summary Get the global secret list
// @Summary List global secrets
// @Router /secrets [get]
// @Produce json
// @Success 200 {array} Secret
@ -71,7 +71,7 @@ func GetGlobalSecret(c *gin.Context) {
// PostGlobalSecret
//
// @Summary Persist/create a global secret
// @Summary Create a global secret
// @Router /secrets [post]
// @Produce json
// @Success 200 {object} Secret

View file

@ -52,7 +52,7 @@ func GetQueueInfo(c *gin.Context) {
// PauseQueue
//
// @Summary Pause a pipeline queue
// @Summary Pause the pipeline queue
// @Router /queue/pause [post]
// @Produce plain
// @Success 204
@ -65,7 +65,7 @@ func PauseQueue(c *gin.Context) {
// ResumeQueue
//
// @Summary Resume a pipeline queue
// @Summary Resume the pipeline queue
// @Router /queue/resume [post]
// @Produce plain
// @Success 204

View file

@ -30,7 +30,7 @@ import (
// GetOrg
//
// @Summary Get organization by id
// @Summary Get an organization
// @Router /orgs/{org_id} [get]
// @Produce json
// @Success 200 {array} Org
@ -57,7 +57,7 @@ func GetOrg(c *gin.Context) {
// GetOrgPermissions
//
// @Summary Get the permissions of the current user in the given organization
// @Summary Get the permissions of the currently authenticated user for the given organization
// @Router /orgs/{org_id}/permissions [get]
// @Produce json
// @Success 200 {array} OrgPerm
@ -114,13 +114,13 @@ func GetOrgPermissions(c *gin.Context) {
// LookupOrg
//
// @Summary Lookup organization by full-name
// @Summary Lookup an organization by full name
// @Router /org/lookup/{org_full_name} [get]
// @Produce json
// @Success 200 {object} Org
// @Tags Organizations
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
// @Param org_full_name path string true "the organizations full-name / slug"
// @Param org_full_name path string true "the organizations full name / slug"
func LookupOrg(c *gin.Context) {
_store := store.FromContext(c)
user := session.User(c)

View file

@ -27,7 +27,7 @@ import (
// GetOrgSecret
//
// @Summary Get the named organization secret
// @Summary Get a organization secret by name
// @Router /orgs/{org_id}/secrets/{secret} [get]
// @Produce json
// @Success 200 {object} Secret
@ -55,7 +55,7 @@ func GetOrgSecret(c *gin.Context) {
// GetOrgSecretList
//
// @Summary Get the organization secret list
// @Summary List organization secrets
// @Router /orgs/{org_id}/secrets [get]
// @Produce json
// @Success 200 {array} Secret
@ -87,7 +87,7 @@ func GetOrgSecretList(c *gin.Context) {
// PostOrgSecret
//
// @Summary Persist/create an organization secret
// @Summary Create an organization secret
// @Router /orgs/{org_id}/secrets [post]
// @Produce json
// @Success 200 {object} Secret
@ -129,7 +129,7 @@ func PostOrgSecret(c *gin.Context) {
// PatchOrgSecret
//
// @Summary Update an organization secret
// @Summary Update an organization secret by name
// @Router /orgs/{org_id}/secrets/{secret} [patch]
// @Produce json
// @Success 200 {object} Secret
@ -183,7 +183,7 @@ func PatchOrgSecret(c *gin.Context) {
// DeleteOrgSecret
//
// @Summary Delete the named secret from an organization
// @Summary Delete an organization secret by name
// @Router /orgs/{org_id}/secrets/{secret} [delete]
// @Produce plain
// @Success 204

View file

@ -26,7 +26,7 @@ import (
// GetOrgs
//
// @Summary Get all orgs
// @Summary List organizations
// @Description Returns all registered orgs in the system. Requires admin rights.
// @Router /orgs [get]
// @Produce json
@ -46,7 +46,7 @@ func GetOrgs(c *gin.Context) {
// DeleteOrg
//
// @Summary Delete an org
// @Summary Delete an organization
// @Description Deletes the given org. Requires admin rights.
// @Router /orgs/{id} [delete]
// @Produce plain

View file

@ -38,7 +38,7 @@ import (
// CreatePipeline
//
// @Summary Run/trigger a pipelines
// @Summary Trigger a manual pipeline
// @Router /repos/{repo_id}/pipelines [post]
// @Produce json
// @Success 200 {object} Pipeline
@ -100,7 +100,8 @@ func createTmpPipeline(event model.WebhookEvent, commit *model.Commit, user *mod
// GetPipelines
//
// @Summary Get pipelines, current running and past ones
// @Summary List repository pipelines
// @Description Get a list of pipelines for a repository.
// @Router /repos/{repo_id}/pipelines [get]
// @Produce json
// @Success 200 {array} Pipeline
@ -146,7 +147,7 @@ func GetPipelines(c *gin.Context) {
// DeletePipeline
//
// @Summary Delete pipeline
// @Summary Delete a pipeline
// @Router /repos/{repo_id}/pipelines/{number} [delete]
// @Produce plain
// @Success 204
@ -186,7 +187,7 @@ func DeletePipeline(c *gin.Context) {
// GetPipeline
//
// @Summary Pipeline information by number
// @Summary Get a repositories pipeline
// @Router /repos/{repo_id}/pipelines/{number} [get]
// @Produce json
// @Success 200 {object} Pipeline
@ -241,7 +242,7 @@ func GetPipelineLast(c *gin.Context) {
// GetStepLogs
//
// @Summary Log information
// @Summary Get logs for a pipeline step
// @Router /repos/{repo_id}/logs/{number}/{stepID} [get]
// @Produce json
// @Success 200 {array} LogEntry
@ -297,7 +298,7 @@ func GetStepLogs(c *gin.Context) {
// DeleteStepLogs
//
// @Summary Deletes step log
// @Summary Delete step logs of a pipeline
// @Router /repos/{repo_id}/logs/{number}/{stepId} [delete]
// @Produce plain
// @Success 204
@ -357,7 +358,7 @@ func DeleteStepLogs(c *gin.Context) {
// GetPipelineConfig
//
// @Summary Pipeline configuration
// @Summary Get configuration files for a pipeline
// @Router /repos/{repo_id}/pipelines/{number}/config [get]
// @Produce json
// @Success 200 {array} Config
@ -391,7 +392,7 @@ func GetPipelineConfig(c *gin.Context) {
// CancelPipeline
//
// @Summary Cancels a pipeline
// @Summary Cancel a pipeline
// @Router /repos/{repo_id}/pipelines/{number}/cancel [post]
// @Produce plain
// @Success 200
@ -427,7 +428,7 @@ func CancelPipeline(c *gin.Context) {
// PostApproval
//
// @Summary Start pipelines in gated repos
// @Summary Approve and start a pipeline
// @Router /repos/{repo_id}/pipelines/{number}/approve [post]
// @Produce json
// @Success 200 {object} Pipeline
@ -459,7 +460,7 @@ func PostApproval(c *gin.Context) {
// PostDecline
//
// @Summary Decline pipelines in gated repos
// @Summary Decline a pipeline
// @Router /repos/{repo_id}/pipelines/{number}/decline [post]
// @Produce json
// @Success 200 {object} Pipeline
@ -491,7 +492,7 @@ func PostDecline(c *gin.Context) {
// GetPipelineQueue
//
// @Summary List pipeline queues
// @Summary List pipelines in queue
// @Router /pipelines [get]
// @Produce json
// @Success 200 {array} Feed
@ -588,7 +589,7 @@ func PostPipeline(c *gin.Context) {
// DeletePipelineLogs
//
// @Summary Deletes log
// @Summary Deletes all logs of a pipeline
// @Router /repos/{repo_id}/logs/{number} [delete]
// @Produce plain
// @Success 204

View file

@ -26,7 +26,7 @@ import (
// GetRegistry
//
// @Summary Get a named registry
// @Summary Get a registry by name
// @Router /repos/{repo_id}/registry/{registry} [get]
// @Produce json
// @Success 200 {object} Registry
@ -49,7 +49,7 @@ func GetRegistry(c *gin.Context) {
// PostRegistry
//
// @Summary Persist/create a registry
// @Summary Create a registry
// @Router /repos/{repo_id}/registry [post]
// @Produce json
// @Success 200 {object} Registry
@ -86,7 +86,7 @@ func PostRegistry(c *gin.Context) {
// PatchRegistry
//
// @Summary Update a named registry
// @Summary Update a registry by name
// @Router /repos/{repo_id}/registry/{registry} [patch]
// @Produce json
// @Success 200 {object} Registry
@ -134,7 +134,7 @@ func PatchRegistry(c *gin.Context) {
// GetRegistryList
//
// @Summary Get the registry list
// @Summary List registries
// @Router /repos/{repo_id}/registry [get]
// @Produce json
// @Success 200 {array} Registry
@ -161,7 +161,7 @@ func GetRegistryList(c *gin.Context) {
// DeleteRegistry
//
// @Summary Delete a named registry
// @Summary Delete a registry by name
// @Router /repos/{repo_id}/registry/{registry} [delete]
// @Produce plain
// @Success 204

View file

@ -199,7 +199,7 @@ func PostRepo(c *gin.Context) {
// PatchRepo
//
// @Summary Change a repository
// @Summary Update a repository
// @Router /repos/{repo_id} [patch]
// @Produce json
// @Success 200 {object} Repo
@ -273,7 +273,7 @@ func PatchRepo(c *gin.Context) {
// ChownRepo
//
// @Summary Change a repository's owner, to the one holding the access token
// @Summary Change a repository's owner to the currently authenticated user
// @Router /repos/{repo_id}/chown [post]
// @Produce json
// @Success 200 {object} Repo
@ -296,20 +296,20 @@ func ChownRepo(c *gin.Context) {
// LookupRepo
//
// @Summary Get repository by full-name
// @Summary Lookup a repository by full name
// @Router /repos/lookup/{repo_full_name} [get]
// @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_full_name path string true "the repository full-name / slug"
// @Param repo_full_name path string true "the repository full name / slug"
func LookupRepo(c *gin.Context) {
c.JSON(http.StatusOK, session.Repo(c))
}
// GetRepo
//
// @Summary Get repository information
// @Summary Get a repository
// @Router /repos/{repo_id} [get]
// @Produce json
// @Success 200 {object} Repo
@ -322,7 +322,7 @@ func GetRepo(c *gin.Context) {
// GetRepoPermissions
//
// @Summary Repository permission information
// @Summary Check current authenticated users access to the repository
// @Description The repository permission, according to the used access token.
// @Router /repos/{repo_id}/permissions [get]
// @Produce json
@ -337,7 +337,7 @@ func GetRepoPermissions(c *gin.Context) {
// GetRepoBranches
//
// @Summary Get repository branches
// @Summary Get branches of a repository
// @Router /repos/{repo_id}/branches [get]
// @Produce json
// @Success 200 {array} string
@ -367,7 +367,7 @@ func GetRepoBranches(c *gin.Context) {
// GetRepoPullRequests
//
// @Summary List active pull requests
// @Summary List active pull requests of a repository
// @Router /repos/{repo_id}/pull_requests [get]
// @Produce json
// @Success 200 {array} PullRequest
@ -547,7 +547,8 @@ func MoveRepo(c *gin.Context) {
// GetAllRepos
//
// @Summary List all repositories on the server. Requires admin rights.
// @Summary List all repositories on the server
// @Description Returns a list of all repositories. Requires admin rights.
// @Router /repos [get]
// @Produce json
// @Success 200 {array} Repo
@ -572,7 +573,8 @@ func GetAllRepos(c *gin.Context) {
// RepairAllRepos
//
// @Summary Repair all repositories on the server. Requires admin rights.
// @Summary Repair all repositories on the server
// @Description Executes a repair process on all repositories. Requires admin rights.
// @Router /repos/repair [post]
// @Produce plain
// @Success 204

View file

@ -26,7 +26,7 @@ import (
// GetSecret
//
// @Summary Get a named secret
// @Summary Get a repository secret by name
// @Router /repos/{repo_id}/secrets/{secretName} [get]
// @Produce json
// @Success 200 {object} Secret
@ -49,7 +49,7 @@ func GetSecret(c *gin.Context) {
// PostSecret
//
// @Summary Persist/create a secret
// @Summary Create a repository secret
// @Router /repos/{repo_id}/secrets [post]
// @Produce json
// @Success 200 {object} Secret
@ -87,7 +87,7 @@ func PostSecret(c *gin.Context) {
// PatchSecret
//
// @Summary Update a named secret
// @Summary Update a repository secret by name
// @Router /repos/{repo_id}/secrets/{secretName} [patch]
// @Produce json
// @Success 200 {object} Secret
@ -138,7 +138,7 @@ func PatchSecret(c *gin.Context) {
// GetSecretList
//
// @Summary Get the secret list
// @Summary List repository secrets
// @Router /repos/{repo_id}/secrets [get]
// @Produce json
// @Success 200 {array} Secret
@ -165,7 +165,7 @@ func GetSecretList(c *gin.Context) {
// DeleteSecret
//
// @Summary Delete a named secret
// @Summary Delete a repository secret by name
// @Router /repos/{repo_id}/secrets/{secretName} [delete]
// @Produce plain
// @Success 204

View file

@ -36,8 +36,8 @@ import (
// EventStreamSSE
//
// @Summary Event stream
// @Description event source streaming for compatibility with quic and http2
// @Summary Stream events like pipeline updates
// @Description With quic and http2 support
// @Router /stream/events [get]
// @Produce plain
// @Success 200
@ -124,7 +124,7 @@ func EventStreamSSE(c *gin.Context) {
// LogStreamSSE
//
// @Summary Log stream
// @Summary Stream logs of a pipeline step
// @Router /stream/logs/{repo_id}/{pipeline}/{stepID} [get]
// @Produce plain
// @Success 200

View file

@ -32,7 +32,7 @@ import (
// GetSelf
//
// @Summary Returns the currently authenticated user.
// @Summary Get the currently authenticated user
// @Router /user [get]
// @Produce json
// @Success 200 {object} User
@ -44,11 +44,11 @@ func GetSelf(c *gin.Context) {
// GetFeed
//
// @Summary A feed entry for a build.
// @Description Feed entries can be used to display information on the latest builds.
// @Summary Get the currently authenticaed users pipeline feed
// @Description The feed lists the most recent pipeline for the currently authenticated user.
// @Router /user/feed [get]
// @Produce json
// @Success 200 {object} Feed
// @Success 200 {array} Feed
// @Tags User
// @Param Authorization header string true "Insert your personal access token" default(Bearer <personal access token>)
func GetFeed(c *gin.Context) {
@ -77,7 +77,7 @@ func GetFeed(c *gin.Context) {
// GetRepos
//
// @Summary Get user's repos
// @Summary Get user's repositories
// @Description Retrieve the currently authenticated User's Repository list
// @Router /user/repos [get]
// @Produce json

View file

@ -28,7 +28,7 @@ import (
// GetUsers
//
// @Summary Get all users
// @Summary List users
// @Description Returns all registered, active users in the system. Requires admin rights.
// @Router /users [get]
// @Produce json
@ -67,7 +67,7 @@ func GetUser(c *gin.Context) {
// PatchUser
//
// @Summary Change a user
// @Summary Update a user
// @Description Changes the data of an existing user. Requires admin rights.
// @Router /users/{login} [patch]
// @Produce json

View file

@ -158,7 +158,7 @@ const selectedAgent = ref<Partial<Agent>>();
const isEditingAgent = computed(() => !!selectedAgent.value?.id);
async function loadAgents(page: number): Promise<Agent[] | null> {
return apiClient.getAgents(page);
return apiClient.getAgents({ page });
}
const { resetPage, data: agents } = usePagination(loadAgents, () => !selectedAgent.value);

View file

@ -50,7 +50,7 @@ const notifications = useNotifications();
const { t } = useI18n();
async function loadOrgs(page: number): Promise<Org[] | null> {
return apiClient.getOrgs(page);
return apiClient.getOrgs({ page });
}
const { resetPage, data: orgs } = usePagination(loadOrgs);

View file

@ -56,7 +56,7 @@ const notifications = useNotifications();
const i18n = useI18n();
async function loadRepos(page: number): Promise<Repo[] | null> {
return apiClient.getAllRepos(page);
return apiClient.getAllRepos({ page });
}
const { data: repos } = usePagination(loadRepos);

View file

@ -65,7 +65,7 @@ const selectedSecret = ref<Partial<Secret>>();
const isEditingSecret = computed(() => !!selectedSecret.value?.id);
async function loadSecrets(page: number): Promise<Secret[] | null> {
return apiClient.getGlobalSecretList(page);
return apiClient.getGlobalSecretList({ page });
}
const { resetPage, data: secrets } = usePagination(loadSecrets, () => !selectedSecret.value);

View file

@ -107,7 +107,7 @@ const selectedUser = ref<Partial<User>>();
const isEditingUser = computed(() => !!selectedUser.value?.id);
async function loadUsers(page: number): Promise<User[] | null> {
return apiClient.getUsers(page);
return apiClient.getUsers({ page });
}
const { resetPage, data: users } = usePagination(loadUsers, () => !selectedUser.value);

View file

@ -90,7 +90,7 @@ const pipelineOptions = computed(() => {
const loading = ref(true);
onMounted(async () => {
const data = await usePaginate((page) => apiClient.getRepoBranches(repo.value.id, page));
const data = await usePaginate((page) => apiClient.getRepoBranches(repo.value.id, { page }));
branches.value = data.map((e) => ({
text: e,
value: e,

View file

@ -69,7 +69,7 @@ async function loadSecrets(page: number): Promise<Secret[] | null> {
throw new Error("Unexpected: Can't load org");
}
return apiClient.getOrgSecretList(org.value.id, page);
return apiClient.getOrgSecretList(org.value.id, { page });
}
const { resetPage, data: secrets } = usePagination(loadSecrets, () => !selectedSecret.value);

View file

@ -70,7 +70,7 @@ async function loadBranches() {
throw new Error('Unexpected: "repo" should be provided at this place');
}
branches.value = (await usePaginate((page) => apiClient.getRepoBranches(repo.value.id, page)))
branches.value = (await usePaginate((page) => apiClient.getRepoBranches(repo.value.id, { page })))
.map((b) => ({
value: b,
text: b,

View file

@ -121,7 +121,7 @@ async function loadCrons(page: number): Promise<Cron[] | null> {
throw new Error("Unexpected: Can't load repo");
}
return apiClient.getCronList(repo.value.id, page);
return apiClient.getCronList(repo.value.id, { page });
}
const { resetPage, data: crons } = usePagination(loadCrons, () => !selectedCron.value);

View file

@ -104,7 +104,7 @@ async function loadRegistries(page: number): Promise<Registry[] | null> {
throw new Error("Unexpected: Can't load repo");
}
return apiClient.getRegistryList(repo.value.id, page);
return apiClient.getRegistryList(repo.value.id, { page });
}
const { resetPage, data: registries } = usePagination(loadRegistries, () => !selectedRegistry.value);

View file

@ -71,11 +71,11 @@ async function loadSecrets(page: number, level: 'repo' | 'org' | 'global'): Prom
switch (level) {
case 'repo':
return apiClient.getSecretList(repo.value.id, page);
return apiClient.getSecretList(repo.value.id, { page });
case 'org':
return apiClient.getOrgSecretList(repo.value.org_id, page);
return apiClient.getOrgSecretList(repo.value.org_id, { page });
case 'global':
return apiClient.getGlobalSecretList(page);
return apiClient.getGlobalSecretList({ page });
default:
throw new Error(`Unexpected level: ${level}`);
}

View file

@ -78,7 +78,7 @@ async function loadSecrets(page: number): Promise<Secret[] | null> {
throw new Error('Unexpected: Unauthenticated');
}
return apiClient.getOrgSecretList(user.org_id, page);
return apiClient.getOrgSecretList(user.org_id, { page });
}
const { resetPage, data: secrets } = usePagination(loadSecrets, () => !selectedSecret.value);

View file

@ -34,6 +34,11 @@ type DeploymentOptions = {
variables: Record<string, string>;
};
type PaginationOptions = {
page?: number;
perPage?: number;
};
export default class WoodpeckerClient extends ApiClient {
getRepoList(opts?: RepoListOptions): Promise<Repo[]> {
const query = encodeQueryString(opts);
@ -52,12 +57,14 @@ export default class WoodpeckerClient extends ApiClient {
return this._get(`/api/repos/${repoId}/permissions`) as Promise<RepoPermissions>;
}
getRepoBranches(repoId: number, page: number): Promise<string[]> {
return this._get(`/api/repos/${repoId}/branches?page=${page}`) as Promise<string[]>;
getRepoBranches(repoId: number, opts?: PaginationOptions): Promise<string[]> {
const query = encodeQueryString(opts);
return this._get(`/api/repos/${repoId}/branches?${query}`) as Promise<string[]>;
}
getRepoPullRequests(repoId: number, page: number): Promise<PullRequest[]> {
return this._get(`/api/repos/${repoId}/pull_requests?page=${page}`) as Promise<PullRequest[]>;
getRepoPullRequests(repoId: number, opts?: PaginationOptions): Promise<PullRequest[]> {
const query = encodeQueryString(opts);
return this._get(`/api/repos/${repoId}/pull_requests?${query}`) as Promise<PullRequest[]>;
}
activateRepo(forgeRemoteId: string): Promise<Repo> {
@ -93,7 +100,7 @@ export default class WoodpeckerClient extends ApiClient {
return this._post(`/api/repos/${repoId}/pipelines/${pipelineNumber}?${query}`) as Promise<Pipeline>;
}
getPipelineList(repoId: number, opts?: Record<string, string | number | boolean>): Promise<Pipeline[]> {
getPipelineList(repoId: number, opts?: PaginationOptions & { before?: string; after?: string }): Promise<Pipeline[]> {
const query = encodeQueryString(opts);
return this._get(`/api/repos/${repoId}/pipelines?${query}`) as Promise<Pipeline[]>;
}
@ -106,9 +113,8 @@ export default class WoodpeckerClient extends ApiClient {
return this._get(`/api/repos/${repoId}/pipelines/${pipelineNumber}/config`) as Promise<PipelineConfig[]>;
}
getPipelineFeed(opts?: Record<string, string | number | boolean>): Promise<PipelineFeed[]> {
const query = encodeQueryString(opts);
return this._get(`/api/user/feed?${query}`) as Promise<PipelineFeed[]>;
getPipelineFeed(): Promise<PipelineFeed[]> {
return this._get(`/api/user/feed`) as Promise<PipelineFeed[]>;
}
cancelPipeline(repoId: number, pipelineNumber: number): Promise<unknown> {
@ -126,7 +132,7 @@ export default class WoodpeckerClient extends ApiClient {
restartPipeline(
repoId: number,
pipeline: string,
opts?: Record<string, string | number | boolean>,
opts?: { event?: string; deploy_to?: string; fork?: boolean },
): Promise<Pipeline> {
const query = encodeQueryString(opts);
return this._post(`/api/repos/${repoId}/pipelines/${pipeline}?${query}`) as Promise<Pipeline>;
@ -140,8 +146,9 @@ export default class WoodpeckerClient extends ApiClient {
return this._delete(`/api/repos/${repoId}/logs/${pipeline}/${step}`);
}
getSecretList(repoId: number, page: number): Promise<Secret[] | null> {
return this._get(`/api/repos/${repoId}/secrets?page=${page}`) as Promise<Secret[] | null>;
getSecretList(repoId: number, opts?: PaginationOptions): Promise<Secret[] | null> {
const query = encodeQueryString(opts);
return this._get(`/api/repos/${repoId}/secrets?${query}`) as Promise<Secret[] | null>;
}
createSecret(repoId: number, secret: Partial<Secret>): Promise<unknown> {
@ -158,8 +165,9 @@ export default class WoodpeckerClient extends ApiClient {
return this._delete(`/api/repos/${repoId}/secrets/${name}`);
}
getRegistryList(repoId: number, page: number): Promise<Registry[] | null> {
return this._get(`/api/repos/${repoId}/registry?page=${page}`) as Promise<Registry[] | null>;
getRegistryList(repoId: number, opts?: PaginationOptions): Promise<Registry[] | null> {
const query = encodeQueryString(opts);
return this._get(`/api/repos/${repoId}/registry?${query}`) as Promise<Registry[] | null>;
}
createRegistry(repoId: number, registry: Partial<Registry>): Promise<unknown> {
@ -174,8 +182,9 @@ export default class WoodpeckerClient extends ApiClient {
return this._delete(`/api/repos/${repoId}/registry/${registryAddress}`);
}
getCronList(repoId: number, page: number): Promise<Cron[] | null> {
return this._get(`/api/repos/${repoId}/cron?page=${page}`) as Promise<Cron[] | null>;
getCronList(repoId: number, opts?: PaginationOptions): Promise<Cron[] | null> {
const query = encodeQueryString(opts);
return this._get(`/api/repos/${repoId}/cron?${query}`) as Promise<Cron[] | null>;
}
createCron(repoId: number, cron: Partial<Cron>): Promise<unknown> {
@ -206,8 +215,9 @@ export default class WoodpeckerClient extends ApiClient {
return this._get(`/api/orgs/${orgId}/permissions`) as Promise<OrgPermissions>;
}
getOrgSecretList(orgId: number, page: number): Promise<Secret[] | null> {
return this._get(`/api/orgs/${orgId}/secrets?page=${page}`) as Promise<Secret[] | null>;
getOrgSecretList(orgId: number, opts?: PaginationOptions): Promise<Secret[] | null> {
const query = encodeQueryString(opts);
return this._get(`/api/orgs/${orgId}/secrets?${query}`) as Promise<Secret[] | null>;
}
createOrgSecret(orgId: number, secret: Partial<Secret>): Promise<unknown> {
@ -224,8 +234,9 @@ export default class WoodpeckerClient extends ApiClient {
return this._delete(`/api/orgs/${orgId}/secrets/${name}`);
}
getGlobalSecretList(page: number): Promise<Secret[] | null> {
return this._get(`/api/secrets?page=${page}`) as Promise<Secret[] | null>;
getGlobalSecretList(opts?: PaginationOptions): Promise<Secret[] | null> {
const query = encodeQueryString(opts);
return this._get(`/api/secrets?${query}`) as Promise<Secret[] | null>;
}
createGlobalSecret(secret: Partial<Secret>): Promise<unknown> {
@ -250,8 +261,9 @@ export default class WoodpeckerClient extends ApiClient {
return this._post('/api/user/token') as Promise<string>;
}
getAgents(page: number): Promise<Agent[] | null> {
return this._get(`/api/agents?page=${page}`) as Promise<Agent[] | null>;
getAgents(opts?: PaginationOptions): Promise<Agent[] | null> {
const query = encodeQueryString(opts);
return this._get(`/api/agents?${query}`) as Promise<Agent[] | null>;
}
getAgent(agentId: Agent['id']): Promise<Agent> {
@ -282,8 +294,9 @@ export default class WoodpeckerClient extends ApiClient {
return this._post('/api/queue/resume');
}
getUsers(page: number): Promise<User[] | null> {
return this._get(`/api/users?page=${page}`) as Promise<User[] | null>;
getUsers(opts?: PaginationOptions): Promise<User[] | null> {
const query = encodeQueryString(opts);
return this._get(`/api/users?${query}`) as Promise<User[] | null>;
}
getUser(username: string): Promise<User> {
@ -306,16 +319,18 @@ export default class WoodpeckerClient extends ApiClient {
return this._delete('/api/user/token') as Promise<string>;
}
getOrgs(page: number): Promise<Org[] | null> {
return this._get(`/api/orgs?page=${page}`) as Promise<Org[] | null>;
getOrgs(opts?: PaginationOptions): Promise<Org[] | null> {
const query = encodeQueryString(opts);
return this._get(`/api/orgs?${query}`) as Promise<Org[] | null>;
}
deleteOrg(org: Org): Promise<unknown> {
return this._delete(`/api/orgs/${org.id}`);
}
getAllRepos(page: number): Promise<Repo[] | null> {
return this._get(`/api/repos?page=${page}`) as Promise<Repo[] | null>;
getAllRepos(opts?: PaginationOptions): Promise<Repo[] | null> {
const query = encodeQueryString(opts);
return this._get(`/api/repos?${query}`) as Promise<Repo[] | null>;
}
repairAllRepos(): Promise<unknown> {

View file

@ -46,8 +46,8 @@ export const usePipelineStore = defineStore('pipelines', () => {
setPipeline(repoId, pipeline);
}
async function loadRepoPipelines(repoId: number) {
const _pipelines = await apiClient.getPipelineList(repoId);
async function loadRepoPipelines(repoId: number, page?: number) {
const _pipelines = await apiClient.getPipelineList(repoId, { page });
_pipelines.forEach((pipeline) => {
setPipeline(repoId, pipeline);
});

View file

@ -41,7 +41,7 @@ async function loadBranches(page: number): Promise<string[]> {
throw new Error('Unexpected: "repo" should be provided at this place');
}
return apiClient.getRepoBranches(repo.value.id, page);
return apiClient.getRepoBranches(repo.value.id, { page });
}
const { resetPage, data: branches, loading } = usePagination(loadBranches);

View file

@ -48,7 +48,7 @@ async function loadPullRequests(page: number): Promise<PullRequest[]> {
throw new Error('Unexpected: "repo" should be provided at this place');
}
return apiClient.getRepoPullRequests(repo.value.id, page);
return apiClient.getRepoPullRequests(repo.value.id, { page });
}
const { resetPage, data: pullRequests, loading } = usePagination(loadPullRequests);