guess i have to add docs to the repo itself

This commit is contained in:
Arya Kiran 2023-08-27 21:53:49 +05:30
parent 8e85a7f259
commit e23e61adfd
No known key found for this signature in database
GPG key ID: 842D12BDA50DF120
4 changed files with 449 additions and 3 deletions

3
.gitignore vendored
View file

@ -21,9 +21,6 @@
# Mozhi binary (on linux and mac)
/mozhi
# Auto-generated Documentation
/docs
# Go workspace file
go.work

188
docs/docs.go Normal file
View file

@ -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)
}

158
docs/swagger.json Normal file
View file

@ -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"
}
}
}
}
}

103
docs/swagger.yaml Normal file
View file

@ -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"