Guest User

Untitled

a guest
Aug 14th, 2017
478
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 117.11 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  4. # !
  5. # ! Note:
  6. # !
  7. # ! THIS SCRIPT HAS BEEN AUTOMATICALLY GENERATED USING
  8. # ! swagger-codegen (https://github.com/swagger-api/swagger-codegen)
  9. # ! FROM SWAGGER SPECIFICATION IN JSON.
  10. # !
  11. # ! Generated on: 2017-08-14T11:32:43.624Z
  12. # !
  13. # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  14.  
  15. #
  16. # This is a Bash client for Swagger Petstore.
  17. #
  18. # LICENSE:
  19. # http://www.apache.org/licenses/LICENSE-2.0.html
  20. #
  21. # CONTACT:
  22. #
  23. # MORE INFORMATION:
  24. # http://swagger.io
  25. #
  26.  
  27. ###############################################################################
  28. #
  29. # Make sure Bash is at least in version 4.3
  30. #
  31. ###############################################################################
  32. if ! ( (("${BASH_VERSION:0:1}" == "4")) && (("${BASH_VERSION:2:1}" >= "3")) ) \
  33.   && ! (("${BASH_VERSION:0:1}" >= "5")); then
  34.     echo ""
  35.     echo "Sorry - your Bash version is ${BASH_VERSION}"
  36.     echo ""
  37.     echo "You need at least Bash 4.3 to run this script."
  38.     echo ""
  39.     exit 1
  40. fi
  41.  
  42. ###############################################################################
  43. #
  44. # Global variables
  45. #
  46. ###############################################################################
  47.  
  48. ##
  49. # The filename of this script for help messages
  50. script_name=`basename "$0"`
  51.  
  52. ##
  53. # Map for headers passed after operation as KEY:VALUE
  54. declare -A header_arguments
  55.  
  56.  
  57. ##
  58. # Map for operation parameters passed after operation as PARAMETER=VALUE
  59. # These will be mapped to appropriate path or query parameters
  60. # The values in operation_parameters are arrays, so that multiple values
  61. # can be provided for the same parameter if allowed by API specification
  62. declare -A operation_parameters
  63.  
  64. ##
  65. # This array stores the minimum number of required occurences for parameter
  66. # 0 - optional
  67. # 1 - required
  68. declare -A operation_parameters_minimum_occurences
  69. operation_parameters_minimum_occurences["addPet:::body"]=1
  70. operation_parameters_minimum_occurences["deletePet:::petId"]=1
  71. operation_parameters_minimum_occurences["deletePet:::api_key"]=0
  72. operation_parameters_minimum_occurences["findPetsByStatus:::status"]=1
  73. operation_parameters_minimum_occurences["findPetsByTags:::tags"]=1
  74. operation_parameters_minimum_occurences["getPetById:::petId"]=1
  75. operation_parameters_minimum_occurences["updatePet:::body"]=1
  76. operation_parameters_minimum_occurences["updatePetWithForm:::petId"]=1
  77. operation_parameters_minimum_occurences["updatePetWithForm:::name"]=0
  78. operation_parameters_minimum_occurences["updatePetWithForm:::status"]=0
  79. operation_parameters_minimum_occurences["uploadFile:::petId"]=1
  80. operation_parameters_minimum_occurences["uploadFile:::additionalMetadata"]=0
  81. operation_parameters_minimum_occurences["uploadFile:::file"]=0
  82. operation_parameters_minimum_occurences["deleteOrder:::orderId"]=1
  83. operation_parameters_minimum_occurences["getOrderById:::orderId"]=1
  84. operation_parameters_minimum_occurences["placeOrder:::body"]=1
  85. operation_parameters_minimum_occurences["createUser:::body"]=1
  86. operation_parameters_minimum_occurences["createUsersWithArrayInput:::body"]=1
  87. operation_parameters_minimum_occurences["createUsersWithListInput:::body"]=1
  88. operation_parameters_minimum_occurences["deleteUser:::username"]=1
  89. operation_parameters_minimum_occurences["getUserByName:::username"]=1
  90. operation_parameters_minimum_occurences["loginUser:::username"]=1
  91. operation_parameters_minimum_occurences["loginUser:::password"]=1
  92. operation_parameters_minimum_occurences["updateUser:::username"]=1
  93. operation_parameters_minimum_occurences["updateUser:::body"]=1
  94.  
  95. ##
  96. # This array stores the maximum number of allowed occurences for parameter
  97. # 1 - single value
  98. # 2 - 2 values
  99. # N - N values
  100. # 0 - unlimited
  101. declare -A operation_parameters_maximum_occurences
  102. operation_parameters_maximum_occurences["addPet:::body"]=0
  103. operation_parameters_maximum_occurences["deletePet:::petId"]=0
  104. operation_parameters_maximum_occurences["deletePet:::api_key"]=0
  105. operation_parameters_maximum_occurences["findPetsByStatus:::status"]=0
  106. operation_parameters_maximum_occurences["findPetsByTags:::tags"]=0
  107. operation_parameters_maximum_occurences["getPetById:::petId"]=0
  108. operation_parameters_maximum_occurences["updatePet:::body"]=0
  109. operation_parameters_maximum_occurences["updatePetWithForm:::petId"]=0
  110. operation_parameters_maximum_occurences["updatePetWithForm:::name"]=0
  111. operation_parameters_maximum_occurences["updatePetWithForm:::status"]=0
  112. operation_parameters_maximum_occurences["uploadFile:::petId"]=0
  113. operation_parameters_maximum_occurences["uploadFile:::additionalMetadata"]=0
  114. operation_parameters_maximum_occurences["uploadFile:::file"]=0
  115. operation_parameters_maximum_occurences["deleteOrder:::orderId"]=0
  116. operation_parameters_maximum_occurences["getOrderById:::orderId"]=0
  117. operation_parameters_maximum_occurences["placeOrder:::body"]=0
  118. operation_parameters_maximum_occurences["createUser:::body"]=0
  119. operation_parameters_maximum_occurences["createUsersWithArrayInput:::body"]=0
  120. operation_parameters_maximum_occurences["createUsersWithListInput:::body"]=0
  121. operation_parameters_maximum_occurences["deleteUser:::username"]=0
  122. operation_parameters_maximum_occurences["getUserByName:::username"]=0
  123. operation_parameters_maximum_occurences["loginUser:::username"]=0
  124. operation_parameters_maximum_occurences["loginUser:::password"]=0
  125. operation_parameters_maximum_occurences["updateUser:::username"]=0
  126. operation_parameters_maximum_occurences["updateUser:::body"]=0
  127.  
  128. ##
  129. # The type of collection for specifying multiple values for parameter:
  130. # - multi, csv, ssv, tsv
  131. declare -A operation_parameters_collection_type
  132. operation_parameters_collection_type["addPet:::body"]=""
  133. operation_parameters_collection_type["deletePet:::petId"]=""
  134. operation_parameters_collection_type["deletePet:::api_key"]=""
  135. operation_parameters_collection_type["findPetsByStatus:::status"]="multi"
  136. operation_parameters_collection_type["findPetsByTags:::tags"]="multi"
  137. operation_parameters_collection_type["getPetById:::petId"]=""
  138. operation_parameters_collection_type["updatePet:::body"]=""
  139. operation_parameters_collection_type["updatePetWithForm:::petId"]=""
  140. operation_parameters_collection_type["updatePetWithForm:::name"]=""
  141. operation_parameters_collection_type["updatePetWithForm:::status"]=""
  142. operation_parameters_collection_type["uploadFile:::petId"]=""
  143. operation_parameters_collection_type["uploadFile:::additionalMetadata"]=""
  144. operation_parameters_collection_type["uploadFile:::file"]=""
  145. operation_parameters_collection_type["deleteOrder:::orderId"]=""
  146. operation_parameters_collection_type["getOrderById:::orderId"]=""
  147. operation_parameters_collection_type["placeOrder:::body"]=""
  148. operation_parameters_collection_type["createUser:::body"]=""
  149. operation_parameters_collection_type["createUsersWithArrayInput:::body"]=
  150. operation_parameters_collection_type["createUsersWithListInput:::body"]=
  151. operation_parameters_collection_type["deleteUser:::username"]=""
  152. operation_parameters_collection_type["getUserByName:::username"]=""
  153. operation_parameters_collection_type["loginUser:::username"]=""
  154. operation_parameters_collection_type["loginUser:::password"]=""
  155. operation_parameters_collection_type["updateUser:::username"]=""
  156. operation_parameters_collection_type["updateUser:::body"]=""
  157.  
  158.  
  159. ##
  160. # Map for body parameters passed after operation as
  161. # PARAMETER==STRING_VALUE or PARAMETER:=NUMERIC_VALUE
  162. # These will be mapped to top level json keys ( { "PARAMETER": "VALUE" })
  163. declare -A body_parameters
  164.  
  165. ##
  166. # These arguments will be directly passed to cURL
  167. curl_arguments=""
  168.  
  169. ##
  170. # The host for making the request
  171. host=""
  172.  
  173. ##
  174. # The user credentials for basic authentication
  175. basic_auth_credential=""
  176.  
  177. ##
  178. # The user API key
  179. apikey_auth_credential=""
  180.  
  181. ##
  182. # If true, the script will only output the actual cURL command that would be
  183. # used
  184. print_curl=false
  185.  
  186. ##
  187. # The operation ID passed on the command line
  188. operation=""
  189.  
  190. ##
  191. # The provided Accept header value
  192. header_accept=""
  193.  
  194. ##
  195. # The provided Content-type header value
  196. header_content_type=""
  197.  
  198. ##
  199. # If there is any body content on the stdin pass it to the body of the request
  200. body_content_temp_file=""
  201.  
  202. ##
  203. # If this variable is set to true, the request will be performed even
  204. # if parameters for required query, header or body values are not provided
  205. # (path parameters are still required).
  206. force=false
  207.  
  208. ##
  209. # Declare some mime types abbreviations for easier content-type and accepts
  210. # headers specification
  211. declare -A mime_type_abbreviations
  212. # text/*
  213. mime_type_abbreviations["text"]="text/plain"
  214. mime_type_abbreviations["html"]="text/html"
  215. mime_type_abbreviations["md"]="text/x-markdown"
  216. mime_type_abbreviations["csv"]="text/csv"
  217. mime_type_abbreviations["css"]="text/css"
  218. mime_type_abbreviations["rtf"]="text/rtf"
  219. # application/*
  220. mime_type_abbreviations["json"]="application/json"
  221. mime_type_abbreviations["xml"]="application/xml"
  222. mime_type_abbreviations["yaml"]="application/yaml"
  223. mime_type_abbreviations["js"]="application/javascript"
  224. mime_type_abbreviations["bin"]="application/octet-stream"
  225. mime_type_abbreviations["rdf"]="application/rdf+xml"
  226. # image/*
  227. mime_type_abbreviations["jpg"]="image/jpeg"
  228. mime_type_abbreviations["png"]="image/png"
  229. mime_type_abbreviations["gif"]="image/gif"
  230. mime_type_abbreviations["bmp"]="image/bmp"
  231. mime_type_abbreviations["tiff"]="image/tiff"
  232.  
  233.  
  234. ##############################################################################
  235. #
  236. # Escape special URL characters
  237. # Based on table at http://www.w3schools.com/tags/ref_urlencode.asp
  238. #
  239. ##############################################################################
  240. url_escape() {
  241.     local raw_url="$1"
  242.  
  243.     value=$(sed -e 's/ /%20/g' \
  244.        -e 's/!/%21/g' \
  245.        -e 's/"/%22/g' \
  246.        -e 's/#/%23/g' \
  247.        -e 's/\&/%26/g' \
  248.        -e 's/'\''/%28/g' \
  249.        -e 's/(/%28/g' \
  250.        -e 's/)/%29/g' \
  251.        -e 's/:/%3A/g' \
  252.        -e 's/?/%3F/g' <<<$raw_url);
  253.  
  254.     echo $value
  255. }
  256.  
  257. ##############################################################################
  258. #
  259. # Lookup the mime type abbreviation in the mime_type_abbreviations array.
  260. # If not present assume the user provided a valid mime type
  261. #
  262. ##############################################################################
  263. lookup_mime_type() {
  264.     local mime_type=$1
  265.  
  266.     if [[ ${mime_type_abbreviations[$mime_type]} ]]; then
  267.         echo ${mime_type_abbreviations[$mime_type]}
  268.     else
  269.         echo $1
  270.     fi
  271. }
  272.  
  273. ##############################################################################
  274. #
  275. # Converts an associative array into a list of cURL header
  276. # arguments (-H "KEY: VALUE")
  277. #
  278. ##############################################################################
  279. header_arguments_to_curl() {
  280.     local headers_curl=""
  281.     local api_key_header=""
  282.     local api_key_header_in_cli=""
  283.     api_key_header="api_key"
  284.  
  285.     for key in "${!header_arguments[@]}"; do
  286.         headers_curl+="-H \"${key}: ${header_arguments[${key}]}\" "
  287.         if [[ "${key}XX" == "${api_key_header}XX" ]]; then
  288.             api_key_header_in_cli="YES"
  289.         fi
  290.     done
  291.     #
  292.     # If the api_key was not provided in the header, try one from the
  293.     # environment variable
  294.     #
  295.     if [[ -z $api_key_header_in_cli && -n $apikey_auth_credential ]]; then
  296.         headers_curl+="-H \"${api_key_header}: ${apikey_auth_credential}\""
  297.     fi
  298.     headers_curl+=" "
  299.  
  300.     echo "${headers_curl}"
  301. }
  302.  
  303. ##############################################################################
  304. #
  305. # Converts an associative array into a simple JSON with keys as top
  306. # level object attributes
  307. #
  308. # \todo Add convertion of more complex attributes using paths
  309. #
  310. ##############################################################################
  311. body_parameters_to_json() {
  312.     local body_json="-d '{"
  313.     local body_parameter_count=${#body_parameters[@]}
  314.     local count=0
  315.     for key in "${!body_parameters[@]}"; do
  316.         body_json+="\"${key}\": ${body_parameters[${key}]}"
  317.         if [[ $count -lt $body_parameter_count-1 ]]; then
  318.             body_json+=", "
  319.         fi
  320.         ((count+=1))
  321.     done
  322.     body_json+="}'"
  323.  
  324.     if [[ "${#body_parameters[@]}" -eq 0 ]]; then
  325.         echo ""
  326.     else
  327.         echo "${body_json}"
  328.     fi
  329. }
  330.  
  331. ##############################################################################
  332. #
  333. # Check if provided parameters match specification requirements
  334. #
  335. ##############################################################################
  336. validate_request_parameters() {
  337.     local path_template=$1
  338.     local -n path_params=$2
  339.     local -n query_params=$3
  340.  
  341.     # First replace all path parameters in the path
  342.     for pparam in "${path_params[@]}"; do
  343.         regexp="(.*)(\{$pparam\})(.*)"
  344.         if [[ $path_template =~ $regexp ]]; then
  345.             path_template=${BASH_REMATCH[1]}${operation_parameters[$pparam]}${BASH_REMATCH[3]}
  346.         fi
  347.     done
  348.  
  349.     # Now append query parameters - if any
  350.     if [[ ${#query_params[@]} -gt 0 ]]; then
  351.         path_template+="?"
  352.     fi
  353.  
  354.     local query_parameter_count=${#query_params[@]}
  355.     local count=0
  356.     for qparam in "${query_params[@]}"; do
  357.         # Get the array of parameter values
  358.         local parameter_values=($(echo "${operation_parameters[$qparam]}" | sed -e 's/'":::"'/\n/g' | while read line; do echo $line | sed 's/[\t ]/'":::"'/g'; done))
  359.  
  360.         #
  361.         # Check if the number of provided values is not less than minimum
  362.         # required
  363.         #
  364.         if [[ "$force" = false ]]; then
  365.             if [[ ${#parameter_values[@]} -lt ${operation_parameters_minimum_occurences["${operation}:::${qparam}"]} ]]; then
  366.                echo "Error: Too few values provided for '${qparam}' parameter"
  367.                exit 1
  368.            fi
  369.  
  370.            #
  371.            # Check if the number of provided values is not more than maximum
  372.            #
  373.            if [[ ${operation_parameters_maximum_occurences["${operation}:::${qparam}"]} -gt 0 \
  374.                   && ${#parameter_values[@]} -gt ${operation_parameters_maximum_occurences["${operation}:::${qparam}"]} ]]; then
  375.                if [[ "$force" = false ]]; then
  376.                    echo "Error: Too many values provided for '${qparam}' parameter"
  377.                    exit 1
  378.                fi
  379.            fi
  380.        fi
  381.  
  382.        if [[ "${operation_parameters_collection_type[${operation}:::${qparam}]}" == "" ]]; then
  383.            local vcount=0
  384.            for qvalue in "${parameter_values[@]}"; do
  385.                path_template+="${qparam}=${qvalue}"
  386.  
  387.                if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  388.                    path_template+="&"
  389.                fi
  390.                ((vcount+=1))
  391.            done
  392.        elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "multi" ]]; then
  393.             local vcount=0
  394.             for qvalue in "${parameter_values[@]}"; do
  395.                 path_template+="${qparam}=${qvalue}"
  396.  
  397.                 if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  398.                     path_template+="&"
  399.                 fi
  400.                 ((vcount+=1))
  401.             done
  402.         elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "csv" ]]; then
  403.            path_template+="${qparam}="
  404.            local vcount=0
  405.            for qvalue in "${parameter_values[@]}"; do
  406.                path_template+="${qvalue}"
  407.  
  408.                if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  409.                    path_template+=","
  410.                fi
  411.                ((vcount+=1))
  412.            done
  413.        elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "ssv" ]]; then
  414.             path_template+="${qparam}="
  415.             for qvalue in "${parameter_values[@]}"; do
  416.                 path_template+="${qvalue}"
  417.  
  418.                 if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  419.                     path_template+=" "
  420.                 fi
  421.                 ((vcount+=1))
  422.             done
  423.         elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "tsv" ]]; then
  424.            path_template+="${qparam}="
  425.            for qvalue in "${parameter_values[@]}"; do
  426.                path_template+="${qvalue}"
  427.  
  428.                if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  429.                    path_template+="\t"
  430.                fi
  431.                ((vcount+=1))
  432.            done
  433.        else
  434.            echo -e ""
  435.            echo -e "Error: Unsupported collection format "
  436.            echo -e ""
  437.            exit 1
  438.        fi
  439.  
  440.  
  441.        if [[ $count -lt $query_parameter_count-1 ]]; then
  442.            path_template+="&"
  443.        fi
  444.        ((count+=1))
  445.    done
  446.  
  447. }
  448.  
  449.  
  450.  
  451. ##############################################################################
  452. #
  453. # Build request path including query parameters
  454. #
  455. ##############################################################################
  456. build_request_path() {
  457.    local path_template=$1
  458.    local -n path_params=$2
  459.    local -n query_params=$3
  460.  
  461.  
  462.    # First replace all path parameters in the path
  463.    for pparam in "${path_params[@]}"; do
  464.        regexp="(.*)(\{$pparam\})(.*)"
  465.        if [[ $path_template =~ $regexp ]]; then
  466.            path_template=${BASH_REMATCH[1]}${operation_parameters[$pparam]}${BASH_REMATCH[3]}
  467.        fi
  468.    done
  469.  
  470.    local query_request_part=""
  471.  
  472.    local query_parameter_count=${#query_params[@]}
  473.    local count=0
  474.    for qparam in "${query_params[@]}"; do
  475.        # Get the array of parameter values
  476.        local parameter_values=($(echo "${operation_parameters[$qparam]}" | sed -e 's/'":::"'/\n/g' | while read line; do echo $line | sed 's/[\t ]/'":::"'/g'; done))
  477.        local parameter_value=""
  478.  
  479.        #
  480.        # Check if the number of provided values is not less than minimum
  481.        # required
  482.        #
  483.        if [[ "$force" = false ]]; then
  484.            if [[ ${#parameter_values[@]} -lt ${operation_parameters_minimum_occurences["${operation}:::${qparam}"]} ]]; then
  485.                 echo "Error: Too few values provided for '${qparam}' parameter"
  486.                 exit 1
  487.             fi
  488.  
  489.             #
  490.             # Check if the number of provided values is not more than maximum
  491.             #
  492.             if [[ ${operation_parameters_maximum_occurences["${operation}:::${qparam}"]} -gt 0 \
  493.                  && ${#parameter_values[@]} -gt ${operation_parameters_maximum_occurences["${operation}:::${qparam}"]} ]]; then
  494.                 if [[ "$force" = false ]]; then
  495.                     echo "Error: Too many values provided for '${qparam}' parameter"
  496.                     exit 1
  497.                 fi
  498.             fi
  499.         fi
  500.  
  501.         #
  502.         # Append parameters without specific cardinality
  503.         #
  504.         if [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "" ]]; then
  505.            local vcount=0
  506.            for qvalue in "${parameter_values[@]}"; do
  507.                parameter_value+="${qparam}=${qvalue}"
  508.  
  509.                if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  510.                    parameter_value+="&"
  511.                fi
  512.                ((vcount+=1))
  513.            done
  514.        #
  515.        # Append parameters specified as 'mutli' collections i.e. param=value1&param=value2&...
  516.        #
  517.        elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "multi" ]]; then
  518.             local vcount=0
  519.             for qvalue in "${parameter_values[@]}"; do
  520.                 parameter_value+="${qparam}=${qvalue}"
  521.  
  522.                 if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  523.                     parameter_value+="&"
  524.                 fi
  525.                 ((vcount+=1))
  526.             done
  527.         #
  528.         # Append parameters specified as 'csv' collections i.e. param=value1,value2,...
  529.         #
  530.         elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "csv" ]]; then
  531.            parameter_value+="${qparam}="
  532.            local vcount=0
  533.            for qvalue in "${parameter_values[@]}"; do
  534.                parameter_value+="${qvalue}"
  535.  
  536.                if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  537.                    parameter_value+=","
  538.                fi
  539.                ((vcount+=1))
  540.            done
  541.        #
  542.        # Append parameters specified as 'ssv' collections i.e. param="value1 value2 ..."
  543.        #
  544.        elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "ssv" ]]; then
  545.             parameter_value+="${qparam}="
  546.             local vcount=0
  547.             for qvalue in "${parameter_values[@]}"; do
  548.                 parameter_value+="${qvalue}"
  549.  
  550.                 if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  551.                     parameter_value+=" "
  552.                 fi
  553.                 ((vcount+=1))
  554.             done
  555.         #
  556.         # Append parameters specified as 'tsv' collections i.e. param="value1\tvalue2\t..."
  557.         #
  558.         elif [[ "${operation_parameters_collection_type["${operation}:::${qparam}"]}" == "tsv" ]]; then
  559.            parameter_value+="${qparam}="
  560.            local vcount=0
  561.            for qvalue in "${parameter_values[@]}"; do
  562.                parameter_value+="${qvalue}"
  563.  
  564.                if [[ $vcount -lt ${#parameter_values[@]}-1 ]]; then
  565.                    parameter_value+="\t"
  566.                fi
  567.                ((vcount+=1))
  568.            done
  569.        fi
  570.  
  571.        if [[ -n "${parameter_value}" ]]; then
  572.            query_request_part+="${parameter_value}"
  573.        fi
  574.  
  575.        if [[ $count -lt $query_parameter_count-1 && -n "${parameter_value}" ]]; then
  576.            query_request_part+="&"
  577.        fi
  578.  
  579.        ((count+=1))
  580.    done
  581.  
  582.  
  583.    # Now append query parameters - if any
  584.    if [[ -n "${query_request_part}" ]]; then
  585.        path_template+="?$(echo ${query_request_part} | sed s'/&$//')"
  586.    fi
  587.  
  588.    echo $path_template
  589. }
  590.  
  591.  
  592.  
  593. ###############################################################################
  594. #
  595. # Print main help message
  596. #
  597. ###############################################################################
  598. print_help() {
  599. cat <<EOF
  600.  
  601. $(tput bold)$(tput setaf 7)Swagger Petstore command line client (API version 1.0.0)$(tput sgr0)
  602.  
  603. $(tput bold)$(tput setaf 7)Usage$(tput sgr0)
  604.  
  605.  $(tput setaf 2)${script_name}$(tput sgr0) [-h|--help] [-V|--version] [--about] [$(tput setaf 1)<curl-options>$(tput sgr0)]
  606.           [-ac|--accept $(tput setaf 2)<mime-type>$(tput sgr0)] [-ct,--content-type $(tput setaf 2)<mime-type>$(tput sgr0)]
  607.           [--host $(tput setaf 6)<url>$(tput sgr0)] [--dry-run] $(tput setaf 3)<operation>$(tput sgr0) [-h|--help] [$(tput setaf 4)<headers>$(tput sgr0)]
  608.           [$(tput setaf 5)<parameters>$(tput sgr0)] [$(tput setaf 5)<body-parameters>$(tput sgr0)]
  609.  
  610.  - $(tput setaf 6)<url>$(tput sgr0) - endpoint of the REST service without basepath
  611.  
  612.  - $(tput setaf 1)<curl-options>$(tput sgr0) - any valid cURL options can be passed before $(tput setaf 3)<operation>$(tput sgr0)
  613.  - $(tput setaf 2)<mime-type>$(tput sgr0) - either full mime-type or one of supported abbreviations:
  614.                   (text, html, md, csv, css, rtf, json, xml, yaml, js, bin,
  615.                    rdf, jpg, png, gif, bmp, tiff)
  616.  - $(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)
  617.  - $(tput setaf 5)<parameters>$(tput sgr0) - REST operation parameters can be passed in the following
  618.                   forms:
  619.                   * $(tput setaf 3)KEY$(tput sgr0)=$(tput setaf 4)VALUE$(tput sgr0) - path or query parameters
  620.  - $(tput setaf 5)<body-parameters>$(tput sgr0) - simple JSON body content (first level only) can be build
  621.                        using the following arguments:
  622.                        * $(tput setaf 3)KEY$(tput sgr0)==$(tput setaf 4)VALUE$(tput sgr0) - body parameters which will be added to body
  623.                                      JSON as '{ ..., "$(tput setaf 3)KEY$(tput sgr0)": "$(tput setaf 4)VALUE$(tput sgr0)", ... }'
  624.                        * $(tput setaf 3)KEY$(tput sgr0):=$(tput setaf 4)VALUE$(tput sgr0) - body parameters which will be added to body
  625.                                      JSON as '{ ..., "$(tput setaf 3)KEY$(tput sgr0)": $(tput setaf 4)VALUE$(tput sgr0), ... }'
  626.  
  627. EOF
  628.    echo -e "$(tput bold)$(tput setaf 7)Authentication methods$(tput sgr0)"
  629.    echo -e ""
  630.    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)"
  631.    
  632.    echo -e "  - $(tput setaf 5)OAuth2 (flow: implicit)$(tput sgr0)"
  633.    echo -e "      Authorization URL: "
  634.    echo -e "        * http://petstore.swagger.io/oauth/dialog"
  635.    echo -e "      Scopes:"
  636.    echo -e "        * write:pets - modify pets in your account"
  637.    echo -e "        * read:pets - read your pets"
  638.    echo ""
  639.    echo -e "$(tput bold)$(tput setaf 7)Operations (grouped by tags)$(tput sgr0)"
  640.    echo ""
  641.    echo -e "$(tput bold)$(tput setaf 7)[pet]$(tput sgr0)"
  642. read -d '' ops <<EOF
  643.  $(tput setaf 6)addPet$(tput sgr0);Add a new pet to the store
  644.  $(tput setaf 6)deletePet$(tput sgr0);Deletes a pet
  645.  $(tput setaf 6)findPetsByStatus$(tput sgr0);Finds Pets by status
  646.  $(tput setaf 6)findPetsByTags$(tput sgr0);Finds Pets by tags
  647.  $(tput setaf 6)getPetById$(tput sgr0);Find pet by ID
  648.  $(tput setaf 6)updatePet$(tput sgr0);Update an existing pet
  649.  $(tput setaf 6)updatePetWithForm$(tput sgr0);Updates a pet in the store with form data
  650.  $(tput setaf 6)uploadFile$(tput sgr0);uploads an image
  651. EOF
  652. echo "  $ops" | column -t -s ';'
  653.    echo ""
  654.    echo -e "$(tput bold)$(tput setaf 7)[store]$(tput sgr0)"
  655. read -d '' ops <<EOF
  656.  $(tput setaf 6)deleteOrder$(tput sgr0);Delete purchase order by ID
  657.  $(tput setaf 6)getInventory$(tput sgr0);Returns pet inventories by status
  658.  $(tput setaf 6)getOrderById$(tput sgr0);Find purchase order by ID
  659.  $(tput setaf 6)placeOrder$(tput sgr0);Place an order for a pet
  660. EOF
  661. echo "  $ops" | column -t -s ';'
  662.    echo ""
  663.    echo -e "$(tput bold)$(tput setaf 7)[user]$(tput sgr0)"
  664. read -d '' ops <<EOF
  665.  $(tput setaf 6)createUser$(tput sgr0);Create user
  666.  $(tput setaf 6)createUsersWithArrayInput$(tput sgr0);Creates list of users with given input array
  667.  $(tput setaf 6)createUsersWithListInput$(tput sgr0);Creates list of users with given input array
  668.  $(tput setaf 6)deleteUser$(tput sgr0);Delete user
  669.  $(tput setaf 6)getUserByName$(tput sgr0);Get user by user name
  670.  $(tput setaf 6)loginUser$(tput sgr0);Logs user into the system
  671.  $(tput setaf 6)logoutUser$(tput sgr0);Logs out current logged in user session
  672.  $(tput setaf 6)updateUser$(tput sgr0);Updated user
  673. EOF
  674. echo "  $ops" | column -t -s ';'
  675.    echo ""
  676.    echo -e "$(tput bold)$(tput setaf 7)Options$(tput sgr0)"
  677.    echo -e "  -h,--help\t\t\t\tPrint this help"
  678.    echo -e "  -V,--version\t\t\t\tPrint API version"
  679.    echo -e "  --about\t\t\t\tPrint the information about service"
  680.    echo -e "  --host $(tput setaf 6)<url>$(tput sgr0)\t\t\t\tSpecify the host URL "
  681. echo -e "              \t\t\t\t(e.g. 'https://petstore.swagger.io')"
  682.  
  683.    echo -e "  --force\t\t\t\tForce command invocation in spite of missing"
  684.    echo -e "         \t\t\t\trequired parameters or wrong content type"
  685.    echo -e "  --dry-run\t\t\t\tPrint out the cURL command without"
  686.    echo -e "           \t\t\t\texecuting it"
  687.    echo -e "  -ac,--accept $(tput setaf 3)<mime-type>$(tput sgr0)\t\tSet the 'Accept' header in the request"
  688.    echo -e "  -ct,--content-type $(tput setaf 3)<mime-type>$(tput sgr0)\tSet the 'Content-type' header in "
  689.    echo -e "                                \tthe request"
  690.    echo ""
  691. }
  692.  
  693.  
  694. ##############################################################################
  695. #
  696. # Print REST service description
  697. #
  698. ##############################################################################
  699. print_about() {
  700.    echo ""
  701.    echo -e "$(tput bold)$(tput setaf 7)Swagger Petstore command line client (API version 1.0.0)$(tput sgr0)"
  702.    echo ""
  703.    echo -e "License: Apache 2.0"
  704.    echo -e "Contact: apiteam@swagger.io"
  705.    echo ""
  706. read -d '' appdescription <<EOF
  707.  
  708. This is a sample server Petstore server.  You can find out more about     Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).      For this sample, you can use the api key 'special-key' to test the authorization     filters.
  709. EOF
  710. echo "$appdescription" | fold -sw 80
  711. }
  712.  
  713.  
  714. ##############################################################################
  715. #
  716. # Print REST api version
  717. #
  718. ##############################################################################
  719. print_version() {
  720.    echo ""
  721.    echo -e "$(tput bold)Swagger Petstore command line client (API version 1.0.0)$(tput sgr0)"
  722.    echo ""
  723. }
  724.  
  725. ##############################################################################
  726. #
  727. # Print help for addPet operation
  728. #
  729. ##############################################################################
  730. print_addPet_help() {
  731.    echo ""
  732.    echo -e "$(tput bold)$(tput setaf 7)addPet - Add a new pet to the store$(tput sgr0)"
  733.    echo -e ""
  734.    echo -e "" | fold -sw 80
  735.    echo -e ""
  736.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  737.    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/^/    /'
  738.    echo -e ""
  739.    echo ""
  740.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  741.    case 405 in
  742.        1*)
  743.        echo -e "$(tput setaf 7)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  744.        ;;
  745.        2*)
  746.        echo -e "$(tput setaf 2)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  747.        ;;
  748.        3*)
  749.        echo -e "$(tput setaf 3)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  750.        ;;
  751.        4*)
  752.        echo -e "$(tput setaf 1)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  753.        ;;
  754.        5*)
  755.        echo -e "$(tput setaf 5)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  756.        ;;
  757.        *)
  758.        echo -e "$(tput setaf 7)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  759.        ;;
  760.    esac
  761. }
  762. ##############################################################################
  763. #
  764. # Print help for deletePet operation
  765. #
  766. ##############################################################################
  767. print_deletePet_help() {
  768.    echo ""
  769.    echo -e "$(tput bold)$(tput setaf 7)deletePet - Deletes a pet$(tput sgr0)"
  770.    echo -e ""
  771.    echo -e "" | fold -sw 80
  772.    echo -e ""
  773.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  774.    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/^/    /'
  775.    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/^/    /'
  776.    echo ""
  777.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  778.    case 400 in
  779.        1*)
  780.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  781.        ;;
  782.        2*)
  783.        echo -e "$(tput setaf 2)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  784.        ;;
  785.        3*)
  786.        echo -e "$(tput setaf 3)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  787.        ;;
  788.        4*)
  789.        echo -e "$(tput setaf 1)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  790.        ;;
  791.        5*)
  792.        echo -e "$(tput setaf 5)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  793.        ;;
  794.        *)
  795.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  796.        ;;
  797.    esac
  798.    case 404 in
  799.        1*)
  800.        echo -e "$(tput setaf 7)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  801.        ;;
  802.        2*)
  803.        echo -e "$(tput setaf 2)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  804.        ;;
  805.        3*)
  806.        echo -e "$(tput setaf 3)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  807.        ;;
  808.        4*)
  809.        echo -e "$(tput setaf 1)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  810.        ;;
  811.        5*)
  812.        echo -e "$(tput setaf 5)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  813.        ;;
  814.        *)
  815.        echo -e "$(tput setaf 7)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  816.        ;;
  817.    esac
  818. }
  819. ##############################################################################
  820. #
  821. # Print help for findPetsByStatus operation
  822. #
  823. ##############################################################################
  824. print_findPetsByStatus_help() {
  825.    echo ""
  826.    echo -e "$(tput bold)$(tput setaf 7)findPetsByStatus - Finds Pets by status$(tput sgr0)"
  827.    echo -e ""
  828.    echo -e "Multiple status values can be provided with comma separated strings" | fold -sw 80
  829.    echo -e ""
  830.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  831.    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 status=value2 status=...$(tput sgr0)" \
  832.        | fold -sw 80 | sed '2,$s/^/    /'
  833.    echo ""
  834.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  835.    case 200 in
  836.        1*)
  837.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  838.        ;;
  839.        2*)
  840.        echo -e "$(tput setaf 2)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  841.        ;;
  842.        3*)
  843.        echo -e "$(tput setaf 3)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  844.        ;;
  845.        4*)
  846.        echo -e "$(tput setaf 1)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  847.        ;;
  848.        5*)
  849.        echo -e "$(tput setaf 5)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  850.        ;;
  851.        *)
  852.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  853.        ;;
  854.    esac
  855.    case 400 in
  856.        1*)
  857.        echo -e "$(tput setaf 7)  400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  858.        ;;
  859.        2*)
  860.        echo -e "$(tput setaf 2)  400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  861.        ;;
  862.        3*)
  863.        echo -e "$(tput setaf 3)  400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  864.        ;;
  865.        4*)
  866.        echo -e "$(tput setaf 1)  400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  867.        ;;
  868.        5*)
  869.        echo -e "$(tput setaf 5)  400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  870.        ;;
  871.        *)
  872.        echo -e "$(tput setaf 7)  400;Invalid status value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  873.        ;;
  874.    esac
  875. }
  876. ##############################################################################
  877. #
  878. # Print help for findPetsByTags operation
  879. #
  880. ##############################################################################
  881. print_findPetsByTags_help() {
  882.    echo ""
  883.    echo -e "$(tput bold)$(tput setaf 7)findPetsByTags - Finds Pets by tags$(tput sgr0)"
  884.    echo -e ""
  885.    echo -e "Muliple tags can be provided with comma separated strings. Use         tag1, tag2, tag3 for testing." | fold -sw 80
  886.    echo -e ""
  887.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  888.    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 tags=value2 tags=...$(tput sgr0)" \
  889.        | fold -sw 80 | sed '2,$s/^/    /'
  890.    echo ""
  891.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  892.    case 200 in
  893.        1*)
  894.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  895.        ;;
  896.        2*)
  897.        echo -e "$(tput setaf 2)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  898.        ;;
  899.        3*)
  900.        echo -e "$(tput setaf 3)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  901.        ;;
  902.        4*)
  903.        echo -e "$(tput setaf 1)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  904.        ;;
  905.        5*)
  906.        echo -e "$(tput setaf 5)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  907.        ;;
  908.        *)
  909.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  910.        ;;
  911.    esac
  912.    case 400 in
  913.        1*)
  914.        echo -e "$(tput setaf 7)  400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  915.        ;;
  916.        2*)
  917.        echo -e "$(tput setaf 2)  400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  918.        ;;
  919.        3*)
  920.        echo -e "$(tput setaf 3)  400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  921.        ;;
  922.        4*)
  923.        echo -e "$(tput setaf 1)  400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  924.        ;;
  925.        5*)
  926.        echo -e "$(tput setaf 5)  400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  927.        ;;
  928.        *)
  929.        echo -e "$(tput setaf 7)  400;Invalid tag value$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  930.        ;;
  931.    esac
  932. }
  933. ##############################################################################
  934. #
  935. # Print help for getPetById operation
  936. #
  937. ##############################################################################
  938. print_getPetById_help() {
  939.    echo ""
  940.    echo -e "$(tput bold)$(tput setaf 7)getPetById - Find pet by ID$(tput sgr0)"
  941.    echo -e ""
  942.    echo -e "Returns a single pet" | fold -sw 80
  943.    echo -e ""
  944.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  945.    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/^/    /'
  946.    echo ""
  947.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  948.    case 200 in
  949.        1*)
  950.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  951.        ;;
  952.        2*)
  953.        echo -e "$(tput setaf 2)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  954.        ;;
  955.        3*)
  956.        echo -e "$(tput setaf 3)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  957.        ;;
  958.        4*)
  959.        echo -e "$(tput setaf 1)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  960.        ;;
  961.        5*)
  962.        echo -e "$(tput setaf 5)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  963.        ;;
  964.        *)
  965.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  966.        ;;
  967.    esac
  968.    case 400 in
  969.        1*)
  970.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  971.        ;;
  972.        2*)
  973.        echo -e "$(tput setaf 2)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  974.        ;;
  975.        3*)
  976.        echo -e "$(tput setaf 3)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  977.        ;;
  978.        4*)
  979.        echo -e "$(tput setaf 1)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  980.        ;;
  981.        5*)
  982.        echo -e "$(tput setaf 5)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  983.        ;;
  984.        *)
  985.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  986.        ;;
  987.    esac
  988.    case 404 in
  989.        1*)
  990.        echo -e "$(tput setaf 7)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  991.        ;;
  992.        2*)
  993.        echo -e "$(tput setaf 2)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  994.        ;;
  995.        3*)
  996.        echo -e "$(tput setaf 3)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  997.        ;;
  998.        4*)
  999.        echo -e "$(tput setaf 1)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1000.        ;;
  1001.        5*)
  1002.        echo -e "$(tput setaf 5)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1003.        ;;
  1004.        *)
  1005.        echo -e "$(tput setaf 7)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1006.        ;;
  1007.    esac
  1008. }
  1009. ##############################################################################
  1010. #
  1011. # Print help for updatePet operation
  1012. #
  1013. ##############################################################################
  1014. print_updatePet_help() {
  1015.    echo ""
  1016.    echo -e "$(tput bold)$(tput setaf 7)updatePet - Update an existing pet$(tput sgr0)"
  1017.    echo -e ""
  1018.    echo -e "" | fold -sw 80
  1019.    echo -e ""
  1020.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1021.    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/^/    /'
  1022.    echo -e ""
  1023.    echo ""
  1024.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1025.    case 400 in
  1026.        1*)
  1027.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1028.        ;;
  1029.        2*)
  1030.        echo -e "$(tput setaf 2)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1031.        ;;
  1032.        3*)
  1033.        echo -e "$(tput setaf 3)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1034.        ;;
  1035.        4*)
  1036.        echo -e "$(tput setaf 1)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1037.        ;;
  1038.        5*)
  1039.        echo -e "$(tput setaf 5)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1040.        ;;
  1041.        *)
  1042.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1043.        ;;
  1044.    esac
  1045.    case 404 in
  1046.        1*)
  1047.        echo -e "$(tput setaf 7)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1048.        ;;
  1049.        2*)
  1050.        echo -e "$(tput setaf 2)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1051.        ;;
  1052.        3*)
  1053.        echo -e "$(tput setaf 3)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1054.        ;;
  1055.        4*)
  1056.        echo -e "$(tput setaf 1)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1057.        ;;
  1058.        5*)
  1059.        echo -e "$(tput setaf 5)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1060.        ;;
  1061.        *)
  1062.        echo -e "$(tput setaf 7)  404;Pet not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1063.        ;;
  1064.    esac
  1065.    case 405 in
  1066.        1*)
  1067.        echo -e "$(tput setaf 7)  405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1068.        ;;
  1069.        2*)
  1070.        echo -e "$(tput setaf 2)  405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1071.        ;;
  1072.        3*)
  1073.        echo -e "$(tput setaf 3)  405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1074.        ;;
  1075.        4*)
  1076.        echo -e "$(tput setaf 1)  405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1077.        ;;
  1078.        5*)
  1079.        echo -e "$(tput setaf 5)  405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1080.        ;;
  1081.        *)
  1082.        echo -e "$(tput setaf 7)  405;Validation exception$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1083.        ;;
  1084.    esac
  1085. }
  1086. ##############################################################################
  1087. #
  1088. # Print help for updatePetWithForm operation
  1089. #
  1090. ##############################################################################
  1091. print_updatePetWithForm_help() {
  1092.    echo ""
  1093.    echo -e "$(tput bold)$(tput setaf 7)updatePetWithForm - Updates a pet in the store with form data$(tput sgr0)"
  1094.    echo -e ""
  1095.    echo -e "" | fold -sw 80
  1096.    echo -e ""
  1097.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1098.    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/^/    /'
  1099.    echo ""
  1100.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1101.    case 405 in
  1102.        1*)
  1103.        echo -e "$(tput setaf 7)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1104.        ;;
  1105.        2*)
  1106.        echo -e "$(tput setaf 2)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1107.        ;;
  1108.        3*)
  1109.        echo -e "$(tput setaf 3)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1110.        ;;
  1111.        4*)
  1112.        echo -e "$(tput setaf 1)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1113.        ;;
  1114.        5*)
  1115.        echo -e "$(tput setaf 5)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1116.        ;;
  1117.        *)
  1118.        echo -e "$(tput setaf 7)  405;Invalid input$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1119.        ;;
  1120.    esac
  1121. }
  1122. ##############################################################################
  1123. #
  1124. # Print help for uploadFile operation
  1125. #
  1126. ##############################################################################
  1127. print_uploadFile_help() {
  1128.    echo ""
  1129.    echo -e "$(tput bold)$(tput setaf 7)uploadFile - uploads an image$(tput sgr0)"
  1130.    echo -e ""
  1131.    echo -e "" | fold -sw 80
  1132.    echo -e ""
  1133.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1134.    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/^/    /'
  1135.    echo ""
  1136.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1137.    case 200 in
  1138.        1*)
  1139.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1140.        ;;
  1141.        2*)
  1142.        echo -e "$(tput setaf 2)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1143.        ;;
  1144.        3*)
  1145.        echo -e "$(tput setaf 3)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1146.        ;;
  1147.        4*)
  1148.        echo -e "$(tput setaf 1)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1149.        ;;
  1150.        5*)
  1151.        echo -e "$(tput setaf 5)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1152.        ;;
  1153.        *)
  1154.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1155.        ;;
  1156.    esac
  1157. }
  1158. ##############################################################################
  1159. #
  1160. # Print help for deleteOrder operation
  1161. #
  1162. ##############################################################################
  1163. print_deleteOrder_help() {
  1164.    echo ""
  1165.    echo -e "$(tput bold)$(tput setaf 7)deleteOrder - Delete purchase order by ID$(tput sgr0)"
  1166.    echo -e ""
  1167.    echo -e "For valid response try integer IDs with positive integer value.         Negative or non-integer values will generate API errors" | fold -sw 80
  1168.    echo -e ""
  1169.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1170.    echo -e "  * $(tput setaf 2)orderId$(tput sgr0) $(tput setaf 4)[Integer]$(tput sgr0) $(tput setaf 1)(required)$(tput sgr0)$(tput sgr0) - ID of the order that needs to be deleted $(tput setaf 3)Specify as: orderId=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/    /'
  1171.    echo ""
  1172.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1173.    case 400 in
  1174.        1*)
  1175.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1176.        ;;
  1177.        2*)
  1178.        echo -e "$(tput setaf 2)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1179.        ;;
  1180.        3*)
  1181.        echo -e "$(tput setaf 3)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1182.        ;;
  1183.        4*)
  1184.        echo -e "$(tput setaf 1)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1185.        ;;
  1186.        5*)
  1187.        echo -e "$(tput setaf 5)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1188.        ;;
  1189.        *)
  1190.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1191.        ;;
  1192.    esac
  1193.    case 404 in
  1194.        1*)
  1195.        echo -e "$(tput setaf 7)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1196.        ;;
  1197.        2*)
  1198.        echo -e "$(tput setaf 2)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1199.        ;;
  1200.        3*)
  1201.        echo -e "$(tput setaf 3)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1202.        ;;
  1203.        4*)
  1204.        echo -e "$(tput setaf 1)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1205.        ;;
  1206.        5*)
  1207.        echo -e "$(tput setaf 5)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1208.        ;;
  1209.        *)
  1210.        echo -e "$(tput setaf 7)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1211.        ;;
  1212.    esac
  1213. }
  1214. ##############################################################################
  1215. #
  1216. # Print help for getInventory operation
  1217. #
  1218. ##############################################################################
  1219. print_getInventory_help() {
  1220.    echo ""
  1221.    echo -e "$(tput bold)$(tput setaf 7)getInventory - Returns pet inventories by status$(tput sgr0)"
  1222.    echo -e ""
  1223.    echo -e "Returns a map of status codes to quantities" | fold -sw 80
  1224.    echo -e ""
  1225.    echo ""
  1226.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1227.    case 200 in
  1228.        1*)
  1229.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1230.        ;;
  1231.        2*)
  1232.        echo -e "$(tput setaf 2)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1233.        ;;
  1234.        3*)
  1235.        echo -e "$(tput setaf 3)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1236.        ;;
  1237.        4*)
  1238.        echo -e "$(tput setaf 1)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1239.        ;;
  1240.        5*)
  1241.        echo -e "$(tput setaf 5)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1242.        ;;
  1243.        *)
  1244.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1245.        ;;
  1246.    esac
  1247. }
  1248. ##############################################################################
  1249. #
  1250. # Print help for getOrderById operation
  1251. #
  1252. ##############################################################################
  1253. print_getOrderById_help() {
  1254.    echo ""
  1255.    echo -e "$(tput bold)$(tput setaf 7)getOrderById - Find purchase order by ID$(tput sgr0)"
  1256.    echo -e ""
  1257.    echo -e "For valid response try integer IDs with value >= 1 and <= 10.         Other values will generated exceptions" | fold -sw 80
  1258.    echo -e ""
  1259.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1260.    echo -e "  * $(tput setaf 2)orderId$(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: orderId=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/    /'
  1261.    echo ""
  1262.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1263.    case 200 in
  1264.        1*)
  1265.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1266.        ;;
  1267.        2*)
  1268.        echo -e "$(tput setaf 2)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1269.        ;;
  1270.        3*)
  1271.        echo -e "$(tput setaf 3)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1272.        ;;
  1273.        4*)
  1274.        echo -e "$(tput setaf 1)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1275.        ;;
  1276.        5*)
  1277.        echo -e "$(tput setaf 5)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1278.        ;;
  1279.        *)
  1280.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1281.        ;;
  1282.    esac
  1283.    case 400 in
  1284.        1*)
  1285.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1286.        ;;
  1287.        2*)
  1288.        echo -e "$(tput setaf 2)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1289.        ;;
  1290.        3*)
  1291.        echo -e "$(tput setaf 3)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1292.        ;;
  1293.        4*)
  1294.        echo -e "$(tput setaf 1)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1295.        ;;
  1296.        5*)
  1297.        echo -e "$(tput setaf 5)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1298.        ;;
  1299.        *)
  1300.        echo -e "$(tput setaf 7)  400;Invalid ID supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1301.        ;;
  1302.    esac
  1303.    case 404 in
  1304.        1*)
  1305.        echo -e "$(tput setaf 7)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1306.        ;;
  1307.        2*)
  1308.        echo -e "$(tput setaf 2)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1309.        ;;
  1310.        3*)
  1311.        echo -e "$(tput setaf 3)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1312.        ;;
  1313.        4*)
  1314.        echo -e "$(tput setaf 1)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1315.        ;;
  1316.        5*)
  1317.        echo -e "$(tput setaf 5)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1318.        ;;
  1319.        *)
  1320.        echo -e "$(tput setaf 7)  404;Order not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1321.        ;;
  1322.    esac
  1323. }
  1324. ##############################################################################
  1325. #
  1326. # Print help for placeOrder operation
  1327. #
  1328. ##############################################################################
  1329. print_placeOrder_help() {
  1330.    echo ""
  1331.    echo -e "$(tput bold)$(tput setaf 7)placeOrder - Place an order for a pet$(tput sgr0)"
  1332.    echo -e ""
  1333.    echo -e "" | fold -sw 80
  1334.    echo -e ""
  1335.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1336.    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/^/    /'
  1337.    echo -e ""
  1338.    echo ""
  1339.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1340.    case 200 in
  1341.        1*)
  1342.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1343.        ;;
  1344.        2*)
  1345.        echo -e "$(tput setaf 2)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1346.        ;;
  1347.        3*)
  1348.        echo -e "$(tput setaf 3)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1349.        ;;
  1350.        4*)
  1351.        echo -e "$(tput setaf 1)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1352.        ;;
  1353.        5*)
  1354.        echo -e "$(tput setaf 5)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1355.        ;;
  1356.        *)
  1357.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1358.        ;;
  1359.    esac
  1360.    case 400 in
  1361.        1*)
  1362.        echo -e "$(tput setaf 7)  400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1363.        ;;
  1364.        2*)
  1365.        echo -e "$(tput setaf 2)  400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1366.        ;;
  1367.        3*)
  1368.        echo -e "$(tput setaf 3)  400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1369.        ;;
  1370.        4*)
  1371.        echo -e "$(tput setaf 1)  400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1372.        ;;
  1373.        5*)
  1374.        echo -e "$(tput setaf 5)  400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1375.        ;;
  1376.        *)
  1377.        echo -e "$(tput setaf 7)  400;Invalid Order$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1378.        ;;
  1379.    esac
  1380. }
  1381. ##############################################################################
  1382. #
  1383. # Print help for createUser operation
  1384. #
  1385. ##############################################################################
  1386. print_createUser_help() {
  1387.    echo ""
  1388.    echo -e "$(tput bold)$(tput setaf 7)createUser - Create user$(tput sgr0)"
  1389.    echo -e ""
  1390.    echo -e "This can only be done by the logged in user." | fold -sw 80
  1391.    echo -e ""
  1392.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1393.    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/^/    /'
  1394.    echo -e ""
  1395.    echo ""
  1396.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1397.    case 0 in
  1398.        1*)
  1399.        echo -e "$(tput setaf 7)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1400.        ;;
  1401.        2*)
  1402.        echo -e "$(tput setaf 2)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1403.        ;;
  1404.        3*)
  1405.        echo -e "$(tput setaf 3)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1406.        ;;
  1407.        4*)
  1408.        echo -e "$(tput setaf 1)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1409.        ;;
  1410.        5*)
  1411.        echo -e "$(tput setaf 5)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1412.        ;;
  1413.        *)
  1414.        echo -e "$(tput setaf 7)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1415.        ;;
  1416.    esac
  1417. }
  1418. ##############################################################################
  1419. #
  1420. # Print help for createUsersWithArrayInput operation
  1421. #
  1422. ##############################################################################
  1423. print_createUsersWithArrayInput_help() {
  1424.    echo ""
  1425.    echo -e "$(tput bold)$(tput setaf 7)createUsersWithArrayInput - Creates list of users with given input array$(tput sgr0)"
  1426.    echo -e ""
  1427.    echo -e "" | fold -sw 80
  1428.    echo -e ""
  1429.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1430.    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/^/    /'
  1431.    echo -e ""
  1432.    echo ""
  1433.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1434.    case 0 in
  1435.        1*)
  1436.        echo -e "$(tput setaf 7)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1437.        ;;
  1438.        2*)
  1439.        echo -e "$(tput setaf 2)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1440.        ;;
  1441.        3*)
  1442.        echo -e "$(tput setaf 3)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1443.        ;;
  1444.        4*)
  1445.        echo -e "$(tput setaf 1)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1446.        ;;
  1447.        5*)
  1448.        echo -e "$(tput setaf 5)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1449.        ;;
  1450.        *)
  1451.        echo -e "$(tput setaf 7)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1452.        ;;
  1453.    esac
  1454. }
  1455. ##############################################################################
  1456. #
  1457. # Print help for createUsersWithListInput operation
  1458. #
  1459. ##############################################################################
  1460. print_createUsersWithListInput_help() {
  1461.    echo ""
  1462.    echo -e "$(tput bold)$(tput setaf 7)createUsersWithListInput - Creates list of users with given input array$(tput sgr0)"
  1463.    echo -e ""
  1464.    echo -e "" | fold -sw 80
  1465.    echo -e ""
  1466.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1467.    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/^/    /'
  1468.    echo -e ""
  1469.    echo ""
  1470.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1471.    case 0 in
  1472.        1*)
  1473.        echo -e "$(tput setaf 7)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1474.        ;;
  1475.        2*)
  1476.        echo -e "$(tput setaf 2)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1477.        ;;
  1478.        3*)
  1479.        echo -e "$(tput setaf 3)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1480.        ;;
  1481.        4*)
  1482.        echo -e "$(tput setaf 1)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1483.        ;;
  1484.        5*)
  1485.        echo -e "$(tput setaf 5)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1486.        ;;
  1487.        *)
  1488.        echo -e "$(tput setaf 7)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1489.        ;;
  1490.    esac
  1491. }
  1492. ##############################################################################
  1493. #
  1494. # Print help for deleteUser operation
  1495. #
  1496. ##############################################################################
  1497. print_deleteUser_help() {
  1498.    echo ""
  1499.    echo -e "$(tput bold)$(tput setaf 7)deleteUser - Delete user$(tput sgr0)"
  1500.    echo -e ""
  1501.    echo -e "This can only be done by the logged in user." | fold -sw 80
  1502.    echo -e ""
  1503.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1504.    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/^/    /'
  1505.    echo ""
  1506.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1507.    case 400 in
  1508.        1*)
  1509.        echo -e "$(tput setaf 7)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1510.        ;;
  1511.        2*)
  1512.        echo -e "$(tput setaf 2)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1513.        ;;
  1514.        3*)
  1515.        echo -e "$(tput setaf 3)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1516.        ;;
  1517.        4*)
  1518.        echo -e "$(tput setaf 1)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1519.        ;;
  1520.        5*)
  1521.        echo -e "$(tput setaf 5)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1522.        ;;
  1523.        *)
  1524.        echo -e "$(tput setaf 7)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1525.        ;;
  1526.    esac
  1527.    case 404 in
  1528.        1*)
  1529.        echo -e "$(tput setaf 7)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1530.        ;;
  1531.        2*)
  1532.        echo -e "$(tput setaf 2)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1533.        ;;
  1534.        3*)
  1535.        echo -e "$(tput setaf 3)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1536.        ;;
  1537.        4*)
  1538.        echo -e "$(tput setaf 1)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1539.        ;;
  1540.        5*)
  1541.        echo -e "$(tput setaf 5)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1542.        ;;
  1543.        *)
  1544.        echo -e "$(tput setaf 7)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1545.        ;;
  1546.    esac
  1547. }
  1548. ##############################################################################
  1549. #
  1550. # Print help for getUserByName operation
  1551. #
  1552. ##############################################################################
  1553. print_getUserByName_help() {
  1554.    echo ""
  1555.    echo -e "$(tput bold)$(tput setaf 7)getUserByName - Get user by user name$(tput sgr0)"
  1556.    echo -e ""
  1557.    echo -e "" | fold -sw 80
  1558.    echo -e ""
  1559.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1560.    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/^/    /'
  1561.    echo ""
  1562.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1563.    case 200 in
  1564.        1*)
  1565.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1566.        ;;
  1567.        2*)
  1568.        echo -e "$(tput setaf 2)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1569.        ;;
  1570.        3*)
  1571.        echo -e "$(tput setaf 3)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1572.        ;;
  1573.        4*)
  1574.        echo -e "$(tput setaf 1)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1575.        ;;
  1576.        5*)
  1577.        echo -e "$(tput setaf 5)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1578.        ;;
  1579.        *)
  1580.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1581.        ;;
  1582.    esac
  1583.    case 400 in
  1584.        1*)
  1585.        echo -e "$(tput setaf 7)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1586.        ;;
  1587.        2*)
  1588.        echo -e "$(tput setaf 2)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1589.        ;;
  1590.        3*)
  1591.        echo -e "$(tput setaf 3)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1592.        ;;
  1593.        4*)
  1594.        echo -e "$(tput setaf 1)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1595.        ;;
  1596.        5*)
  1597.        echo -e "$(tput setaf 5)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1598.        ;;
  1599.        *)
  1600.        echo -e "$(tput setaf 7)  400;Invalid username supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1601.        ;;
  1602.    esac
  1603.    case 404 in
  1604.        1*)
  1605.        echo -e "$(tput setaf 7)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1606.        ;;
  1607.        2*)
  1608.        echo -e "$(tput setaf 2)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1609.        ;;
  1610.        3*)
  1611.        echo -e "$(tput setaf 3)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1612.        ;;
  1613.        4*)
  1614.        echo -e "$(tput setaf 1)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1615.        ;;
  1616.        5*)
  1617.        echo -e "$(tput setaf 5)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1618.        ;;
  1619.        *)
  1620.        echo -e "$(tput setaf 7)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1621.        ;;
  1622.    esac
  1623. }
  1624. ##############################################################################
  1625. #
  1626. # Print help for loginUser operation
  1627. #
  1628. ##############################################################################
  1629. print_loginUser_help() {
  1630.    echo ""
  1631.    echo -e "$(tput bold)$(tput setaf 7)loginUser - Logs user into the system$(tput sgr0)"
  1632.    echo -e ""
  1633.    echo -e "" | fold -sw 80
  1634.    echo -e ""
  1635.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1636.    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)" \
  1637.        | fold -sw 80 | sed '2,$s/^/    /'
  1638.    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)" \
  1639.        | fold -sw 80 | sed '2,$s/^/    /'
  1640.    echo ""
  1641.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1642.    case 200 in
  1643.        1*)
  1644.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1645.        ;;
  1646.        2*)
  1647.        echo -e "$(tput setaf 2)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1648.        ;;
  1649.        3*)
  1650.        echo -e "$(tput setaf 3)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1651.        ;;
  1652.        4*)
  1653.        echo -e "$(tput setaf 1)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1654.        ;;
  1655.        5*)
  1656.        echo -e "$(tput setaf 5)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1657.        ;;
  1658.        *)
  1659.        echo -e "$(tput setaf 7)  200;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1660.        ;;
  1661.    esac
  1662.        echo -e "       $(tput bold)$(tput setaf 7)Response headers$(tput sgr0)"
  1663.        echo -e "       $(tput setaf 4)X-Rate-Limit$(tput sgr0) - calls per hour allowed by the user" | fold -sw 80 | sed '2,$s/^/        /'
  1664.        echo -e "       $(tput setaf 4)X-Expires-After$(tput sgr0) - date in UTC when token expires" | fold -sw 80 | sed '2,$s/^/        /'
  1665.    case 400 in
  1666.        1*)
  1667.        echo -e "$(tput setaf 7)  400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1668.        ;;
  1669.        2*)
  1670.        echo -e "$(tput setaf 2)  400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1671.        ;;
  1672.        3*)
  1673.        echo -e "$(tput setaf 3)  400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1674.        ;;
  1675.        4*)
  1676.        echo -e "$(tput setaf 1)  400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1677.        ;;
  1678.        5*)
  1679.        echo -e "$(tput setaf 5)  400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1680.        ;;
  1681.        *)
  1682.        echo -e "$(tput setaf 7)  400;Invalid username/password supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1683.        ;;
  1684.    esac
  1685. }
  1686. ##############################################################################
  1687. #
  1688. # Print help for logoutUser operation
  1689. #
  1690. ##############################################################################
  1691. print_logoutUser_help() {
  1692.    echo ""
  1693.    echo -e "$(tput bold)$(tput setaf 7)logoutUser - Logs out current logged in user session$(tput sgr0)"
  1694.    echo -e ""
  1695.    echo -e "" | fold -sw 80
  1696.    echo -e ""
  1697.    echo ""
  1698.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1699.    case 0 in
  1700.        1*)
  1701.        echo -e "$(tput setaf 7)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1702.        ;;
  1703.        2*)
  1704.        echo -e "$(tput setaf 2)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1705.        ;;
  1706.        3*)
  1707.        echo -e "$(tput setaf 3)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1708.        ;;
  1709.        4*)
  1710.        echo -e "$(tput setaf 1)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1711.        ;;
  1712.        5*)
  1713.        echo -e "$(tput setaf 5)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1714.        ;;
  1715.        *)
  1716.        echo -e "$(tput setaf 7)  0;successful operation$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1717.        ;;
  1718.    esac
  1719. }
  1720. ##############################################################################
  1721. #
  1722. # Print help for updateUser operation
  1723. #
  1724. ##############################################################################
  1725. print_updateUser_help() {
  1726.    echo ""
  1727.    echo -e "$(tput bold)$(tput setaf 7)updateUser - Updated user$(tput sgr0)"
  1728.    echo -e ""
  1729.    echo -e "This can only be done by the logged in user." | fold -sw 80
  1730.    echo -e ""
  1731.    echo -e "$(tput bold)$(tput setaf 7)Parameters$(tput sgr0)"
  1732.    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 updated $(tput setaf 3)Specify as: username=value$(tput sgr0)" | fold -sw 80 | sed '2,$s/^/    /'
  1733.    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/^/    /'
  1734.    echo -e ""
  1735.    echo ""
  1736.    echo -e "$(tput bold)$(tput setaf 7)Responses$(tput sgr0)"
  1737.    case 400 in
  1738.        1*)
  1739.        echo -e "$(tput setaf 7)  400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1740.        ;;
  1741.        2*)
  1742.        echo -e "$(tput setaf 2)  400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1743.        ;;
  1744.        3*)
  1745.        echo -e "$(tput setaf 3)  400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1746.        ;;
  1747.        4*)
  1748.        echo -e "$(tput setaf 1)  400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1749.        ;;
  1750.        5*)
  1751.        echo -e "$(tput setaf 5)  400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1752.        ;;
  1753.        *)
  1754.        echo -e "$(tput setaf 7)  400;Invalid user supplied$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1755.        ;;
  1756.    esac
  1757.    case 404 in
  1758.        1*)
  1759.        echo -e "$(tput setaf 7)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1760.        ;;
  1761.        2*)
  1762.        echo -e "$(tput setaf 2)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1763.        ;;
  1764.        3*)
  1765.        echo -e "$(tput setaf 3)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1766.        ;;
  1767.        4*)
  1768.        echo -e "$(tput setaf 1)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1769.        ;;
  1770.        5*)
  1771.        echo -e "$(tput setaf 5)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1772.        ;;
  1773.        *)
  1774.        echo -e "$(tput setaf 7)  404;User not found$(tput sgr0)" | column -t -s ';' | fold -sw 80 | sed '2,$s/^/       /'
  1775.        ;;
  1776.    esac
  1777. }
  1778.  
  1779.  
  1780. ##############################################################################
  1781. #
  1782. # Call addPet operation
  1783. #
  1784. ##############################################################################
  1785. call_addPet() {
  1786.    local path_parameter_names=()
  1787.    local query_parameter_names=()
  1788.  
  1789.    if [[ $force = false ]]; then
  1790.        validate_request_parameters "/v2/pet" path_parameter_names query_parameter_names
  1791.    fi
  1792.  
  1793.    local path=$(build_request_path "/v2/pet" path_parameter_names query_parameter_names)
  1794.    local method="POST"
  1795.    local headers_curl=$(header_arguments_to_curl)
  1796.    if [[ -n $header_accept ]]; then
  1797.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  1798.    fi
  1799.  
  1800.    local basic_auth_option=""
  1801.    if [[ -n $basic_auth_credential ]]; then
  1802.        basic_auth_option="-u ${basic_auth_credential}"
  1803.    fi
  1804.    local body_json_curl=""
  1805.  
  1806.    #
  1807.    # Check if the user provided 'Content-type' headers in the
  1808.    # command line. If not try to set them based on the Swagger specification
  1809.    # if values produces and consumes are defined unambigously
  1810.    #
  1811.  
  1812.  
  1813.    if [[ -z $header_content_type && "$force" = false ]]; then
  1814.        :
  1815.        echo "Error: Request's content-type not specified!!!"
  1816.        echo "This operation expects content-type in one of the following formats:"
  1817.        echo -e "\t- application/json"
  1818.        echo -e "\t- application/xml"
  1819.        echo ""
  1820.        echo "Use '--content-type' to set proper content type"
  1821.        exit 1
  1822.    else
  1823.        headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
  1824.    fi
  1825.  
  1826.  
  1827.    #
  1828.    # If we have received some body content over pipe, pass it from the
  1829.    # temporary file to cURL
  1830.    #
  1831.    if [[ -n $body_content_temp_file ]]; then
  1832.        if [[ "$print_curl" = true ]]; then
  1833.            echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  1834.        else
  1835.            eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  1836.        fi
  1837.        rm "${body_content_temp_file}"
  1838.    #
  1839.    # If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
  1840.    #
  1841.    else
  1842.        body_json_curl=$(body_parameters_to_json)
  1843.        if [[ "$print_curl" = true ]]; then
  1844.            echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  1845.        else
  1846.            eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  1847.        fi
  1848.    fi
  1849. }
  1850.  
  1851. ##############################################################################
  1852. #
  1853. # Call deletePet operation
  1854. #
  1855. ##############################################################################
  1856. call_deletePet() {
  1857.    local path_parameter_names=(petId)
  1858.    local query_parameter_names=()
  1859.  
  1860.    if [[ $force = false ]]; then
  1861.        validate_request_parameters "/v2/pet/{petId}" path_parameter_names query_parameter_names
  1862.    fi
  1863.  
  1864.    local path=$(build_request_path "/v2/pet/{petId}" path_parameter_names query_parameter_names)
  1865.    local method="DELETE"
  1866.    local headers_curl=$(header_arguments_to_curl)
  1867.    if [[ -n $header_accept ]]; then
  1868.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  1869.    fi
  1870.  
  1871.    local basic_auth_option=""
  1872.    if [[ -n $basic_auth_credential ]]; then
  1873.        basic_auth_option="-u ${basic_auth_credential}"
  1874.    fi
  1875.    if [[ "$print_curl" = true ]]; then
  1876.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  1877.    else
  1878.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  1879.    fi
  1880. }
  1881.  
  1882. ##############################################################################
  1883. #
  1884. # Call findPetsByStatus operation
  1885. #
  1886. ##############################################################################
  1887. call_findPetsByStatus() {
  1888.    local path_parameter_names=()
  1889.    local query_parameter_names=(status)
  1890.  
  1891.    if [[ $force = false ]]; then
  1892.        validate_request_parameters "/v2/pet/findByStatus" path_parameter_names query_parameter_names
  1893.    fi
  1894.  
  1895.    local path=$(build_request_path "/v2/pet/findByStatus" path_parameter_names query_parameter_names)
  1896.    local method="GET"
  1897.    local headers_curl=$(header_arguments_to_curl)
  1898.    if [[ -n $header_accept ]]; then
  1899.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  1900.    fi
  1901.  
  1902.    local basic_auth_option=""
  1903.    if [[ -n $basic_auth_credential ]]; then
  1904.        basic_auth_option="-u ${basic_auth_credential}"
  1905.    fi
  1906.    if [[ "$print_curl" = true ]]; then
  1907.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  1908.    else
  1909.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  1910.    fi
  1911. }
  1912.  
  1913. ##############################################################################
  1914. #
  1915. # Call findPetsByTags operation
  1916. #
  1917. ##############################################################################
  1918. call_findPetsByTags() {
  1919.    local path_parameter_names=()
  1920.    local query_parameter_names=(tags)
  1921.  
  1922.    if [[ $force = false ]]; then
  1923.        validate_request_parameters "/v2/pet/findByTags" path_parameter_names query_parameter_names
  1924.    fi
  1925.  
  1926.    local path=$(build_request_path "/v2/pet/findByTags" path_parameter_names query_parameter_names)
  1927.    local method="GET"
  1928.    local headers_curl=$(header_arguments_to_curl)
  1929.    if [[ -n $header_accept ]]; then
  1930.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  1931.    fi
  1932.  
  1933.    local basic_auth_option=""
  1934.    if [[ -n $basic_auth_credential ]]; then
  1935.        basic_auth_option="-u ${basic_auth_credential}"
  1936.    fi
  1937.    if [[ "$print_curl" = true ]]; then
  1938.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  1939.    else
  1940.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  1941.    fi
  1942. }
  1943.  
  1944. ##############################################################################
  1945. #
  1946. # Call getPetById operation
  1947. #
  1948. ##############################################################################
  1949. call_getPetById() {
  1950.    local path_parameter_names=(petId)
  1951.    local query_parameter_names=()
  1952.  
  1953.    if [[ $force = false ]]; then
  1954.        validate_request_parameters "/v2/pet/{petId}" path_parameter_names query_parameter_names
  1955.    fi
  1956.  
  1957.    local path=$(build_request_path "/v2/pet/{petId}" path_parameter_names query_parameter_names)
  1958.    local method="GET"
  1959.    local headers_curl=$(header_arguments_to_curl)
  1960.    if [[ -n $header_accept ]]; then
  1961.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  1962.    fi
  1963.  
  1964.    local basic_auth_option=""
  1965.    if [[ -n $basic_auth_credential ]]; then
  1966.        basic_auth_option="-u ${basic_auth_credential}"
  1967.    fi
  1968.    if [[ "$print_curl" = true ]]; then
  1969.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  1970.    else
  1971.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  1972.    fi
  1973. }
  1974.  
  1975. ##############################################################################
  1976. #
  1977. # Call updatePet operation
  1978. #
  1979. ##############################################################################
  1980. call_updatePet() {
  1981.    local path_parameter_names=()
  1982.    local query_parameter_names=()
  1983.  
  1984.    if [[ $force = false ]]; then
  1985.        validate_request_parameters "/v2/pet" path_parameter_names query_parameter_names
  1986.    fi
  1987.  
  1988.    local path=$(build_request_path "/v2/pet" path_parameter_names query_parameter_names)
  1989.    local method="PUT"
  1990.    local headers_curl=$(header_arguments_to_curl)
  1991.    if [[ -n $header_accept ]]; then
  1992.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  1993.    fi
  1994.  
  1995.    local basic_auth_option=""
  1996.    if [[ -n $basic_auth_credential ]]; then
  1997.        basic_auth_option="-u ${basic_auth_credential}"
  1998.    fi
  1999.    local body_json_curl=""
  2000.  
  2001.    #
  2002.    # Check if the user provided 'Content-type' headers in the
  2003.    # command line. If not try to set them based on the Swagger specification
  2004.    # if values produces and consumes are defined unambigously
  2005.    #
  2006.  
  2007.  
  2008.    if [[ -z $header_content_type && "$force" = false ]]; then
  2009.        :
  2010.        echo "Error: Request's content-type not specified!!!"
  2011.        echo "This operation expects content-type in one of the following formats:"
  2012.        echo -e "\t- application/json"
  2013.        echo -e "\t- application/xml"
  2014.        echo ""
  2015.        echo "Use '--content-type' to set proper content type"
  2016.        exit 1
  2017.    else
  2018.        headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
  2019.    fi
  2020.  
  2021.  
  2022.    #
  2023.    # If we have received some body content over pipe, pass it from the
  2024.    # temporary file to cURL
  2025.    #
  2026.    if [[ -n $body_content_temp_file ]]; then
  2027.        if [[ "$print_curl" = true ]]; then
  2028.            echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2029.        else
  2030.            eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2031.        fi
  2032.        rm "${body_content_temp_file}"
  2033.    #
  2034.    # If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
  2035.    #
  2036.    else
  2037.        body_json_curl=$(body_parameters_to_json)
  2038.        if [[ "$print_curl" = true ]]; then
  2039.            echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2040.        else
  2041.            eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2042.        fi
  2043.    fi
  2044. }
  2045.  
  2046. ##############################################################################
  2047. #
  2048. # Call updatePetWithForm operation
  2049. #
  2050. ##############################################################################
  2051. call_updatePetWithForm() {
  2052.    local path_parameter_names=(petId)
  2053.    local query_parameter_names=()
  2054.  
  2055.    if [[ $force = false ]]; then
  2056.        validate_request_parameters "/v2/pet/{petId}" path_parameter_names query_parameter_names
  2057.    fi
  2058.  
  2059.    local path=$(build_request_path "/v2/pet/{petId}" path_parameter_names query_parameter_names)
  2060.    local method="POST"
  2061.    local headers_curl=$(header_arguments_to_curl)
  2062.    if [[ -n $header_accept ]]; then
  2063.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2064.    fi
  2065.  
  2066.    local basic_auth_option=""
  2067.    if [[ -n $basic_auth_credential ]]; then
  2068.        basic_auth_option="-u ${basic_auth_credential}"
  2069.    fi
  2070.    if [[ "$print_curl" = true ]]; then
  2071.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2072.    else
  2073.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2074.    fi
  2075. }
  2076.  
  2077. ##############################################################################
  2078. #
  2079. # Call uploadFile operation
  2080. #
  2081. ##############################################################################
  2082. call_uploadFile() {
  2083.    local path_parameter_names=(petId)
  2084.    local query_parameter_names=()
  2085.  
  2086.    if [[ $force = false ]]; then
  2087.        validate_request_parameters "/v2/pet/{petId}/uploadImage" path_parameter_names query_parameter_names
  2088.    fi
  2089.  
  2090.    local path=$(build_request_path "/v2/pet/{petId}/uploadImage" path_parameter_names query_parameter_names)
  2091.    local method="POST"
  2092.    local headers_curl=$(header_arguments_to_curl)
  2093.    if [[ -n $header_accept ]]; then
  2094.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2095.    fi
  2096.  
  2097.    local basic_auth_option=""
  2098.    if [[ -n $basic_auth_credential ]]; then
  2099.        basic_auth_option="-u ${basic_auth_credential}"
  2100.    fi
  2101.    if [[ "$print_curl" = true ]]; then
  2102.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2103.    else
  2104.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2105.    fi
  2106. }
  2107.  
  2108. ##############################################################################
  2109. #
  2110. # Call deleteOrder operation
  2111. #
  2112. ##############################################################################
  2113. call_deleteOrder() {
  2114.    local path_parameter_names=(orderId)
  2115.    local query_parameter_names=()
  2116.  
  2117.    if [[ $force = false ]]; then
  2118.        validate_request_parameters "/v2/store/order/{orderId}" path_parameter_names query_parameter_names
  2119.    fi
  2120.  
  2121.    local path=$(build_request_path "/v2/store/order/{orderId}" path_parameter_names query_parameter_names)
  2122.    local method="DELETE"
  2123.    local headers_curl=$(header_arguments_to_curl)
  2124.    if [[ -n $header_accept ]]; then
  2125.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2126.    fi
  2127.  
  2128.    local basic_auth_option=""
  2129.    if [[ -n $basic_auth_credential ]]; then
  2130.        basic_auth_option="-u ${basic_auth_credential}"
  2131.    fi
  2132.    if [[ "$print_curl" = true ]]; then
  2133.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2134.    else
  2135.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2136.    fi
  2137. }
  2138.  
  2139. ##############################################################################
  2140. #
  2141. # Call getInventory operation
  2142. #
  2143. ##############################################################################
  2144. call_getInventory() {
  2145.    local path_parameter_names=()
  2146.    local query_parameter_names=()
  2147.  
  2148.    if [[ $force = false ]]; then
  2149.        validate_request_parameters "/v2/store/inventory" path_parameter_names query_parameter_names
  2150.    fi
  2151.  
  2152.    local path=$(build_request_path "/v2/store/inventory" path_parameter_names query_parameter_names)
  2153.    local method="GET"
  2154.    local headers_curl=$(header_arguments_to_curl)
  2155.    if [[ -n $header_accept ]]; then
  2156.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2157.    fi
  2158.  
  2159.    local basic_auth_option=""
  2160.    if [[ -n $basic_auth_credential ]]; then
  2161.        basic_auth_option="-u ${basic_auth_credential}"
  2162.    fi
  2163.    if [[ "$print_curl" = true ]]; then
  2164.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2165.    else
  2166.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2167.    fi
  2168. }
  2169.  
  2170. ##############################################################################
  2171. #
  2172. # Call getOrderById operation
  2173. #
  2174. ##############################################################################
  2175. call_getOrderById() {
  2176.    local path_parameter_names=(orderId)
  2177.    local query_parameter_names=()
  2178.  
  2179.    if [[ $force = false ]]; then
  2180.        validate_request_parameters "/v2/store/order/{orderId}" path_parameter_names query_parameter_names
  2181.    fi
  2182.  
  2183.    local path=$(build_request_path "/v2/store/order/{orderId}" path_parameter_names query_parameter_names)
  2184.    local method="GET"
  2185.    local headers_curl=$(header_arguments_to_curl)
  2186.    if [[ -n $header_accept ]]; then
  2187.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2188.    fi
  2189.  
  2190.    local basic_auth_option=""
  2191.    if [[ -n $basic_auth_credential ]]; then
  2192.        basic_auth_option="-u ${basic_auth_credential}"
  2193.    fi
  2194.    if [[ "$print_curl" = true ]]; then
  2195.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2196.    else
  2197.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2198.    fi
  2199. }
  2200.  
  2201. ##############################################################################
  2202. #
  2203. # Call placeOrder operation
  2204. #
  2205. ##############################################################################
  2206. call_placeOrder() {
  2207.    local path_parameter_names=()
  2208.    local query_parameter_names=()
  2209.  
  2210.    if [[ $force = false ]]; then
  2211.        validate_request_parameters "/v2/store/order" path_parameter_names query_parameter_names
  2212.    fi
  2213.  
  2214.    local path=$(build_request_path "/v2/store/order" path_parameter_names query_parameter_names)
  2215.    local method="POST"
  2216.    local headers_curl=$(header_arguments_to_curl)
  2217.    if [[ -n $header_accept ]]; then
  2218.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2219.    fi
  2220.  
  2221.    local basic_auth_option=""
  2222.    if [[ -n $basic_auth_credential ]]; then
  2223.        basic_auth_option="-u ${basic_auth_credential}"
  2224.    fi
  2225.    local body_json_curl=""
  2226.  
  2227.    #
  2228.    # Check if the user provided 'Content-type' headers in the
  2229.    # command line. If not try to set them based on the Swagger specification
  2230.    # if values produces and consumes are defined unambigously
  2231.    #
  2232.  
  2233.  
  2234.    if [[ -z $header_content_type && "$force" = false ]]; then
  2235.        :
  2236.    else
  2237.        headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
  2238.    fi
  2239.  
  2240.  
  2241.    #
  2242.    # If we have received some body content over pipe, pass it from the
  2243.    # temporary file to cURL
  2244.    #
  2245.    if [[ -n $body_content_temp_file ]]; then
  2246.        if [[ "$print_curl" = true ]]; then
  2247.            echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2248.        else
  2249.            eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2250.        fi
  2251.        rm "${body_content_temp_file}"
  2252.    #
  2253.    # If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
  2254.    #
  2255.    else
  2256.        body_json_curl=$(body_parameters_to_json)
  2257.        if [[ "$print_curl" = true ]]; then
  2258.            echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2259.        else
  2260.            eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2261.        fi
  2262.    fi
  2263. }
  2264.  
  2265. ##############################################################################
  2266. #
  2267. # Call createUser operation
  2268. #
  2269. ##############################################################################
  2270. call_createUser() {
  2271.    local path_parameter_names=()
  2272.    local query_parameter_names=()
  2273.  
  2274.    if [[ $force = false ]]; then
  2275.        validate_request_parameters "/v2/user" path_parameter_names query_parameter_names
  2276.    fi
  2277.  
  2278.    local path=$(build_request_path "/v2/user" path_parameter_names query_parameter_names)
  2279.    local method="POST"
  2280.    local headers_curl=$(header_arguments_to_curl)
  2281.    if [[ -n $header_accept ]]; then
  2282.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2283.    fi
  2284.  
  2285.    local basic_auth_option=""
  2286.    if [[ -n $basic_auth_credential ]]; then
  2287.        basic_auth_option="-u ${basic_auth_credential}"
  2288.    fi
  2289.    local body_json_curl=""
  2290.  
  2291.    #
  2292.    # Check if the user provided 'Content-type' headers in the
  2293.    # command line. If not try to set them based on the Swagger specification
  2294.    # if values produces and consumes are defined unambigously
  2295.    #
  2296.  
  2297.  
  2298.    if [[ -z $header_content_type && "$force" = false ]]; then
  2299.        :
  2300.    else
  2301.        headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
  2302.    fi
  2303.  
  2304.  
  2305.    #
  2306.    # If we have received some body content over pipe, pass it from the
  2307.    # temporary file to cURL
  2308.    #
  2309.    if [[ -n $body_content_temp_file ]]; then
  2310.        if [[ "$print_curl" = true ]]; then
  2311.            echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2312.        else
  2313.            eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2314.        fi
  2315.        rm "${body_content_temp_file}"
  2316.    #
  2317.    # If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
  2318.    #
  2319.    else
  2320.        body_json_curl=$(body_parameters_to_json)
  2321.        if [[ "$print_curl" = true ]]; then
  2322.            echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2323.        else
  2324.            eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2325.        fi
  2326.    fi
  2327. }
  2328.  
  2329. ##############################################################################
  2330. #
  2331. # Call createUsersWithArrayInput operation
  2332. #
  2333. ##############################################################################
  2334. call_createUsersWithArrayInput() {
  2335.    local path_parameter_names=()
  2336.    local query_parameter_names=()
  2337.  
  2338.    if [[ $force = false ]]; then
  2339.        validate_request_parameters "/v2/user/createWithArray" path_parameter_names query_parameter_names
  2340.    fi
  2341.  
  2342.    local path=$(build_request_path "/v2/user/createWithArray" path_parameter_names query_parameter_names)
  2343.    local method="POST"
  2344.    local headers_curl=$(header_arguments_to_curl)
  2345.    if [[ -n $header_accept ]]; then
  2346.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2347.    fi
  2348.  
  2349.    local basic_auth_option=""
  2350.    if [[ -n $basic_auth_credential ]]; then
  2351.        basic_auth_option="-u ${basic_auth_credential}"
  2352.    fi
  2353.    local body_json_curl=""
  2354.  
  2355.    #
  2356.    # Check if the user provided 'Content-type' headers in the
  2357.    # command line. If not try to set them based on the Swagger specification
  2358.    # if values produces and consumes are defined unambigously
  2359.    #
  2360.  
  2361.  
  2362.    if [[ -z $header_content_type && "$force" = false ]]; then
  2363.        :
  2364.    else
  2365.        headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
  2366.    fi
  2367.  
  2368.  
  2369.    #
  2370.    # If we have received some body content over pipe, pass it from the
  2371.    # temporary file to cURL
  2372.    #
  2373.    if [[ -n $body_content_temp_file ]]; then
  2374.        if [[ "$print_curl" = true ]]; then
  2375.            echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2376.        else
  2377.            eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2378.        fi
  2379.        rm "${body_content_temp_file}"
  2380.    #
  2381.    # If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
  2382.    #
  2383.    else
  2384.        body_json_curl=$(body_parameters_to_json)
  2385.        if [[ "$print_curl" = true ]]; then
  2386.            echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2387.        else
  2388.            eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2389.        fi
  2390.    fi
  2391. }
  2392.  
  2393. ##############################################################################
  2394. #
  2395. # Call createUsersWithListInput operation
  2396. #
  2397. ##############################################################################
  2398. call_createUsersWithListInput() {
  2399.    local path_parameter_names=()
  2400.    local query_parameter_names=()
  2401.  
  2402.    if [[ $force = false ]]; then
  2403.        validate_request_parameters "/v2/user/createWithList" path_parameter_names query_parameter_names
  2404.    fi
  2405.  
  2406.    local path=$(build_request_path "/v2/user/createWithList" path_parameter_names query_parameter_names)
  2407.    local method="POST"
  2408.    local headers_curl=$(header_arguments_to_curl)
  2409.    if [[ -n $header_accept ]]; then
  2410.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2411.    fi
  2412.  
  2413.    local basic_auth_option=""
  2414.    if [[ -n $basic_auth_credential ]]; then
  2415.        basic_auth_option="-u ${basic_auth_credential}"
  2416.    fi
  2417.    local body_json_curl=""
  2418.  
  2419.    #
  2420.    # Check if the user provided 'Content-type' headers in the
  2421.    # command line. If not try to set them based on the Swagger specification
  2422.    # if values produces and consumes are defined unambigously
  2423.    #
  2424.  
  2425.  
  2426.    if [[ -z $header_content_type && "$force" = false ]]; then
  2427.        :
  2428.    else
  2429.        headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
  2430.    fi
  2431.  
  2432.  
  2433.    #
  2434.    # If we have received some body content over pipe, pass it from the
  2435.    # temporary file to cURL
  2436.    #
  2437.    if [[ -n $body_content_temp_file ]]; then
  2438.        if [[ "$print_curl" = true ]]; then
  2439.            echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2440.        else
  2441.            eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2442.        fi
  2443.        rm "${body_content_temp_file}"
  2444.    #
  2445.    # If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
  2446.    #
  2447.    else
  2448.        body_json_curl=$(body_parameters_to_json)
  2449.        if [[ "$print_curl" = true ]]; then
  2450.            echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2451.        else
  2452.            eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2453.        fi
  2454.    fi
  2455. }
  2456.  
  2457. ##############################################################################
  2458. #
  2459. # Call deleteUser operation
  2460. #
  2461. ##############################################################################
  2462. call_deleteUser() {
  2463.    local path_parameter_names=(username)
  2464.    local query_parameter_names=()
  2465.  
  2466.    if [[ $force = false ]]; then
  2467.        validate_request_parameters "/v2/user/{username}" path_parameter_names query_parameter_names
  2468.    fi
  2469.  
  2470.    local path=$(build_request_path "/v2/user/{username}" path_parameter_names query_parameter_names)
  2471.    local method="DELETE"
  2472.    local headers_curl=$(header_arguments_to_curl)
  2473.    if [[ -n $header_accept ]]; then
  2474.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2475.    fi
  2476.  
  2477.    local basic_auth_option=""
  2478.    if [[ -n $basic_auth_credential ]]; then
  2479.        basic_auth_option="-u ${basic_auth_credential}"
  2480.    fi
  2481.    if [[ "$print_curl" = true ]]; then
  2482.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2483.    else
  2484.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2485.    fi
  2486. }
  2487.  
  2488. ##############################################################################
  2489. #
  2490. # Call getUserByName operation
  2491. #
  2492. ##############################################################################
  2493. call_getUserByName() {
  2494.    local path_parameter_names=(username)
  2495.    local query_parameter_names=()
  2496.  
  2497.    if [[ $force = false ]]; then
  2498.        validate_request_parameters "/v2/user/{username}" path_parameter_names query_parameter_names
  2499.    fi
  2500.  
  2501.    local path=$(build_request_path "/v2/user/{username}" path_parameter_names query_parameter_names)
  2502.    local method="GET"
  2503.    local headers_curl=$(header_arguments_to_curl)
  2504.    if [[ -n $header_accept ]]; then
  2505.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2506.    fi
  2507.  
  2508.    local basic_auth_option=""
  2509.    if [[ -n $basic_auth_credential ]]; then
  2510.        basic_auth_option="-u ${basic_auth_credential}"
  2511.    fi
  2512.    if [[ "$print_curl" = true ]]; then
  2513.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2514.    else
  2515.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2516.    fi
  2517. }
  2518.  
  2519. ##############################################################################
  2520. #
  2521. # Call loginUser operation
  2522. #
  2523. ##############################################################################
  2524. call_loginUser() {
  2525.    local path_parameter_names=()
  2526.    local query_parameter_names=(username password)
  2527.  
  2528.    if [[ $force = false ]]; then
  2529.        validate_request_parameters "/v2/user/login" path_parameter_names query_parameter_names
  2530.    fi
  2531.  
  2532.    local path=$(build_request_path "/v2/user/login" path_parameter_names query_parameter_names)
  2533.    local method="GET"
  2534.    local headers_curl=$(header_arguments_to_curl)
  2535.    if [[ -n $header_accept ]]; then
  2536.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2537.    fi
  2538.  
  2539.    local basic_auth_option=""
  2540.    if [[ -n $basic_auth_credential ]]; then
  2541.        basic_auth_option="-u ${basic_auth_credential}"
  2542.    fi
  2543.    if [[ "$print_curl" = true ]]; then
  2544.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2545.    else
  2546.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2547.    fi
  2548. }
  2549.  
  2550. ##############################################################################
  2551. #
  2552. # Call logoutUser operation
  2553. #
  2554. ##############################################################################
  2555. call_logoutUser() {
  2556.    local path_parameter_names=()
  2557.    local query_parameter_names=()
  2558.  
  2559.    if [[ $force = false ]]; then
  2560.        validate_request_parameters "/v2/user/logout" path_parameter_names query_parameter_names
  2561.    fi
  2562.  
  2563.    local path=$(build_request_path "/v2/user/logout" path_parameter_names query_parameter_names)
  2564.    local method="GET"
  2565.    local headers_curl=$(header_arguments_to_curl)
  2566.    if [[ -n $header_accept ]]; then
  2567.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2568.    fi
  2569.  
  2570.    local basic_auth_option=""
  2571.    if [[ -n $basic_auth_credential ]]; then
  2572.        basic_auth_option="-u ${basic_auth_credential}"
  2573.    fi
  2574.    if [[ "$print_curl" = true ]]; then
  2575.        echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2576.    else
  2577.        eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\""
  2578.    fi
  2579. }
  2580.  
  2581. ##############################################################################
  2582. #
  2583. # Call updateUser operation
  2584. #
  2585. ##############################################################################
  2586. call_updateUser() {
  2587.    local path_parameter_names=(username)
  2588.    local query_parameter_names=()
  2589.  
  2590.    if [[ $force = false ]]; then
  2591.        validate_request_parameters "/v2/user/{username}" path_parameter_names query_parameter_names
  2592.    fi
  2593.  
  2594.    local path=$(build_request_path "/v2/user/{username}" path_parameter_names query_parameter_names)
  2595.    local method="PUT"
  2596.    local headers_curl=$(header_arguments_to_curl)
  2597.    if [[ -n $header_accept ]]; then
  2598.        headers_curl="${headers_curl} -H 'Accept: ${header_accept}'"
  2599.    fi
  2600.  
  2601.    local basic_auth_option=""
  2602.    if [[ -n $basic_auth_credential ]]; then
  2603.        basic_auth_option="-u ${basic_auth_credential}"
  2604.    fi
  2605.    local body_json_curl=""
  2606.  
  2607.    #
  2608.    # Check if the user provided 'Content-type' headers in the
  2609.    # command line. If not try to set them based on the Swagger specification
  2610.    # if values produces and consumes are defined unambigously
  2611.    #
  2612.  
  2613.  
  2614.    if [[ -z $header_content_type && "$force" = false ]]; then
  2615.        :
  2616.    else
  2617.        headers_curl="${headers_curl} -H 'Content-type: ${header_content_type}'"
  2618.    fi
  2619.  
  2620.  
  2621.    #
  2622.    # If we have received some body content over pipe, pass it from the
  2623.    # temporary file to cURL
  2624.    #
  2625.    if [[ -n $body_content_temp_file ]]; then
  2626.        if [[ "$print_curl" = true ]]; then
  2627.            echo "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2628.        else
  2629.            eval "cat ${body_content_temp_file} | curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} \"${host}${path}\" -d @-"
  2630.        fi
  2631.        rm "${body_content_temp_file}"
  2632.    #
  2633.    # If not, try to build the content body from arguments KEY==VALUE and KEY:=VALUE
  2634.    #
  2635.    else
  2636.        body_json_curl=$(body_parameters_to_json)
  2637.        if [[ "$print_curl" = true ]]; then
  2638.            echo "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2639.        else
  2640.            eval "curl ${basic_auth_option} ${curl_arguments} ${headers_curl} -X ${method} ${body_json_curl} \"${host}${path}\""
  2641.        fi
  2642.    fi
  2643. }
  2644.  
  2645.  
  2646.  
  2647. ##############################################################################
  2648. #
  2649. # Main
  2650. #
  2651. ##############################################################################
  2652.  
  2653.  
  2654. # Check dependencies
  2655. type curl >/dev/null 2>&1 || { echo >&2 "Error: You do not have 'cURL' installed."; exit 1; }
  2656. type sed >/dev/null 2>&1 || { echo >&2 "Error: You do not have 'sed' installed."; exit 1; }
  2657. type column >/dev/null 2>&1 || { echo >&2 "Error: You do not have 'bsdmainutils' installed."; exit 1; }
  2658.  
  2659. #
  2660. # Process command line
  2661. #
  2662. # Pass all arguemnts before 'operation' to cURL except the ones we override
  2663. #
  2664. take_user=false
  2665. take_host=false
  2666. take_accept_header=false
  2667. take_contenttype_header=false
  2668.  
  2669. for key in "$@"; do
  2670. # Take the value of -u|--user argument
  2671. if [[ "$take_user" = true ]]; then
  2672.    basic_auth_credential="$key"
  2673.    take_user=false
  2674.    continue
  2675. fi
  2676. # Take the value of --host argument
  2677. if [[ "$take_host" = true ]]; then
  2678.    host="$key"
  2679.    take_host=false
  2680.    continue
  2681. fi
  2682. # Take the value of --accept argument
  2683. if [[ "$take_accept_header" = true ]]; then
  2684.    header_accept=$(lookup_mime_type "$key")
  2685.    take_accept_header=false
  2686.    continue
  2687. fi
  2688. # Take the value of --content-type argument
  2689. if [[ "$take_contenttype_header" = true ]]; then
  2690.    header_content_type=$(lookup_mime_type "$key")
  2691.    take_contenttype_header=false
  2692.    continue
  2693. fi
  2694. case $key in
  2695.    -h|--help)
  2696.    if [[ "x$operation" == "x" ]]; then
  2697.        print_help
  2698.        exit 0
  2699.    else
  2700.        eval "print_${operation}_help"
  2701.        exit 0
  2702.    fi
  2703.    ;;
  2704.    -V|--version)
  2705.    print_version
  2706.    exit 0
  2707.    ;;
  2708.    --about)
  2709.    print_about
  2710.    exit 0
  2711.    ;;
  2712.    -u|--user)
  2713.    take_user=true
  2714.    ;;
  2715.    --host)
  2716.    take_host=true
  2717.    ;;
  2718.    --force)
  2719.    force=true
  2720.    ;;
  2721.    -ac|--accept)
  2722.    take_accept_header=true
  2723.    ;;
  2724.    -ct|--content-type)
  2725.    take_contenttype_header=true
  2726.    ;;
  2727.    --dry-run)
  2728.    print_curl=true
  2729.    ;;
  2730.    addPet)
  2731.    operation="addPet"
  2732.    ;;
  2733.    deletePet)
  2734.    operation="deletePet"
  2735.    ;;
  2736.    findPetsByStatus)
  2737.    operation="findPetsByStatus"
  2738.    ;;
  2739.    findPetsByTags)
  2740.    operation="findPetsByTags"
  2741.    ;;
  2742.    getPetById)
  2743.    operation="getPetById"
  2744.    ;;
  2745.    updatePet)
  2746.    operation="updatePet"
  2747.    ;;
  2748.    updatePetWithForm)
  2749.    operation="updatePetWithForm"
  2750.    ;;
  2751.    uploadFile)
  2752.    operation="uploadFile"
  2753.    ;;
  2754.    deleteOrder)
  2755.    operation="deleteOrder"
  2756.    ;;
  2757.    getInventory)
  2758.    operation="getInventory"
  2759.    ;;
  2760.    getOrderById)
  2761.    operation="getOrderById"
  2762.    ;;
  2763.    placeOrder)
  2764.    operation="placeOrder"
  2765.    ;;
  2766.    createUser)
  2767.    operation="createUser"
  2768.    ;;
  2769.    createUsersWithArrayInput)
  2770.    operation="createUsersWithArrayInput"
  2771.    ;;
  2772.    createUsersWithListInput)
  2773.    operation="createUsersWithListInput"
  2774.    ;;
  2775.    deleteUser)
  2776.    operation="deleteUser"
  2777.    ;;
  2778.    getUserByName)
  2779.    operation="getUserByName"
  2780.    ;;
  2781.    loginUser)
  2782.    operation="loginUser"
  2783.    ;;
  2784.    logoutUser)
  2785.    operation="logoutUser"
  2786.    ;;
  2787.    updateUser)
  2788.    operation="updateUser"
  2789.    ;;
  2790.    *==*)
  2791.    # Parse body arguments and convert them into top level
  2792.    # JSON properties passed in the body content as strings
  2793.    if [[ "$operation" ]]; then
  2794.        IFS='==' read body_key sep body_value <<< "$key"
  2795.        body_parameters[${body_key}]="\"${body_value}\""
  2796.    fi
  2797.    ;;
  2798.    *:=*)
  2799.    # Parse body arguments and convert them into top level
  2800.    # JSON properties passed in the body content without qoutes
  2801.    if [[ "$operation" ]]; then
  2802.        IFS=':=' read body_key sep body_value <<< "$key"
  2803.        body_parameters[${body_key}]=${body_value}
  2804.    fi
  2805.    ;;
  2806.    *:*)
  2807.    # Parse header arguments and convert them into curl
  2808.    # only after the operation argument
  2809.    if [[ "$operation" ]]; then
  2810.        IFS=':' read header_name header_value <<< "$key"
  2811.        #
  2812.        # If the header key is the same as the api_key expected by API in the
  2813.        # header, override the ${apikey_auth_credential} variable
  2814.        #
  2815.        if [[ $header_name == "api_key" ]]; then
  2816.            apikey_auth_credential=$header_value
  2817.        fi
  2818.        header_arguments[$header_name]=$header_value
  2819.    else
  2820.        curl_arguments+=" $key"
  2821.    fi
  2822.    ;;
  2823.    -)
  2824.    body_content_temp_file=$(mktemp)
  2825.    cat - > $body_content_temp_file
  2826.    ;;
  2827.    *=*)
  2828.    # Parse operation arguments and convert them into curl
  2829.    # only after the operation argument
  2830.    if [[ "$operation" ]]; then
  2831.        IFS='=' read parameter_name parameter_value <<< "$key"
  2832.        if [[ -z "${operation_parameters[$parameter_name]+foo}" ]]; then
  2833.            operation_parameters[$parameter_name]=$(url_escape "${parameter_value}")
  2834.        else
  2835.            operation_parameters[$parameter_name]+=":::"$(url_escape "${parameter_value}")
  2836.        fi
  2837.    else
  2838.        curl_arguments+=" $key"
  2839.    fi
  2840.    ;;
  2841.    *)
  2842.    # If we are before the operation, treat the arguments as cURL arguments
  2843.    if [[ "x$operation" == "x" ]]; then
  2844.        # Maintain quotes around cURL arguments if necessary
  2845.        space_regexp="[[:space:]]"
  2846.        if [[ $key =~ $space_regexp ]]; then
  2847.            curl_arguments+=" \"$key\""
  2848.        else
  2849.            curl_arguments+=" $key"
  2850.        fi
  2851.    fi
  2852.    ;;
  2853. esac
  2854. done
  2855.  
  2856.  
  2857. # Check if user provided host name
  2858. if [[ -z "$host" ]]; then
  2859.    echo "Error: No hostname provided!!!"
  2860.    echo "Check usage: '${script_name} --help'"
  2861.    exit 1
  2862. fi
  2863.  
  2864. # Check if user specified operation ID
  2865. if [[ -z "$operation" ]]; then
  2866.    echo "Error: No operation specified!"
  2867.    echo "Check available operations: '${script_name} --help'"
  2868.    exit 1
  2869. fi
  2870.  
  2871.  
  2872. # Run cURL command based on the operation ID
  2873. case $operation in
  2874.    addPet)
  2875.    call_addPet
  2876.    ;;
  2877.    deletePet)
  2878.    call_deletePet
  2879.    ;;
  2880.    findPetsByStatus)
  2881.    call_findPetsByStatus
  2882.    ;;
  2883.    findPetsByTags)
  2884.    call_findPetsByTags
  2885.    ;;
  2886.    getPetById)
  2887.    call_getPetById
  2888.    ;;
  2889.    updatePet)
  2890.    call_updatePet
  2891.    ;;
  2892.    updatePetWithForm)
  2893.    call_updatePetWithForm
  2894.    ;;
  2895.    uploadFile)
  2896.    call_uploadFile
  2897.    ;;
  2898.    deleteOrder)
  2899.    call_deleteOrder
  2900.    ;;
  2901.    getInventory)
  2902.    call_getInventory
  2903.    ;;
  2904.    getOrderById)
  2905.    call_getOrderById
  2906.    ;;
  2907.    placeOrder)
  2908.    call_placeOrder
  2909.    ;;
  2910.    createUser)
  2911.    call_createUser
  2912.    ;;
  2913.    createUsersWithArrayInput)
  2914.    call_createUsersWithArrayInput
  2915.    ;;
  2916.    createUsersWithListInput)
  2917.    call_createUsersWithListInput
  2918.    ;;
  2919.    deleteUser)
  2920.    call_deleteUser
  2921.    ;;
  2922.    getUserByName)
  2923.    call_getUserByName
  2924.    ;;
  2925.    loginUser)
  2926.    call_loginUser
  2927.    ;;
  2928.    logoutUser)
  2929.    call_logoutUser
  2930.    ;;
  2931.    updateUser)
  2932.    call_updateUser
  2933.    ;;
  2934.    *)
  2935.    echo "Error: Unknown operation: $operation"
  2936.    echo ""
  2937.    print_help
  2938.    exit 1
  2939. esac
Advertisement
Add Comment
Please, Sign In to add comment