Files
goose/api_clients/bash/goose-api
2025-10-02 20:13:20 -04:00

5007 lines
193 KiB
Bash

#!/usr/bin/env bash
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !
# ! Note:
# !
# ! THIS SCRIPT HAS BEEN AUTOMATICALLY GENERATED USING
# ! openapi-generator (https://openapi-generator.tech)
# ! FROM OPENAPI SPECIFICATION IN JSON.
# !
# ! Generator version: 7.14.0
# !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# This is a Bash client for goose-server.
#
# LICENSE:
#
#
# CONTACT:
# ai-oss-tools@block.xyz
#
# MORE INFORMATION:
#
#
# For improved pattern matching in case statements
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 autodetection 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["manageContext:::ContextManageRequest"]=1
operation_parameters_minimum_occurrences["createRecipe:::CreateRecipeRequest"]=1
operation_parameters_minimum_occurrences["decodeRecipe:::DecodeRecipeRequest"]=1
operation_parameters_minimum_occurrences["deleteRecipe:::DeleteRecipeRequest"]=1
operation_parameters_minimum_occurrences["encodeRecipe:::EncodeRecipeRequest"]=1
operation_parameters_minimum_occurrences["scanRecipe:::ScanRecipeRequest"]=1
operation_parameters_minimum_occurrences["createSchedule:::CreateScheduleRequest"]=1
operation_parameters_minimum_occurrences["deleteSchedule:::id"]=1
operation_parameters_minimum_occurrences["inspectRunningJob:::id"]=1
operation_parameters_minimum_occurrences["killRunningJob:::id"]=1
operation_parameters_minimum_occurrences["pauseSchedule:::id"]=1
operation_parameters_minimum_occurrences["runNowHandler:::id"]=1
operation_parameters_minimum_occurrences["sessionsHandler:::id"]=1
operation_parameters_minimum_occurrences["sessionsHandler:::limit"]=0
operation_parameters_minimum_occurrences["unpauseSchedule:::id"]=1
operation_parameters_minimum_occurrences["updateSchedule:::id"]=1
operation_parameters_minimum_occurrences["updateSchedule:::UpdateScheduleRequest"]=1
operation_parameters_minimum_occurrences["deleteSession:::session_id"]=1
operation_parameters_minimum_occurrences["getSession:::session_id"]=1
operation_parameters_minimum_occurrences["updateSessionDescription:::session_id"]=1
operation_parameters_minimum_occurrences["updateSessionDescription:::UpdateSessionDescriptionRequest"]=1
operation_parameters_minimum_occurrences["addSubRecipes:::AddSubRecipesRequest"]=1
operation_parameters_minimum_occurrences["extendPrompt:::ExtendPromptRequest"]=1
operation_parameters_minimum_occurrences["getTools:::session_id"]=1
operation_parameters_minimum_occurrences["getTools:::extension_name"]=0
operation_parameters_minimum_occurrences["resumeAgent:::ResumeAgentRequest"]=1
operation_parameters_minimum_occurrences["startAgent:::StartAgentRequest"]=1
operation_parameters_minimum_occurrences["updateAgentProvider:::UpdateProviderRequest"]=1
operation_parameters_minimum_occurrences["updateRouterToolSelector:::UpdateRouterToolSelectorRequest"]=1
operation_parameters_minimum_occurrences["updateSessionConfig:::SessionConfigRequest"]=1
operation_parameters_minimum_occurrences["addExtension:::ExtensionQuery"]=1
operation_parameters_minimum_occurrences["createCustomProvider:::CreateCustomProviderRequest"]=1
operation_parameters_minimum_occurrences["getProviderModels:::name"]=1
operation_parameters_minimum_occurrences["readConfig:::ConfigKeyQuery"]=1
operation_parameters_minimum_occurrences["removeConfig:::ConfigKeyQuery"]=1
operation_parameters_minimum_occurrences["removeCustomProvider:::id"]=1
operation_parameters_minimum_occurrences["removeExtension:::name"]=1
operation_parameters_minimum_occurrences["upsertConfig:::UpsertConfigQuery"]=1
operation_parameters_minimum_occurrences["upsertPermissions:::UpsertPermissionsQuery"]=1
operation_parameters_minimum_occurrences["confirmPermission:::PermissionConfirmationRequest"]=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["manageContext:::ContextManageRequest"]=0
operation_parameters_maximum_occurrences["createRecipe:::CreateRecipeRequest"]=0
operation_parameters_maximum_occurrences["decodeRecipe:::DecodeRecipeRequest"]=0
operation_parameters_maximum_occurrences["deleteRecipe:::DeleteRecipeRequest"]=0
operation_parameters_maximum_occurrences["encodeRecipe:::EncodeRecipeRequest"]=0
operation_parameters_maximum_occurrences["scanRecipe:::ScanRecipeRequest"]=0
operation_parameters_maximum_occurrences["createSchedule:::CreateScheduleRequest"]=0
operation_parameters_maximum_occurrences["deleteSchedule:::id"]=0
operation_parameters_maximum_occurrences["inspectRunningJob:::id"]=0
operation_parameters_maximum_occurrences["killRunningJob:::id"]=0
operation_parameters_maximum_occurrences["pauseSchedule:::id"]=0
operation_parameters_maximum_occurrences["runNowHandler:::id"]=0
operation_parameters_maximum_occurrences["sessionsHandler:::id"]=0
operation_parameters_maximum_occurrences["sessionsHandler:::limit"]=0
operation_parameters_maximum_occurrences["unpauseSchedule:::id"]=0
operation_parameters_maximum_occurrences["updateSchedule:::id"]=0
operation_parameters_maximum_occurrences["updateSchedule:::UpdateScheduleRequest"]=0
operation_parameters_maximum_occurrences["deleteSession:::session_id"]=0
operation_parameters_maximum_occurrences["getSession:::session_id"]=0
operation_parameters_maximum_occurrences["updateSessionDescription:::session_id"]=0
operation_parameters_maximum_occurrences["updateSessionDescription:::UpdateSessionDescriptionRequest"]=0
operation_parameters_maximum_occurrences["addSubRecipes:::AddSubRecipesRequest"]=0
operation_parameters_maximum_occurrences["extendPrompt:::ExtendPromptRequest"]=0
operation_parameters_maximum_occurrences["getTools:::session_id"]=0
operation_parameters_maximum_occurrences["getTools:::extension_name"]=0
operation_parameters_maximum_occurrences["resumeAgent:::ResumeAgentRequest"]=0
operation_parameters_maximum_occurrences["startAgent:::StartAgentRequest"]=0
operation_parameters_maximum_occurrences["updateAgentProvider:::UpdateProviderRequest"]=0
operation_parameters_maximum_occurrences["updateRouterToolSelector:::UpdateRouterToolSelectorRequest"]=0
operation_parameters_maximum_occurrences["updateSessionConfig:::SessionConfigRequest"]=0
operation_parameters_maximum_occurrences["addExtension:::ExtensionQuery"]=0
operation_parameters_maximum_occurrences["createCustomProvider:::CreateCustomProviderRequest"]=0
operation_parameters_maximum_occurrences["getProviderModels:::name"]=0
operation_parameters_maximum_occurrences["readConfig:::ConfigKeyQuery"]=0
operation_parameters_maximum_occurrences["removeConfig:::ConfigKeyQuery"]=0
operation_parameters_maximum_occurrences["removeCustomProvider:::id"]=0
operation_parameters_maximum_occurrences["removeExtension:::name"]=0
operation_parameters_maximum_occurrences["upsertConfig:::UpsertConfigQuery"]=0
operation_parameters_maximum_occurrences["upsertPermissions:::UpsertPermissionsQuery"]=0
operation_parameters_maximum_occurrences["confirmPermission:::PermissionConfirmationRequest"]=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["manageContext:::ContextManageRequest"]=""
operation_parameters_collection_type["createRecipe:::CreateRecipeRequest"]=""
operation_parameters_collection_type["decodeRecipe:::DecodeRecipeRequest"]=""
operation_parameters_collection_type["deleteRecipe:::DeleteRecipeRequest"]=""
operation_parameters_collection_type["encodeRecipe:::EncodeRecipeRequest"]=""
operation_parameters_collection_type["scanRecipe:::ScanRecipeRequest"]=""
operation_parameters_collection_type["createSchedule:::CreateScheduleRequest"]=""
operation_parameters_collection_type["deleteSchedule:::id"]=""
operation_parameters_collection_type["inspectRunningJob:::id"]=""
operation_parameters_collection_type["killRunningJob:::id"]=""
operation_parameters_collection_type["pauseSchedule:::id"]=""
operation_parameters_collection_type["runNowHandler:::id"]=""
operation_parameters_collection_type["sessionsHandler:::id"]=""
operation_parameters_collection_type["sessionsHandler:::limit"]=""
operation_parameters_collection_type["unpauseSchedule:::id"]=""
operation_parameters_collection_type["updateSchedule:::id"]=""
operation_parameters_collection_type["updateSchedule:::UpdateScheduleRequest"]=""
operation_parameters_collection_type["deleteSession:::session_id"]=""
operation_parameters_collection_type["getSession:::session_id"]=""
operation_parameters_collection_type["updateSessionDescription:::session_id"]=""
operation_parameters_collection_type["updateSessionDescription:::UpdateSessionDescriptionRequest"]=""
operation_parameters_collection_type["addSubRecipes:::AddSubRecipesRequest"]=""
operation_parameters_collection_type["extendPrompt:::ExtendPromptRequest"]=""
operation_parameters_collection_type["getTools:::session_id"]=""
operation_parameters_collection_type["getTools:::extension_name"]=""
operation_parameters_collection_type["resumeAgent:::ResumeAgentRequest"]=""
operation_parameters_collection_type["startAgent:::StartAgentRequest"]=""
operation_parameters_collection_type["updateAgentProvider:::UpdateProviderRequest"]=""
operation_parameters_collection_type["updateRouterToolSelector:::UpdateRouterToolSelectorRequest"]=""
operation_parameters_collection_type["updateSessionConfig:::SessionConfigRequest"]=""
operation_parameters_collection_type["addExtension:::ExtensionQuery"]=""
operation_parameters_collection_type["createCustomProvider:::CreateCustomProviderRequest"]=""
operation_parameters_collection_type["getProviderModels:::name"]=""
operation_parameters_collection_type["readConfig:::ConfigKeyQuery"]=""
operation_parameters_collection_type["removeConfig:::ConfigKeyQuery"]=""
operation_parameters_collection_type["removeCustomProvider:::id"]=""
operation_parameters_collection_type["removeExtension:::name"]=""
operation_parameters_collection_type["upsertConfig:::UpsertConfigQuery"]=""
operation_parameters_collection_type["upsertPermissions:::UpsertPermissionsQuery"]=""
operation_parameters_collection_type["confirmPermission:::PermissionConfirmationRequest"]=""
##
# 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=""
##
# 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() {
if [[ $RAW_BODY == "1" ]]; then
echo "-d '${body_parameters["RAW_BODY"]}'"
else
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
fi
}
##############################################################################
#
# Converts an associative array into form urlencoded string
#
##############################################################################
body_parameters_to_form_urlencoded() {
local body_form_urlencoded="-d '"
local count=0
for key in "${!body_parameters[@]}"; do
if [[ $((count++)) -gt 0 ]]; then
body_form_urlencoded+="&"
fi
body_form_urlencoded+="${key}=${body_parameters[${key}]}"
done
body_form_urlencoded+="'"
if [[ "${#body_parameters[@]}" -eq 0 ]]; then
echo ""
else
echo "${body_form_urlencoded}"
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=""
for qparam in "${query_params[@]}"; do
if [[ "${operation_parameters[$qparam]}" == "" ]]; then
continue
fi
# Get the array of parameter values
local parameter_value=""
local parameter_values
mapfile -t parameter_values < <(sed -e 's/'":::"'/\n/g' <<<"${operation_parameters[$qparam]}")
#
# 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 'multi' collections i.e. param=value1&param=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
if [[ -n "${query_request_part}" ]]; then
query_request_part+="&"
fi
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}goose-server command line client (API version 1.9.0)${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
- ${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}Operations (grouped by tags)${OFF}"
echo ""
echo -e "${BOLD}${WHITE}[contextManagement]${OFF}"
read -r -d '' ops <<EOF
${CYAN}manageContext${OFF};
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[recipeManagement]${OFF}"
read -r -d '' ops <<EOF
${CYAN}createRecipe${OFF};Create a Recipe configuration from the current session
${CYAN}decodeRecipe${OFF};
${CYAN}deleteRecipe${OFF};
${CYAN}encodeRecipe${OFF};
${CYAN}listRecipes${OFF};
${CYAN}scanRecipe${OFF};
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[schedule]${OFF}"
read -r -d '' ops <<EOF
${CYAN}createSchedule${OFF};
${CYAN}deleteSchedule${OFF};
${CYAN}inspectRunningJob${OFF};
${CYAN}killRunningJob${OFF};
${CYAN}listSchedules${OFF};
${CYAN}pauseSchedule${OFF};
${CYAN}runNowHandler${OFF};
${CYAN}sessionsHandler${OFF};
${CYAN}unpauseSchedule${OFF};
${CYAN}updateSchedule${OFF};
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[sessionManagement]${OFF}"
read -r -d '' ops <<EOF
${CYAN}deleteSession${OFF};
${CYAN}getSession${OFF};
${CYAN}getSessionInsights${OFF};
${CYAN}listSessions${OFF};
${CYAN}updateSessionDescription${OFF};
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[superRoutesAgent]${OFF}"
read -r -d '' ops <<EOF
${CYAN}addSubRecipes${OFF};
${CYAN}extendPrompt${OFF};
${CYAN}getTools${OFF};
${CYAN}resumeAgent${OFF};
${CYAN}startAgent${OFF};
${CYAN}updateAgentProvider${OFF};
${CYAN}updateRouterToolSelector${OFF};
${CYAN}updateSessionConfig${OFF};
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[superRoutesConfigManagement]${OFF}"
read -r -d '' ops <<EOF
${CYAN}addExtension${OFF};
${CYAN}backupConfig${OFF};
${CYAN}createCustomProvider${OFF};
${CYAN}getExtensions${OFF};
${CYAN}getProviderModels${OFF};
${CYAN}initConfig${OFF};
${CYAN}providers${OFF};
${CYAN}readAllConfig${OFF};
${CYAN}readConfig${OFF};
${CYAN}recoverConfig${OFF};
${CYAN}removeConfig${OFF};
${CYAN}removeCustomProvider${OFF};
${CYAN}removeExtension${OFF};
${CYAN}upsertConfig${OFF};
${CYAN}upsertPermissions${OFF};
${CYAN}validateConfig${OFF};
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[superRoutesHealth]${OFF}"
read -r -d '' ops <<EOF
${CYAN}status${OFF};
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[superRoutesReply]${OFF}"
read -r -d '' ops <<EOF
${CYAN}confirmPermission${OFF};
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "${BOLD}${WHITE}[superRoutesSetup]${OFF}"
read -r -d '' ops <<EOF
${CYAN}startOpenrouterSetup${OFF};
${CYAN}startTetrateSetup${OFF};
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://localhost')"
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 autodetected"
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}goose-server command line client (API version 1.9.0)${OFF}"
echo ""
echo -e "License: Apache-2.0"
echo -e "Contact: ai-oss-tools@block.xyz"
echo ""
read -r -d '' appdescription <<EOF
An AI agent
EOF
echo "$appdescription" | paste -sd' ' | fold -sw 80
}
##############################################################################
#
# Print REST api version
#
##############################################################################
print_version() {
echo ""
echo -e "${BOLD}goose-server command line client (API version 1.9.0)${OFF}"
echo ""
}
##############################################################################
#
# Print help for manageContext operation
#
##############################################################################
print_manageContext_help() {
echo ""
echo -e "${BOLD}${WHITE}manageContext - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Context managed successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - Invalid or missing API key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=412
echo -e "${result_color_table[${code:0:1}]} 412;Precondition failed - Agent not available${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for createRecipe operation
#
##############################################################################
print_createRecipe_help() {
echo ""
echo -e "${BOLD}${WHITE}createRecipe - Create a Recipe configuration from the current session${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Recipe created successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Bad request${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=412
echo -e "${result_color_table[${code:0:1}]} 412;Precondition failed - Agent not available${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for decodeRecipe operation
#
##############################################################################
print_decodeRecipe_help() {
echo ""
echo -e "${BOLD}${WHITE}decodeRecipe - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Recipe decoded successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Bad request${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for deleteRecipe operation
#
##############################################################################
print_deleteRecipe_help() {
echo ""
echo -e "${BOLD}${WHITE}deleteRecipe - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=204
echo -e "${result_color_table[${code:0:1}]} 204;Recipe deleted successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - Invalid or missing API key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Recipe not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for encodeRecipe operation
#
##############################################################################
print_encodeRecipe_help() {
echo ""
echo -e "${BOLD}${WHITE}encodeRecipe - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Recipe encoded successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Bad request${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for listRecipes operation
#
##############################################################################
print_listRecipes_help() {
echo ""
echo -e "${BOLD}${WHITE}listRecipes - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Get recipe list successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - Invalid or missing API key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for scanRecipe operation
#
##############################################################################
print_scanRecipe_help() {
echo ""
echo -e "${BOLD}${WHITE}scanRecipe - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Recipe scanned successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for createSchedule operation
#
##############################################################################
print_createSchedule_help() {
echo ""
echo -e "${BOLD}${WHITE}createSchedule - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Scheduled job created successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Invalid cron expression or recipe file${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=409
echo -e "${result_color_table[${code:0:1}]} 409;Job ID already exists${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for deleteSchedule operation
#
##############################################################################
print_deleteSchedule_help() {
echo ""
echo -e "${BOLD}${WHITE}deleteSchedule - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of the schedule to delete ${YELLOW}Specify as: id=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;Scheduled job deleted successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Scheduled job not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for inspectRunningJob operation
#
##############################################################################
print_inspectRunningJob_help() {
echo ""
echo -e "${BOLD}${WHITE}inspectRunningJob - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of the schedule to inspect ${YELLOW}Specify as: id=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;Running job information${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Scheduled job not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for killRunningJob operation
#
##############################################################################
print_killRunningJob_help() {
echo ""
echo -e "${BOLD}${WHITE}killRunningJob - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW}Specify as: id=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;Running job killed successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for listSchedules operation
#
##############################################################################
print_listSchedules_help() {
echo ""
echo -e "${BOLD}${WHITE}listSchedules - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;A list of scheduled jobs${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for pauseSchedule operation
#
##############################################################################
print_pauseSchedule_help() {
echo ""
echo -e "${BOLD}${WHITE}pauseSchedule - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of the schedule to pause ${YELLOW}Specify as: id=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;Scheduled job paused successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Cannot pause a currently running job${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Scheduled job not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for runNowHandler operation
#
##############################################################################
print_runNowHandler_help() {
echo ""
echo -e "${BOLD}${WHITE}runNowHandler - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of the schedule to run ${YELLOW}Specify as: id=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;Scheduled job triggered successfully, returns new session ID${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Scheduled job not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error when trying to run the job${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for sessionsHandler operation
#
##############################################################################
print_sessionsHandler_help() {
echo ""
echo -e "${BOLD}${WHITE}sessionsHandler - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of the schedule ${YELLOW}Specify as: id=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}limit${OFF} ${BLUE}[integer]${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW} Specify as: limit=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;A list of session display info${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for unpauseSchedule operation
#
##############################################################################
print_unpauseSchedule_help() {
echo ""
echo -e "${BOLD}${WHITE}unpauseSchedule - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of the schedule to unpause ${YELLOW}Specify as: id=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;Scheduled job unpaused successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Scheduled job not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for updateSchedule operation
#
##############################################################################
print_updateSchedule_help() {
echo ""
echo -e "${BOLD}${WHITE}updateSchedule - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ID of the schedule to update ${YELLOW}Specify as: id=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Scheduled job updated successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Cannot update a currently running job or invalid request${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Scheduled job not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for deleteSession operation
#
##############################################################################
print_deleteSession_help() {
echo ""
echo -e "${BOLD}${WHITE}deleteSession - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}session_id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Unique identifier for the session ${YELLOW}Specify as: session_id=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;Session deleted successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - Invalid or missing API key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Session not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for getSession operation
#
##############################################################################
print_getSession_help() {
echo ""
echo -e "${BOLD}${WHITE}getSession - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}session_id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Unique identifier for the session ${YELLOW}Specify as: session_id=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;Session history retrieved successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - Invalid or missing API key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Session not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for getSessionInsights operation
#
##############################################################################
print_getSessionInsights_help() {
echo ""
echo -e "${BOLD}${WHITE}getSessionInsights - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Session insights retrieved successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - Invalid or missing API key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for listSessions operation
#
##############################################################################
print_listSessions_help() {
echo ""
echo -e "${BOLD}${WHITE}listSessions - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;List of available sessions retrieved successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - Invalid or missing API key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for updateSessionDescription operation
#
##############################################################################
print_updateSessionDescription_help() {
echo ""
echo -e "${BOLD}${WHITE}updateSessionDescription - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}session_id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Unique identifier for the session ${YELLOW}Specify as: session_id=value${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Session description updated successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Bad request - Description too long (max 200 characters)${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - Invalid or missing API key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Session not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for addSubRecipes operation
#
##############################################################################
print_addSubRecipes_help() {
echo ""
echo -e "${BOLD}${WHITE}addSubRecipes - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Added sub recipes to agent successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - invalid secret key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=424
echo -e "${result_color_table[${code:0:1}]} 424;Agent not initialized${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for extendPrompt operation
#
##############################################################################
print_extendPrompt_help() {
echo ""
echo -e "${BOLD}${WHITE}extendPrompt - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Extended system prompt successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - invalid secret key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=424
echo -e "${result_color_table[${code:0:1}]} 424;Agent not initialized${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for getTools operation
#
##############################################################################
print_getTools_help() {
echo ""
echo -e "${BOLD}${WHITE}getTools - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}session_id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Required session ID to scope tools to a specific session${YELLOW} Specify as: session_id=value${OFF}" \
| paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * ${GREEN}extension_name${OFF} ${BLUE}[string]${OFF} ${CYAN}(default: null)${OFF} - Optional extension name to filter tools${YELLOW} Specify as: extension_name=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;Tools retrieved successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - invalid secret key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=424
echo -e "${result_color_table[${code:0:1}]} 424;Agent not initialized${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for resumeAgent operation
#
##############################################################################
print_resumeAgent_help() {
echo ""
echo -e "${BOLD}${WHITE}resumeAgent - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Agent started successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Bad request - invalid working directory${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - invalid secret key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for startAgent operation
#
##############################################################################
print_startAgent_help() {
echo ""
echo -e "${BOLD}${WHITE}startAgent - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Agent started successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Bad request - invalid working directory${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - invalid secret key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for updateAgentProvider operation
#
##############################################################################
print_updateAgentProvider_help() {
echo ""
echo -e "${BOLD}${WHITE}updateAgentProvider - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Provider updated successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Bad request - missing or invalid parameters${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - invalid secret key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=424
echo -e "${result_color_table[${code:0:1}]} 424;Agent not initialized${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for updateRouterToolSelector operation
#
##############################################################################
print_updateRouterToolSelector_help() {
echo ""
echo -e "${BOLD}${WHITE}updateRouterToolSelector - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Tool selection strategy updated successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - invalid secret key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=424
echo -e "${result_color_table[${code:0:1}]} 424;Agent not initialized${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for updateSessionConfig operation
#
##############################################################################
print_updateSessionConfig_help() {
echo ""
echo -e "${BOLD}${WHITE}updateSessionConfig - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Session config updated successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - invalid secret key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=424
echo -e "${result_color_table[${code:0:1}]} 424;Agent not initialized${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for addExtension operation
#
##############################################################################
print_addExtension_help() {
echo ""
echo -e "${BOLD}${WHITE}addExtension - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Extension added or updated successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Invalid request${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=422
echo -e "${result_color_table[${code:0:1}]} 422;Could not serialize config.yaml${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for backupConfig operation
#
##############################################################################
print_backupConfig_help() {
echo ""
echo -e "${BOLD}${WHITE}backupConfig - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Config file backed up${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for createCustomProvider operation
#
##############################################################################
print_createCustomProvider_help() {
echo ""
echo -e "${BOLD}${WHITE}createCustomProvider - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Custom provider created successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Invalid request${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for getExtensions operation
#
##############################################################################
print_getExtensions_help() {
echo ""
echo -e "${BOLD}${WHITE}getExtensions - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;All extensions retrieved successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for getProviderModels operation
#
##############################################################################
print_getProviderModels_help() {
echo ""
echo -e "${BOLD}${WHITE}getProviderModels - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}name${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - Provider name (e.g., openai) ${YELLOW}Specify as: name=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;Models fetched successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Unknown provider, provider not configured, or authentication error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=429
echo -e "${result_color_table[${code:0:1}]} 429;Rate limit exceeded${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for initConfig operation
#
##############################################################################
print_initConfig_help() {
echo ""
echo -e "${BOLD}${WHITE}initConfig - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Config initialization check completed${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for providers operation
#
##############################################################################
print_providers_help() {
echo ""
echo -e "${BOLD}${WHITE}providers - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;All configuration values retrieved successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for readAllConfig operation
#
##############################################################################
print_readAllConfig_help() {
echo ""
echo -e "${BOLD}${WHITE}readAllConfig - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;All configuration values retrieved successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for readConfig operation
#
##############################################################################
print_readConfig_help() {
echo ""
echo -e "${BOLD}${WHITE}readConfig - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Configuration value retrieved successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Unable to get the configuration value${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for recoverConfig operation
#
##############################################################################
print_recoverConfig_help() {
echo ""
echo -e "${BOLD}${WHITE}recoverConfig - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Config recovery attempted${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for removeConfig operation
#
##############################################################################
print_removeConfig_help() {
echo ""
echo -e "${BOLD}${WHITE}removeConfig - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Configuration value removed successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Configuration key not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for removeCustomProvider operation
#
##############################################################################
print_removeCustomProvider_help() {
echo ""
echo -e "${BOLD}${WHITE}removeCustomProvider - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}id${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW}Specify as: id=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;Custom provider removed successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Provider not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for removeExtension operation
#
##############################################################################
print_removeExtension_help() {
echo ""
echo -e "${BOLD}${WHITE}removeExtension - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}name${OFF} ${BLUE}[string]${OFF} ${RED}(required)${OFF} ${CYAN}(default: null)${OFF} - ${YELLOW}Specify as: name=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;Extension removed successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=404
echo -e "${result_color_table[${code:0:1}]} 404;Extension not found${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for upsertConfig operation
#
##############################################################################
print_upsertConfig_help() {
echo ""
echo -e "${BOLD}${WHITE}upsertConfig - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Configuration value upserted successfully${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for upsertPermissions operation
#
##############################################################################
print_upsertPermissions_help() {
echo ""
echo -e "${BOLD}${WHITE}upsertPermissions - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Permission update completed${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=400
echo -e "${result_color_table[${code:0:1}]} 400;Invalid request${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for validateConfig operation
#
##############################################################################
print_validateConfig_help() {
echo ""
echo -e "${BOLD}${WHITE}validateConfig - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Config validation result${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=422
echo -e "${result_color_table[${code:0:1}]} 422;Config file is corrupted${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for status operation
#
##############################################################################
print_status_help() {
echo ""
echo -e "${BOLD}${WHITE}status - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
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/^/ /'
}
##############################################################################
#
# Print help for confirmPermission operation
#
##############################################################################
print_confirmPermission_help() {
echo ""
echo -e "${BOLD}${WHITE}confirmPermission - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo -e "${BOLD}${WHITE}Parameters${OFF}"
echo -e " * ${GREEN}body${OFF} ${BLUE}[application/json]${OFF} ${RED}(required)${OFF}${OFF} - " | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;Permission action is confirmed${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=401
echo -e "${result_color_table[${code:0:1}]} 401;Unauthorized - invalid secret key${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
code=500
echo -e "${result_color_table[${code:0:1}]} 500;Internal server error${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for startOpenrouterSetup operation
#
##############################################################################
print_startOpenrouterSetup_help() {
echo ""
echo -e "${BOLD}${WHITE}startOpenrouterSetup - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Print help for startTetrateSetup operation
#
##############################################################################
print_startTetrateSetup_help() {
echo ""
echo -e "${BOLD}${WHITE}startTetrateSetup - ${OFF}" | paste -sd' ' | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "${BOLD}${WHITE}Responses${OFF}"
code=200
echo -e "${result_color_table[${code:0:1}]} 200;${OFF}" | paste -sd' ' | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
}
##############################################################################
#
# Call manageContext operation
#
##############################################################################
call_manageContext() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/context/manage" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call createRecipe operation
#
##############################################################################
call_createRecipe() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/recipes/create" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call decodeRecipe operation
#
##############################################################################
call_decodeRecipe() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/recipes/decode" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call deleteRecipe operation
#
##############################################################################
call_deleteRecipe() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/recipes/delete" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call encodeRecipe operation
#
##############################################################################
call_encodeRecipe() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/recipes/encode" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call listRecipes operation
#
##############################################################################
call_listRecipes() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/recipes/list" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call scanRecipe operation
#
##############################################################################
call_scanRecipe() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/recipes/scan" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call createSchedule operation
#
##############################################################################
call_createSchedule() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/schedule/create" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call deleteSchedule operation
#
##############################################################################
call_deleteSchedule() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/schedule/delete/{id}" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="DELETE"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call inspectRunningJob operation
#
##############################################################################
call_inspectRunningJob() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/schedule/{id}/inspect" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call killRunningJob operation
#
##############################################################################
call_killRunningJob() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/schedule/{id}/kill" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call listSchedules operation
#
##############################################################################
call_listSchedules() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/schedule/list" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call pauseSchedule operation
#
##############################################################################
call_pauseSchedule() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/schedule/{id}/pause" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call runNowHandler operation
#
##############################################################################
call_runNowHandler() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/schedule/{id}/run_now" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call sessionsHandler operation
#
##############################################################################
call_sessionsHandler() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=(limit)
local path
if ! path=$(build_request_path "/schedule/{id}/sessions" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call unpauseSchedule operation
#
##############################################################################
call_unpauseSchedule() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/schedule/{id}/unpause" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call updateSchedule operation
#
##############################################################################
call_updateSchedule() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/schedule/{id}" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="PUT"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call deleteSession operation
#
##############################################################################
call_deleteSession() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(session_id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/sessions/{session_id}" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="DELETE"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call getSession operation
#
##############################################################################
call_getSession() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(session_id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/sessions/{session_id}" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call getSessionInsights operation
#
##############################################################################
call_getSessionInsights() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/sessions/insights" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call listSessions operation
#
##############################################################################
call_listSessions() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/sessions" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call updateSessionDescription operation
#
##############################################################################
call_updateSessionDescription() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(session_id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/sessions/{session_id}/description" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="PUT"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call addSubRecipes operation
#
##############################################################################
call_addSubRecipes() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/agent/add_sub_recipes" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call extendPrompt operation
#
##############################################################################
call_extendPrompt() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/agent/prompt" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call getTools operation
#
##############################################################################
call_getTools() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=(extension_name session_id)
local path
if ! path=$(build_request_path "/agent/tools" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call resumeAgent operation
#
##############################################################################
call_resumeAgent() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/agent/resume" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call startAgent operation
#
##############################################################################
call_startAgent() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/agent/start" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call updateAgentProvider operation
#
##############################################################################
call_updateAgentProvider() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/agent/update_provider" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call updateRouterToolSelector operation
#
##############################################################################
call_updateRouterToolSelector() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/agent/update_router_tool_selector" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call updateSessionConfig operation
#
##############################################################################
call_updateSessionConfig() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/agent/session_config" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call addExtension operation
#
##############################################################################
call_addExtension() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/extensions" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call backupConfig operation
#
##############################################################################
call_backupConfig() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/backup" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call createCustomProvider operation
#
##############################################################################
call_createCustomProvider() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/custom-providers" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call getExtensions operation
#
##############################################################################
call_getExtensions() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/extensions" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call getProviderModels operation
#
##############################################################################
call_getProviderModels() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(name)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/providers/{name}/models" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call initConfig operation
#
##############################################################################
call_initConfig() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/init" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call providers operation
#
##############################################################################
call_providers() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/providers" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call readAllConfig operation
#
##############################################################################
call_readAllConfig() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call readConfig operation
#
##############################################################################
call_readConfig() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/read" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call recoverConfig operation
#
##############################################################################
call_recoverConfig() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/recover" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call removeConfig operation
#
##############################################################################
call_removeConfig() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/remove" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call removeCustomProvider operation
#
##############################################################################
call_removeCustomProvider() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(id)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/custom-providers/{id}" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="DELETE"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call removeExtension operation
#
##############################################################################
call_removeExtension() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=(name)
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/extensions/{name}" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="DELETE"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call upsertConfig operation
#
##############################################################################
call_upsertConfig() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/upsert" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call upsertPermissions operation
#
##############################################################################
call_upsertPermissions() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/permissions" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call validateConfig operation
#
##############################################################################
call_validateConfig() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/config/validate" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call status operation
#
##############################################################################
call_status() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/status" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="GET"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call confirmPermission operation
#
##############################################################################
call_confirmPermission() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/confirm" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
local body_json_curl=""
#
# Check if the user provided 'Content-type' headers in the
# command line. If not try to set them based on the OpenAPI specification
# if values produces and consumes are defined unambiguously
#
if [[ -z $header_content_type ]]; then
header_content_type="application/json"
fi
if [[ -z $header_content_type && "$force" = false ]]; then
:
echo "ERROR: Request's content-type not specified!!!"
echo "This operation expects content-type in one of the following formats:"
echo -e "\\t- application/json"
echo ""
echo "Use '--content-type' to set proper content type"
exit 1
else
headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
fi
#
# If we have received some body content over pipe, pass it from the
# temporary file to cURL
#
if [[ -n $body_content_temp_file ]]; then
if [[ "$print_curl" = true ]]; then
echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
else
eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
fi
rm "${body_content_temp_file}"
#
# If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
#
else
body_json_curl=$(body_parameters_to_json)
if [[ "$print_curl" = true ]]; then
echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
fi
fi
}
##############################################################################
#
# Call startOpenrouterSetup operation
#
##############################################################################
call_startOpenrouterSetup() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/handle_openrouter" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call startTetrateSetup operation
#
##############################################################################
call_startTetrateSetup() {
# ignore error about 'path_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local path_parameter_names=()
# ignore error about 'query_parameter_names' being unused; passed by reference
# shellcheck disable=SC2034
local query_parameter_names=()
local path
if ! path=$(build_request_path "/handle_tetrate" path_parameter_names query_parameter_names); then
ERROR_MSG=$path
exit 1
fi
local method="POST"
local headers_curl
headers_curl=$(header_arguments_to_curl)
if [[ -n $header_accept ]]; then
headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
fi
local basic_auth_option=""
if [[ -n $basic_auth_credential ]]; then
basic_auth_option="-u ${basic_auth_credential}"
fi
if [[ "$print_curl" = true ]]; then
echo "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl -d '' ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Main
#
##############################################################################
# Check dependencies
type curl >/dev/null 2>&1 || { echo >&2 "ERROR: You do not have 'cURL' installed."; exit 1; }
type sed >/dev/null 2>&1 || { echo >&2 "ERROR: You do not have 'sed' installed."; exit 1; }
type column >/dev/null 2>&1 || { echo >&2 "ERROR: You do not have 'bsdmainutils' installed."; exit 1; }
#
# Process command line
#
# Pass all arguments before 'operation' to cURL except the ones we override
#
take_user=false
take_host=false
take_accept_header=false
take_contenttype_header=false
for key in "$@"; do
# Take the value of -u|--user argument
if [[ "$take_user" = true ]]; then
basic_auth_credential="$key"
take_user=false
continue
fi
# Take the value of --host argument
if [[ "$take_host" = true ]]; then
host="$key"
take_host=false
continue
fi
# Take the value of --accept argument
if [[ "$take_accept_header" = true ]]; then
header_accept=$(lookup_mime_type "$key")
take_accept_header=false
continue
fi
# Take the value of --content-type argument
if [[ "$take_contenttype_header" = true ]]; then
header_content_type=$(lookup_mime_type "$key")
take_contenttype_header=false
continue
fi
case $key in
-h|--help)
if [[ "x$operation" == "x" ]]; then
print_help
exit 0
else
eval "print_${operation}_help"
exit 0
fi
;;
-V|--version)
print_version
exit 0
;;
--about)
print_about
exit 0
;;
-u|--user)
take_user=true
;;
--host)
take_host=true
;;
--force)
force=true
;;
-ac|--accept)
take_accept_header=true
;;
-ct|--content-type)
take_contenttype_header=true
;;
--dry-run)
print_curl=true
;;
-nc|--no-colors)
RED=""
GREEN=""
YELLOW=""
BLUE=""
MAGENTA=""
CYAN=""
WHITE=""
BOLD=""
OFF=""
result_color_table=( "" "" "" "" "" "" "" )
;;
manageContext)
operation="manageContext"
;;
createRecipe)
operation="createRecipe"
;;
decodeRecipe)
operation="decodeRecipe"
;;
deleteRecipe)
operation="deleteRecipe"
;;
encodeRecipe)
operation="encodeRecipe"
;;
listRecipes)
operation="listRecipes"
;;
scanRecipe)
operation="scanRecipe"
;;
createSchedule)
operation="createSchedule"
;;
deleteSchedule)
operation="deleteSchedule"
;;
inspectRunningJob)
operation="inspectRunningJob"
;;
killRunningJob)
operation="killRunningJob"
;;
listSchedules)
operation="listSchedules"
;;
pauseSchedule)
operation="pauseSchedule"
;;
runNowHandler)
operation="runNowHandler"
;;
sessionsHandler)
operation="sessionsHandler"
;;
unpauseSchedule)
operation="unpauseSchedule"
;;
updateSchedule)
operation="updateSchedule"
;;
deleteSession)
operation="deleteSession"
;;
getSession)
operation="getSession"
;;
getSessionInsights)
operation="getSessionInsights"
;;
listSessions)
operation="listSessions"
;;
updateSessionDescription)
operation="updateSessionDescription"
;;
addSubRecipes)
operation="addSubRecipes"
;;
extendPrompt)
operation="extendPrompt"
;;
getTools)
operation="getTools"
;;
resumeAgent)
operation="resumeAgent"
;;
startAgent)
operation="startAgent"
;;
updateAgentProvider)
operation="updateAgentProvider"
;;
updateRouterToolSelector)
operation="updateRouterToolSelector"
;;
updateSessionConfig)
operation="updateSessionConfig"
;;
addExtension)
operation="addExtension"
;;
backupConfig)
operation="backupConfig"
;;
createCustomProvider)
operation="createCustomProvider"
;;
getExtensions)
operation="getExtensions"
;;
getProviderModels)
operation="getProviderModels"
;;
initConfig)
operation="initConfig"
;;
providers)
operation="providers"
;;
readAllConfig)
operation="readAllConfig"
;;
readConfig)
operation="readConfig"
;;
recoverConfig)
operation="recoverConfig"
;;
removeConfig)
operation="removeConfig"
;;
removeCustomProvider)
operation="removeCustomProvider"
;;
removeExtension)
operation="removeExtension"
;;
upsertConfig)
operation="upsertConfig"
;;
upsertPermissions)
operation="upsertPermissions"
;;
validateConfig)
operation="validateConfig"
;;
status)
operation="status"
;;
confirmPermission)
operation="confirmPermission"
;;
startOpenrouterSetup)
operation="startOpenrouterSetup"
;;
startTetrateSetup)
operation="startTetrateSetup"
;;
*==*)
# Parse body arguments and convert them into top level
# JSON properties passed in the body content as strings
if [[ "$operation" ]]; then
IFS='==' read -r body_key sep body_value <<< "$key"
body_parameters[${body_key}]="\"${body_value}\""
fi
;;
--body=*)
# Parse value of body as argument and convert it into only
# the raw body content
if [[ "$operation" ]]; then
IFS='--body=' read -r body_value <<< "$key"
body_value=${body_value##--body=}
body_parameters["RAW_BODY"]="${body_value}"
RAW_BODY=1
fi
;;
*:=*)
# Parse body arguments and convert them into top level
# JSON properties passed in the body content without quotes
if [[ "$operation" ]]; then
# ignore error about 'sep' being unused
# shellcheck disable=SC2034
IFS=':=' read -r body_key sep body_value <<< "$key"
body_parameters[${body_key}]=${body_value}
fi
;;
+([^=]):*)
# Parse header arguments and convert them into curl
# only after the operation argument
if [[ "$operation" ]]; then
IFS=':' read -r header_name header_value <<< "$key"
header_arguments[$header_name]=$header_value
else
curl_arguments+=" $key"
fi
;;
-)
body_content_temp_file=$(mktemp)
cat - > "$body_content_temp_file"
;;
*=*)
# Parse operation arguments and convert them into curl
# only after the operation argument
if [[ "$operation" ]]; then
IFS='=' read -r parameter_name parameter_value <<< "$key"
if [[ -z "${operation_parameters[$parameter_name]+foo}" ]]; then
operation_parameters[$parameter_name]=$(url_escape "${parameter_value}")
else
operation_parameters[$parameter_name]+=":::"$(url_escape "${parameter_value}")
fi
else
curl_arguments+=" $key"
fi
;;
*)
# If we are before the operation, treat the arguments as cURL arguments
if [[ "x$operation" == "x" ]]; then
# Maintain quotes around cURL arguments if necessary
space_regexp="[[:space:]]"
if [[ $key =~ $space_regexp ]]; then
curl_arguments+=" \"$key\""
else
curl_arguments+=" $key"
fi
fi
;;
esac
done
# Check if user provided host name
if [[ -z "$host" ]]; then
ERROR_MSG="ERROR: No hostname provided!!! You have to provide on command line option '--host ...'"
exit 1
fi
# Check if user specified operation ID
if [[ -z "$operation" ]]; then
ERROR_MSG="ERROR: No operation specified!!!"
exit 1
fi
# Run cURL command based on the operation ID
case $operation in
manageContext)
call_manageContext
;;
createRecipe)
call_createRecipe
;;
decodeRecipe)
call_decodeRecipe
;;
deleteRecipe)
call_deleteRecipe
;;
encodeRecipe)
call_encodeRecipe
;;
listRecipes)
call_listRecipes
;;
scanRecipe)
call_scanRecipe
;;
createSchedule)
call_createSchedule
;;
deleteSchedule)
call_deleteSchedule
;;
inspectRunningJob)
call_inspectRunningJob
;;
killRunningJob)
call_killRunningJob
;;
listSchedules)
call_listSchedules
;;
pauseSchedule)
call_pauseSchedule
;;
runNowHandler)
call_runNowHandler
;;
sessionsHandler)
call_sessionsHandler
;;
unpauseSchedule)
call_unpauseSchedule
;;
updateSchedule)
call_updateSchedule
;;
deleteSession)
call_deleteSession
;;
getSession)
call_getSession
;;
getSessionInsights)
call_getSessionInsights
;;
listSessions)
call_listSessions
;;
updateSessionDescription)
call_updateSessionDescription
;;
addSubRecipes)
call_addSubRecipes
;;
extendPrompt)
call_extendPrompt
;;
getTools)
call_getTools
;;
resumeAgent)
call_resumeAgent
;;
startAgent)
call_startAgent
;;
updateAgentProvider)
call_updateAgentProvider
;;
updateRouterToolSelector)
call_updateRouterToolSelector
;;
updateSessionConfig)
call_updateSessionConfig
;;
addExtension)
call_addExtension
;;
backupConfig)
call_backupConfig
;;
createCustomProvider)
call_createCustomProvider
;;
getExtensions)
call_getExtensions
;;
getProviderModels)
call_getProviderModels
;;
initConfig)
call_initConfig
;;
providers)
call_providers
;;
readAllConfig)
call_readAllConfig
;;
readConfig)
call_readConfig
;;
recoverConfig)
call_recoverConfig
;;
removeConfig)
call_removeConfig
;;
removeCustomProvider)
call_removeCustomProvider
;;
removeExtension)
call_removeExtension
;;
upsertConfig)
call_upsertConfig
;;
upsertPermissions)
call_upsertPermissions
;;
validateConfig)
call_validateConfig
;;
status)
call_status
;;
confirmPermission)
call_confirmPermission
;;
startOpenrouterSetup)
call_startOpenrouterSetup
;;
startTetrateSetup)
call_startTetrateSetup
;;
*)
ERROR_MSG="ERROR: Unknown operation: $operation"
exit 1
esac