{
    "openapi": "3.0.0",
    "info": {
        "title": "机器翻译 - API文档",
        "version": "1.0.0",
        "description": "系统支持自动识别源语言也可以指定来源和翻译对象。单次请求不能超过500个字符。参考文档：<a target=\"_blank\" href=\"https:\/\/www.tianapi.com\/article\/36\">支持的语种及代码<\/a>"
    },
    "servers": [
        {
            "url": "https:\/\/apis.tianapi.com"
        }
    ],
    "paths": {
        "\/fanyi\/index": {
            "get": {
                "summary": "语言翻译",
                "tags": [
                    "机器翻译"
                ],
                "description": "各国语言互译支持智能识别",
                "parameters": [
                    {
                        "name": "to",
                        "in": "query",
                        "description": "目标语言，默认自动识别",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "example": "auto",
                            "description": "目标语言，默认自动识别"
                        }
                    },
                    {
                        "name": "key",
                        "in": "query",
                        "description": "API密钥",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "description": "API密钥"
                        }
                    },
                    {
                        "name": "text",
                        "in": "query",
                        "description": "需要翻译的内容",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "example": "hallo",
                            "description": "需要翻译的内容"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "to": {
                                            "type": "string",
                                            "example": "zh",
                                            "description": "目标语言"
                                        },
                                        "dst": {
                                            "type": "string",
                                            "example": "你好",
                                            "description": "翻译结果"
                                        },
                                        "src": {
                                            "type": "string",
                                            "example": "hallo",
                                            "description": "翻译文本"
                                        },
                                        "from": {
                                            "type": "string",
                                            "example": "en",
                                            "description": "来源语言"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "to": "zh",
                                        "dst": "你好",
                                        "src": "hallo",
                                        "from": "en"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "summary": "语言翻译",
                "tags": [
                    "机器翻译"
                ],
                "description": "各国语言互译支持智能识别",
                "requestBody": {
                    "content": {
                        "application\/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "to": {
                                        "type": "string",
                                        "example": "auto",
                                        "description": "目标语言，默认自动识别"
                                    },
                                    "key": {
                                        "type": "string",
                                        "description": "API密钥"
                                    },
                                    "text": {
                                        "type": "string",
                                        "example": "hallo",
                                        "description": "需要翻译的内容"
                                    }
                                },
                                "required": [
                                    "key",
                                    "text"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "成功响应",
                        "content": {
                            "application\/json": {
                                "schema": {
                                    "type": "object",
                                    "properties": {
                                        "to": {
                                            "type": "string",
                                            "example": "zh",
                                            "description": "目标语言"
                                        },
                                        "dst": {
                                            "type": "string",
                                            "example": "你好",
                                            "description": "翻译结果"
                                        },
                                        "src": {
                                            "type": "string",
                                            "example": "hallo",
                                            "description": "翻译文本"
                                        },
                                        "from": {
                                            "type": "string",
                                            "example": "en",
                                            "description": "来源语言"
                                        }
                                    }
                                },
                                "example": {
                                    "msg": "success",
                                    "code": 200,
                                    "result": {
                                        "to": "zh",
                                        "dst": "你好",
                                        "src": "hallo",
                                        "from": "en"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}