Files
MTranServer/internal/docs/docs.go
2025-11-10 03:25:36 +08:00

710 lines
22 KiB
Go

// Package docs Code generated by swaggo/swag. DO NOT EDIT
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"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": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.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/handlers.ImmeTranslateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.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/handlers.KissTranslateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.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/handlers.GoogleTranslateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.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/handlers.TranslateRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.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/handlers.TranslateBatchRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.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": {
"handlers.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-Hans"
}
}
},
"handlers.GoogleTranslateResponse": {
"type": "object",
"properties": {
"data": {
"type": "object",
"properties": {
"translations": {
"type": "array",
"items": {
"type": "object",
"properties": {
"translatedText": {
"type": "string",
"example": "吉萨大金字塔"
}
}
}
}
}
}
}
},
"handlers.ImmeTranslateRequest": {
"type": "object",
"required": [
"from",
"to",
"trans"
],
"properties": {
"from": {
"type": "string",
"example": "en"
},
"to": {
"type": "string",
"example": "zh-Hans"
},
"trans": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"Hello",
" world!",
"Good morning!"
]
}
}
},
"handlers.ImmeTranslateResponse": {
"type": "object",
"properties": {
"trans": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"你好,世界!",
"早上好!"
]
}
}
},
"handlers.KissTranslateRequest": {
"type": "object",
"required": [
"from",
"text",
"to"
],
"properties": {
"from": {
"type": "string",
"example": "en"
},
"text": {
"type": "string",
"example": "Hello, world!"
},
"to": {
"type": "string",
"example": "zh-Hans"
}
}
},
"handlers.KissTranslateResponse": {
"type": "object",
"properties": {
"text": {
"type": "string",
"example": "你好,世界!"
}
}
},
"handlers.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-Hans"
}
}
},
"handlers.TranslateBatchResponse": {
"type": "object",
"properties": {
"results": {
"type": "array",
"items": {
"type": "string"
},
"example": [
"你好,世界!",
"早上好!"
]
}
}
},
"handlers.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-Hans"
}
}
},
"handlers.TranslateResponse": {
"type": "object",
"properties": {
"result": {
"type": "string",
"example": "你好,世界!"
}
}
}
},
"securityDefinitions": {
"ApiKeyAuth": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
},
"ApiKeyQuery": {
"type": "apiKey",
"name": "token",
"in": "query"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "3.0.0",
Host: "localhost:8989",
BasePath: "/",
Schemes: []string{},
Title: "MTranServer API",
Description: "超低资源消耗超快的离线翻译服务器 API",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}