Add API to support link package to repository and unlink it (#33481)

Fix #21062

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
(cherry picked from commit 5df9fd3e9c6ae7f848da65dbe9b9d321f29c003a)
This commit is contained in:
Lunny Xiao 2025-02-16 19:18:00 -08:00 committed by Gusted
parent b74a967c92
commit e09ea821bd
No known key found for this signature in database
GPG key ID: FD821B732837125F
6 changed files with 334 additions and 14 deletions

View file

@ -4159,6 +4159,93 @@
}
}
},
"/packages/{owner}/{type}/{name}/-/link/{repo_name}": {
"post": {
"tags": [
"package"
],
"summary": "Link a package to a repository",
"operationId": "linkPackage",
"parameters": [
{
"type": "string",
"description": "owner of the package",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "type of the package",
"name": "type",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the package",
"name": "name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the repository to link.",
"name": "repo_name",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"$ref": "#/responses/empty"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/packages/{owner}/{type}/{name}/-/unlink": {
"post": {
"tags": [
"package"
],
"summary": "Unlink a package from a repository",
"operationId": "unlinkPackage",
"parameters": [
{
"type": "string",
"description": "owner of the package",
"name": "owner",
"in": "path",
"required": true
},
{
"type": "string",
"description": "type of the package",
"name": "type",
"in": "path",
"required": true
},
{
"type": "string",
"description": "name of the package",
"name": "name",
"in": "path",
"required": true
}
],
"responses": {
"201": {
"$ref": "#/responses/empty"
},
"404": {
"$ref": "#/responses/notFound"
}
}
}
},
"/packages/{owner}/{type}/{name}/{version}": {
"get": {
"produces": [