Benjamin Douglas 9058099e5b Add alias type definitions for Java
When a spec defines a Model at the top level that is a non-aggretate type (such
as string, number or boolean), it essentially represents an alias for the simple
type. For example, the following spec snippet creates an alias of the boolean
type that for all intents and purposes acts just like a regular boolean.

    definitions:
      JustABoolean:
        type: boolean

This can be modeled in some languages through built-in mechanisms, such as
typedefs in C++. Java, however, just not have a clean way of representing this.

This change introduces an internal mechanism for representing aliases. It
maintains a map in DefaultCodegen that tracks these types of definitions, and
wherever it sees the "JustABoolean" type in the spec, it generates code that
uses the built-in "Boolean" instead.

This functionality currenlty only applies to Java, but could be extended to
other languages later.

The change adds a few examples of this to the fake endpoint spec for testing,
which means all of the samples change as well.
2017-04-17 12:58:31 -07:00

3760 lines
150 KiB
Bash
Executable File

#!/usr/bin/env bash
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
# !
# ! Note:
# !
# ! THIS SCRIPT HAS BEEN AUTOMATICALLY GENERATED USING
# ! swagger-codegen (https://github.com/swagger-api/swagger-codegen)
# ! FROM SWAGGER SPECIFICATION IN JSON.
# !
# !
# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
#
# This is a Bash client for Swagger Petstore.
#
# LICENSE:
# http://www.apache.org/licenses/LICENSE-2.0.html
#
# CONTACT:
# apiteam@swagger.io
#
# MORE INFORMATION:
# http://swagger.io
#
###############################################################################
#
# 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
##
# This array stores the minimum number of required occurences for parameter
# 0 - optional
# 1 - required
declare -A operation_parameters_minimum_occurences
operation_parameters_minimum_occurences["fakeOuterBooleanSerialize:::body"]=0
operation_parameters_minimum_occurences["fakeOuterCompositeSerialize:::body"]=0
operation_parameters_minimum_occurences["fakeOuterNumberSerialize:::body"]=0
operation_parameters_minimum_occurences["fakeOuterStringSerialize:::body"]=0
operation_parameters_minimum_occurences["testClientModel:::body"]=1
operation_parameters_minimum_occurences["testEndpointParameters:::number"]=1
operation_parameters_minimum_occurences["testEndpointParameters:::double"]=1
operation_parameters_minimum_occurences["testEndpointParameters:::pattern_without_delimiter"]=1
operation_parameters_minimum_occurences["testEndpointParameters:::byte"]=1
operation_parameters_minimum_occurences["testEndpointParameters:::integer"]=0
operation_parameters_minimum_occurences["testEndpointParameters:::int32"]=0
operation_parameters_minimum_occurences["testEndpointParameters:::int64"]=0
operation_parameters_minimum_occurences["testEndpointParameters:::float"]=0
operation_parameters_minimum_occurences["testEndpointParameters:::string"]=0
operation_parameters_minimum_occurences["testEndpointParameters:::binary"]=0
operation_parameters_minimum_occurences["testEndpointParameters:::date"]=0
operation_parameters_minimum_occurences["testEndpointParameters:::dateTime"]=0
operation_parameters_minimum_occurences["testEndpointParameters:::password"]=0
operation_parameters_minimum_occurences["testEndpointParameters:::callback"]=0
operation_parameters_minimum_occurences["testEnumParameters:::enum_form_string_array"]=0
operation_parameters_minimum_occurences["testEnumParameters:::enum_form_string"]=0
operation_parameters_minimum_occurences["testEnumParameters:::enum_header_string_array"]=0
operation_parameters_minimum_occurences["testEnumParameters:::enum_header_string"]=0
operation_parameters_minimum_occurences["testEnumParameters:::enum_query_string_array"]=0
operation_parameters_minimum_occurences["testEnumParameters:::enum_query_string"]=0
operation_parameters_minimum_occurences["testEnumParameters:::enum_query_integer"]=0
operation_parameters_minimum_occurences["testEnumParameters:::enum_query_double"]=0
operation_parameters_minimum_occurences["addPet:::body"]=1
operation_parameters_minimum_occurences["deletePet:::petId"]=1
operation_parameters_minimum_occurences["deletePet:::api_key"]=0
operation_parameters_minimum_occurences["findPetsByStatus:::status"]=1
operation_parameters_minimum_occurences["findPetsByTags:::tags"]=1
operation_parameters_minimum_occurences["getPetById:::petId"]=1
operation_parameters_minimum_occurences["updatePet:::body"]=1
operation_parameters_minimum_occurences["updatePetWithForm:::petId"]=1
operation_parameters_minimum_occurences["updatePetWithForm:::name"]=0
operation_parameters_minimum_occurences["updatePetWithForm:::status"]=0
operation_parameters_minimum_occurences["uploadFile:::petId"]=1
operation_parameters_minimum_occurences["uploadFile:::additionalMetadata"]=0
operation_parameters_minimum_occurences["uploadFile:::file"]=0
operation_parameters_minimum_occurences["deleteOrder:::order_id"]=1
operation_parameters_minimum_occurences["getOrderById:::order_id"]=1
operation_parameters_minimum_occurences["placeOrder:::body"]=1
operation_parameters_minimum_occurences["createUser:::body"]=1
operation_parameters_minimum_occurences["createUsersWithArrayInput:::body"]=1
operation_parameters_minimum_occurences["createUsersWithListInput:::body"]=1
operation_parameters_minimum_occurences["deleteUser:::username"]=1
operation_parameters_minimum_occurences["getUserByName:::username"]=1
operation_parameters_minimum_occurences["loginUser:::username"]=1
operation_parameters_minimum_occurences["loginUser:::password"]=1
operation_parameters_minimum_occurences["updateUser:::username"]=1
operation_parameters_minimum_occurences["updateUser:::body"]=1
##
# This array stores the maximum number of allowed occurences for parameter
# 1 - single value
# 2 - 2 values
# N - N values
# 0 - unlimited
declare -A operation_parameters_maximum_occurences
operation_parameters_maximum_occurences["fakeOuterBooleanSerialize:::body"]=0
operation_parameters_maximum_occurences["fakeOuterCompositeSerialize:::body"]=0
operation_parameters_maximum_occurences["fakeOuterNumberSerialize:::body"]=0
operation_parameters_maximum_occurences["fakeOuterStringSerialize:::body"]=0
operation_parameters_maximum_occurences["testClientModel:::body"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::number"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::double"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::pattern_without_delimiter"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::byte"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::integer"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::int32"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::int64"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::float"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::string"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::binary"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::date"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::dateTime"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::password"]=0
operation_parameters_maximum_occurences["testEndpointParameters:::callback"]=0
operation_parameters_maximum_occurences["testEnumParameters:::enum_form_string_array"]=0
operation_parameters_maximum_occurences["testEnumParameters:::enum_form_string"]=0
operation_parameters_maximum_occurences["testEnumParameters:::enum_header_string_array"]=0
operation_parameters_maximum_occurences["testEnumParameters:::enum_header_string"]=0
operation_parameters_maximum_occurences["testEnumParameters:::enum_query_string_array"]=0
operation_parameters_maximum_occurences["testEnumParameters:::enum_query_string"]=0
operation_parameters_maximum_occurences["testEnumParameters:::enum_query_integer"]=0
operation_parameters_maximum_occurences["testEnumParameters:::enum_query_double"]=0
operation_parameters_maximum_occurences["addPet:::body"]=0
operation_parameters_maximum_occurences["deletePet:::petId"]=0
operation_parameters_maximum_occurences["deletePet:::api_key"]=0
operation_parameters_maximum_occurences["findPetsByStatus:::status"]=0
operation_parameters_maximum_occurences["findPetsByTags:::tags"]=0
operation_parameters_maximum_occurences["getPetById:::petId"]=0
operation_parameters_maximum_occurences["updatePet:::body"]=0
operation_parameters_maximum_occurences["updatePetWithForm:::petId"]=0
operation_parameters_maximum_occurences["updatePetWithForm:::name"]=0
operation_parameters_maximum_occurences["updatePetWithForm:::status"]=0
operation_parameters_maximum_occurences["uploadFile:::petId"]=0
operation_parameters_maximum_occurences["uploadFile:::additionalMetadata"]=0
operation_parameters_maximum_occurences["uploadFile:::file"]=0
operation_parameters_maximum_occurences["deleteOrder:::order_id"]=0
operation_parameters_maximum_occurences["getOrderById:::order_id"]=0
operation_parameters_maximum_occurences["placeOrder:::body"]=0
operation_parameters_maximum_occurences["createUser:::body"]=0
operation_parameters_maximum_occurences["createUsersWithArrayInput:::body"]=0
operation_parameters_maximum_occurences["createUsersWithListInput:::body"]=0
operation_parameters_maximum_occurences["deleteUser:::username"]=0
operation_parameters_maximum_occurences["getUserByName:::username"]=0
operation_parameters_maximum_occurences["loginUser:::username"]=0
operation_parameters_maximum_occurences["loginUser:::password"]=0
operation_parameters_maximum_occurences["updateUser:::username"]=0
operation_parameters_maximum_occurences["updateUser:::body"]=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["fakeOuterBooleanSerialize:::body"]=""
operation_parameters_collection_type["fakeOuterCompositeSerialize:::body"]=""
operation_parameters_collection_type["fakeOuterNumberSerialize:::body"]=""
operation_parameters_collection_type["fakeOuterStringSerialize:::body"]=""
operation_parameters_collection_type["testClientModel:::body"]=""
operation_parameters_collection_type["testEndpointParameters:::number"]=""
operation_parameters_collection_type["testEndpointParameters:::double"]=""
operation_parameters_collection_type["testEndpointParameters:::pattern_without_delimiter"]=""
operation_parameters_collection_type["testEndpointParameters:::byte"]=""
operation_parameters_collection_type["testEndpointParameters:::integer"]=""
operation_parameters_collection_type["testEndpointParameters:::int32"]=""
operation_parameters_collection_type["testEndpointParameters:::int64"]=""
operation_parameters_collection_type["testEndpointParameters:::float"]=""
operation_parameters_collection_type["testEndpointParameters:::string"]=""
operation_parameters_collection_type["testEndpointParameters:::binary"]=""
operation_parameters_collection_type["testEndpointParameters:::date"]=""
operation_parameters_collection_type["testEndpointParameters:::dateTime"]=""
operation_parameters_collection_type["testEndpointParameters:::password"]=""
operation_parameters_collection_type["testEndpointParameters:::callback"]=""
operation_parameters_collection_type["testEnumParameters:::enum_form_string_array"]=
operation_parameters_collection_type["testEnumParameters:::enum_form_string"]=""
operation_parameters_collection_type["testEnumParameters:::enum_header_string_array"]=
operation_parameters_collection_type["testEnumParameters:::enum_header_string"]=""
operation_parameters_collection_type["testEnumParameters:::enum_query_string_array"]=
operation_parameters_collection_type["testEnumParameters:::enum_query_string"]=""
operation_parameters_collection_type["testEnumParameters:::enum_query_integer"]=""
operation_parameters_collection_type["testEnumParameters:::enum_query_double"]=""
operation_parameters_collection_type["addPet:::body"]=""
operation_parameters_collection_type["deletePet:::petId"]=""
operation_parameters_collection_type["deletePet:::api_key"]=""
operation_parameters_collection_type["findPetsByStatus:::status"]="csv"
operation_parameters_collection_type["findPetsByTags:::tags"]="csv"
operation_parameters_collection_type["getPetById:::petId"]=""
operation_parameters_collection_type["updatePet:::body"]=""
operation_parameters_collection_type["updatePetWithForm:::petId"]=""
operation_parameters_collection_type["updatePetWithForm:::name"]=""
operation_parameters_collection_type["updatePetWithForm:::status"]=""
operation_parameters_collection_type["uploadFile:::petId"]=""
operation_parameters_collection_type["uploadFile:::additionalMetadata"]=""
operation_parameters_collection_type["uploadFile:::file"]=""
operation_parameters_collection_type["deleteOrder:::order_id"]=""
operation_parameters_collection_type["getOrderById:::order_id"]=""
operation_parameters_collection_type["placeOrder:::body"]=""
operation_parameters_collection_type["createUser:::body"]=""
operation_parameters_collection_type["createUsersWithArrayInput:::body"]=
operation_parameters_collection_type["createUsersWithListInput:::body"]=
operation_parameters_collection_type["deleteUser:::username"]=""
operation_parameters_collection_type["getUserByName:::username"]=""
operation_parameters_collection_type["loginUser:::username"]=""
operation_parameters_collection_type["loginUser:::password"]=""
operation_parameters_collection_type["updateUser:::username"]=""
operation_parameters_collection_type["updateUser:::body"]=""
##
# 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="-sS --tlsv1.2"
##
# The host for making the request
host="$PETSTORE_HOST"
##
# The user credentials for basic authentication
basic_auth_credential="$PETSTORE_BASIC_AUTH"
##
# The user API key
apikey_auth_credential="$PETSTORE_API_KEY"
##
# 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/?/%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 $1
fi
}
##############################################################################
#
# Converts an associative array into a list of cURL header
# arguments (-H "KEY: VALUE")
#
##############################################################################
header_arguments_to_curl() {
local headers_curl=""
local api_key_header=""
local api_key_header_in_cli=""
api_key_header="api_key"
for key in "${!header_arguments[@]}"; do
headers_curl+="-H \"${key}: ${header_arguments[${key}]}\" "
if [[ "${key}XX" == "${api_key_header}XX" ]]; then
api_key_header_in_cli="YES"
fi
done
#
# If the api_key was not provided in the header, try one from the
# environment variable
#
if [[ -z $api_key_header_in_cli && -n $apikey_auth_credential ]]; then
headers_curl+="-H \"${api_key_header}: ${apikey_auth_credential}\""
fi
headers_curl+=" "
echo "${headers_curl}"
}
##############################################################################
#
# Converts an associative array into a simple JSON with keys as top
# level object attributes
#
# \todo Add convertion of more complex attributes using paths
#
##############################################################################
body_parameters_to_json() {
local body_json="-d '{"
local body_parameter_count=${#body_parameters[@]}
local count=0
for key in "${!body_parameters[@]}"; do
body_json+="\"${key}\": ${body_parameters[${key}]}"
if [[ $count -lt $body_parameter_count-1 ]]; then
body_json+=", "
fi
((count+=1))
done
body_json+="}'"
if [[ "${#body_parameters[@]}" -eq 0 ]]; then
echo ""
else
echo "${body_json}"
fi
}
##############################################################################
#
# Check if provided parameters match specification requirements
#
##############################################################################
validate_request_parameters() {
local path_template=$1
local -n path_params=$2
local -n query_params=$3
# First replace all path parameters in the path
for pparam in "${path_params[@]}"; do
regexp="(.*)(\{$pparam\})(.*)"
if [[ $path_template =~ $regexp ]]; then
path_template=${BASH_REMATCH[1]}${operation_parameters[$pparam]}${BASH_REMATCH[3]}
fi
done
# Now append query parameters - if any
if [[ ${#query_params[@]} -gt 0 ]]; then
path_template+="?"
fi
local query_parameter_count=${#query_params[@]}
local count=0
for qparam in "${query_params[@]}"; do
# Get the array of parameter values
local parameter_values=($(echo "${operation_parameters[$qparam]}" | sed -e 's/'":::"'/\n/g' | while read line; do echo $line | sed 's/[\t ]/'":::"'/g'; done))
#
# Check if the number of provided values is not less than minimum
# required
#
if [[ "$force" = false ]]; then
if [[ ${#parameter_values[@]} -lt ${operation_parameters_minimum_occurences["${operation}:::${qparam}"]} ]]; then
echo "Error: Too few values provided for '${qparam}' parameter"
exit 1
fi
#
# Check if the number of provided values is not more than maximum
#
if [[ ${operation_parameters_maximum_occurences["${operation}:::${qparam}"]} -gt 0 \
&& ${#parameter_values[@]} -gt ${operation_parameters_maximum_occurences["${operation}:::${qparam}"]} ]]; then
if [[ "$force" = false ]]; then
echo "Error: Too many values provided for '${qparam}' parameter"
exit 1
fi
fi
fi
if [[ "${operation_parameters_collection_type[${operation}:::${qparam}]}" == "" ]]; then
local vcount=0
for qvalue in "${parameter_values[@]}"; do
path_template+="${qparam}=${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
path_template+="&"
fi
((vcount+=1))
done
elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "multi" ]]; then
local vcount=0
for qvalue in "${parameter_values[@]}"; do
path_template+="${qparam}=${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
path_template+="&"
fi
((vcount+=1))
done
elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "csv" ]]; then
path_template+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
path_template+="${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
path_template+=","
fi
((vcount+=1))
done
elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "ssv" ]]; then
path_template+="${qparam}="
for qvalue in "${parameter_values[@]}"; do
path_template+="${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
path_template+=" "
fi
((vcount+=1))
done
elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "tsv" ]]; then
path_template+="${qparam}="
for qvalue in "${parameter_values[@]}"; do
path_template+="${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
path_template+="\t"
fi
((vcount+=1))
done
else
echo -e ""
echo -e "Error: Unsupported collection format "
echo -e ""
exit 1
fi
if [[ $count -lt $query_parameter_count-1 ]]; then
path_template+="&"
fi
((count+=1))
done
}
##############################################################################
#
# Build request path including query parameters
#
##############################################################################
build_request_path() {
local path_template=$1
local -n path_params=$2
local -n query_params=$3
# First replace all path parameters in the path
for pparam in "${path_params[@]}"; do
regexp="(.*)(\{$pparam\})(.*)"
if [[ $path_template =~ $regexp ]]; then
path_template=${BASH_REMATCH[1]}${operation_parameters[$pparam]}${BASH_REMATCH[3]}
fi
done
local query_request_part=""
local query_parameter_count=${#query_params[@]}
local count=0
for qparam in "${query_params[@]}"; do
# Get the array of parameter values
local parameter_values=($(echo "${operation_parameters[$qparam]}" | sed -e 's/'":::"'/\n/g' | while read line; do echo $line | sed 's/[\t ]/'":::"'/g'; done))
local parameter_value=""
#
# Check if the number of provided values is not less than minimum
# required
#
if [[ "$force" = false ]]; then
if [[ ${#parameter_values[@]} -lt ${operation_parameters_minimum_occurences["${operation}:::${qparam}"]} ]]; then
echo "Error: Too few values provided for '${qparam}' parameter"
exit 1
fi
#
# Check if the number of provided values is not more than maximum
#
if [[ ${operation_parameters_maximum_occurences["${operation}:::${qparam}"]} -gt 0 \
&& ${#parameter_values[@]} -gt ${operation_parameters_maximum_occurences["${operation}:::${qparam}"]} ]]; then
if [[ "$force" = false ]]; then
echo "Error: Too many values provided for '${qparam}' parameter"
exit 1
fi
fi
fi
#
# Append parameters without specific cardinality
#
if [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "" ]]; then
local vcount=0
for qvalue in "${parameter_values[@]}"; do
parameter_value+="${qparam}=${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
parameter_value+="&"
fi
((vcount+=1))
done
#
# Append parameters specified as 'mutli' collections i.e. param=value1&param=value2&...
#
elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "multi" ]]; then
local vcount=0
for qvalue in "${parameter_values[@]}"; do
parameter_value+="${qparam}=${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
parameter_value+="&"
fi
((vcount+=1))
done
#
# Append parameters specified as 'csv' collections i.e. param=value1,value2,...
#
elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "csv" ]]; then
parameter_value+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
parameter_value+="${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
parameter_value+=","
fi
((vcount+=1))
done
#
# Append parameters specified as 'ssv' collections i.e. param="value1 value2 ..."
#
elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "ssv" ]]; then
parameter_value+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
parameter_value+="${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
parameter_value+=" "
fi
((vcount+=1))
done
#
# Append parameters specified as 'tsv' collections i.e. param="value1\tvalue2\t..."
#
elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "tsv" ]]; then
parameter_value+="${qparam}="
local vcount=0
for qvalue in "${parameter_values[@]}"; do
parameter_value+="${qvalue}"
if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
parameter_value+="\t"
fi
((vcount+=1))
done
fi
if [[ -n "${parameter_value}" ]]; then
query_request_part+="${parameter_value}"
fi
if [[ $count -lt $query_parameter_count-1 && -n "${parameter_value}" ]]; then
query_request_part+="&"
fi
((count+=1))
done
# Now append query parameters - if any
if [[ -n "${query_request_part}" ]]; then
path_template+="?$(echo ${query_request_part} | sed s'/&$//')"
fi
echo $path_template
}
###############################################################################
#
# Print main help message
#
###############################################################################
print_help() {
cat <<EOF
$(tput bold)$(tput setaf 7)Swagger Petstore command line client (API version 1.0.0)$(tput sgr0)
$(tput bold)$(tput setaf 7)Usage$(tput sgr0)
$(tput setaf 2)${script_name}$(tput sgr0) [-h|--help] [-V|--version] [--about] [$(tput setaf 1)<curl-options>$(tput sgr0)]
[-ac|--accept $(tput setaf 2)<mime-type>$(tput sgr0)] [-ct,--content-type $(tput setaf 2)<mime-type>$(tput sgr0)]
[--host $(tput setaf 6)<url>$(tput sgr0)] [--dry-run] $(tput setaf 3)<operation>$(tput sgr0) [-h|--help] [$(tput setaf 4)<headers>$(tput sgr0)]
[$(tput setaf 5)<parameters>$(tput sgr0)] [$(tput setaf 5)<body-parameters>$(tput sgr0)]
- $(tput setaf 6)<url>$(tput sgr0) - endpoint of the REST service without basepath
Can also be specified in PETSTORE_HOST environment variable.
- $(tput setaf 1)<curl-options>$(tput sgr0) - any valid cURL options can be passed before $(tput setaf 3)<operation>$(tput sgr0)
- $(tput setaf 2)<mime-type>$(tput sgr0) - 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)
- $(tput setaf 4)<headers>$(tput sgr0) - HTTP headers can be passed in the form $(tput setaf 3)HEADER$(tput sgr0):$(tput setaf 4)VALUE$(tput sgr0)
- $(tput setaf 5)<parameters>$(tput sgr0) - REST operation parameters can be passed in the following
forms:
* $(tput setaf 3)KEY$(tput sgr0)=$(tput setaf 4)VALUE$(tput sgr0) - path or query parameters
- $(tput setaf 5)<body-parameters>$(tput sgr0) - simple JSON body content (first level only) can be build
using the following arguments:
* $(tput setaf 3)KEY$(tput sgr0)==$(tput setaf 4)VALUE$(tput sgr0) - body parameters which will be added to body
JSON as '{ ..., "$(tput setaf 3)KEY$(tput sgr0)": "$(tput setaf 4)VALUE$(tput sgr0)", ... }'
* $(tput setaf 3)KEY$(tput sgr0):=$(tput setaf 4)VALUE$(tput sgr0) - body parameters which will be added to body
JSON as '{ ..., "$(tput setaf 3)KEY$(tput sgr0)": $(tput setaf 4)VALUE$(tput sgr0), ... }'
EOF
echo -e "$(tput bold)$(tput setaf 7)Authentication methods$(tput sgr0)"
echo -e ""
echo -e " - $(tput setaf 4)Api-key$(tput sgr0) - add '$(tput setaf 1)api_key:<api-key>$(tput sgr0)' after $(tput setaf 3)<operation>$(tput sgr0)"
echo -e " or export $(tput setaf 1)PETSTORE_API_KEY='<api-key>'$(tput sgr0)"
echo -e " - $(tput setaf 4)Basic AUTH$(tput sgr0) - add '-u <username>:<password>' before $(tput setaf 3)<operation>$(tput sgr0)"
echo -e " or export $(tput setaf 1)PETSTORE_BASIC_AUTH='<username>:<password>'$(tput sgr0)"
echo -e " - $(tput setaf 5)OAuth2 (flow: implicit)$(tput sgr0)"
echo -e " Authorization URL: "
echo -e " * http://petstore.swagger.io/api/oauth/dialog"
echo -e " Scopes:"
echo -e " * write:pets - modify pets in your account"
echo -e " * read:pets - read your pets"
echo ""
echo -e "$(tput bold)$(tput setaf 7)Operations (grouped by tags)$(tput sgr0)"
echo ""
echo -e "$(tput bold)$(tput setaf 7)[fake]$(tput sgr0)"
read -d '' ops <<EOF
$(tput setaf 6)fakeOuterBooleanSerialize$(tput sgr0);
$(tput setaf 6)fakeOuterCompositeSerialize$(tput sgr0);
$(tput setaf 6)fakeOuterNumberSerialize$(tput sgr0);
$(tput setaf 6)fakeOuterStringSerialize$(tput sgr0);
$(tput setaf 6)testClientModel$(tput sgr0);To test \"client\" model
$(tput setaf 6)testEndpointParameters$(tput sgr0);Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트
$(tput setaf 6)testEnumParameters$(tput sgr0);To test enum parameters
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "$(tput bold)$(tput setaf 7)[pet]$(tput sgr0)"
read -d '' ops <<EOF
$(tput setaf 6)addPet$(tput sgr0);Add a new pet to the store
$(tput setaf 6)deletePet$(tput sgr0);Deletes a pet
$(tput setaf 6)findPetsByStatus$(tput sgr0);Finds Pets by status
$(tput setaf 6)findPetsByTags$(tput sgr0);Finds Pets by tags
$(tput setaf 6)getPetById$(tput sgr0);Find pet by ID
$(tput setaf 6)updatePet$(tput sgr0);Update an existing pet
$(tput setaf 6)updatePetWithForm$(tput sgr0);Updates a pet in the store with form data
$(tput setaf 6)uploadFile$(tput sgr0);uploads an image
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "$(tput bold)$(tput setaf 7)[store]$(tput sgr0)"
read -d '' ops <<EOF
$(tput setaf 6)deleteOrder$(tput sgr0);Delete purchase order by ID
$(tput setaf 6)getInventory$(tput sgr0);Returns pet inventories by status
$(tput setaf 6)getOrderById$(tput sgr0);Find purchase order by ID
$(tput setaf 6)placeOrder$(tput sgr0);Place an order for a pet
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "$(tput bold)$(tput setaf 7)[user]$(tput sgr0)"
read -d '' ops <<EOF
$(tput setaf 6)createUser$(tput sgr0);Create user
$(tput setaf 6)createUsersWithArrayInput$(tput sgr0);Creates list of users with given input array
$(tput setaf 6)createUsersWithListInput$(tput sgr0);Creates list of users with given input array
$(tput setaf 6)deleteUser$(tput sgr0);Delete user
$(tput setaf 6)getUserByName$(tput sgr0);Get user by user name
$(tput setaf 6)loginUser$(tput sgr0);Logs user into the system
$(tput setaf 6)logoutUser$(tput sgr0);Logs out current logged in user session
$(tput setaf 6)updateUser$(tput sgr0);Updated user
EOF
echo " $ops" | column -t -s ';'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Options$(tput sgr0)"
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 $(tput setaf 6)<url>$(tput sgr0)\t\t\t\tSpecify the host URL "
echo -e " \t\t\t\t(e.g. 'https://petstore.swagger.io:80')"
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 " -ac,--accept $(tput setaf 3)<mime-type>$(tput sgr0)\t\tSet the 'Accept' header in the request"
echo -e " -ct,--content-type $(tput setaf 3)<mime-type>$(tput sgr0)\tSet the 'Content-type' header in "
echo -e " \tthe request"
echo ""
}
##############################################################################
#
# Print REST service description
#
##############################################################################
print_about() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)Swagger Petstore command line client (API version 1.0.0)$(tput sgr0)"
echo ""
echo -e "License: Apache 2.0"
echo -e "Contact: apiteam@swagger.io"
echo ""
read -d '' appdescription <<EOF
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
EOF
echo "$appdescription" | fold -sw 80
}
##############################################################################
#
# Print REST api version
#
##############################################################################
print_version() {
echo ""
echo -e "$(tput bold)Swagger Petstore command line client (API version 1.0.0)$(tput sgr0)"
echo ""
}
##############################################################################
#
# Print help for fakeOuterBooleanSerialize operation
#
##############################################################################
print_fakeOuterBooleanSerialize_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)fakeOuterBooleanSerialize - $(tput sgr0)"
echo -e ""
echo -e "Test serialization of outer boolean types" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[]$(tput sgr0)$(tput sgr0) - Input boolean as post body" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;Output boolean$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;Output boolean$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;Output boolean$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;Output boolean$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;Output boolean$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;Output boolean$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for fakeOuterCompositeSerialize operation
#
##############################################################################
print_fakeOuterCompositeSerialize_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)fakeOuterCompositeSerialize - $(tput sgr0)"
echo -e ""
echo -e "Test serialization of object with outer number type" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[]$(tput sgr0)$(tput sgr0) - Input composite as post body" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;Output composite$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;Output composite$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;Output composite$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;Output composite$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;Output composite$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;Output composite$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for fakeOuterNumberSerialize operation
#
##############################################################################
print_fakeOuterNumberSerialize_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)fakeOuterNumberSerialize - $(tput sgr0)"
echo -e ""
echo -e "Test serialization of outer number types" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[]$(tput sgr0)$(tput sgr0) - Input number as post body" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;Output number$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;Output number$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;Output number$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;Output number$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;Output number$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;Output number$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for fakeOuterStringSerialize operation
#
##############################################################################
print_fakeOuterStringSerialize_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)fakeOuterStringSerialize - $(tput sgr0)"
echo -e ""
echo -e "Test serialization of outer string types" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[]$(tput sgr0)$(tput sgr0) - Input string as post body" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;Output string$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;Output string$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;Output string$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;Output string$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;Output string$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;Output string$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for testClientModel operation
#
##############################################################################
print_testClientModel_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)testClientModel - To test \"client\" model$(tput sgr0)"
echo -e ""
echo -e "To test \"client\" model" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[application/json]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - client model" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for testEndpointParameters operation
#
##############################################################################
print_testEndpointParameters_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)testEndpointParameters - Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트$(tput sgr0)"
echo -e ""
echo -e "Fake endpoint for testing various parameters
假端點
偽のエンドポイント
가짜 엔드 포인트" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 404 in
1*)
echo -e "$(tput setaf 7) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for testEnumParameters operation
#
##############################################################################
print_testEnumParameters_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)testEnumParameters - To test enum parameters$(tput sgr0)"
echo -e ""
echo -e "To test enum parameters" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)enum_header_string_array$(tput sgr0) $(tput setaf 4)[Array[String]]$(tput sgr0)$(tput sgr0) - Header parameter enum test (string array) $(tput setaf 3)Specify as: enum_header_string_array:value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * $(tput setaf 2)enum_header_string$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 6)(default: -efg)$(tput sgr0) - Header parameter enum test (string) $(tput setaf 3)Specify as: enum_header_string:value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * $(tput setaf 2)enum_query_string_array$(tput sgr0) $(tput setaf 4)[Array[String]]$(tput sgr0)$(tput sgr0) - Query parameter enum test (string array)$(tput setaf 3) Specify as: $(tput sgr0)" \
| fold -sw 80 | sed '2,$s/^/ /'
echo -e " * $(tput setaf 2)enum_query_string$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 6)(default: -efg)$(tput sgr0) - Query parameter enum test (string)$(tput setaf 3) Specify as: enum_query_string=value$(tput sgr0)" \
| fold -sw 80 | sed '2,$s/^/ /'
echo -e " * $(tput setaf 2)enum_query_integer$(tput sgr0) $(tput setaf 4)[Integer]$(tput sgr0)$(tput sgr0) - Query parameter enum test (double)$(tput setaf 3) Specify as: enum_query_integer=value$(tput sgr0)" \
| fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid request$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid request$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid request$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid request$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid request$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid request$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 404 in
1*)
echo -e "$(tput setaf 7) 404;Not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 404;Not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 404;Not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 404;Not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 404;Not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 404;Not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for addPet operation
#
##############################################################################
print_addPet_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)addPet - Add a new pet to the store$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[application/json,application/xml]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - Pet object that needs to be added to the store" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 405 in
1*)
echo -e "$(tput setaf 7) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for deletePet operation
#
##############################################################################
print_deletePet_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)deletePet - Deletes a pet$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)petId$(tput sgr0) $(tput setaf 4)[Integer]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - Pet id to delete $(tput setaf 3)Specify as: petId=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * $(tput setaf 2)api_key$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0)$(tput sgr0) - $(tput setaf 3)Specify as: api_key:value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid pet value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid pet value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid pet value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid pet value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid pet value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid pet value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for findPetsByStatus operation
#
##############################################################################
print_findPetsByStatus_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)findPetsByStatus - Finds Pets by status$(tput sgr0)"
echo -e ""
echo -e "Multiple status values can be provided with comma separated strings" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)status$(tput sgr0) $(tput setaf 4)[Array[String]]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - Status values that need to be considered for filter$(tput setaf 3) Specify as: status="value1,value2,..."$(tput sgr0)" \
| fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for findPetsByTags operation
#
##############################################################################
print_findPetsByTags_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)findPetsByTags - Finds Pets by tags$(tput sgr0)"
echo -e ""
echo -e "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing." | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)tags$(tput sgr0) $(tput setaf 4)[Array[String]]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - Tags to filter by$(tput setaf 3) Specify as: tags="value1,value2,..."$(tput sgr0)" \
| fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for getPetById operation
#
##############################################################################
print_getPetById_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)getPetById - Find pet by ID$(tput sgr0)"
echo -e ""
echo -e "Returns a single pet" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)petId$(tput sgr0) $(tput setaf 4)[Integer]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of pet to return $(tput setaf 3)Specify as: petId=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 404 in
1*)
echo -e "$(tput setaf 7) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for updatePet operation
#
##############################################################################
print_updatePet_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)updatePet - Update an existing pet$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[application/json,application/xml]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - Pet object that needs to be added to the store" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 404 in
1*)
echo -e "$(tput setaf 7) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 405 in
1*)
echo -e "$(tput setaf 7) 405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for updatePetWithForm operation
#
##############################################################################
print_updatePetWithForm_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)updatePetWithForm - Updates a pet in the store with form data$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)petId$(tput sgr0) $(tput setaf 4)[Integer]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of pet that needs to be updated $(tput setaf 3)Specify as: petId=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 405 in
1*)
echo -e "$(tput setaf 7) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for uploadFile operation
#
##############################################################################
print_uploadFile_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)uploadFile - uploads an image$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)petId$(tput sgr0) $(tput setaf 4)[Integer]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of pet to update $(tput setaf 3)Specify as: petId=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for deleteOrder operation
#
##############################################################################
print_deleteOrder_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)deleteOrder - Delete purchase order by ID$(tput sgr0)"
echo -e ""
echo -e "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)order_id$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of the order that needs to be deleted $(tput setaf 3)Specify as: order_id=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 404 in
1*)
echo -e "$(tput setaf 7) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for getInventory operation
#
##############################################################################
print_getInventory_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)getInventory - Returns pet inventories by status$(tput sgr0)"
echo -e ""
echo -e "Returns a map of status codes to quantities" | fold -sw 80
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for getOrderById operation
#
##############################################################################
print_getOrderById_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)getOrderById - Find purchase order by ID$(tput sgr0)"
echo -e ""
echo -e "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)order_id$(tput sgr0) $(tput setaf 4)[Integer]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of pet that needs to be fetched $(tput setaf 3)Specify as: order_id=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 404 in
1*)
echo -e "$(tput setaf 7) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for placeOrder operation
#
##############################################################################
print_placeOrder_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)placeOrder - Place an order for a pet$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - order placed for purchasing the pet" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for createUser operation
#
##############################################################################
print_createUser_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)createUser - Create user$(tput sgr0)"
echo -e ""
echo -e "This can only be done by the logged in user." | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - Created user object" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 0 in
1*)
echo -e "$(tput setaf 7) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for createUsersWithArrayInput operation
#
##############################################################################
print_createUsersWithArrayInput_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)createUsersWithArrayInput - Creates list of users with given input array$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - List of user object" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 0 in
1*)
echo -e "$(tput setaf 7) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for createUsersWithListInput operation
#
##############################################################################
print_createUsersWithListInput_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)createUsersWithListInput - Creates list of users with given input array$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - List of user object" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 0 in
1*)
echo -e "$(tput setaf 7) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for deleteUser operation
#
##############################################################################
print_deleteUser_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)deleteUser - Delete user$(tput sgr0)"
echo -e ""
echo -e "This can only be done by the logged in user." | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)username$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - The name that needs to be deleted $(tput setaf 3)Specify as: username=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 404 in
1*)
echo -e "$(tput setaf 7) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for getUserByName operation
#
##############################################################################
print_getUserByName_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)getUserByName - Get user by user name$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)username$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - The name that needs to be fetched. Use user1 for testing. $(tput setaf 3)Specify as: username=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 404 in
1*)
echo -e "$(tput setaf 7) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for loginUser operation
#
##############################################################################
print_loginUser_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)loginUser - Logs user into the system$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)username$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - The user name for login$(tput setaf 3) Specify as: username=value$(tput sgr0)" \
| fold -sw 80 | sed '2,$s/^/ /'
echo -e " * $(tput setaf 2)password$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - The password for login in clear text$(tput setaf 3) Specify as: password=value$(tput sgr0)" \
| fold -sw 80 | sed '2,$s/^/ /'
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 200 in
1*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
echo -e " $(tput bold)$(tput setaf 7)Response headers$(tput sgr0)"
echo -e " $(tput setaf 4)X-Rate-Limit$(tput sgr0) - calls per hour allowed by the user" | fold -sw 80 | sed '2,$s/^/ /'
echo -e " $(tput setaf 4)X-Expires-After$(tput sgr0) - date in UTC when toekn expires" | fold -sw 80 | sed '2,$s/^/ /'
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for logoutUser operation
#
##############################################################################
print_logoutUser_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)logoutUser - Logs out current logged in user session$(tput sgr0)"
echo -e ""
echo -e "" | fold -sw 80
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 0 in
1*)
echo -e "$(tput setaf 7) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Print help for updateUser operation
#
##############################################################################
print_updateUser_help() {
echo ""
echo -e "$(tput bold)$(tput setaf 7)updateUser - Updated user$(tput sgr0)"
echo -e ""
echo -e "This can only be done by the logged in user." | fold -sw 80
echo -e ""
echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
echo -e " * $(tput setaf 2)username$(tput sgr0) $(tput setaf 4)[String]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - name that need to be deleted $(tput setaf 3)Specify as: username=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/ /'
echo -e " * $(tput setaf 2)body$(tput sgr0) $(tput setaf 4)[]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - Updated user object" | fold -sw 80 | sed '2,$s/^/ /'
echo -e ""
echo ""
echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
case 400 in
1*)
echo -e "$(tput setaf 7) 400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
case 404 in
1*)
echo -e "$(tput setaf 7) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
2*)
echo -e "$(tput setaf 2) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
3*)
echo -e "$(tput setaf 3) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
4*)
echo -e "$(tput setaf 1) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
5*)
echo -e "$(tput setaf 5) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
*)
echo -e "$(tput setaf 7) 404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/ /'
;;
esac
}
##############################################################################
#
# Call fakeOuterBooleanSerialize operation
#
##############################################################################
call_fakeOuterBooleanSerialize() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/fake/outer/boolean" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/fake/outer/boolean" path_parameter_names query_parameter_names)
local method="POST"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
if [[ -z $header_content_type && "$force" = false ]]; then
:
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 fakeOuterCompositeSerialize operation
#
##############################################################################
call_fakeOuterCompositeSerialize() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/fake/outer/composite" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/fake/outer/composite" path_parameter_names query_parameter_names)
local method="POST"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
if [[ -z $header_content_type && "$force" = false ]]; then
:
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 fakeOuterNumberSerialize operation
#
##############################################################################
call_fakeOuterNumberSerialize() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/fake/outer/number" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/fake/outer/number" path_parameter_names query_parameter_names)
local method="POST"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
if [[ -z $header_content_type && "$force" = false ]]; then
:
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 fakeOuterStringSerialize operation
#
##############################################################################
call_fakeOuterStringSerialize() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/fake/outer/string" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/fake/outer/string" path_parameter_names query_parameter_names)
local method="POST"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
if [[ -z $header_content_type && "$force" = false ]]; then
:
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 testClientModel operation
#
##############################################################################
call_testClientModel() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/fake" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/fake" path_parameter_names query_parameter_names)
local method="PATCH"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
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 testEndpointParameters operation
#
##############################################################################
call_testEndpointParameters() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/fake" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/fake" path_parameter_names query_parameter_names)
local method="POST"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call testEnumParameters operation
#
##############################################################################
call_testEnumParameters() {
local path_parameter_names=()
local query_parameter_names=(enum_query_string_array enum_query_string enum_query_integer)
if [[ $force = false ]]; then
validate_request_parameters "/v2/fake" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/fake" path_parameter_names query_parameter_names)
local method="GET"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call addPet operation
#
##############################################################################
call_addPet() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/pet" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/pet" path_parameter_names query_parameter_names)
local method="POST"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
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 -e "\t- application/xml"
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 deletePet operation
#
##############################################################################
call_deletePet() {
local path_parameter_names=(petId)
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/pet/{petId}" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/pet/{petId}" path_parameter_names query_parameter_names)
local method="DELETE"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call findPetsByStatus operation
#
##############################################################################
call_findPetsByStatus() {
local path_parameter_names=()
local query_parameter_names=(status)
if [[ $force = false ]]; then
validate_request_parameters "/v2/pet/findByStatus" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/pet/findByStatus" path_parameter_names query_parameter_names)
local method="GET"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call findPetsByTags operation
#
##############################################################################
call_findPetsByTags() {
local path_parameter_names=()
local query_parameter_names=(tags)
if [[ $force = false ]]; then
validate_request_parameters "/v2/pet/findByTags" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/pet/findByTags" path_parameter_names query_parameter_names)
local method="GET"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call getPetById operation
#
##############################################################################
call_getPetById() {
local path_parameter_names=(petId)
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/pet/{petId}" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/pet/{petId}" path_parameter_names query_parameter_names)
local method="GET"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call updatePet operation
#
##############################################################################
call_updatePet() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/pet" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/pet" path_parameter_names query_parameter_names)
local method="PUT"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
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 -e "\t- application/xml"
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 updatePetWithForm operation
#
##############################################################################
call_updatePetWithForm() {
local path_parameter_names=(petId)
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/pet/{petId}" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/pet/{petId}" path_parameter_names query_parameter_names)
local method="POST"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call uploadFile operation
#
##############################################################################
call_uploadFile() {
local path_parameter_names=(petId)
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/pet/{petId}/uploadImage" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/pet/{petId}/uploadImage" path_parameter_names query_parameter_names)
local method="POST"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call deleteOrder operation
#
##############################################################################
call_deleteOrder() {
local path_parameter_names=(order_id)
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/store/order/{order_id}" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/store/order/{order_id}" path_parameter_names query_parameter_names)
local method="DELETE"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call getInventory operation
#
##############################################################################
call_getInventory() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/store/inventory" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/store/inventory" path_parameter_names query_parameter_names)
local method="GET"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call getOrderById operation
#
##############################################################################
call_getOrderById() {
local path_parameter_names=(order_id)
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/store/order/{order_id}" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/store/order/{order_id}" path_parameter_names query_parameter_names)
local method="GET"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call placeOrder operation
#
##############################################################################
call_placeOrder() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/store/order" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/store/order" path_parameter_names query_parameter_names)
local method="POST"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
if [[ -z $header_content_type && "$force" = false ]]; then
:
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 createUser operation
#
##############################################################################
call_createUser() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/user" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/user" path_parameter_names query_parameter_names)
local method="POST"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
if [[ -z $header_content_type && "$force" = false ]]; then
:
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 createUsersWithArrayInput operation
#
##############################################################################
call_createUsersWithArrayInput() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/user/createWithArray" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/user/createWithArray" path_parameter_names query_parameter_names)
local method="POST"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
if [[ -z $header_content_type && "$force" = false ]]; then
:
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 createUsersWithListInput operation
#
##############################################################################
call_createUsersWithListInput() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/user/createWithList" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/user/createWithList" path_parameter_names query_parameter_names)
local method="POST"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
if [[ -z $header_content_type && "$force" = false ]]; then
:
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 deleteUser operation
#
##############################################################################
call_deleteUser() {
local path_parameter_names=(username)
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/user/{username}" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/user/{username}" path_parameter_names query_parameter_names)
local method="DELETE"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call getUserByName operation
#
##############################################################################
call_getUserByName() {
local path_parameter_names=(username)
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/user/{username}" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/user/{username}" path_parameter_names query_parameter_names)
local method="GET"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call loginUser operation
#
##############################################################################
call_loginUser() {
local path_parameter_names=()
local query_parameter_names=(username password)
if [[ $force = false ]]; then
validate_request_parameters "/v2/user/login" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/user/login" path_parameter_names query_parameter_names)
local method="GET"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call logoutUser operation
#
##############################################################################
call_logoutUser() {
local path_parameter_names=()
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/user/logout" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/user/logout" path_parameter_names query_parameter_names)
local method="GET"
local 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 ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
else
eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
fi
}
##############################################################################
#
# Call updateUser operation
#
##############################################################################
call_updateUser() {
local path_parameter_names=(username)
local query_parameter_names=()
if [[ $force = false ]]; then
validate_request_parameters "/v2/user/{username}" path_parameter_names query_parameter_names
fi
local path=$(build_request_path "/v2/user/{username}" path_parameter_names query_parameter_names)
local method="PUT"
local 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 Swagger specification
# if values produces and consumes are defined unambigously
#
if [[ -z $header_content_type && "$force" = false ]]; then
:
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
}
##############################################################################
#
# 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 arguemnts 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
;;
fakeOuterBooleanSerialize)
operation="fakeOuterBooleanSerialize"
;;
fakeOuterCompositeSerialize)
operation="fakeOuterCompositeSerialize"
;;
fakeOuterNumberSerialize)
operation="fakeOuterNumberSerialize"
;;
fakeOuterStringSerialize)
operation="fakeOuterStringSerialize"
;;
testClientModel)
operation="testClientModel"
;;
testEndpointParameters)
operation="testEndpointParameters"
;;
testEnumParameters)
operation="testEnumParameters"
;;
addPet)
operation="addPet"
;;
deletePet)
operation="deletePet"
;;
findPetsByStatus)
operation="findPetsByStatus"
;;
findPetsByTags)
operation="findPetsByTags"
;;
getPetById)
operation="getPetById"
;;
updatePet)
operation="updatePet"
;;
updatePetWithForm)
operation="updatePetWithForm"
;;
uploadFile)
operation="uploadFile"
;;
deleteOrder)
operation="deleteOrder"
;;
getInventory)
operation="getInventory"
;;
getOrderById)
operation="getOrderById"
;;
placeOrder)
operation="placeOrder"
;;
createUser)
operation="createUser"
;;
createUsersWithArrayInput)
operation="createUsersWithArrayInput"
;;
createUsersWithListInput)
operation="createUsersWithListInput"
;;
deleteUser)
operation="deleteUser"
;;
getUserByName)
operation="getUserByName"
;;
loginUser)
operation="loginUser"
;;
logoutUser)
operation="logoutUser"
;;
updateUser)
operation="updateUser"
;;
*==*)
# Parse body arguments and convert them into top level
# JSON properties passed in the body content as strings
if [[ "$operation" ]]; then
IFS='==' read body_key sep body_value <<< "$key"
body_parameters[${body_key}]="\"${body_value}\""
fi
;;
*:=*)
# Parse body arguments and convert them into top level
# JSON properties passed in the body content without qoutes
if [[ "$operation" ]]; then
IFS=':=' read 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 header_name header_value <<< "$key"
#
# If the header key is the same as the api_key expected by API in the
# header, override the ${apikey_auth_credential} variable
#
if [[ $header_name == "api_key" ]]; then
apikey_auth_credential=$header_value
fi
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 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
echo "Error: No hostname provided!!!"
echo "Check usage: '${script_name} --help'"
exit 1
fi
# Check if user specified operation ID
if [[ -z "$operation" ]]; then
echo "Error: No operation specified!"
echo "Check available operations: '${script_name} --help'"
exit 1
fi
# Run cURL command based on the operation ID
case $operation in
fakeOuterBooleanSerialize)
call_fakeOuterBooleanSerialize
;;
fakeOuterCompositeSerialize)
call_fakeOuterCompositeSerialize
;;
fakeOuterNumberSerialize)
call_fakeOuterNumberSerialize
;;
fakeOuterStringSerialize)
call_fakeOuterStringSerialize
;;
testClientModel)
call_testClientModel
;;
testEndpointParameters)
call_testEndpointParameters
;;
testEnumParameters)
call_testEnumParameters
;;
addPet)
call_addPet
;;
deletePet)
call_deletePet
;;
findPetsByStatus)
call_findPetsByStatus
;;
findPetsByTags)
call_findPetsByTags
;;
getPetById)
call_getPetById
;;
updatePet)
call_updatePet
;;
updatePetWithForm)
call_updatePetWithForm
;;
uploadFile)
call_uploadFile
;;
deleteOrder)
call_deleteOrder
;;
getInventory)
call_getInventory
;;
getOrderById)
call_getOrderById
;;
placeOrder)
call_placeOrder
;;
createUser)
call_createUser
;;
createUsersWithArrayInput)
call_createUsersWithArrayInput
;;
createUsersWithListInput)
call_createUsersWithListInput
;;
deleteUser)
call_deleteUser
;;
getUserByName)
call_getUserByName
;;
loginUser)
call_loginUser
;;
logoutUser)
call_logoutUser
;;
updateUser)
call_updateUser
;;
*)
echo "Error: Unknown operation: $operation"
echo ""
print_help
exit 1
esac