mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-07-09 22:00:03 +02:00
Add API for License templates (#23009)
This adds a API for getting License templates. This tries to be as close to the [GitHub API](https://docs.github.com/en/rest/licenses?apiVersion=2022-11-28) as possible, but Gitea does not support all features that GitHub has. I think they should been added, but this out f the scope of this PR. You should merge #23006 before this PR for security reasons.
This commit is contained in:
parent
4d5c803f8b
commit
fb37eefa28
6 changed files with 270 additions and 0 deletions
107
templates/swagger/v1_json.tmpl
generated
107
templates/swagger/v1_json.tmpl
generated
|
@ -883,6 +883,52 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"/licenses": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"miscellaneous"
|
||||
],
|
||||
"summary": "Returns a list of all license templates",
|
||||
"operationId": "listLicenseTemplates",
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/LicenseTemplateList"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/licenses/{name}": {
|
||||
"get": {
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"miscellaneous"
|
||||
],
|
||||
"summary": "Returns information about a license template",
|
||||
"operationId": "getLicenseTemplateInfo",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "name of the license",
|
||||
"name": "name",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"$ref": "#/responses/LicenseTemplateInfo"
|
||||
},
|
||||
"404": {
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/markdown": {
|
||||
"post": {
|
||||
"consumes": [
|
||||
|
@ -18704,6 +18750,52 @@
|
|||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"LicenseTemplateInfo": {
|
||||
"description": "LicensesInfo contains information about a License",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"body": {
|
||||
"type": "string",
|
||||
"x-go-name": "Body"
|
||||
},
|
||||
"implementation": {
|
||||
"type": "string",
|
||||
"x-go-name": "Implementation"
|
||||
},
|
||||
"key": {
|
||||
"type": "string",
|
||||
"x-go-name": "Key"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"x-go-name": "URL"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"LicensesTemplateListEntry": {
|
||||
"description": "LicensesListEntry is used for the API",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"key": {
|
||||
"type": "string",
|
||||
"x-go-name": "Key"
|
||||
},
|
||||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"url": {
|
||||
"type": "string",
|
||||
"x-go-name": "URL"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"MarkdownOption": {
|
||||
"description": "MarkdownOption markdown options",
|
||||
"type": "object",
|
||||
|
@ -21587,6 +21679,21 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"LicenseTemplateInfo": {
|
||||
"description": "LicenseTemplateInfo",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/LicenseTemplateInfo"
|
||||
}
|
||||
},
|
||||
"LicenseTemplateList": {
|
||||
"description": "LicenseTemplateList",
|
||||
"schema": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/LicensesTemplateListEntry"
|
||||
}
|
||||
}
|
||||
},
|
||||
"MarkdownRender": {
|
||||
"description": "MarkdownRender is a rendered markdown document",
|
||||
"schema": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue