{
  "swagger": "2.0",
  "info": {
    "description": "超低资源消耗超快的离线翻译服务器 API",
    "title": "MTranServer API",
    "termsOfService": "https://github.com/xxnuo/MTranServer",
    "contact": {
      "name": "API Support",
      "url": "https://github.com/xxnuo/MTranServer/issues",
      "email": "support@example.com"
    },
    "license": {
      "name": "MIT",
      "url": "https://github.com/xxnuo/MTranServer/blob/main/LICENSE"
    },
    "version": "3.0.0"
  },
  "host": "localhost:8989",
  "basePath": "/",
  "paths": {
    "/__heartbeat__": {
      "get": {
        "description": "返回服务状态",
        "produces": [
          "text/plain"
        ],
        "tags": [
          "系统"
        ],
        "summary": "心跳检查",
        "responses": {
          "200": {
            "description": "Ready",
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "/__lbheartbeat__": {
      "get": {
        "description": "返回负载均衡器心跳状态",
        "produces": [
          "text/plain"
        ],
        "tags": [
          "系统"
        ],
        "summary": "负载均衡心跳检查",
        "responses": {
          "200": {
            "description": "Ready",
            "schema": {
              "type": "string"
            }
          }
        }
      }
    },
    "/health": {
      "get": {
        "description": "检查服务是否正常运行",
        "produces": [
          "application/json"
        ],
        "tags": [
          "系统"
        ],
        "summary": "健康检查",
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/imme": {
      "post": {
        "description": "为沉浸式翻译插件提供的翻译接口",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "插件"
        ],
        "summary": "沉浸式翻译插件接口",
        "parameters": [
          {
            "type": "string",
            "description": "API Token",
            "name": "token",
            "in": "query"
          },
          {
            "description": "沉浸式翻译请求",
            "name": "request",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/main.ImmeTranslateRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/main.ImmeTranslateResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/kiss": {
      "post": {
        "description": "为简约翻译插件提供的翻译接口",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "插件"
        ],
        "summary": "简约翻译插件接口",
        "parameters": [
          {
            "type": "string",
            "description": "API Token",
            "name": "KEY",
            "in": "header"
          },
          {
            "description": "简约翻译请求",
            "name": "request",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/main.KissTranslateRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/main.KissTranslateResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/language/translate/v2": {
      "post": {
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyQuery": []
          }
        ],
        "description": "兼容 Google Translate API v2 的翻译接口",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "翻译"
        ],
        "summary": "Google 翻译兼容接口",
        "parameters": [
          {
            "description": "Google 翻译请求",
            "name": "request",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/main.GoogleTranslateRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/main.GoogleTranslateResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/languages": {
      "get": {
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyQuery": []
          }
        ],
        "description": "返回所有支持的翻译语言代码",
        "produces": [
          "application/json"
        ],
        "tags": [
          "翻译"
        ],
        "summary": "获取支持的语言列表",
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/translate": {
      "post": {
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyQuery": []
          }
        ],
        "description": "翻译单个文本",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "翻译"
        ],
        "summary": "单文本翻译",
        "parameters": [
          {
            "description": "翻译请求",
            "name": "request",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/main.TranslateRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/main.TranslateResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/translate/batch": {
      "post": {
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeyQuery": []
          }
        ],
        "description": "批量翻译多个文本",
        "consumes": [
          "application/json"
        ],
        "produces": [
          "application/json"
        ],
        "tags": [
          "翻译"
        ],
        "summary": "批量翻译",
        "parameters": [
          {
            "description": "批量翻译请求",
            "name": "request",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/main.TranslateBatchRequest"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "$ref": "#/definitions/main.TranslateBatchResponse"
            }
          },
          "400": {
            "description": "Bad Request",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "/version": {
      "get": {
        "description": "返回当前服务的版本号",
        "produces": [
          "application/json"
        ],
        "tags": [
          "系统"
        ],
        "summary": "获取服务版本",
        "responses": {
          "200": {
            "description": "OK",
            "schema": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "definitions": {
    "main.GoogleTranslateRequest": {
      "type": "object",
      "required": [
        "q",
        "source",
        "target"
      ],
      "properties": {
        "format": {
          "type": "string",
          "example": "text"
        },
        "q": {
          "type": "string",
          "example": "The Great Pyramid of Giza"
        },
        "source": {
          "type": "string",
          "example": "en"
        },
        "target": {
          "type": "string",
          "example": "zh"
        }
      }
    },
    "main.GoogleTranslateResponse": {
      "type": "object",
      "properties": {
        "data": {
          "type": "object",
          "properties": {
            "translations": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "translatedText": {
                    "type": "string",
                    "example": "吉萨大金字塔"
                  }
                }
              }
            }
          }
        }
      }
    },
    "main.ImmeTranslateRequest": {
      "type": "object",
      "required": [
        "from",
        "to",
        "trans"
      ],
      "properties": {
        "from": {
          "type": "string",
          "example": "en"
        },
        "to": {
          "type": "string",
          "example": "zh"
        },
        "trans": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "example": [
            "Hello",
            " world!",
            "Good morning!"
          ]
        }
      }
    },
    "main.ImmeTranslateResponse": {
      "type": "object",
      "properties": {
        "trans": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "example": [
            "你好，世界！",
            "早上好！"
          ]
        }
      }
    },
    "main.KissTranslateRequest": {
      "type": "object",
      "required": [
        "from",
        "text",
        "to"
      ],
      "properties": {
        "from": {
          "type": "string",
          "example": "en"
        },
        "text": {
          "type": "string",
          "example": "Hello, world!"
        },
        "to": {
          "type": "string",
          "example": "zh"
        }
      }
    },
    "main.KissTranslateResponse": {
      "type": "object",
      "properties": {
        "text": {
          "type": "string",
          "example": "你好，世界！"
        }
      }
    },
    "main.TranslateBatchRequest": {
      "type": "object",
      "required": [
        "from",
        "texts",
        "to"
      ],
      "properties": {
        "from": {
          "type": "string",
          "example": "en"
        },
        "html": {
          "type": "boolean",
          "example": false
        },
        "texts": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "example": [
            "Hello",
            " world!",
            "Good morning!"
          ]
        },
        "to": {
          "type": "string",
          "example": "zh"
        }
      }
    },
    "main.TranslateBatchResponse": {
      "type": "object",
      "properties": {
        "results": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "example": [
            "你好，世界！",
            "早上好！"
          ]
        }
      }
    },
    "main.TranslateRequest": {
      "type": "object",
      "required": [
        "from",
        "text",
        "to"
      ],
      "properties": {
        "from": {
          "type": "string",
          "example": "en"
        },
        "html": {
          "type": "boolean",
          "example": false
        },
        "text": {
          "type": "string",
          "example": "Hello, world!"
        },
        "to": {
          "type": "string",
          "example": "zh"
        }
      }
    },
    "main.TranslateResponse": {
      "type": "object",
      "properties": {
        "result": {
          "type": "string",
          "example": "你好，世界！"
        }
      }
    }
  },
  "securityDefinitions": {
    "ApiKeyAuth": {
      "type": "apiKey",
      "name": "Authorization",
      "in": "header"
    },
    "ApiKeyQuery": {
      "type": "apiKey",
      "name": "token",
      "in": "query"
    }
  }
}