mirror of
https://github.com/go-gitea/gitea
synced 2025-07-22 18:28:37 +00:00
[Refactor] CombinedStatus and CommitStatus related functions & structs (#14026)
* RM unused struct * rename (*CommitStatus) loadRepo() -> loadAttributes() * move ToCommitStatus into its own file * use CommitStatusState instead of StatusState * move CombinedStatus convertion into convert package * let models.GetLatestCommitStatus use repoID direct and accept ListOptions * update swagger docs * fix tests * Fix swagger docs * rm page * fix swagger docs!!! * return json null * always return json * rename api.Status to api.CommitStatus * fix swagger docs * sec swagger fix
This commit is contained in:
@@ -2867,7 +2867,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/commits/{ref}/statuses": {
|
||||
"/repos/{owner}/{repo}/commits/{ref}/status": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
@@ -2901,14 +2901,101 @@
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page number of results",
|
||||
"description": "page number of results to return (1-based)",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page size of results",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/Status"
|
||||
"$ref": "#/responses/CombinedStatus"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/repos/{owner}/{repo}/commits/{ref}/statuses": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"repository"
|
||||
],
|
||||
"summary": "Get a commit's statuses, by branch/tag/commit reference",
|
||||
"operationId": "repoListStatusesByRef",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "owner of the repo",
|
||||
"name": "owner",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of the repo",
|
||||
"name": "repo",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of branch/tag/commit",
|
||||
"name": "ref",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"oldest",
|
||||
"recentupdate",
|
||||
"leastupdate",
|
||||
"leastindex",
|
||||
"highestindex"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "type of sort",
|
||||
"name": "sort",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"enum": [
|
||||
"pending",
|
||||
"success",
|
||||
"error",
|
||||
"failure",
|
||||
"warning"
|
||||
],
|
||||
"type": "string",
|
||||
"description": "type of state",
|
||||
"name": "state",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page number of results to return (1-based)",
|
||||
"name": "page",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "integer",
|
||||
"description": "page size of results",
|
||||
"name": "limit",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/CommitStatusList"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
@@ -8462,7 +8549,7 @@
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/StatusList"
|
||||
"$ref": "#/responses/CommitStatusList"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
@@ -8510,7 +8597,7 @@
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"$ref": "#/responses/Status"
|
||||
"$ref": "#/responses/CommitStatus"
|
||||
},
|
||||
"400": {
|
||||
"$ref": "#/responses/error"
|
||||
@@ -11431,6 +11518,43 @@
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"CombinedStatus": {
|
||||
"description": "CombinedStatus holds the combined state of several statuses for a single commit",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"commit_url": {
|
||||
"type": "string",
|
||||
"x-go-name": "CommitURL"
|
||||
},
|
||||
"repository": {
|
||||
"$ref": "#/definitions/Repository"
|
||||
},
|
||||
"sha": {
|
||||
"type": "string",
|
||||
"x-go-name": "SHA"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/definitions/CommitStatusState"
|
||||
},
|
||||
"statuses": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/CommitStatus"
|
||||
},
|
||||
"x-go-name": "Statuses"
|
||||
},
|
||||
"total_count": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "TotalCount"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"x-go-name": "URL"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"Comment": {
|
||||
"description": "Comment represents a comment on a commit or issue",
|
||||
"type": "object",
|
||||
@@ -11558,6 +11682,55 @@
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"CommitStatus": {
|
||||
"description": "CommitStatus holds a single status of a single Commit",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"type": "string",
|
||||
"x-go-name": "Context"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"x-go-name": "Created"
|
||||
},
|
||||
"creator": {
|
||||
"$ref": "#/definitions/User"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"x-go-name": "Description"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"status": {
|
||||
"$ref": "#/definitions/CommitStatusState"
|
||||
},
|
||||
"target_url": {
|
||||
"type": "string",
|
||||
"x-go-name": "TargetURL"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"x-go-name": "Updated"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"x-go-name": "URL"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"CommitStatusState": {
|
||||
"description": "CommitStatusState holds the state of a CommitStatus\nIt can be \"pending\", \"success\", \"error\", \"failure\", and \"warning\"",
|
||||
"type": "string",
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"CommitUser": {
|
||||
"type": "object",
|
||||
"title": "CommitUser contains information of a user in the context of a commit.",
|
||||
@@ -12341,7 +12514,7 @@
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"CreateStatusOption": {
|
||||
"description": "CreateStatusOption holds the information needed to create a new Status for a Commit",
|
||||
"description": "CreateStatusOption holds the information needed to create a new CommitStatus for a Commit",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
@@ -12353,7 +12526,7 @@
|
||||
"x-go-name": "Description"
|
||||
},
|
||||
"state": {
|
||||
"$ref": "#/definitions/StatusState"
|
||||
"$ref": "#/definitions/CommitStatusState"
|
||||
},
|
||||
"target_url": {
|
||||
"type": "string",
|
||||
@@ -15251,55 +15424,6 @@
|
||||
"type": "string",
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"Status": {
|
||||
"description": "Status holds a single Status of a single Commit",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"context": {
|
||||
"type": "string",
|
||||
"x-go-name": "Context"
|
||||
},
|
||||
"created_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"x-go-name": "Created"
|
||||
},
|
||||
"creator": {
|
||||
"$ref": "#/definitions/User"
|
||||
},
|
||||
"description": {
|
||||
"type": "string",
|
||||
"x-go-name": "Description"
|
||||
},
|
||||
"id": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"x-go-name": "ID"
|
||||
},
|
||||
"status": {
|
||||
"$ref": "#/definitions/StatusState"
|
||||
},
|
||||
"target_url": {
|
||||
"type": "string",
|
||||
"x-go-name": "TargetURL"
|
||||
},
|
||||
"updated_at": {
|
||||
"type": "string",
|
||||
"format": "date-time",
|
||||
"x-go-name": "Updated"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"x-go-name": "URL"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"StatusState": {
|
||||
"description": "StatusState holds the state of a Status\nIt can be \"pending\", \"success\", \"error\", \"failure\", and \"warning\"",
|
||||
"type": "string",
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"StopWatch": {
|
||||
"description": "StopWatch represent a running stopwatch",
|
||||
"type": "object",
|
||||
@@ -15773,6 +15897,12 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"CombinedStatus": {
|
||||
"description": "CombinedStatus",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CombinedStatus"
|
||||
}
|
||||
},
|
||||
"Comment": {
|
||||
"description": "Comment",
|
||||
"schema": {
|
||||
@@ -15829,6 +15959,21 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"CommitStatus": {
|
||||
"description": "CommitStatus",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/CommitStatus"
|
||||
}
|
||||
},
|
||||
"CommitStatusList": {
|
||||
"description": "CommitStatusList",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/CommitStatus"
|
||||
}
|
||||
}
|
||||
},
|
||||
"ContentsListResponse": {
|
||||
"description": "ContentsListResponse",
|
||||
"schema": {
|
||||
@@ -16235,21 +16380,6 @@
|
||||
"$ref": "#/definitions/ServerVersion"
|
||||
}
|
||||
},
|
||||
"Status": {
|
||||
"description": "Status",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/Status"
|
||||
}
|
||||
},
|
||||
"StatusList": {
|
||||
"description": "StatusList",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/Status"
|
||||
}
|
||||
}
|
||||
},
|
||||
"StopWatch": {
|
||||
"description": "StopWatch",
|
||||
"schema": {
|
||||
|
Reference in New Issue
Block a user