From e23e61adfd29f1cbb9204f36d1f4f4bdab2304aa Mon Sep 17 00:00:00 2001 From: Arya Kiran Date: Sun, 27 Aug 2023 21:53:49 +0530 Subject: [PATCH] guess i have to add docs to the repo itself --- .gitignore | 3 - docs/docs.go | 188 ++++++++++++++++++++++++++++++++++++++++++++++ docs/swagger.json | 158 ++++++++++++++++++++++++++++++++++++++ docs/swagger.yaml | 103 +++++++++++++++++++++++++ 4 files changed, 449 insertions(+), 3 deletions(-) create mode 100644 docs/docs.go create mode 100644 docs/swagger.json create mode 100644 docs/swagger.yaml diff --git a/.gitignore b/.gitignore index 5492257..68f7b2d 100644 --- a/.gitignore +++ b/.gitignore @@ -21,9 +21,6 @@ # Mozhi binary (on linux and mac) /mozhi -# Auto-generated Documentation -/docs - # Go workspace file go.work diff --git a/docs/docs.go b/docs/docs.go new file mode 100644 index 0000000..f0253f4 --- /dev/null +++ b/docs/docs.go @@ -0,0 +1,188 @@ +// 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}}", + "contact": {}, + "version": "{{.Version}}" + }, + "host": "{{.Host}}", + "basePath": "{{.BasePath}}", + "paths": { + "/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/utils.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/utils.List" + } + } + } + } + }, + "/api/translate": { + "get": { + "description": "When engine is set to all, it will return an array of utils.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/utils.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": { + "utils.LangOut": { + "type": "object", + "properties": { + "detected": { + "type": "string" + }, + "engine": { + "type": "string" + }, + "source_language": { + "type": "string" + }, + "target_language": { + "type": "string" + }, + "translated-text": { + "type": "string" + } + } + }, + "utils.List": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + } +}` + +// SwaggerInfo holds exported Swagger Info so clients can modify it +var SwaggerInfo = &swag.Spec{ + Version: "", + Host: "", + BasePath: "", + Schemes: []string{}, + Title: "", + Description: "", + InfoInstanceName: "swagger", + SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", +} + +func init() { + swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo) +} diff --git a/docs/swagger.json b/docs/swagger.json new file mode 100644 index 0000000..1e5fe9f --- /dev/null +++ b/docs/swagger.json @@ -0,0 +1,158 @@ +{ + "swagger": "2.0", + "info": { + "contact": {} + }, + "paths": { + "/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/utils.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/utils.List" + } + } + } + } + }, + "/api/translate": { + "get": { + "description": "When engine is set to all, it will return an array of utils.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/utils.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": { + "utils.LangOut": { + "type": "object", + "properties": { + "detected": { + "type": "string" + }, + "engine": { + "type": "string" + }, + "source_language": { + "type": "string" + }, + "target_language": { + "type": "string" + }, + "translated-text": { + "type": "string" + } + } + }, + "utils.List": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + } + } + } +} \ No newline at end of file diff --git a/docs/swagger.yaml b/docs/swagger.yaml new file mode 100644 index 0000000..5713145 --- /dev/null +++ b/docs/swagger.yaml @@ -0,0 +1,103 @@ +definitions: + utils.LangOut: + properties: + detected: + type: string + engine: + type: string + source_language: + type: string + target_language: + type: string + translated-text: + type: string + type: object + utils.List: + properties: + id: + type: string + name: + type: string + type: object +info: + contact: {} +paths: + /api/source_languages: + get: + parameters: + - description: Engine name + in: query + name: engine + required: true + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/utils.List' + summary: Show list of available source languages for engine + /api/target_languages: + get: + parameters: + - description: Engine name + in: query + name: engine + required: true + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/utils.List' + summary: Show list of available target languages for engine + /api/translate: + get: + description: When engine is set to all, it will return an array of utils.LangOut. + parameters: + - description: Engine name + in: query + name: engine + required: true + type: string + - description: Source language + in: query + name: from + required: true + type: string + - description: Target language + in: query + name: to + required: true + type: string + - description: Text being translated + in: query + name: text + required: true + type: string + responses: + "200": + description: OK + schema: + $ref: '#/definitions/utils.LangOut' + summary: Translate text + /api/tts: + get: + parameters: + - description: Engine name + in: query + name: engine + required: true + type: string + - description: Language being TTS'd + in: query + name: lang + required: true + type: string + - description: Text being TTS'd + in: query + name: text + required: true + type: string + responses: {} + summary: Get Text-To-Speech for specified language using specified engine +swagger: "2.0"