-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfarsava-cli
executable file
·1837 lines (1695 loc) · 81.5 KB
/
farsava-cli
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !
# ! Note:
# !
# ! THIS SCRIPT HAS BEEN AUTOMATICALLY GENERATED USING
# ! openapi-generator (https://openapi-generator.tech)
# ! FROM OPENAPI SPECIFICATION IN JSON.
# !
# !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# This is a Bash client for Farsava API.
#
# LICENSE:
#
#
# CONTACT:
#
# MORE INFORMATION:
# https://bump.sh/doc/farsava
#
# For improved pattern matching in case statemets
shopt -s extglob
###############################################################################
#
# Make sure Bash is at least in version 4.3
#
###############################################################################
if ! ( (("${BASH_VERSION:0:1}" == "4")) && (("${BASH_VERSION:2:1}" >= "3")) ) \
&& ! (("${BASH_VERSION:0:1}" >= "5")); then
echo ""
echo "Sorry - your Bash version is ${BASH_VERSION}"
echo ""
echo "You need at least Bash 4.3 to run this script."
echo ""
exit 1
fi
###############################################################################
#
# Global variables
#
###############################################################################
##
# The filename of this script for help messages
script_name=$(basename "$0")
##
# Map for headers passed after operation as KEY:VALUE
declare -A header_arguments
##
# Map for operation parameters passed after operation as PARAMETER=VALUE
# These will be mapped to appropriate path or query parameters
# The values in operation_parameters are arrays, so that multiple values
# can be provided for the same parameter if allowed by API specification
declare -A operation_parameters
##
# Declare colors with autodection if output is terminal
if [ -t 1 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
BLUE="$(tput setaf 4)"
MAGENTA="$(tput setaf 5)"
CYAN="$(tput setaf 6)"
WHITE="$(tput setaf 7)"
BOLD="$(tput bold)"
OFF="$(tput sgr0)"
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
MAGENTA=""
CYAN=""
WHITE=""
BOLD=""
OFF=""
fi
declare -a result_color_table=( "$WHITE" "$WHITE" "$GREEN" "$YELLOW" "$WHITE" "$MAGENTA" "$WHITE" )
##
# This array stores the minimum number of required occurrences for parameter
# 0 - optional
# 1 - required
declare -A operation_parameters_minimum_occurrences
operation_parameters_minimum_occurrences["getLanguageModelById:::languageModelId"]=1
operation_parameters_minimum_occurrences["trainLanguageModel:::LanguageModelTrainRequestBody"]=1
operation_parameters_minimum_occurrences["deleteTranscription:::transcriptionId"]=1
operation_parameters_minimum_occurrences["getTranscription:::transcriptionId"]=1
operation_parameters_minimum_occurrences["recognize:::ASRRequestBodyData"]=1
operation_parameters_minimum_occurrences["recognizeLongRunning:::ASRRequestBodyURI"]=1
operation_parameters_minimum_occurrences["synthesize:::TTSRequestBody"]=1
##
# This array stores the maximum number of allowed occurrences for parameter
# 1 - single value
# 2 - 2 values
# N - N values
# 0 - unlimited
declare -A operation_parameters_maximum_occurrences
operation_parameters_maximum_occurrences["getLanguageModelById:::languageModelId"]=0
operation_parameters_maximum_occurrences["trainLanguageModel:::LanguageModelTrainRequestBody"]=0
operation_parameters_maximum_occurrences["deleteTranscription:::transcriptionId"]=0
operation_parameters_maximum_occurrences["getTranscription:::transcriptionId"]=0
operation_parameters_maximum_occurrences["recognize:::ASRRequestBodyData"]=0
operation_parameters_maximum_occurrences["recognizeLongRunning:::ASRRequestBodyURI"]=0
operation_parameters_maximum_occurrences["synthesize:::TTSRequestBody"]=0
##
# The type of collection for specifying multiple values for parameter:
# - multi, csv, ssv, tsv
declare -A operation_parameters_collection_type
operation_parameters_collection_type["getLanguageModelById:::languageModelId"]=""
operation_parameters_collection_type["trainLanguageModel:::LanguageModelTrainRequestBody"]=""
operation_parameters_collection_type["deleteTranscription:::transcriptionId"]=""
operation_parameters_collection_type["getTranscription:::transcriptionId"]=""
operation_parameters_collection_type["recognize:::ASRRequestBodyData"]=""
operation_parameters_collection_type["recognizeLongRunning:::ASRRequestBodyURI"]=""
operation_parameters_collection_type["synthesize:::TTSRequestBody"]=""
##
# Map for body parameters passed after operation as
# PARAMETER==STRING_VALUE or PARAMETER:=NUMERIC_VALUE
# These will be mapped to top level json keys ( { "PARAMETER": "VALUE" })
declare -A body_parameters
##
# These arguments will be directly passed to cURL
curl_arguments=""
##
# The host for making the request
host="$FARSAVA_SERVER"
##
# The user credentials for basic authentication
basic_auth_credential=""
##
# If true, the script will only output the actual cURL command that would be
# used
print_curl=false
##
# The operation ID passed on the command line
operation=""
##
# The provided Accept header value
header_accept=""
##
# The provided Content-type header value
header_content_type=""
##
# If there is any body content on the stdin pass it to the body of the request
body_content_temp_file=""
##
# If this variable is set to true, the request will be performed even
# if parameters for required query, header or body values are not provided
# (path parameters are still required).
force=false
##
# Declare some mime types abbreviations for easier content-type and accepts
# headers specification
declare -A mime_type_abbreviations
# text/*
mime_type_abbreviations["text"]="text/plain"
mime_type_abbreviations["html"]="text/html"
mime_type_abbreviations["md"]="text/x-markdown"
mime_type_abbreviations["csv"]="text/csv"
mime_type_abbreviations["css"]="text/css"
mime_type_abbreviations["rtf"]="text/rtf"
# application/*
mime_type_abbreviations["json"]="application/json"
mime_type_abbreviations["xml"]="application/xml"
mime_type_abbreviations["yaml"]="application/yaml"
mime_type_abbreviations["js"]="application/javascript"
mime_type_abbreviations["bin"]="application/octet-stream"
mime_type_abbreviations["rdf"]="application/rdf+xml"
# image/*
mime_type_abbreviations["jpg"]="image/jpeg"
mime_type_abbreviations["png"]="image/png"
mime_type_abbreviations["gif"]="image/gif"
mime_type_abbreviations["bmp"]="image/bmp"
mime_type_abbreviations["tiff"]="image/tiff"
##############################################################################
#
# Escape special URL characters
# Based on table at http://www.w3schools.com/tags/ref_urlencode.asp
#
##############################################################################
url_escape() {
local raw_url="$1"
value=$(sed -e 's/ /%20/g' \
-e 's/!/%21/g' \
-e 's/"/%22/g' \
-e 's/#/%23/g' \
-e 's/\&/%26/g' \
-e 's/'\''/%28/g' \
-e 's/(/%28/g' \
-e 's/)/%29/g' \
-e 's/:/%3A/g' \
-e 's/\t/%09/g' \
-e 's/?/%3F/g' <<<"$raw_url");
echo "$value"
}
##############################################################################
#
# Lookup the mime type abbreviation in the mime_type_abbreviations array.
# If not present assume the user provided a valid mime type
#
##############################################################################
lookup_mime_type() {
local mime_type="$1"
if [[ ${mime_type_abbreviations[$mime_type]} ]]; then
echo "${mime_type_abbreviations[$mime_type]}"
else
echo "$mime_type"
fi
}
##############################################################################
#
# Converts an associative array into a list of cURL header
# arguments (-H "KEY: VALUE")
#
##############################################################################
header_arguments_to_curl() {
local headers_curl=""
for key in "${!header_arguments[@]}"; do
headers_curl+="-H \"${key}: ${header_arguments[${key}]}\" "
done
headers_curl+=" "
echo "${headers_curl}"
}
##############################################################################
#
# Converts an associative array into a simple JSON with keys as top
# level object attributes
#
# \todo Add conversion of more complex attributes using paths
#
##############################################################################
body_parameters_to_json() {
local body_json="-d '{"
local count=0
for key in "${!body_parameters[@]}"; do
if [[ $((count++)) -gt 0 ]]; then
body_json+=", "
fi
body_json+="\"${key}\": ${body_parameters[${key}]}"
done
body_json+="}'"
if [[ "${#body_parameters[@]}" -eq 0 ]]; then
echo ""
else
echo "${body_json}"
fi
}
##############################################################################
#
# Helper method for showing error because for example echo in
# build_request_path() is evaluated as part of command line not printed on
# output. Anyway better idea for resource clean up ;-).
#
##############################################################################
ERROR_MSG=""
function finish {
if [[ -n "$ERROR_MSG" ]]; then
echo >&2 "${OFF}${RED}$ERROR_MSG"
echo >&2 "${OFF}Check usage: '${script_name} --help'"
fi
}
trap finish EXIT
##############################################################################
#
# Validate and build request path including query parameters
#
##############################################################################
build_request_path() {
local path_template=$1
local -n path_params=$2
local -n query_params=$3
#
# Check input parameters count against minimum and maximum required
#
if [[ "$force" = false ]]; then
local was_error=""
for qparam in "${query_params[@]}" "${path_params[@]}"; do
local parameter_values
mapfile -t parameter_values < <(sed -e 's/'":::"'/\n/g' <<<"${operation_parameters[$qparam]}")
#
# Check if the number of provided values is not less than minimum required
#
if [[ ${#parameter_values[@]} -lt ${operation_parameters_minimum_occurrences["${operation}:::${qparam}"]} ]]; then
echo "ERROR: Too few values provided for '${qparam}' parameter."
was_error=true
fi
#
# Check if the number of provided values is not more than maximum
#
if [[ ${operation_parameters_maximum_occurrences["${operation}:::${qparam}"]} -gt 0 \
&& ${#parameter_values[@]} -gt ${operation_parameters_maximum_occurrences["${operation}:::${qparam}"]} ]]; then
echo "ERROR: Too many values provided for '${qparam}' parameter"
was_error=true
fi
done
if [[ -n "$was_error" ]]; then
exit 1
fi
fi
# First replace all path parameters in the path
for pparam in "${path_params[@]}"; do
local path_regex="(.*)(\\{$pparam\\})(.*)"
if [[ $path_template =~ $path_regex ]]; then
path_template=${BASH_REMATCH[1]}${operation_parameters[$pparam]}${BASH_REMATCH[3]}
fi
done
local query_request_part=""
local count=0
for qparam in "${query_params[@]}"; do
# Get the array of parameter values
local parameter_value=""
local parameter_values
mapfile -t parameter_values < <(sed -e 's/'":::"'/\n/g' <<<"${operation_parameters[$qparam]}")
if [[ -n "${parameter_values[*]}" ]]; then
if [[ $((count++)) -gt 0 ]]; then
query_request_part+="&"
fi
fi
#
# Append parameters without specific cardinality
#
local collection_type="${operation_parameters_collection_type["${operation}:::${qparam}"]}"
if [[ "${collection_type}" == "" ]]; then
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+="&"
fi
parameter_value+="${qparam}=${qvalue}"
done
#
# Append parameters specified as 'mutli' collections i.e. param=value1¶m=value2&...
#
elif [[ "${collection_type}" == "multi" ]]; then
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+="&"
fi
parameter_value+="${qparam}=${qvalue}"
done
#
# Append parameters specified as 'csv' collections i.e. param=value1,value2,...
#
elif [[ "${collection_type}" == "csv" ]]; then
parameter_value+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+=","
fi
parameter_value+="${qvalue}"
done
#
# Append parameters specified as 'ssv' collections i.e. param="value1 value2 ..."
#
elif [[ "${collection_type}" == "ssv" ]]; then
parameter_value+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+=" "
fi
parameter_value+="${qvalue}"
done
#
# Append parameters specified as 'tsv' collections i.e. param="value1\tvalue2\t..."
#
elif [[ "${collection_type}" == "tsv" ]]; then
parameter_value+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
if [[ $((vcount++)) -gt 0 ]]; then
parameter_value+="\\t"
fi
parameter_value+="${qvalue}"
done
else
echo "Unsupported collection format \"${collection_type}\""
exit 1
fi
if [[ -n "${parameter_value}" ]]; then
query_request_part+="${parameter_value}"
fi
done
# Now append query parameters - if any
if [[ -n "${query_request_part}" ]]; then
path_template+="?${query_request_part}"
fi
echo "$path_template"
}
###############################################################################
#
# Print main help message
#
###############################################################################
print_help() {
cat <<EOF
${BOLD}${WHITE}Farsava API command line client (API version 1.0.6)${OFF}
${BOLD}${WHITE}Usage${OFF}
${GREEN}${script_name}${OFF} [-h|--help] [-V|--version] [--about] [${RED}<curl-options>${OFF}]
[-ac|--accept ${GREEN}<mime-type>${OFF}] [-ct,--content-type ${GREEN}<mime-type>${OFF}]
[--host ${CYAN}<url>${OFF}] [--dry-run] [-nc|--no-colors] ${YELLOW}<operation>${OFF} [-h|--help]
[${BLUE}<headers>${OFF}] [${MAGENTA}<parameters>${OFF}] [${MAGENTA}<body-parameters>${OFF}]
- ${CYAN}<url>${OFF} - endpoint of the REST service without basepath
Can also be specified in FARSAVA_SERVER environment variable.
- ${RED}<curl-options>${OFF} - any valid cURL options can be passed before ${YELLOW}<operation>${OFF}
- ${GREEN}<mime-type>${OFF} - either full mime-type or one of supported abbreviations:
(text, html, md, csv, css, rtf, json, xml, yaml, js, bin,
rdf, jpg, png, gif, bmp, tiff)
- ${BLUE}<headers>${OFF} - HTTP headers can be passed in the form ${YELLOW}HEADER${OFF}:${BLUE}VALUE${OFF}
- ${MAGENTA}<parameters>${OFF} - REST operation parameters can be passed in the following
forms:
* ${YELLOW}KEY${OFF}=${BLUE}VALUE${OFF} - path or query parameters
- ${MAGENTA}<body-parameters>${OFF} - simple JSON body content (first level only) can be build
using the following arguments:
* ${YELLOW}KEY${OFF}==${BLUE}VALUE${OFF} - body parameters which will be added to body
JSON as '{ ..., "${YELLOW}KEY${OFF}": "${BLUE}VALUE${OFF}", ... }'
* ${YELLOW}KEY${OFF}:=${BLUE}VALUE${OFF} - body parameters which will be added to body
JSON as '{ ..., "${YELLOW}KEY${OFF}": ${BLUE}VALUE${OFF}, ... }'
EOF
echo -e "${BOLD}${WHITE}Authentication methods${OFF}"
echo -e ""
echo -e " - ${BLUE}Basic AUTH${OFF} - add '-u <username>:<password>' before ${YELLOW}<operation>${OFF}"
echo ""
echo -e "${BOLD}${WHITE}Operations (grouped by tags)${OFF}"
echo ""
echo -e "${BOLD}${WHITE}[languageModel]${OFF}"
read -r -d '' ops <<EOF
${CYAN}getLanguageModelById${OFF};GET /speech/languagemodels/{languageModelId} (AUTH)
${CYAN}getLanguageModelList${OFF};GET /speech/languagemodels (AUTH)
${CYAN}trainLanguageModel${OFF};POST /speech/languagemodels (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[speech]${OFF}"
read -r -d '' ops <<EOF
${CYAN}deleteTranscription${OFF};DELETE /speech/transcriptions/{transcriptionId} (AUTH)
${CYAN}getTranscription${OFF};GET /speech/transcriptions/{transcriptionId} (AUTH)
${CYAN}recognize${OFF};POST /speech/asr (AUTH)
${CYAN}recognizeLive${OFF};GET /speech/asrlive (AUTH)
${CYAN}recognizeLongRunning${OFF};POST /speech/asrlongrunning (AUTH)
${CYAN}speechHealthCheck${OFF};GET /speech/healthcheck (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[voice]${OFF}"
read -r -d '' ops <<EOF
${CYAN}getVoicesList${OFF};GET /voice/speakers (AUTH)
${CYAN}synthesize${OFF};POST /voice/tts (AUTH)
${CYAN}voiceHealthCheck${OFF};GET /voice/healthcheck (AUTH)
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}Options${OFF}"
echo -e " -h,--help\\t\\t\\t\\tPrint this help"
echo -e " -V,--version\\t\\t\\t\\tPrint API version"
echo -e " --about\\t\\t\\t\\tPrint the information about service"
echo -e " --host ${CYAN}<url>${OFF}\\t\\t\\t\\tSpecify the host URL "
echo -e " \\t\\t\\t\\t(e.g. 'https://api.amerandish.com')"
echo -e " --force\\t\\t\\t\\tForce command invocation in spite of missing"
echo -e " \\t\\t\\t\\trequired parameters or wrong content type"
echo -e " --dry-run\\t\\t\\t\\tPrint out the cURL command without"
echo -e " \\t\\t\\t\\texecuting it"
echo -e " -nc,--no-colors\\t\\t\\tEnforce print without colors, otherwise autodected"
echo -e " -ac,--accept ${YELLOW}<mime-type>${OFF}\\t\\tSet the 'Accept' header in the request"
echo -e " -ct,--content-type ${YELLOW}<mime-type>${OFF}\\tSet the 'Content-type' header in "
echo -e " \\tthe request"
echo ""
}
##############################################################################
#
# Print REST service description
#
##############################################################################
print_about() {
echo ""
echo -e "${BOLD}${WHITE}Farsava API command line client (API version 1.0.6)${OFF}"
echo ""
echo -e "License: "
echo -e "Contact: [email protected]"
echo ""
read -r -d '' appdescription <<EOF
Farsava API. Speech Recognition and Text to Speech by applying powerful deep neural network models.
EOF
echo "$appdescription" | paste -sd' ' | fold -sw 80
}
##############################################################################
#
# Print REST api version
#
##############################################################################
print_version() {
echo ""
echo -e "${BOLD}Farsava API command line client (API version 1.0.6)${OFF}"
echo ""
}
##############################################################################
#
# Print help for getLanguageModelById operation
#
##############################################################################
print_getLanguageModelById_help() {
echo ""
echo -e "${BOLD}${WHITE}getLanguageModelById - GET /speech/languagemodels/{languageModelId}${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Retrieving the status of a language model with specified languageModelId. A language model is ready to use when its status is *trained*.
***" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}languageModelId${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Id of the language model. ${YELLOW}Specify as: languageModelId=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;OK. Language Model Retrieved.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Server can not find requested resource.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=501
echo -e "${result_color_table[${code:0:1}]} 501;The request method is not supported by the server and cannot be handled.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for getLanguageModelList operation
#
##############################################################################
print_getLanguageModelList_help() {
echo ""
echo -e "${BOLD}${WHITE}getLanguageModelList - GET /speech/languagemodels${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Returns list of user available language models. Each user can access *general* language models plus their own *custom* trained language models.
***" | paste -sd' ' | fold -sw 80
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;OK. List of Language Models Retrieved.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Server can not find requested resource.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=501
echo -e "${result_color_table[${code:0:1}]} 501;The request method is not supported by the server and cannot be handled.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for trainLanguageModel operation
#
##############################################################################
print_trainLanguageModel_help() {
echo ""
echo -e "${BOLD}${WHITE}trainLanguageModel - POST /speech/languagemodels${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Train a custom language model using pharases provided by user. Returning a languageModelId for accessing the language model later and using this custom language model to transcribe audios. Using custom language models will boost accuracy for specific keywords/phrases and can be used for a domain-specific speech recognition.
***" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - A json object including a name and a corpora. Corpora is a array of text data to train a custom model. This text data can be keywords/phrases. All values in the array must be a string. Name is an arbitary string you set for the custom language model name." | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=201
echo -e "${result_color_table[${code:0:1}]} 201;OK. Processing and Training Language Model.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=501
echo -e "${result_color_table[${code:0:1}]} 501;The request method is not supported by the server and cannot be handled.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for deleteTranscription operation
#
##############################################################################
print_deleteTranscription_help() {
echo ""
echo -e "${BOLD}${WHITE}deleteTranscription - DELETE /speech/transcriptions/{transcriptionId}${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Deletes a transcription for a previous file using transcriptionId.
***" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}transcriptionId${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Id of the transcribed audio. It is a UUID string provided in the speech recognition result. ${YELLOW}Specify as: transcriptionId=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=204
echo -e "${result_color_table[${code:0:1}]} 204;The resource was deleted successfully.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Server can not find requested resource.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=501
echo -e "${result_color_table[${code:0:1}]} 501;The request method is not supported by the server and cannot be handled.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for getTranscription operation
#
##############################################################################
print_getTranscription_help() {
echo ""
echo -e "${BOLD}${WHITE}getTranscription - GET /speech/transcriptions/{transcriptionId}${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "Transcription endpoint enable us to retrieve a previous speech recognition result or inform us on a long running speech recognition status. To access a speech recognition result transcriptionId should be provided.
***" | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}transcriptionId${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Id of the transcribed audio. It is a UUID string provided in the speech recognition result. ${YELLOW}Specify as: transcriptionId=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;OK. Transcription Retrieved.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Server can not find requested resource.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=501
echo -e "${result_color_table[${code:0:1}]} 501;The request method is not supported by the server and cannot be handled.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for recognize operation
#
##############################################################################
print_recognize_help() {
echo ""
echo -e "${BOLD}${WHITE}recognize - POST /speech/asr${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "## Performs synchronous speech recognition
***
This resource receives audio data in different formats and transcribes the audio using state-of-the-art deep neural networks. It performs synchronous speech recognition and the result will be availble after all audio has been sent and processed. This endpoint is designed for transcription of short audio files upto 1 minute.
***
Using *config* object you can can specify audio configs such as *audioEncoding* and *sampleRateHertz*. We will support different languages so you can choose the *languageCode*. Using *asrModel* and *languageModel* in config you can use customized models. Refer to *asrLongRunning* and *WebSocket API* for longer audio transcriptions." | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - ## Audio *data* along with the customized *config* is posted to this service for speech recognition." | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=201
echo -e "${result_color_table[${code:0:1}]} 201;OK. Transcription Generated.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=415
echo -e "${result_color_table[${code:0:1}]} 415;The media format of the requested data is not supported by the server, so the server is rejecting the request.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for recognizeLive operation
#
##############################################################################
print_recognizeLive_help() {
echo ""
echo -e "${BOLD}${WHITE}recognizeLive - GET /speech/asrlive${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "## Performs asynchronous live speech recognition using websocket
***
This resource establish a websocket with client and receives audio data using websocket. It will start transcribing the audio using state-of-the-art deep neural networks and returns the partial results on the websocket.
This endpoint is designed for transcription of stream audio data upto 15 minute. It will send back partial (status=partial) result everytime it transcribes an endpoint. After client sends the close signal, it will receive a ASRResponseBody with status=done.
***
Using *config* object you can can specify audio configs such as *audioEncoding* and *sampleRateHertz*. We will support different languages so you can choose the *languageCode*. Using *asrModel* and *languageModel* in config you can use customized models.
Refer to *ASRLongRuning API* for long audio speech recognition.
Refer to *ASR API* for fast recognition for short audio files." | paste -sd' ' | fold -sw 80
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;OK.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=415
echo -e "${result_color_table[${code:0:1}]} 415;The media format of the requested data is not supported by the server, so the server is rejecting the request.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for recognizeLongRunning operation
#
##############################################################################
print_recognizeLongRunning_help() {
echo ""
echo -e "${BOLD}${WHITE}recognizeLongRunning - POST /speech/asrlongrunning${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "## Performs asynchronous speech recognition
***
This resource receives a uri containing the audio resource, download it and transcribes the audio using state-of-the-art deep neural networks. It performs asynchronous speech recognition and the result will be availble using transcription endpoint. This endpoint is designed for transcription of long audio files upto 240 minute.
***
Using *config* object you can can specify audio configs such as *audioEncoding* and *sampleRateHertz*. We will support different languages so you can choose the *languageCode*. Using *asrModel* and *languageModel* in config you can use customized models.
Refer to *WebSocket API* for speech recognition with streams.
Refer to *ASR API* for fast recognition for short audio files." | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - post uri and configs to this service for asr." | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=201
echo -e "${result_color_table[${code:0:1}]} 201;OK. Transcription Generated.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=415
echo -e "${result_color_table[${code:0:1}]} 415;The media format of the requested data is not supported by the server, so the server is rejecting the request.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for speechHealthCheck operation
#
##############################################################################
print_speechHealthCheck_help() {
echo ""
echo -e "${BOLD}${WHITE}speechHealthCheck - GET /speech/healthcheck${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "## speech health check endpoint.
***
This endpoint will return a simple json including **service status** and **API version**." | paste -sd' ' | fold -sw 80
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;OK.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for getVoicesList operation
#
##############################################################################
print_getVoicesList_help() {
echo ""
echo -e "${BOLD}${WHITE}getVoicesList - GET /voice/speakers${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "This endpoint retrieves the list of available speakers for speech synthesization. Each speaker has a unique *voiceId* which can be used to synthesize speech. The result aslo includes each speaker langauge, gender and name.
***" | paste -sd' ' | fold -sw 80
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;OK. TTS Voices List Retrieved.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=501
echo -e "${result_color_table[${code:0:1}]} 501;The request method is not supported by the server and cannot be handled.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for synthesize operation
#
##############################################################################
print_synthesize_help() {
echo ""
echo -e "${BOLD}${WHITE}synthesize - POST /voice/tts${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "## Synthesizes speech synchronously
***
Receives text and data configs and synthesize speech in different voices and format using state-of-the-art deep neural networks. This service synthesizes speech synchronously and the results will be available after all text input has been processed.
***
Using *config* object you can can specify audio configs such as *audioEncoding* and *sampleRateHertz*. We will support different languages so you can choose the *languageCode*. using *voiceSelectionParams* you can choose between the supported voices with specifying voiceId. Voices differ in gender, tone and style." | paste -sd' ' | fold -sw 80
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - Receives a json including input text, voice parameteres and audio config." | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=201
echo -e "${result_color_table[${code:0:1}]} 201;OK. Speech Synthesized.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=415
echo -e "${result_color_table[${code:0:1}]} 415;The media format of the requested data is not supported by the server, so the server is rejecting the request.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=501
echo -e "${result_color_table[${code:0:1}]} 501;The request method is not supported by the server and cannot be handled.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for voiceHealthCheck operation
#
##############################################################################
print_voiceHealthCheck_help() {
echo ""
echo -e "${BOLD}${WHITE}voiceHealthCheck - GET /voice/healthcheck${OFF}${BLUE}(AUTH - BASIC)${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "## voice health check endpoint.
***
This endpoint will return a simple json including **service status** and **API version**." | paste -sd' ' | fold -sw 80
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;OK.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;This response means that server could not understand the request due to invalid syntax.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Authentication is needed to get requested response. This is similar to 403, but in this case, authentication is possible.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=403
echo -e "${result_color_table[${code:0:1}]} 403;Client does not have access rights to the content so server is rejecting to give proper response.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=405
echo -e "${result_color_table[${code:0:1}]} 405;The request method is known by the server but has been disabled and cannot be used.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;The user has sent too many requests in a given amount of time (\"rate limiting\").${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;The server has encountered a situation it doesn't know how to handle.${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Call getLanguageModelById operation
#
##############################################################################
call_getLanguageModelById() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(languageModelId)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=( )
local path