~metalune/public-inbox

simplytranslate_web: Added documentation for api v1 PROPOSED

ManeraKai: 1
 simplytranslate_web: Added documentation for api

 3 files changed, 70 insertions(+), 2 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~metalune/public-inbox/patches/25946/mbox | git am -3
Learn more about email & git

[PATCH] simplytranslate_web: Added documentation for api Export this patch

From: ManeraKai <manerakai@protonmail.com>

---
 README.md   |  7 ++++--
 api.md      | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 config.conf |  3 +++
 3 files changed, 70 insertions(+), 2 deletions(-)
 create mode 100644 api.md

diff --git a/README.md b/README.md
index 4243bf9..66e703e 100644
--- a/README.md
+++ b/README.md
@@ -38,9 +38,12 @@ python3 main.py
uvicorn main:app --port 5000
```

## API
[Documentation](./api.md)

## Other projects like this
[gtranslate](https://git.sr.ht/~yerinalexey/gtranslate)
[lingva translate](https://github.com/TheDavidDelta/lingva-translate)
* [gtranslate](https://git.sr.ht/~yerinalexey/gtranslate)
* [lingva translate](https://github.com/TheDavidDelta/lingva-translate)

## Contact

diff --git a/api.md b/api.md
new file mode 100644
index 0000000..0087e59
--- /dev/null
+++ b/api.md
@@ -0,0 +1,62 @@
# SimplyTranslate Web API
## How to access the API
By going to the path `/api/`.\
Ex: https://simplytranslate.org/api/.

## Translate
Path `/api/translate/`
#### Arguments
* `engine`
    * `google`

        Google Translate
    * `libre`

        Libre Translate

* `from`

    Choose the From-Language (Source Language). It's based on the engine.
* `to`

    Choose the To-Language (Target Language). It's based on the engine.

* `text`

    The original text (input).

Ex: https://simplytranslate.org/api/translate/?engine=google&from=en&to=es&text=Hello.

## Get Languages
Path `/api/get_languages/`
#### Arguments
* `engine`
    * `google`

        Google Translate
    * `libre`

        Libre Translate

Ex: https://simplytranslate.org/api/get_languages/?engine=google.

## Text-To-Speech (TTS)
Path `/api/tts/`
#### Arguments
* `engine`
    * `google`

        Google Translate
    * `libre`

        Libre Translate

* `lang`

    Choose the language. It's based on the engine.

* `text`

    Input.

Ex: https://simplytranslate.org/api/tts/?engine=google&lang=en&text=Hello.
\ No newline at end of file
diff --git a/config.conf b/config.conf
index 508a302..383f505 100644
--- a/config.conf
+++ b/config.conf
@@ -15,6 +15,9 @@ ApiKey = [REDACTED]
# Google translate is enabled by default.
Enabled = True

[deepl]
Enabled = True

[network]
port = 5000
host = 0.0.0.0
\ No newline at end of file
-- 
2.25.1
Merged.