diff --git a/lib/aws_codegen/rest_service.ex b/lib/aws_codegen/rest_service.ex index 4300307..c57f026 100644 --- a/lib/aws_codegen/rest_service.ex +++ b/lib/aws_codegen/rest_service.ex @@ -169,31 +169,30 @@ defmodule AWS.CodeGen.RestService do function_parameter_types(action, true) end - def function_parameter_types(action, required_only \\ false) do + def function_parameter_types(action, required_only \\ false) + + def function_parameter_types("GET", required_only) do language = action.language - Enum.join([ - join_parameter_types(action.url_parameters, language) - | case action.method do - "GET" -> - case required_only do - false -> - [ - join_parameter_types(action.query_parameters, language), - join_parameter_types(action.request_header_parameters, language), - join_parameter_types(action.request_headers_parameters, language) - ] - - true -> - [ - join_parameter_types(action.required_query_parameters, language), - join_parameter_types(action.required_request_header_parameters, language) - ] - end - - _ -> - [] - end - ]) + + get_parameter_types = + if required_only do + [ + join_parameter_types(action.required_query_parameters, language), + join_parameter_types(action.required_request_header_parameters, language) + ] + else + [ + join_parameter_types(action.query_parameters, language), + join_parameter_types(action.request_header_parameters, language), + join_parameter_types(action.request_headers_parameters, language) + ] + end + + Enum.join([join_parameter_types(action.url_parameters, language) | get_parameter_types]) + end + + def function_parameter_types(action, _required_only) do + join_parameter_types(action.url_parameters, action.language) end defp join_parameter_types(parameters, language) do