{
    "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/{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/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"
                ]
            }
        }
    },
    "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"
                }
            }
        },
        "request.Auth": {
            "type": "object",
            "properties": {
                "password": {
                    "type": "string",
                    "example": "ut12345678"
                },
                "username": {
                    "type": "string",
                    "example": "ut12345678"
                }
            }
        },
        "request.FuzzySearchReq": {
            "type": "object",
            "properties": {
                "channel": {
                    "type": "string"
                },
                "appId": {
                    "type": "string"
                },
                "arch": {
                    "type": "string"
                },
                "repoName": {
                    "type": "string"
                },
                "version": {
                    "type": "string"
                }
            }
        },
        "request.RegisterStruct": {
            "type": "object",
            "properties": {
                "appId": {
                    "type": "string"
                },
                "arch": {
                    "type": "string"
                },
                "channel": {
                    "type": "string"
                },
                "description": {
                    "type": "string"
                },
                "kind": {
                    "type": "string"
                },
                "module": {
                    "type": "string"
                },
                "name": {
                    "type": "string"
                },
                "repoName": {
                    "type": "string"
                },
                "runtime": {
                    "type": "string"
                },
                "size": {
                    "type": "integer"
                },
                "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"
        }
    }
}