mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-07-18 09:22:47 +00:00
continued work on swagger doc
This commit is contained in:
parent
a1e8c0a0c3
commit
a0ae4debc9
401
doc/swagger.yml
401
doc/swagger.yml
@ -2,12 +2,10 @@ swagger: "2.0"
|
|||||||
info:
|
info:
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
title: Drone API
|
title: Drone API
|
||||||
contact:
|
|
||||||
name: Team Drone
|
|
||||||
url: "https://github.com/drone/drone"
|
|
||||||
license:
|
license:
|
||||||
name: Creative Commons 4.0 International
|
name: Creative Commons 4.0 International
|
||||||
url: "http://creativecommons.org/licenses/by/4.0/"
|
url: "http://creativecommons.org/licenses/by/4.0/"
|
||||||
|
|
||||||
host: "localhost:8080"
|
host: "localhost:8080"
|
||||||
basePath: /api
|
basePath: /api
|
||||||
schemes:
|
schemes:
|
||||||
@ -17,6 +15,22 @@ consumes:
|
|||||||
- application/json
|
- application/json
|
||||||
produces:
|
produces:
|
||||||
- application/json
|
- application/json
|
||||||
|
|
||||||
|
#
|
||||||
|
# Operation tags
|
||||||
|
#
|
||||||
|
|
||||||
|
tags:
|
||||||
|
- name: repository
|
||||||
|
- name: build
|
||||||
|
- name: user
|
||||||
|
- name: users
|
||||||
|
- name: tokens
|
||||||
|
|
||||||
|
#
|
||||||
|
# Security Definitions
|
||||||
|
#
|
||||||
|
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
securityDefinitions:
|
securityDefinitions:
|
||||||
@ -24,81 +38,190 @@ securityDefinitions:
|
|||||||
type: apiKey
|
type: apiKey
|
||||||
in: query
|
in: query
|
||||||
name: access_token
|
name: access_token
|
||||||
|
|
||||||
|
#
|
||||||
|
# Endpoint Definitions
|
||||||
|
#
|
||||||
|
|
||||||
paths:
|
paths:
|
||||||
|
|
||||||
|
#
|
||||||
|
# Repos Endpoint
|
||||||
|
#
|
||||||
|
|
||||||
/repos/{owner}/{name}:
|
/repos/{owner}/{name}:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
- name: owner
|
- name: owner
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
- name: name
|
- name: name
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: name of the repository
|
||||||
tags:
|
tags:
|
||||||
- repository
|
- repository
|
||||||
description: Returns the repository based on name.
|
summary: Get a repo
|
||||||
|
description: Retrieves the details of a repository.
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
200:
|
||||||
description: The repository.
|
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Repo"
|
$ref: "#/definitions/Repo"
|
||||||
|
404:
|
||||||
|
description: |
|
||||||
|
Unable to find the repository.
|
||||||
|
|
||||||
patch:
|
patch:
|
||||||
parameters:
|
parameters:
|
||||||
- name: owner
|
- name: owner
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
- name: name
|
- name: name
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: name of the repository
|
||||||
- name: repo
|
- name: repo
|
||||||
in: body
|
in: body
|
||||||
description: The updated repository JSON
|
description: The updated repository JSON
|
||||||
schema:
|
schema:
|
||||||
$ref: '#/definitions/Repo'
|
$ref: '#/definitions/Repo'
|
||||||
|
example: |
|
||||||
|
{
|
||||||
|
"trusted":false,
|
||||||
|
"timeout":60,
|
||||||
|
"hooks":{
|
||||||
|
"pull_request":true,
|
||||||
|
"push":true,
|
||||||
|
"tags":false
|
||||||
|
},
|
||||||
|
"keypair":{
|
||||||
|
"public": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDwXK...",
|
||||||
|
"private": "-----BEGIN RSA PRIVATE KEY-----\nF7tLaAvx..."
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"HEROKU_KEY": "f0e4c2f76c58916ec258f24"
|
||||||
|
}
|
||||||
|
}
|
||||||
required: true
|
required: true
|
||||||
tags:
|
tags:
|
||||||
- repository
|
- repository
|
||||||
description: Updates the repository.
|
summary: Updates a repo
|
||||||
|
description: Updates the specified repository.
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
responses:
|
responses:
|
||||||
"200":
|
200:
|
||||||
description: The updated repository.
|
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Repo"
|
$ref: "#/definitions/Repo"
|
||||||
|
400:
|
||||||
|
description: |
|
||||||
|
Unable to update the repository in the database.
|
||||||
|
404:
|
||||||
|
description: |
|
||||||
|
Unable to find the repository.
|
||||||
|
|
||||||
|
post:
|
||||||
|
parameters:
|
||||||
|
- name: owner
|
||||||
|
in: path
|
||||||
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
|
- name: name
|
||||||
|
in: path
|
||||||
|
type: string
|
||||||
|
description: name of the repository
|
||||||
|
tags:
|
||||||
|
- repository
|
||||||
|
summary: Creates a repo
|
||||||
|
description: Creates a new repository.
|
||||||
|
security:
|
||||||
|
- accessToken: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
schema:
|
||||||
|
$ref: "#/definitions/Repo"
|
||||||
|
400:
|
||||||
|
description: |
|
||||||
|
Unable to update the Repository record in the database
|
||||||
|
403:
|
||||||
|
description: |
|
||||||
|
Unable to activate the Repository due to insufficient privileges
|
||||||
|
404:
|
||||||
|
description: |
|
||||||
|
Unable to retrieve the Repository from the remote system (ie GitHub)
|
||||||
|
409:
|
||||||
|
description: |
|
||||||
|
Unable to activate the Repository because it is already activate
|
||||||
|
500:
|
||||||
|
description: |
|
||||||
|
Unable to activate the Repository due to an internal server error. This may indicate a problem adding hooks to the remote system (ie Github), generating SSH deployment keys, or persisting to the database.
|
||||||
|
|
||||||
delete:
|
delete:
|
||||||
parameters:
|
parameters:
|
||||||
- name: owner
|
- name: owner
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
- name: name
|
- name: name
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: name of the repository
|
||||||
tags:
|
tags:
|
||||||
- repository
|
- repository
|
||||||
description: Deletes the repository.
|
summary: Delete a repo
|
||||||
|
description: Permanently deletes a repository. It cannot be undone.
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |
|
||||||
|
Successfully deleted the Repository
|
||||||
|
400:
|
||||||
|
description: |
|
||||||
|
Unable to remove post-commit hooks from the remote system (ie GitHub)
|
||||||
|
404:
|
||||||
|
description: |
|
||||||
|
Unable to find the Repository in the database
|
||||||
|
500:
|
||||||
|
description: |
|
||||||
|
Unable to update the Repository record in the database
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Repos Watch/Unwatch Enpoint
|
||||||
|
#
|
||||||
|
|
||||||
/repos/{owner}/{name}/watch:
|
/repos/{owner}/{name}/watch:
|
||||||
post:
|
post:
|
||||||
parameters:
|
parameters:
|
||||||
- name: owner
|
- name: owner
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
- name: name
|
- name: name
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: name of the repository
|
||||||
tags:
|
tags:
|
||||||
- repository
|
- repository
|
||||||
|
summary: Watch
|
||||||
description: Watches the named repository.
|
description: Watches the named repository.
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |
|
||||||
|
Successfully watching this repository.
|
||||||
|
400:
|
||||||
|
description: |
|
||||||
|
Unable to update the database.
|
||||||
|
404:
|
||||||
|
description: |
|
||||||
|
Unable to find the repository.
|
||||||
|
|
||||||
/repos/{owner}/{name}/unwatch:
|
/repos/{owner}/{name}/unwatch:
|
||||||
delete:
|
delete:
|
||||||
@ -106,14 +229,32 @@ paths:
|
|||||||
- name: owner
|
- name: owner
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
- name: name
|
- name: name
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: name of the repository
|
||||||
tags:
|
tags:
|
||||||
- repository
|
- repository
|
||||||
|
summary: Unwatch
|
||||||
description: Unwatches the repository.
|
description: Unwatches the repository.
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |
|
||||||
|
Successfully Unwatched this repository.
|
||||||
|
400:
|
||||||
|
description: |
|
||||||
|
Unable to update the database.
|
||||||
|
404:
|
||||||
|
description: |
|
||||||
|
Unable to find the repository.
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Builds Endpoint
|
||||||
|
#
|
||||||
|
|
||||||
/repos/{owner}/{name}/builds:
|
/repos/{owner}/{name}/builds:
|
||||||
get:
|
get:
|
||||||
@ -121,68 +262,116 @@ paths:
|
|||||||
- name: owner
|
- name: owner
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
- name: name
|
- name: name
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: name of the repository
|
||||||
tags:
|
tags:
|
||||||
- build
|
- build
|
||||||
|
summary: Get recent builds
|
||||||
description: Returns recent builds for the repository based on name.
|
description: Returns recent builds for the repository based on name.
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
responses:
|
responses:
|
||||||
"200":
|
200:
|
||||||
description: The recent builds.
|
description: The recent builds.
|
||||||
schema:
|
schema:
|
||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
$ref: "#/definitions/Build"
|
$ref: "#/definitions/Build"
|
||||||
|
404:
|
||||||
|
description: |
|
||||||
|
Unable to find the Repository in the database
|
||||||
|
|
||||||
/repos/{owner}/{name}/builds/{number}:
|
/repos/{owner}/{name}/builds/{number}:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
- name: owner
|
- name: owner
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
- name: name
|
- name: name
|
||||||
in: path
|
in: path
|
||||||
type: string
|
type: string
|
||||||
|
description: name of the repository
|
||||||
- name: number
|
- name: number
|
||||||
in: path
|
in: path
|
||||||
type: integer
|
type: integer
|
||||||
|
description: sequential build number
|
||||||
tags:
|
tags:
|
||||||
- build
|
- build
|
||||||
|
summary: Get a build
|
||||||
description: Returns the repository build by number.
|
description: Returns the repository build by number.
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
responses:
|
responses:
|
||||||
"200":
|
200:
|
||||||
description: The build.
|
description: The build.
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/Build"
|
$ref: "#/definitions/Build"
|
||||||
|
404:
|
||||||
|
description: |
|
||||||
|
Unable to find the Build
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Badges
|
||||||
|
#
|
||||||
|
|
||||||
|
/badges/{owner}/{name}/status.svg:
|
||||||
|
get:
|
||||||
|
description: Returns an SVG status badge for the latest Build
|
||||||
|
parameters:
|
||||||
|
- name: owner
|
||||||
|
in: path
|
||||||
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
|
- name: name
|
||||||
|
in: path
|
||||||
|
type: string
|
||||||
|
description: name of the repository
|
||||||
|
- name: string
|
||||||
|
in: query
|
||||||
|
type: string
|
||||||
|
description: specify a branch. defaults to master
|
||||||
|
default: master
|
||||||
|
|
||||||
|
/badges/{owner}/{name}/cc.xml:
|
||||||
|
get:
|
||||||
|
description: Returns a CCMenu feed for the Repository
|
||||||
|
parameters:
|
||||||
|
- name: owner
|
||||||
|
in: path
|
||||||
|
type: string
|
||||||
|
description: owner of the repository
|
||||||
|
- name: name
|
||||||
|
in: path
|
||||||
|
type: string
|
||||||
|
description: name of the repository
|
||||||
|
produces:
|
||||||
|
- application/xml
|
||||||
|
|
||||||
|
#
|
||||||
|
# User Endpoint
|
||||||
|
#
|
||||||
|
|
||||||
/user:
|
/user:
|
||||||
get:
|
get:
|
||||||
|
summary: Gets a user
|
||||||
description: Returns the currently authenticated user.
|
description: Returns the currently authenticated user.
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
tags:
|
tags:
|
||||||
- user
|
- user
|
||||||
responses:
|
responses:
|
||||||
"200":
|
200:
|
||||||
description: The currently authenticated user.
|
description: The currently authenticated user.
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/User"
|
$ref: "#/definitions/User"
|
||||||
examples:
|
|
||||||
application/json: |-
|
|
||||||
{
|
|
||||||
"name": "Octocat",
|
|
||||||
"email": "octocat@github.com",
|
|
||||||
"gravatar_id": "7194e8d48fa1d2b689f99443b767316c",
|
|
||||||
"admin": false,
|
|
||||||
"active": true
|
|
||||||
}
|
|
||||||
patch:
|
patch:
|
||||||
|
summary: Updates a user
|
||||||
description: Updates the currently authenticated user.
|
description: Updates the currently authenticated user.
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
tags:
|
tags:
|
||||||
- user
|
- user
|
||||||
parameters:
|
parameters:
|
||||||
@ -193,12 +382,89 @@ paths:
|
|||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/User"
|
$ref: "#/definitions/User"
|
||||||
responses:
|
responses:
|
||||||
"200":
|
200:
|
||||||
description: The updated user.
|
description: The updated user.
|
||||||
schema:
|
schema:
|
||||||
$ref: "#/definitions/User"
|
$ref: "#/definitions/User"
|
||||||
|
400:
|
||||||
|
description: |
|
||||||
|
Unable to update the user in the database
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# User Repos
|
||||||
|
#
|
||||||
|
|
||||||
|
/user/repos:
|
||||||
|
get:
|
||||||
|
summary: Get user repos
|
||||||
|
description: |
|
||||||
|
Retrieve the currently authenticated User's Repository list
|
||||||
|
tags:
|
||||||
|
- user
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/definitions/Repo"
|
||||||
|
400:
|
||||||
|
description: |
|
||||||
|
Unable to retrieve Repository list
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# User Tokens
|
||||||
|
#
|
||||||
|
|
||||||
|
/user/tokens:
|
||||||
|
get:
|
||||||
|
post:
|
||||||
|
|
||||||
|
/user/tokens/{label}:
|
||||||
|
delete:
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Users Endpoint
|
||||||
|
#
|
||||||
|
|
||||||
|
/users:
|
||||||
|
get:
|
||||||
|
tags:
|
||||||
|
- users
|
||||||
|
summary: Get all users
|
||||||
|
description: Returns all registered, active users in the system.
|
||||||
|
security:
|
||||||
|
- accessToken: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: All registered users.
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: "#/definitions/User"
|
||||||
|
|
||||||
|
/users/{login}:
|
||||||
|
get:
|
||||||
|
post:
|
||||||
|
patch:
|
||||||
|
delete:
|
||||||
|
|
||||||
|
#
|
||||||
|
# Schema Definitions
|
||||||
|
#
|
||||||
|
|
||||||
definitions:
|
definitions:
|
||||||
User:
|
User:
|
||||||
|
example: |
|
||||||
|
{
|
||||||
|
"name": "Octocat",
|
||||||
|
"email": "octocat@github.com",
|
||||||
|
"gravatar_id": "7194e8d48fa1d2b689f99443b767316c",
|
||||||
|
"admin": false,
|
||||||
|
"active": true
|
||||||
|
}
|
||||||
properties:
|
properties:
|
||||||
login:
|
login:
|
||||||
type: string
|
type: string
|
||||||
@ -210,7 +476,45 @@ definitions:
|
|||||||
type: boolean
|
type: boolean
|
||||||
active:
|
active:
|
||||||
type: boolean
|
type: boolean
|
||||||
|
Token:
|
||||||
|
properties:
|
||||||
|
issued_at:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
label:
|
||||||
|
type: string
|
||||||
|
hash:
|
||||||
|
type: string
|
||||||
Repo:
|
Repo:
|
||||||
|
example: |
|
||||||
|
{
|
||||||
|
"owner":"drone",
|
||||||
|
"name":"drone-test-go",
|
||||||
|
"full_name":"drone/drone-test-go",
|
||||||
|
"self_url":"http://localhost:8080/drone/drone-test-go",
|
||||||
|
"link_url":"https://github.com/drone/drone-test-go",
|
||||||
|
"clone_url":"https://github.com/drone/drone-test-go.git",
|
||||||
|
"default_branch":"master",
|
||||||
|
"private":true,
|
||||||
|
"trusted":false,
|
||||||
|
"timeout":60,
|
||||||
|
"hooks":{
|
||||||
|
"pull_request":true,
|
||||||
|
"push":true,
|
||||||
|
"tags":false
|
||||||
|
},
|
||||||
|
"keypair":{
|
||||||
|
"public": "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDwXK..."
|
||||||
|
},
|
||||||
|
"permissions":{
|
||||||
|
"pull":true,
|
||||||
|
"push":true,
|
||||||
|
"admin":true
|
||||||
|
},
|
||||||
|
"params": {
|
||||||
|
"HEROKU_KEY": "f0e4c2f76c58916ec258f24"
|
||||||
|
}
|
||||||
|
}
|
||||||
properties:
|
properties:
|
||||||
owner:
|
owner:
|
||||||
type: string
|
type: string
|
||||||
@ -258,6 +562,45 @@ definitions:
|
|||||||
params:
|
params:
|
||||||
type: object
|
type: object
|
||||||
Build:
|
Build:
|
||||||
|
example: |
|
||||||
|
{
|
||||||
|
"number": 1,
|
||||||
|
"status": "success",
|
||||||
|
"started_at": 5788800,
|
||||||
|
"finished_at": 5789500,
|
||||||
|
|
||||||
|
"head_commit": {
|
||||||
|
"sha": "d101ef3ed6e973b039c3fd5ccdec378b0fa8684c",
|
||||||
|
"ref": "refs\/heads\/master",
|
||||||
|
"branch": "master",
|
||||||
|
"message": "updated the README.md file",
|
||||||
|
"timestamp": "",
|
||||||
|
"remote": "https:\/\/github.com\/drone\/drone.git",
|
||||||
|
"author": {
|
||||||
|
"login": "bradrydzewski",
|
||||||
|
"email": "brad.rydzewski@gmail.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
"jobs": [
|
||||||
|
{
|
||||||
|
"number": 1,
|
||||||
|
"status": "success",
|
||||||
|
"started_at": 5788800,
|
||||||
|
"finished_at": 5789500,
|
||||||
|
"exit_code": 0,
|
||||||
|
"environment": { "GO_VERSION": "1.4" }
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"number": 2,
|
||||||
|
"status": "success",
|
||||||
|
"started_at": 5788800,
|
||||||
|
"finished_at": 5789500,
|
||||||
|
"exit_code": 0,
|
||||||
|
"environment": { "GO_VERSION": "1.5" }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
properties:
|
properties:
|
||||||
number:
|
number:
|
||||||
type: integer
|
type: integer
|
||||||
|
Loading…
Reference in New Issue
Block a user