8ec9eb81创建于 2025年3月11日历史提交
{
    "swagger": "2.0",
    "info": {
        "description": "玲珑仓库接口",
        "title": "linglong仓库",
        "termsOfService": "https://www.deepin.org",
        "contact": {
            "name": "wrj97",
            "url": "https://linglong.dev",
            "email": "wurongjie@deepin.org"
        }
    },
    "paths": {
        "/api/v0/apps/fuzzysearchapp": {
            "post": {
                "consumes": ["application/json"],
                "produces": ["application/json"],
                "tags": ["Client"],
                "summary": "模糊查找App",
                "operationId": "FuzzySearchApp",
                "parameters": [
                    {
                        "description": "app json数据",
                        "name": "data",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.FuzzySearchReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/api.JSONResult"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/definitions/request.RegisterStruct"
                                            }
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api/v1/repos": {
            "get": {
                "description": "returns repository mode and resolve all branches",
                "tags": ["Client", "Repo"],
                "summary": "查看仓库列表",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/api.JSONResult"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/definitions/schema.RepoInfo"
                                            }
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api/v1/repos/{repo}": {
            "get": {
                "description": "returns repository mode and resolve all branches",
                "tags": ["Client", "Repo"],
                "summary": "查看仓库信息",
                "operationId": "GetRepo",
                "parameters": [
                    {
                        "type": "string",
                        "description": "仓库名称",
                        "name": "repo",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/api.JSONResult"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/schema.RepoInfo"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api/v1/repos/{repo}/refs/{channel}/{app_id}/{version}/{arch}/{module}": {
            "delete": {
                "description": "delete a ref from repo",
                "tags": ["Client", "Ref"],
                "summary": "delete a ref from repo",
                "operationId": "RefDelete",
                "parameters": [
                    {
                        "type": "string",
                        "description": "31a165ba1be6dec616b1f8f3207b4273",
                        "name": "X-Token",
                        "in": "header",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "repo name",
                        "name": "repo",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "channel",
                        "name": "channel",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "app id",
                        "name": "app_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "version",
                        "name": "version",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "arch",
                        "name": "arch",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "module",
                        "name": "module",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "hard delete",
                        "name": "hard",
                        "in": "query"
                    }
                ],
                "responses": {},
                "X-Role": ["admin", "owner"]
            }
        },
        "/api/v1/sign-in": {
            "post": {
                "tags": ["Client", "Auth"],
                "summary": "登陆帐号",
                "operationId": "SignIn",
                "parameters": [
                    {
                        "description": "auth json数据",
                        "name": "data",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/request.Auth"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/api.JSONResult"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.SignIn"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api/v1/upload-tasks": {
            "post": {
                "description": "generate a new upload task id",
                "tags": ["Client", "UploadTask"],
                "summary": "generate a new upload task id",
                "operationId": "NewUploadTaskID",
                "parameters": [
                    {
                        "type": "string",
                        "description": "31a165ba1be6dec616b1f8f3207b4273",
                        "name": "X-Token",
                        "in": "header",
                        "required": true
                    },
                    {
                        "description": "JSON数据",
                        "name": "req",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/schema.NewUploadTaskReq"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/api.JSONResult"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.NewUploadTaskResp"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                },
                "X-Role": ["admin", "owner", "maintainer", "developer"]
            }
        },
        "/api/v1/upload-tasks/{task_id}/layer": {
            "put": {
                "tags": ["Client", "UploadTask"],
                "summary": "upload layer file to upload task",
                "operationId": "UploadTaskLayerFile",
                "parameters": [
                    {
                        "type": "string",
                        "description": "31a165ba1be6dec616b1f8f3207b4273",
                        "name": "X-Token",
                        "in": "header",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "task id",
                        "name": "task_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "file",
                        "description": "文件路径",
                        "name": "file",
                        "in": "formData",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/api.UploadTaskLayerFileResp"
                        }
                    }
                },
                "X-Role": ["admin", "owner", "maintainer", "developer"]
            }
        },
        "/api/v1/upload-tasks/{task_id}/status": {
            "get": {
                "description": "get upload task status",
                "tags": ["Client", "UploadTask"],
                "summary": "get upload task status",
                "operationId": "UploadTaskInfo",
                "parameters": [
                    {
                        "type": "string",
                        "description": "31a165ba1be6dec616b1f8f3207b4273",
                        "name": "X-Token",
                        "in": "header",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "task id",
                        "name": "task_id",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "allOf": [
                                {
                                    "$ref": "#/definitions/api.JSONResult"
                                },
                                {
                                    "type": "object",
                                    "properties": {
                                        "data": {
                                            "$ref": "#/definitions/response.UploadTaskStatusInfo"
                                        }
                                    }
                                }
                            ]
                        }
                    }
                }
            }
        },
        "/api/v1/upload-tasks/{task_id}/tar": {
            "put": {
                "description": "upload tgz file to upload task",
                "tags": ["Client", "UploadTask"],
                "summary": "upload tgz file to upload task",
                "operationId": "UploadTaskFile",
                "parameters": [
                    {
                        "type": "string",
                        "description": "31a165ba1be6dec616b1f8f3207b4273",
                        "name": "X-Token",
                        "in": "header",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "task id",
                        "name": "task_id",
                        "in": "path",
                        "required": true
                    },
                    {
                        "type": "file",
                        "description": "文件路径",
                        "name": "file",
                        "in": "formData",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/api.UploadTaskFileResp"
                        }
                    }
                },
                "X-Role": ["admin", "owner", "maintainer", "developer"]
            }
        },
        "/api/v2/search/apps": {
            "get": {
                "consumes": ["application/json"],
                "produces": ["application/json"],
                "tags": ["Client"],
                "summary": "查找App",
                "operationId": "SearchApp",
                "parameters": [
                    {
                        "type": "string",
                        "description": "repo name",
                        "name": "repo_name",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "app channel",
                        "name": "channel",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "app id",
                        "name": "app_id",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "app arch",
                        "name": "arch",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "app module",
                        "name": "module",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "app version",
                        "name": "version",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/apiv2.SearchAppResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/apiv2.JSONError"
                        }
                    },
                    "500": {
                        "description": "Internal Server Error",
                        "schema": {
                            "$ref": "#/definitions/apiv2.JSONError"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "api.JSONResult": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer"
                },
                "data": {},
                "msg": {
                    "type": "string"
                },
                "trace_id": {
                    "type": "string"
                }
            }
        },
        "api.UploadTaskFileResp": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer"
                },
                "data": {
                    "$ref": "#/definitions/response.UploadTaskResp"
                },
                "msg": {
                    "type": "string"
                },
                "trace_id": {
                    "type": "string"
                }
            }
        },
        "api.UploadTaskLayerFileResp": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer"
                },
                "data": {
                    "$ref": "#/definitions/response.UploadTaskResp"
                },
                "msg": {
                    "type": "string"
                },
                "trace_id": {
                    "type": "string"
                }
            }
        },
        "apiv2.JSONError": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer"
                },
                "fields": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "string"
                    }
                },
                "msg": {
                    "type": "string"
                },
                "trace_id": {
                    "type": "string"
                }
            }
        },
        "apiv2.SearchAppResponse": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "integer"
                },
                "data": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/request.RegisterStruct"
                    }
                },
                "trace_id": {
                    "type": "string"
                }
            }
        },
        "request.Auth": {
            "type": "object",
            "properties": {
                "password": {
                    "type": "string",
                    "example": "ut12345678"
                },
                "username": {
                    "type": "string",
                    "example": "ut12345678"
                }
            }
        },
        "request.FuzzySearchReq": {
            "type": "object",
            "properties": {
                "appId": {
                    "type": "string"
                },
                "arch": {
                    "type": "string"
                },
                "channel": {
                    "type": "string"
                },
                "repoName": {
                    "type": "string"
                },
                "version": {
                    "type": "string"
                }
            }
        },
        "request.RegisterStruct": {
            "type": "object",
            "properties": {
                "appId": {
                    "type": "string"
                },
                "arch": {
                    "type": "string"
                },
                "base": {
                    "type": "string"
                },
                "channel": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "id": {
                    "type": "string"
                },
                "kind": {
                    "type": "string"
                },
                "module": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "repoName": {
                    "type": "string"
                },
                "runtime": {
                    "type": "string"
                },
                "size": {
                    "type": "integer",
                    "format": "int64"
                },
                "uabUrl": {
                    "type": "string"
                },
                "version": {
                    "type": "string"
                }
            }
        },
        "response.NewUploadTaskResp": {
            "type": "object",
            "properties": {
                "id": {
                    "type": "string"
                }
            }
        },
        "response.SignIn": {
            "type": "object",
            "properties": {
                "token": {
                    "type": "string"
                }
            }
        },
        "response.UploadTaskResp": {
            "type": "object",
            "properties": {
                "watchId": {
                    "type": "string"
                }
            }
        },
        "response.UploadTaskStatusInfo": {
            "type": "object",
            "properties": {
                "status": {
                    "type": "string"
                }
            }
        },
        "schema.NewUploadTaskReq": {
            "type": "object",
            "properties": {
                "ref": {
                    "type": "string"
                },
                "repoName": {
                    "type": "string"
                }
            }
        },
        "schema.RepoInfo": {
            "type": "object",
            "properties": {
                "mode": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "refs": {
                    "type": "array",
                    "items": {
                        "type": "string"
                    }
                }
            }
        }
    },
    "securityDefinitions": {
        "Token": {
            "description": "\"调用sign-in后获取的token\"",
            "type": "apiKey",
            "name": "X-Token",
            "in": "header"
        }
    }
}