@@ -18,35 +18,6 @@ extension {{moduleName}}Client {
1818/// { {classname} } protocol defines a blueprint of methods, properties, and other requirements for { {classname} } functionality.
1919{ {#nonPublicApi} }internal{ {/nonPublicApi} }{ {^nonPublicApi} }public{ {/nonPublicApi} } protocol { {classname} }Protocol {
2020{{#operation} }
21-
22- { {#hasParams} }
23- /**
24- { {#summary} }
25- { {{summary} }}
26- { {/summary} }
27- - { {httpMethod} } { {{path} }}{ {#notes} }
28- - { {{notes} }}{ {/notes} }{ {#subresourceOperation} }
29- - subresourceOperation: { {subresourceOperation} }{ {/subresourceOperation} }{ {#defaultResponse} }
30- - defaultResponse: { {defaultResponse} }{ {/defaultResponse} }
31- { {#authMethods} }
32- - { {#isBasic} }BASIC{ {/isBasic} }{ {#isOAuth} }OAuth{ {/isOAuth} }{ {#isApiKey} }API Key{ {/isApiKey} }:
33- - type: { {type} }{ {#keyParamName} } { {keyParamName} } { {#isKeyInQuery} }(QUERY){ {/isKeyInQuery} }{ {#isKeyInHeaer} }(HEADER){ {/isKeyInHeaer} }{ {/keyParamName} }
34- - name: { {name} }
35- { {/authMethods} }
36- { {#hasResponseHeaders} }
37- - responseHeaders: [{ {#responseHeaders} }{ {{baseName} }}({ {{dataType} }}){ {^-last} }, { {/-last} }{ {/responseHeaders} }]
38- { {/hasResponseHeaders} }
39- { {#externalDocs} }
40- - externalDocs: { {externalDocs} }
41- { {/externalDocs} }
42- { {#allParams} }
43- - parameter { {paramName} }: ({ {#isFormParam} }form{ {/isFormParam} }{ {#isQueryParam} }query{ {/isQueryParam} }{ {#isPathParam} }path{ {/isPathParam} }{ {#isHeaderParam} }header{ {/isHeaderParam} }{ {#isBodyParam} }body{ {/isBodyParam} }) { {description} } { {^required} }(optional{ {#defaultValue} }, default to { {{.} }}{ {/defaultValue} }){ {/required} }
44- { {/allParams} }
45- - returns: Call<{ {#returnType} }{ {#isResponseFile} }Data{ {/isResponseFile} }{ {^isResponseFile} }{ {{returnType} }}{ {/isResponseFile} }{ {/returnType} }{ {^returnType} }NoResponse{ {/returnType} }> { {description} }
46- */
47- @available(*, deprecated, message: "This method is deprecated in favor of the alternative method with { {classname} }.{ {operationIdCamelCase} }RequestParams class.")
48- func { {operationId} }Call({ {#allParams} }{ {paramName} }: { {#isEnum} }{ {#isContainer} }{ {{dataType} }}{ {/isContainer} }{ {^isContainer} }{ {classname} }.{ {{datatypeWithEnum} }}_{ {operationId} }{ {/isContainer} }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }?{ {/required} }{ {^-last} }, { {/-last} }{ {/allParams} }) throws -> Call<{ {#returnType} }{ {#isResponseFile} }Data{ {/isResponseFile} }{ {^isResponseFile} }{ {{returnType} }}{ {/isResponseFile} }{ {/returnType} }{ {^returnType} }NoResponse{ {/returnType} }>
49- { {/hasParams} }
5021
5122 /**
5223 { {#summary} }
@@ -218,82 +189,7 @@ extension {{moduleName}}Client {
218189 }
219190 }
220191{ {/useResult} }
221- { {#hasParams} }
222- /**
223- { {#summary} }
224- { {{summary} }}
225- { {/summary} }
226- - { {httpMethod} } { {{path} }}{ {#notes} }
227- - { {{notes} }}{ {/notes} }{ {#subresourceOperation} }
228- - subresourceOperation: { {subresourceOperation} }{ {/subresourceOperation} }{ {#defaultResponse} }
229- - defaultResponse: { {defaultResponse} }{ {/defaultResponse} }
230- { {#authMethods} }
231- - { {#isBasic} }BASIC{ {/isBasic} }{ {#isOAuth} }OAuth{ {/isOAuth} }{ {#isApiKey} }API Key{ {/isApiKey} }:
232- - type: { {type} }{ {#keyParamName} } { {keyParamName} } { {#isKeyInQuery} }(QUERY){ {/isKeyInQuery} }{ {#isKeyInHeaer} }(HEADER){ {/isKeyInHeaer} }{ {/keyParamName} }
233- - name: { {name} }
234- { {/authMethods} }
235- { {#hasResponseHeaders} }
236- - responseHeaders: [{ {#responseHeaders} }{ {{baseName} }}({ {{dataType} }}){ {^-last} }, { {/-last} }{ {/responseHeaders} }]
237- { {/hasResponseHeaders} }
238- { {#externalDocs} }
239- - externalDocs: { {externalDocs} }
240- { {/externalDocs} }
241- { {#allParams} }
242- - parameter { {paramName} }: ({ {#isFormParam} }form{ {/isFormParam} }{ {#isQueryParam} }query{ {/isQueryParam} }{ {#isPathParam} }path{ {/isPathParam} }{ {#isHeaderParam} }header{ {/isHeaderParam} }{ {#isBodyParam} }body{ {/isBodyParam} }) { {description} } { {^required} }(optional{ {#defaultValue} }, default to { {{.} }}{ {/defaultValue} }){ {/required} }
243- { {/allParams} }
244- - returns: Call<{ {#returnType} }{ {#isResponseFile} }Data{ {/isResponseFile} }{ {^isResponseFile} }{ {{returnType} }}{ {/isResponseFile} }{ {/returnType} }{ {^returnType} }NoResponse{ {/returnType} }> { {description} }
245- */
246- @available(*, deprecated, message: "This method is deprecated in favor of the alternative method with { {classname} }.{ {operationIdCamelCase} }RequestParams class.")
247- { {#nonPublicApi} }internal{ {/nonPublicApi} }{ {^nonPublicApi} }open{ {/nonPublicApi} } func { {operationId} }Call({ {#allParams} }{ {paramName} }: { {#isEnum} }{ {#isContainer} }{ {{dataType} }}{ {/isContainer} }{ {^isContainer} }{ {{datatypeWithEnum} }}_{ {operationId} }{ {/isContainer} }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {^-last} }, { {/-last} }{ {/allParams} }) throws -> Call<{ {#returnType} }{ {#isResponseFile} }Data{ {/isResponseFile} }{ {^isResponseFile} }{ {{returnType} }}{ {/isResponseFile} }{ {/returnType} }{ {^returnType} }NoResponse{ {/returnType} }> {
248- guard let dataProvider = dataProvider else { throw CallError.missingDataProvider }
249- { {^pathParams} }let{ {/pathParams} }{ {#pathParams} }{ {#-first} }var{ {/-first} }{ {/pathParams} } path = "{ {{path} }}"{ {#pathParams} }
250- let { {paramName} }PathItem = "\({ {#isEnum} }{ {paramName} }{ {#isContainer} }{ {{dataType} }}{ {/isContainer} }{ {^isContainer} }.rawValue{ {/isContainer} }{ {/isEnum} }{ {^isEnum} }APIHelper.mapValueToPathItem({ {paramName} }){ {/isEnum} })"
251- path = path.replacingOccurrences(of: "{ {=<% %>= } }{ <% baseName%> } <%={ { } }=%>", with: { {paramName} }PathItem, options: .literal, range: nil){ {/pathParams} }
252- { {#pathParams} }{ {#-first} }path = path.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""{ {/-first} }{ {/pathParams} }
253- { {#bodyParam} }
254- let parameters = JSONEncodingHelper.encodingParameters(forEncodableObject: { {paramName} })
255- { {/bodyParam} }
256- { {^bodyParam} }
257- { {#hasFormParams} }
258- let formParams: [String: Any?] = [
259- { {#formParams} }
260- { {#isModel} }
261- "{ {paramName} }": JSONEncodingHelper.encodingParameters(forEncodableObject: { {paramName} }){ {^-last} }, { {/-last} }
262- { {/isModel} }
263- { {^isModel} }
264- { {> _param_deprecated} }{ {^-last} }, { {/-last} }
265- { {/isModel} }
266- { {/formParams} }
267- ]
268-
269- let nonNullParameters = APIHelper.rejectNil(formParams)
270- let parameters = APIHelper.convertBoolToString(nonNullParameters)
271- { {/hasFormParams} }
272- { {^hasFormParams} }
273- let parameters: [String: Any]? = nil
274- { {/hasFormParams} }
275- { {/bodyParam} }{ {#hasQueryParams} }
276- let queryParameters: [String: Any?] = [
277- { {#queryParams} }
278- { {> _param_deprecated} }{ {^-last} }, { {/-last} }
279- { {/queryParams} }
280- ]{ {/hasQueryParams} }
281- let urlComponents = URLComponents(url: baseURL.appendingPathComponent(path), resolvingAgainstBaseURL: false){ {#headerParams} }{ {#-first} }
282- let nillableHeaders: [String: Any?] = [{ {/-first} }
283- { {> _param_deprecated} }{ {^-last} }, { {/-last} }{ {#-last} }
284- ]
285- let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders){ {/-last} }{ {/headerParams} }
286- guard let url = urlComponents?.url else { throw CallError.invalidUrl }
287- let request = try ClientCommonGen2.RequestBuilder.createURLRequest(requestUrl: url,
288- method: "{ {httpMethod} }",
289- queryParameters: { {#hasQueryParams} }queryParameters.compactMapValues({ $0 } ){ {/hasQueryParams} }{ {^hasQueryParams} }nil{ {/hasQueryParams} },
290- bodyParameters: parameters,
291- bodyType: { {#hasBodyParam} }{ {^isMultipart} }.json{ {/isMultipart} }{ {/hasBodyParam} }{ {^hasBodyParam} }{ {#isMultipart} }.multipartForm{ {/isMultipart} }{ {/hasBodyParam} }{ {^hasBodyParam} }{ {^isMultipart} }.none{ {/isMultipart} }{ {/hasBodyParam} }{ {#headerParams} }{ {#-first} },
292- headers: headerParameters{ {/-first} }{ {/headerParams} })
293- return Call<{ {#returnType} }{ {#isResponseFile} }Data{ {/isResponseFile} }{ {^isResponseFile} }{ {{returnType} }}{ {/isResponseFile} }{ {/returnType} }{ {^returnType} }NoResponse{ {/returnType} }>(dataProvider: dataProvider, request: request)
294- }
295- { {/hasParams} }
296-
192+
297193 /**
298194 { {#summary} }
299195 { {{summary} }}
0 commit comments