This is a Bash client script for accessing Farsava API service.
The script uses cURL underneath for making all REST calls.
# Make sure the script has executable rights
$ chmod u+x farsava-cli
# Print the list of operations available on the service
$ ./farsava-cli -h
# Print the service description
$ ./farsava-cli --about
# Print detailed information about specific operation
$ ./farsava-cli <operationId> -h
# Make GET request
./farsava-cli --host http://<hostname>:<port> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>
# Make GET request using arbitrary curl options (must be passed before <operationId>) to an SSL service using username:password
farsava-cli -k -sS --tlsv1.2 --host https://<hostname> -u <user>:<password> --accept xml <operationId> <queryParam1>=<value1> <header_key1>:<header_value2>
# Make POST request
$ echo '<body_content>' | farsava-cli --host <hostname> --content-type json <operationId> -
# Make POST request with simple JSON content, e.g.:
# {
# "key1": "value1",
# "key2": "value2",
# "key3": 23
# }
$ echo '<body_content>' | farsava-cli --host <hostname> --content-type json <operationId> key1==value1 key2=value2 key3:=23 -
# Preview the cURL command without actually executing it
$ farsava-cli --host http://<hostname>:<port> --dry-run <operationid>
You can easily create a Docker image containing a preconfigured environment for using the REST Bash client including working autocompletion and short welcome message with basic instructions, using the generated Dockerfile:
docker build -t my-rest-client .
docker run -it my-rest-client
By default you will be logged into a Zsh environment which has much more advanced auto completion, but you can switch to Bash, where basic autocompletion is also available.
The generated bash-completion script can be either directly loaded to the current Bash session using:
source farsava-cli.bash-completion
Alternatively, the script can be copied to the /etc/bash-completion.d
(or on OSX with Homebrew to /usr/local/etc/bash-completion.d
):
sudo cp farsava-cli.bash-completion /etc/bash-completion.d/farsava-cli
On OSX you might need to install bash-completion using Homebrew:
brew install bash-completion
and add the following to the ~/.bashrc
:
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
In Zsh, the generated _farsava-cli
Zsh completion file must be copied to one of the folders under $FPATH
variable.
All URIs are relative to /v1
Class | Method | HTTP request | Description |
---|---|---|---|
LanguageModelApi | getLanguageModelById | GET /speech/languagemodels/{languageModelId} | GET /speech/languagemodels/{languageModelId} |
LanguageModelApi | getLanguageModelList | GET /speech/languagemodels | GET /speech/languagemodels |
LanguageModelApi | trainLanguageModel | POST /speech/languagemodels | POST /speech/languagemodels |
SpeechApi | deleteTranscription | DELETE /speech/transcriptions/{transcriptionId} | DELETE /speech/transcriptions/{transcriptionId} |
SpeechApi | getTranscription | GET /speech/transcriptions/{transcriptionId} | GET /speech/transcriptions/{transcriptionId} |
SpeechApi | recognize | POST /speech/asr | POST /speech/asr |
SpeechApi | recognizeLive | GET /speech/asrlive | GET /speech/asrlive |
SpeechApi | recognizeLongRunning | POST /speech/asrlongrunning | POST /speech/asrlongrunning |
SpeechApi | speechHealthCheck | GET /speech/healthcheck | GET /speech/healthcheck |
VoiceApi | getVoicesList | GET /voice/speakers | GET /voice/speakers |
VoiceApi | synthesize | POST /voice/tts | POST /voice/tts |
VoiceApi | voiceHealthCheck | GET /voice/healthcheck | GET /voice/healthcheck |
- ASRRequestBodyData
- ASRRequestBodyURI
- ASRResponseBody
- ASRStatus
- AudioEncoding
- Error
- HealthCheckResponseBody
- LMStatus
- LanguageCode
- LanguageModelResult
- LanguageModelTrainRequestBody
- RecognitionAudioData
- RecognitionAudioURI
- RecognitionConfig
- SpeechRecognitionModel
- SpeechRecognitionResult
- SynthesisInput
- TTSAudioConfig
- TTSRequestBody
- TTSResponseBody
- TTSVoiceGender
- VoiceSelectionParams
- WordInfo
- Type: HTTP basic authentication