forked from forgejo/forgejo
Update swagger documentation (#2899)
* Update swagger documentation Add docs for missing endpoints Add documentation for request parameters Make parameter naming consistent Fix response documentation * Restore delete comments
This commit is contained in:
parent
4287d100b3
commit
f26f4a7e01
72 changed files with 8875 additions and 2323 deletions
|
@ -14,6 +14,34 @@ import (
|
|||
|
||||
// NewCommitStatus creates a new CommitStatus
|
||||
func NewCommitStatus(ctx *context.APIContext, form api.CreateStatusOption) {
|
||||
// swagger:operation POST /repos/{owner}/{repo}/statuses/{sha} repository repoCreateStatus
|
||||
// ---
|
||||
// summary: Create a commit status
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: owner
|
||||
// in: path
|
||||
// description: owner of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: repo
|
||||
// in: path
|
||||
// description: name of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: sha
|
||||
// in: path
|
||||
// description: sha of the commit
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: body
|
||||
// in: body
|
||||
// schema:
|
||||
// "$ref": "#/definitions/CreateStatusOption"
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/StatusList"
|
||||
sha := ctx.Params("sha")
|
||||
if len(sha) == 0 {
|
||||
sha = ctx.Params("ref")
|
||||
|
@ -43,10 +71,63 @@ func NewCommitStatus(ctx *context.APIContext, form api.CreateStatusOption) {
|
|||
|
||||
// GetCommitStatuses returns all statuses for any given commit hash
|
||||
func GetCommitStatuses(ctx *context.APIContext) {
|
||||
sha := ctx.Params("sha")
|
||||
if len(sha) == 0 {
|
||||
sha = ctx.Params("ref")
|
||||
}
|
||||
// swagger:operation GET /repos/{owner}/{repo}/statuses/{sha} repository repoListStatuses
|
||||
// ---
|
||||
// summary: Get a commit's statuses
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: owner
|
||||
// in: path
|
||||
// description: owner of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: repo
|
||||
// in: path
|
||||
// description: name of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: sha
|
||||
// in: path
|
||||
// description: sha of the commit
|
||||
// type: string
|
||||
// required: true
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/StatusList"
|
||||
getCommitStatuses(ctx, ctx.Params("sha"))
|
||||
}
|
||||
|
||||
// GetCommitStatusesByRef returns all statuses for any given commit ref
|
||||
func GetCommitStatusesByRef(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses repository repoListStatusesByRef
|
||||
// ---
|
||||
// summary: Get a commit's statuses, by branch/tag/commit reference
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: owner
|
||||
// in: path
|
||||
// description: owner of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: repo
|
||||
// in: path
|
||||
// description: name of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: ref
|
||||
// in: path
|
||||
// description: name of branch/tag/commit
|
||||
// type: string
|
||||
// required: true
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/StatusList"
|
||||
getCommitStatuses(ctx, ctx.Params("ref"))
|
||||
}
|
||||
|
||||
func getCommitStatuses(ctx *context.APIContext, sha string) {
|
||||
if len(sha) == 0 {
|
||||
ctx.Error(400, "ref/sha not given", nil)
|
||||
return
|
||||
|
@ -78,12 +159,33 @@ type combinedCommitStatus struct {
|
|||
URL string `json:"url"`
|
||||
}
|
||||
|
||||
// GetCombinedCommitStatus returns the combined status for any given commit hash
|
||||
func GetCombinedCommitStatus(ctx *context.APIContext) {
|
||||
sha := ctx.Params("sha")
|
||||
if len(sha) == 0 {
|
||||
sha = ctx.Params("ref")
|
||||
}
|
||||
// GetCombinedCommitStatusByRef returns the combined status for any given commit hash
|
||||
func GetCombinedCommitStatusByRef(ctx *context.APIContext) {
|
||||
// swagger:operation GET /repos/{owner}/{repo}/commits/{ref}/statuses repository repoGetCombinedStatusByRef
|
||||
// ---
|
||||
// summary: Get a commit's combined status, by branch/tag/commit reference
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
// - name: owner
|
||||
// in: path
|
||||
// description: owner of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: repo
|
||||
// in: path
|
||||
// description: name of the repo
|
||||
// type: string
|
||||
// required: true
|
||||
// - name: ref
|
||||
// in: path
|
||||
// description: name of branch/tag/commit
|
||||
// type: string
|
||||
// required: true
|
||||
// responses:
|
||||
// "200":
|
||||
// "$ref": "#/responses/Status"
|
||||
sha := ctx.Params("ref")
|
||||
if len(sha) == 0 {
|
||||
ctx.Error(400, "ref/sha not given", nil)
|
||||
return
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue