@@ -53,11 +53,7 @@ extension {{projectName}}API {
53
53
{ {/isEnum} }
54
54
{ {/allParams} }
55
55
{ {^useVapor} }
56
- { {^usePromiseKit} }
57
- { {^useRxSwift} }
58
- { {^useResult} }
59
- { {^useCombine} }
60
- { {^useAsyncAwait} }
56
+ { {#useObjcBlock} }
61
57
62
58
/**
63
59
{ {#summary} }
@@ -71,7 +67,7 @@ extension {{projectName}}API {
71
67
@available(*, deprecated, message: "This operation is deprecated.")
72
68
{ {/isDeprecated} }
73
69
@discardableResult
74
- { {#nonPublicApi} }internal{ {/nonPublicApi} }{ {^nonPublicApi} }open{ {/nonPublicApi} } { {#apiStaticMethod} }class { {/apiStaticMethod} }func { {operationId} }({ {#allParams} }{ {paramName} }: { {#isEnum} }{ {#isContainer} }[{ {enumName} }_{ {operationId} }]{ {/isContainer} }{ {^isContainer} }{ {enumName} }_{ {operationId} }{ {/isContainer} }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {^-last } } , { {/-last } } { {/ allParams} }{ {#apiStaticMethod} }{ {#hasParams } }, { {/hasParams } } openAPIClient: OpenAPIClient = OpenAPIClient.shared{ {/apiStaticMethod} }, completion: @Sendable @escaping (_ data: { {{returnType} }}{ {^returnType} }Void{ {/returnType} }?, _ error: Error?) -> Void) -> RequestTask {
70
+ { {#nonPublicApi} }internal{ {/nonPublicApi} }{ {^nonPublicApi} }open{ {/nonPublicApi} } { {#apiStaticMethod} }class { {/apiStaticMethod} }func { {operationId} }({ {#allParams} }{ {paramName} }: { {#isEnum} }{ {#isContainer} }[{ {enumName} }_{ {operationId} }]{ {/isContainer} }{ {^isContainer} }{ {enumName} }_{ {operationId} }{ {/isContainer} }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }, { {/allParams} }{ {#apiStaticMethod} }openAPIClient: OpenAPIClient = OpenAPIClient.shared, { {/apiStaticMethod} }completion: @Sendable @escaping (_ data: { {{returnType} }}{ {^returnType} }Void{ {/returnType} }?, _ error: Error?) -> Void) -> RequestTask {
75
71
return {{operationId} }WithRequestBuilder({ {#allParams} }{ {paramName} }: { {paramName} }{ {^-last} }, { {/-last} }{ {/allParams} }{ {#apiStaticMethod} }{ {#hasParams} }, { {/hasParams} }openAPIClient: openAPIClient{ {/apiStaticMethod} }).execute { result in
76
72
switch result {
77
73
{{#returnType} }
@@ -87,12 +83,7 @@ extension {{projectName}}API {
87
83
}
88
84
}
89
85
}
90
- { {/useAsyncAwait} }
91
- { {/useCombine} }
92
- { {/useResult} }
93
- { {/useRxSwift} }
94
- { {/usePromiseKit} }
95
- { {/useVapor} }
86
+ { {/useObjcBlock} }
96
87
{ {#usePromiseKit} }
97
88
98
89
/**
@@ -257,6 +248,86 @@ extension {{projectName}}API {
257
248
}
258
249
}
259
250
{ {/useResult} }
251
+
252
+ /**
253
+ { {#summary} }
254
+ { {{.} }}
255
+ { {/summary} }
256
+ - { {httpMethod} } { {{path} }}{ {#notes} }
257
+ - { {{.} }}{ {/notes} }{ {#subresourceOperation} }
258
+ - subresourceOperation: { {.} }{ {/subresourceOperation} }{ {#defaultResponse} }
259
+ - defaultResponse: { {.} }{ {/defaultResponse} }
260
+ { {#authMethods} }
261
+ - { {#isBasicBasic} }BASIC{ {/isBasicBasic} }{ {#isBasicBearer} }Bearer Token{ {/isBasicBearer} }{ {#isOAuth} }OAuth{ {/isOAuth} }{ {#isApiKey} }API Key{ {/isApiKey} }:
262
+ - type: { {type} }{ {#keyParamName} } { {keyParamName} } { {#isKeyInQuery} }(QUERY){ {/isKeyInQuery} }{ {#isKeyInHeader} }(HEADER){ {/isKeyInHeader} }{ {/keyParamName} }
263
+ - name: { {name} }
264
+ { {/authMethods} }
265
+ { {#hasResponseHeaders} }
266
+ - responseHeaders: [{ {#responseHeaders} }{ {{baseName} }}({ {{dataType} }}){ {^-last} }, { {/-last} }{ {/responseHeaders} }]
267
+ { {/hasResponseHeaders} }
268
+ { {#externalDocs} }
269
+ - externalDocs: { {.} }
270
+ { {/externalDocs} }
271
+ { {#allParams} }
272
+ - 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} }
273
+ { {/allParams} }{ {#apiStaticMethod} }
274
+ - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.{ {/apiStaticMethod} }
275
+ - returns: RequestBuilder<{ {{returnType} }}{ {#returnType} }{ {#isResponseOptional} }?{ {/isResponseOptional} }{ {/returnType} }{ {^returnType} }Void{ {/returnType} }> { {description} }
276
+ */
277
+ { {#isDeprecated} }
278
+ @available(*, deprecated, message: "This operation is deprecated.")
279
+ { {/isDeprecated} }
280
+ { {#nonPublicApi} }internal{ {/nonPublicApi} }{ {^nonPublicApi} }open{ {/nonPublicApi} } { {#apiStaticMethod} }class { {/apiStaticMethod} }func { {operationId} }WithRequestBuilder({ {#allParams} }{ {paramName} }: { {#isEnum} }{ {#isContainer} }[{ {enumName} }_{ {operationId} }]{ {/isContainer} }{ {^isContainer} }{ {enumName} }_{ {operationId} }{ {/isContainer} }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {^-last} }, { {/-last} }{ {/allParams} }{ {#apiStaticMethod} }{ {#hasParams} }, { {/hasParams} }openAPIClient: OpenAPIClient = OpenAPIClient.shared{ {/apiStaticMethod} }) -> RequestBuilder<{ {{returnType} }}{ {#returnType} }{ {#isResponseOptional} }?{ {/isResponseOptional} }{ {/returnType} }{ {^returnType} }Void{ {/returnType} }> {
281
+ {{^pathParams} }let{ {/pathParams} }{ {#pathParams} }{ {#-first} }var{ {/-first} }{ {/pathParams} } localVariablePath = "{ {{path} }}"{ {#pathParams} }
282
+ let { {paramName} }PreEscape = "\({ {#isEnum} }{ {paramName} }{ {#isContainer} }{ {{dataType} }}{ {/isContainer} }{ {^isContainer} }.rawValue{ {/isContainer} }{ {/isEnum} }{ {^isEnum} }APIHelper.mapValueToPathItem({ {paramName} }){ {/isEnum} })"
283
+ let { {paramName} }PostEscape = { {paramName} }PreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
284
+ localVariablePath = localVariablePath.replacingOccurrences(of: "{ {=<% %>= } }{ <% baseName%> } <%={ { } }=%>", with: { {paramName} }PostEscape, options: .literal, range: nil){ {/pathParams} }
285
+ let localVariableURLString = openAPIClient.basePath + localVariablePath
286
+ { {#bodyParam} }
287
+ { {#isBinary} }
288
+ let localVariableParameters = ["body": { {paramName} }]
289
+ { {/isBinary} }
290
+ { {^isBinary} }
291
+ let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: { {paramName} }, codableHelper: openAPIClient.codableHelper)
292
+ { {/isBinary} }
293
+ { {/bodyParam} }
294
+ { {^bodyParam} }
295
+ { {#hasFormParams} }
296
+ let localVariableFormParams: [String: Any?] = [
297
+ { {#formParams} }
298
+ { {> _param} },
299
+ { {/formParams} }
300
+ ]
301
+
302
+ let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
303
+ let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
304
+ { {/hasFormParams} }
305
+ { {^hasFormParams} }
306
+ let localVariableParameters: [String: Any]? = nil
307
+ { {/hasFormParams} }
308
+ { {/bodyParam} }{ {#hasQueryParams} }
309
+ var localVariableUrlComponents = URLComponents(string: localVariableURLString)
310
+ localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([{ {^queryParams} }:{ {/queryParams} }
311
+ { {#queryParams} }
312
+ { {> _param} },
313
+ { {/queryParams} }
314
+ ]){ {/hasQueryParams} }{ {^hasQueryParams} }
315
+ let localVariableUrlComponents = URLComponents(string: localVariableURLString){ {/hasQueryParams} }
316
+
317
+ let localVariableNillableHeaders: [String: Any?] = [{ {^headerParams} }{ {^hasFormParams} }{ {^hasConsumes} }
318
+ :{ {/hasConsumes} }{ {/hasFormParams} }{ {/headerParams} }{ {#hasFormParams} }
319
+ "Content-Type": { {^consumes} }"multipart/form-data"{ {/consumes} }{ {#consumes.0} }"{ {{mediaType} }}"{ {/consumes.0} },{ {/hasFormParams} }{ {^hasFormParams} }{ {#hasConsumes} }
320
+ "Content-Type": { {#consumes.0} }"{ {{mediaType} }}"{ {/consumes.0} },{ {/hasConsumes} }{ {/hasFormParams} }{ {#headerParams} }
321
+ { {> _param} },{ {/headerParams} }
322
+ ]
323
+
324
+ let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
325
+
326
+ let localVariableRequestBuilder: RequestBuilder<{ {{returnType} }}{ {#returnType} }{ {#isResponseOptional} }?{ {/isResponseOptional} }{ {/returnType} }{ {^returnType} }Void{ {/returnType} }>.Type = openAPIClient.requestBuilderFactory.{ {#returnType} }getBuilder(){ {/returnType} }{ {^returnType} }getNonDecodableBuilder(){ {/returnType} }
327
+
328
+ return localVariableRequestBuilder.init(method: "{ {httpMethod} }", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: { {#hasAuthMethods} }true{ {/hasAuthMethods} }{ {^hasAuthMethods} }false{ {/hasAuthMethods} }, openAPIClient: openAPIClient)
329
+ }
330
+ { {/useVapor} }
260
331
{ {#useVapor} }
261
332
262
333
/**
@@ -381,87 +452,6 @@ extension {{projectName}}API {
381
452
}
382
453
}
383
454
{ {/useVapor} }
384
- { {^useVapor} }
385
-
386
- /**
387
- { {#summary} }
388
- { {{.} }}
389
- { {/summary} }
390
- - { {httpMethod} } { {{path} }}{ {#notes} }
391
- - { {{.} }}{ {/notes} }{ {#subresourceOperation} }
392
- - subresourceOperation: { {.} }{ {/subresourceOperation} }{ {#defaultResponse} }
393
- - defaultResponse: { {.} }{ {/defaultResponse} }
394
- { {#authMethods} }
395
- - { {#isBasicBasic} }BASIC{ {/isBasicBasic} }{ {#isBasicBearer} }Bearer Token{ {/isBasicBearer} }{ {#isOAuth} }OAuth{ {/isOAuth} }{ {#isApiKey} }API Key{ {/isApiKey} }:
396
- - type: { {type} }{ {#keyParamName} } { {keyParamName} } { {#isKeyInQuery} }(QUERY){ {/isKeyInQuery} }{ {#isKeyInHeader} }(HEADER){ {/isKeyInHeader} }{ {/keyParamName} }
397
- - name: { {name} }
398
- { {/authMethods} }
399
- { {#hasResponseHeaders} }
400
- - responseHeaders: [{ {#responseHeaders} }{ {{baseName} }}({ {{dataType} }}){ {^-last} }, { {/-last} }{ {/responseHeaders} }]
401
- { {/hasResponseHeaders} }
402
- { {#externalDocs} }
403
- - externalDocs: { {.} }
404
- { {/externalDocs} }
405
- { {#allParams} }
406
- - 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} }
407
- { {/allParams} }{ {#apiStaticMethod} }
408
- - parameter openAPIClient: The OpenAPIClient that contains the configuration for the http request.{ {/apiStaticMethod} }
409
- - returns: RequestBuilder<{ {{returnType} }}{ {#returnType} }{ {#isResponseOptional} }?{ {/isResponseOptional} }{ {/returnType} }{ {^returnType} }Void{ {/returnType} }> { {description} }
410
- */
411
- { {#isDeprecated} }
412
- @available(*, deprecated, message: "This operation is deprecated.")
413
- { {/isDeprecated} }
414
- { {#nonPublicApi} }internal{ {/nonPublicApi} }{ {^nonPublicApi} }open{ {/nonPublicApi} } { {#apiStaticMethod} }class { {/apiStaticMethod} }func { {operationId} }WithRequestBuilder({ {#allParams} }{ {paramName} }: { {#isEnum} }{ {#isContainer} }[{ {enumName} }_{ {operationId} }]{ {/isContainer} }{ {^isContainer} }{ {enumName} }_{ {operationId} }{ {/isContainer} }{ {/isEnum} }{ {^isEnum} }{ {{dataType} }}{ {/isEnum} }{ {^required} }? = nil{ {/required} }{ {^-last} }, { {/-last} }{ {/allParams} }{ {#apiStaticMethod} }{ {#hasParams} }, { {/hasParams} }openAPIClient: OpenAPIClient = OpenAPIClient.shared{ {/apiStaticMethod} }) -> RequestBuilder<{ {{returnType} }}{ {#returnType} }{ {#isResponseOptional} }?{ {/isResponseOptional} }{ {/returnType} }{ {^returnType} }Void{ {/returnType} }> {
415
- {{^pathParams} }let{ {/pathParams} }{ {#pathParams} }{ {#-first} }var{ {/-first} }{ {/pathParams} } localVariablePath = "{ {{path} }}"{ {#pathParams} }
416
- let { {paramName} }PreEscape = "\({ {#isEnum} }{ {paramName} }{ {#isContainer} }{ {{dataType} }}{ {/isContainer} }{ {^isContainer} }.rawValue{ {/isContainer} }{ {/isEnum} }{ {^isEnum} }APIHelper.mapValueToPathItem({ {paramName} }){ {/isEnum} })"
417
- let { {paramName} }PostEscape = { {paramName} }PreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? ""
418
- localVariablePath = localVariablePath.replacingOccurrences(of: "{ {=<% %>= } }{ <% baseName%> } <%={ { } }=%>", with: { {paramName} }PostEscape, options: .literal, range: nil){ {/pathParams} }
419
- let localVariableURLString = openAPIClient.basePath + localVariablePath
420
- { {#bodyParam} }
421
- { {#isBinary} }
422
- let localVariableParameters = ["body": { {paramName} }]
423
- { {/isBinary} }
424
- { {^isBinary} }
425
- let localVariableParameters = JSONEncodingHelper.encodingParameters(forEncodableObject: { {paramName} }, codableHelper: openAPIClient.codableHelper)
426
- { {/isBinary} }
427
- { {/bodyParam} }
428
- { {^bodyParam} }
429
- { {#hasFormParams} }
430
- let localVariableFormParams: [String: Any?] = [
431
- { {#formParams} }
432
- { {> _param} },
433
- { {/formParams} }
434
- ]
435
-
436
- let localVariableNonNullParameters = APIHelper.rejectNil(localVariableFormParams)
437
- let localVariableParameters = APIHelper.convertBoolToString(localVariableNonNullParameters)
438
- { {/hasFormParams} }
439
- { {^hasFormParams} }
440
- let localVariableParameters: [String: Any]? = nil
441
- { {/hasFormParams} }
442
- { {/bodyParam} }{ {#hasQueryParams} }
443
- var localVariableUrlComponents = URLComponents(string: localVariableURLString)
444
- localVariableUrlComponents?.queryItems = APIHelper.mapValuesToQueryItems([{ {^queryParams} }:{ {/queryParams} }
445
- { {#queryParams} }
446
- { {> _param} },
447
- { {/queryParams} }
448
- ]){ {/hasQueryParams} }{ {^hasQueryParams} }
449
- let localVariableUrlComponents = URLComponents(string: localVariableURLString){ {/hasQueryParams} }
450
-
451
- let localVariableNillableHeaders: [String: Any?] = [{ {^headerParams} }{ {^hasFormParams} }{ {^hasConsumes} }
452
- :{ {/hasConsumes} }{ {/hasFormParams} }{ {/headerParams} }{ {#hasFormParams} }
453
- "Content-Type": { {^consumes} }"multipart/form-data"{ {/consumes} }{ {#consumes.0} }"{ {{mediaType} }}"{ {/consumes.0} },{ {/hasFormParams} }{ {^hasFormParams} }{ {#hasConsumes} }
454
- "Content-Type": { {#consumes.0} }"{ {{mediaType} }}"{ {/consumes.0} },{ {/hasConsumes} }{ {/hasFormParams} }{ {#headerParams} }
455
- { {> _param} },{ {/headerParams} }
456
- ]
457
-
458
- let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders)
459
-
460
- let localVariableRequestBuilder: RequestBuilder<{ {{returnType} }}{ {#returnType} }{ {#isResponseOptional} }?{ {/isResponseOptional} }{ {/returnType} }{ {^returnType} }Void{ {/returnType} }>.Type = openAPIClient.requestBuilderFactory.{ {#returnType} }getBuilder(){ {/returnType} }{ {^returnType} }getNonDecodableBuilder(){ {/returnType} }
461
-
462
- return localVariableRequestBuilder.init(method: "{ {httpMethod} }", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: { {#hasAuthMethods} }true{ {/hasAuthMethods} }{ {^hasAuthMethods} }false{ {/hasAuthMethods} }, openAPIClient: openAPIClient)
463
- }
464
- { {/useVapor} }
465
455
{ {/operation} }
466
456
}
467
457
{ {#swiftUseApiNamespace} }
0 commit comments