Advertisement
Guest User

Untitled

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