@@ -50,14 +50,15 @@ module {{moduleName}}
5050 # @param [Hash] header_params Header parameters
5151 # @param [Hash] query_params Query parameters
5252 # @param [String] auth_names Authentication scheme name
53- def update_params_for_auth!(header_params, query_params, auth_names)
53+ def update_params_for_auth!(header_params, query_params, cookie_params, auth_names)
5454 auth_names.each do |auth_name|
5555 auth_setting = @config.auth_settings[auth_name]
5656 next unless auth_setting
5757 case auth_setting[:in]
5858 when "header" then header_params[auth_setting[:key]] = auth_setting[:value]
5959 when "query" then query_params[auth_setting[:key]] = auth_setting[:value]
60- else raise ArgumentError.new("Authentication token must be in `query` of `header`")
60+ when "cookie" then cookie_params[auth_setting[:key]] = auth_setting[:value]
61+ else raise ArgumentError.new("Authentication token must be in `cookie`, `query` or `header`")
6162 end
6263 end
6364 end
@@ -119,7 +120,7 @@ module {{moduleName}}
119120 #
120121 # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
121122 # the data deserialized from response body (could be nil), response status code and response headers.
122- def call_api(http_method : Symbol, path : String, operation : Symbol, return_type : String?, post_body : String?, auth_names = [] of String, header_params = { } of String => String, query_params = { } of String => String, form_params = { } of Symbol => (String | ::File))
123+ def call_api(http_method : Symbol, path : String, operation : Symbol, return_type : String?, post_body : String?, auth_names = [] of String, header_params = { } of String => String, query_params = { } of String => String, cookie_params = { } of String => String, form_params = { } of Symbol => (String | ::File))
123124 #ssl_options = {
124125 # :ca_file => @config.ssl_ca_file,
125126 # :verify => @config.ssl_verify,
@@ -128,7 +129,7 @@ module {{moduleName}}
128129 # :client_key => @config.ssl_client_key
129130 #}
130131
131- update_params_for_auth! header_params, query_params, auth_names
132+ update_params_for_auth! header_params, query_params, cookie_params, auth_names
132133
133134 if !post_body.nil? && !post_body.empty?
134135 # use JSON string in the payload
@@ -143,7 +144,7 @@ module {{moduleName}}
143144 build_request_url(path, operation),
144145 params: query_params,
145146 headers: header_params,
146- # cookies: cookie_params, # TODO add cookies support
147+ cookies: cookie_params,
147148 form: form_or_body,
148149 logging: @config.debugging,
149150 handle_errors: false
0 commit comments