mirror of
https://codeberg.org/aryak/mozhi
synced 2024-12-22 23:39:44 +05:30
323 lines
10 KiB
JSON
323 lines
10 KiB
JSON
{
|
|
"swagger": "2.0",
|
|
"info": {
|
|
"contact": {}
|
|
},
|
|
"paths": {
|
|
"/api/engines": {
|
|
"get": {
|
|
"description": "Lists available Engines.",
|
|
"summary": "List engines",
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/image": {
|
|
"post": {
|
|
"description": "When engine is set to all, it will return an array of libmozhi.LangOut.",
|
|
"summary": "Translate an image",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Engine name",
|
|
"name": "engine",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Source language",
|
|
"name": "from",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Target language",
|
|
"name": "to",
|
|
"in": "formData",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "file",
|
|
"description": "PNG image",
|
|
"name": "image",
|
|
"in": "formData",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/libmozhi.ImgOut"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/source_languages": {
|
|
"get": {
|
|
"summary": "Show list of available source languages for engine",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Engine name",
|
|
"name": "engine",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/libmozhi.List"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/target_languages": {
|
|
"get": {
|
|
"summary": "Show list of available target languages for engine",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Engine name",
|
|
"name": "engine",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/libmozhi.List"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/translate": {
|
|
"get": {
|
|
"description": "When engine is set to all, it will return an array of libmozhi.LangOut.",
|
|
"summary": "Translate text",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Engine name",
|
|
"name": "engine",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Source language",
|
|
"name": "from",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Target language",
|
|
"name": "to",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Text being translated",
|
|
"name": "text",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "OK",
|
|
"schema": {
|
|
"$ref": "#/definitions/libmozhi.LangOut"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/tts": {
|
|
"get": {
|
|
"summary": "Get Text-To-Speech for specified language using specified engine",
|
|
"parameters": [
|
|
{
|
|
"type": "string",
|
|
"description": "Engine name",
|
|
"name": "engine",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Language being TTS'd",
|
|
"name": "lang",
|
|
"in": "query",
|
|
"required": true
|
|
},
|
|
{
|
|
"type": "string",
|
|
"description": "Text being TTS'd",
|
|
"name": "text",
|
|
"in": "query",
|
|
"required": true
|
|
}
|
|
],
|
|
"responses": {}
|
|
}
|
|
}
|
|
},
|
|
"definitions": {
|
|
"libmozhi.ImgOut": {
|
|
"type": "object",
|
|
"properties": {
|
|
"sourceB64": {
|
|
"type": "string"
|
|
},
|
|
"sourceLang": {
|
|
"type": "string"
|
|
},
|
|
"sourceTextParsed": {
|
|
"type": "string"
|
|
},
|
|
"targetLang": {
|
|
"type": "string"
|
|
},
|
|
"translatedImgB64": {
|
|
"type": "string"
|
|
},
|
|
"translatedTextParsed": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"libmozhi.LangOut": {
|
|
"type": "object",
|
|
"properties": {
|
|
"detected": {
|
|
"type": "string"
|
|
},
|
|
"engine": {
|
|
"type": "string"
|
|
},
|
|
"source_antonyms": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"source_equivalent_target_lang": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"source_language": {
|
|
"type": "string"
|
|
},
|
|
"source_synonyms": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"source_transliteration": {
|
|
"type": "string"
|
|
},
|
|
"target_antonyms": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"target_equivalent_source_lang": {
|
|
"type": "object",
|
|
"additionalProperties": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"target_language": {
|
|
"type": "string"
|
|
},
|
|
"target_synonyms": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"target_transliteration": {
|
|
"type": "string"
|
|
},
|
|
"translated-text": {
|
|
"type": "string"
|
|
},
|
|
"word_choices": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/definitions/libmozhi.WordChoices"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"libmozhi.List": {
|
|
"type": "object",
|
|
"properties": {
|
|
"id": {
|
|
"type": "string"
|
|
},
|
|
"name": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
},
|
|
"libmozhi.WordChoices": {
|
|
"type": "object",
|
|
"properties": {
|
|
"definition": {
|
|
"type": "string"
|
|
},
|
|
"example": {
|
|
"description": "Example is for google alone; since it does not have a linked example for source \u0026 target",
|
|
"type": "string"
|
|
},
|
|
"examples_source": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"examples_target": {
|
|
"type": "array",
|
|
"items": {
|
|
"type": "string"
|
|
}
|
|
},
|
|
"word": {
|
|
"type": "string"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |