@@ -56,6 +56,7 @@ module Line
5656
5757 # {{ op.notes }}
5858 # This requests to <code>{{ op.httpMethod }} {{ endpoint(operations.classname) }}{{ op.path }}</code>
59+ # This returns an array containing response, HTTP status code, and header in order. Please specify all header keys in lowercase.
5960 #
6061 {% for param in op.allParams -%}
6162 # @param {{param.paramName}} [{{ param.dataType }}{{ param.required ? '' : ', nil' }}] {{param.description}}
@@ -69,17 +70,19 @@ module Line
6970 {% if op.externalDocs.url != null -%}
7071 # @see {{op.externalDocs.url}}
7172 {%- endif %}
72- # @return [response body, response status code, and response headers]
7373 {%- for response in op.responses %}
7474 {%- if response.content['application/json'].schema.complexType != null %}
7575 # @return [Array(Line::Bot::V2::{{ packageName | camelize }}::{{ response.content['application/json'].schema.complexType }}, Integer, Hash{String => String})] when HTTP status code is {{ response.code }}
7676 {%- else %}
7777 # @return [Array((String|nil), Integer, Hash{String => String})] when HTTP status code is {{ response.code }}
7878 {%- endif %}
7979 {%- endfor %}
80- def {{op.nickname}}_with_http_info({% for param in op.allParams %}
80+ # @return [Array((String|nil), Integer, Hash{String => String})] when other HTTP status code is returned. String is HTTP response body itself.
81+ {#- Remove this steep:ignore after https://github.com/soutaro/steep/issues/1603 is resolved #}
82+ def {{op.nickname}}_with_http_info( # steep:ignore MethodBodyTypeMismatch
83+ {%- for param in op.allParams %}
8184 {{param.paramName}}:{{ param.required ? '' : ' nil' }}{{ loop.last ? '' : ',' -}}
82- {% endfor %}
85+ {%- endfor %}
8386 )
8487 path = "{{ op.path }}"{% for param in op.pathParams %}
8588 .gsub(/{{ "{" + param.baseName + "}" }}/, {{ param.paramName }}.to_s)
@@ -106,23 +109,23 @@ module Line
106109 headers: header_params{% endif %}
107110 )
108111
109- response_body = case response.code.to_i
110- {%- for response in op.responses %}
111- when {{ response.code }}
112- {%- if response.content['application/json'].schema.complexType != null %}
113- json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
114- json.transform_keys! do |key|
115- Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
116- end
117- Line::Bot::V2::{{ packageName | camelize }}::{{ response.content['application/json'].schema.complexType }}.create(json) # steep:ignore InsufficientKeywordArguments
118- {%- else %}
119- response.body
120- {%- endif %}{% endfor %}
121- else
122- response.body
123- end
124-
125- [response_body, response.code.to_i, response.each_header.to_h]
112+ case response.code.to_i
113+ {%- for response in op.responses %}
114+ when {{ response.code }}
115+ {%- if response.content['application/json'].schema.complexType != null %}
116+ json = Line::Bot::V2::Utils.deep_underscore(JSON.parse(response.body))
117+ json.transform_keys! do |key|
118+ Line::Bot::V2::RESERVED_WORDS.include?(key) ? "_#{key}".to_sym : key
119+ end
120+ response_body = Line::Bot::V2::{{ packageName | camelize }}::{{ response.content['application/json'].schema.complexType }}.create(json) # steep:ignore InsufficientKeywordArguments
121+ [response_body, {{ response.code }}, response.each_header.to_h]
122+ {%- else %}
123+ [response.body, {{ response.code }}, response.each_header.to_h]
124+ {%- endif %}
125+ {%- endfor %}
126+ else
127+ [response.body, response.code.to_i, response.each_header.to_h]
128+ end
126129 end
127130
128131 # {{ op.notes }}
@@ -148,6 +151,7 @@ module Line
148151 # @return [String, nil] when HTTP status code is {{ response.code }}
149152 {%- endif %}
150153 {%- endfor %}
154+ # @return [String, nil] when other HTTP status code is returned. This String is HTTP response body itself.
151155 def {{op.nickname}}({% for param in op.allParams %}
152156 {{param.paramName}}:{{ param.required ? '' : ' nil' }}{{ loop.last ? '' : ',' -}}
153157 {% endfor %}
0 commit comments