Skip to content

Commit dcd11c2

Browse files
committed
[swift6][client] make api calls concurrent
1 parent cc045ab commit dcd11c2

40 files changed

Lines changed: 129 additions & 15 deletions

File tree

modules/openapi-generator/src/main/resources/swift6/APIs.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ import Alamofire{{/useAlamofire}}
119119
}
120120

121121
{{#useAsyncAwait}}
122+
@concurrent
122123
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
123124
@discardableResult
124125
{{#nonPublicApi}}internal{{/nonPublicApi}}{{^nonPublicApi}}open{{/nonPublicApi}} func execute() async throws(ErrorResponse) -> Response<T> {

modules/openapi-generator/src/main/resources/swift6/Package.swift.mustache

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:6.0
1+
// swift-tools-version:6.2
22

33
import PackageDescription
44

modules/openapi-generator/src/main/resources/swift6/api.mustache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ extension {{projectName}}API {
209209
- parameter apiConfiguration: The configuration for the http request.{{/apiStaticMethod}}
210210
- returns: {{{returnType}}}{{#returnType}}{{#isResponseOptional}}?{{/isResponseOptional}}{{/returnType}}{{^returnType}}Void{{/returnType}}
211211
*/
212+
@concurrent
212213
{{#isDeprecated}}
213214
@available(*, deprecated, message: "This operation is deprecated.")
214215
{{/isDeprecated}}

samples/client/petstore/swift6/alamofireLibrary/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:6.0
1+
// swift-tools-version:6.2
22

33
import PackageDescription
44

samples/client/petstore/swift6/apiNonStaticMethod/Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:6.0
1+
// swift-tools-version:6.2
22

33
import PackageDescription
44

samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/AnotherFakeAPI.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ open class AnotherFakeAPI {
116116
- parameter body: (body) client model
117117
- returns: Client
118118
*/
119+
@concurrent
119120
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
120121
open func call123testSpecialTags(body: Client) async throws(ErrorResponse) -> Client {
121122
return try await call123testSpecialTagsWithRequestBuilder(body: body).execute().body

samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeAPI.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ open class FakeAPI {
111111
- parameter body: (body) Input boolean as post body (optional)
112112
- returns: Bool
113113
*/
114+
@concurrent
114115
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
115116
open func fakeOuterBooleanSerialize(body: Bool? = nil) async throws(ErrorResponse) -> Bool {
116117
return try await fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute().body
@@ -250,6 +251,7 @@ open class FakeAPI {
250251
- parameter body: (body) Input composite as post body (optional)
251252
- returns: OuterComposite
252253
*/
254+
@concurrent
253255
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
254256
open func fakeOuterCompositeSerialize(body: OuterComposite? = nil) async throws(ErrorResponse) -> OuterComposite {
255257
return try await fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute().body
@@ -389,6 +391,7 @@ open class FakeAPI {
389391
- parameter body: (body) Input number as post body (optional)
390392
- returns: Double
391393
*/
394+
@concurrent
392395
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
393396
open func fakeOuterNumberSerialize(body: Double? = nil) async throws(ErrorResponse) -> Double {
394397
return try await fakeOuterNumberSerializeWithRequestBuilder(body: body).execute().body
@@ -528,6 +531,7 @@ open class FakeAPI {
528531
- parameter body: (body) Input string as post body (optional)
529532
- returns: String
530533
*/
534+
@concurrent
531535
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
532536
open func fakeOuterStringSerialize(body: String? = nil) async throws(ErrorResponse) -> String {
533537
return try await fakeOuterStringSerializeWithRequestBuilder(body: body).execute().body
@@ -667,6 +671,7 @@ open class FakeAPI {
667671
- parameter body: (body)
668672
- returns: Void
669673
*/
674+
@concurrent
670675
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
671676
open func testBodyWithFileSchema(body: FileSchemaTestClass) async throws(ErrorResponse) {
672677
return try await testBodyWithFileSchemaWithRequestBuilder(body: body).execute().body
@@ -811,6 +816,7 @@ open class FakeAPI {
811816
- parameter body: (body)
812817
- returns: Void
813818
*/
819+
@concurrent
814820
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
815821
open func testBodyWithQueryParams(query: String, body: User) async throws(ErrorResponse) {
816822
return try await testBodyWithQueryParamsWithRequestBuilder(query: query, body: body).execute().body
@@ -959,6 +965,7 @@ open class FakeAPI {
959965
- parameter body: (body) client model
960966
- returns: Client
961967
*/
968+
@concurrent
962969
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
963970
open func testClientModel(body: Client) async throws(ErrorResponse) -> Client {
964971
return try await testClientModelWithRequestBuilder(body: body).execute().body
@@ -1170,6 +1177,7 @@ open class FakeAPI {
11701177
- parameter callback: (form) None (optional)
11711178
- returns: Void
11721179
*/
1180+
@concurrent
11731181
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
11741182
open func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int? = nil, int32: Int? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: Date? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) async throws(ErrorResponse) {
11751183
return try await testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute().body
@@ -1465,6 +1473,7 @@ open class FakeAPI {
14651473
- parameter enumFormString: (form) Form parameter enum test (string) (optional, default to .efg)
14661474
- returns: Void
14671475
*/
1476+
@concurrent
14681477
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
14691478
open func testEnumParameters(enumHeaderStringArray: [EnumHeaderStringArray_testEnumParameters]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [EnumQueryStringArray_testEnumParameters]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, enumFormStringArray: [EnumFormStringArray_testEnumParameters]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil) async throws(ErrorResponse) {
14701479
return try await testEnumParametersWithRequestBuilder(enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble, enumFormStringArray: enumFormStringArray, enumFormString: enumFormString).execute().body
@@ -1664,6 +1673,7 @@ open class FakeAPI {
16641673
- parameter int64Group: (query) Integer in group parameters (optional)
16651674
- returns: Void
16661675
*/
1676+
@concurrent
16671677
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
16681678
open func testGroupParameters(requiredStringGroup: Int, requiredBooleanGroup: Bool, requiredInt64Group: Int64, stringGroup: Int? = nil, booleanGroup: Bool? = nil, int64Group: Int64? = nil) async throws(ErrorResponse) {
16691679
return try await testGroupParametersWithRequestBuilder(requiredStringGroup: requiredStringGroup, requiredBooleanGroup: requiredBooleanGroup, requiredInt64Group: requiredInt64Group, stringGroup: stringGroup, booleanGroup: booleanGroup, int64Group: int64Group).execute().body
@@ -1827,6 +1837,7 @@ open class FakeAPI {
18271837
- parameter param: (body) request body
18281838
- returns: Void
18291839
*/
1840+
@concurrent
18301841
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
18311842
open func testInlineAdditionalProperties(param: [String: String]) async throws(ErrorResponse) {
18321843
return try await testInlineAdditionalPropertiesWithRequestBuilder(param: param).execute().body
@@ -1977,6 +1988,7 @@ open class FakeAPI {
19771988
- parameter param2: (form) field2
19781989
- returns: Void
19791990
*/
1991+
@concurrent
19801992
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
19811993
open func testJsonFormData(param: String, param2: String) async throws(ErrorResponse) {
19821994
return try await testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute().body

samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/FakeClassnameTags123API.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ open class FakeClassnameTags123API {
116116
- parameter body: (body) client model
117117
- returns: Client
118118
*/
119+
@concurrent
119120
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
120121
open func testClassname(body: Client) async throws(ErrorResponse) -> Client {
121122
return try await testClassnameWithRequestBuilder(body: body).execute().body

samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ open class PetAPI {
116116
- parameter body: (body) Pet object that needs to be added to the store
117117
- returns: Void
118118
*/
119+
@concurrent
119120
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
120121
open func addPet(body: Pet) async throws(ErrorResponse) {
121122
return try await addPetWithRequestBuilder(body: body).execute().body
@@ -272,6 +273,7 @@ open class PetAPI {
272273
- parameter apiKey: (header) (optional)
273274
- returns: Void
274275
*/
276+
@concurrent
275277
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
276278
open func deletePet(petId: Int64, apiKey: String? = nil) async throws(ErrorResponse) {
277279
return try await deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute().body
@@ -434,6 +436,7 @@ open class PetAPI {
434436
- parameter status: (query) Status values that need to be considered for filter
435437
- returns: [Pet]
436438
*/
439+
@concurrent
437440
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
438441
open func findPetsByStatus(status: [Status_findPetsByStatus]) async throws(ErrorResponse) -> [Pet] {
439442
return try await findPetsByStatusWithRequestBuilder(status: status).execute().body
@@ -590,6 +593,7 @@ open class PetAPI {
590593
- parameter tags: (query) Tags to filter by
591594
- returns: [Pet]
592595
*/
596+
@concurrent
593597
@available(*, deprecated, message: "This operation is deprecated.")
594598
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
595599
open func findPetsByTags(tags: [String]) async throws(ErrorResponse) -> [Pet] {
@@ -745,6 +749,7 @@ open class PetAPI {
745749
- parameter petId: (path) ID of pet to return
746750
- returns: Pet
747751
*/
752+
@concurrent
748753
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
749754
open func getPetById(petId: Int64) async throws(ErrorResponse) -> Pet {
750755
return try await getPetByIdWithRequestBuilder(petId: petId).execute().body
@@ -897,6 +902,7 @@ open class PetAPI {
897902
- parameter body: (body) Pet object that needs to be added to the store
898903
- returns: Void
899904
*/
905+
@concurrent
900906
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
901907
open func updatePet(body: Pet) async throws(ErrorResponse) {
902908
return try await updatePetWithRequestBuilder(body: body).execute().body
@@ -1055,6 +1061,7 @@ open class PetAPI {
10551061
- parameter status: (form) Updated status of the pet (optional)
10561062
- returns: Void
10571063
*/
1064+
@concurrent
10581065
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
10591066
open func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil) async throws(ErrorResponse) {
10601067
return try await updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute().body
@@ -1226,6 +1233,7 @@ open class PetAPI {
12261233
- parameter file: (form) file to upload (optional)
12271234
- returns: ApiResponse
12281235
*/
1236+
@concurrent
12291237
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
12301238
open func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: Data? = nil) async throws(ErrorResponse) -> ApiResponse {
12311239
return try await uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute().body
@@ -1397,6 +1405,7 @@ open class PetAPI {
13971405
- parameter additionalMetadata: (form) Additional data to pass to server (optional)
13981406
- returns: ApiResponse
13991407
*/
1408+
@concurrent
14001409
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
14011410
open func uploadFileWithRequiredFile(petId: Int64, requiredFile: Data, additionalMetadata: String? = nil) async throws(ErrorResponse) -> ApiResponse {
14021411
return try await uploadFileWithRequiredFileWithRequestBuilder(petId: petId, requiredFile: requiredFile, additionalMetadata: additionalMetadata).execute().body

samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/StoreAPI.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ open class StoreAPI {
116116
- parameter orderId: (path) ID of the order that needs to be deleted
117117
- returns: Void
118118
*/
119+
@concurrent
119120
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
120121
open func deleteOrder(orderId: String) async throws(ErrorResponse) {
121122
return try await deleteOrderWithRequestBuilder(orderId: orderId).execute().body
@@ -260,6 +261,7 @@ open class StoreAPI {
260261

261262
- returns: [String: Int]
262263
*/
264+
@concurrent
263265
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
264266
open func getInventory() async throws(ErrorResponse) -> [String: Int] {
265267
return try await getInventoryWithRequestBuilder().execute().body
@@ -407,6 +409,7 @@ open class StoreAPI {
407409
- parameter orderId: (path) ID of pet that needs to be fetched
408410
- returns: Order
409411
*/
412+
@concurrent
410413
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
411414
open func getOrderById(orderId: Int64) async throws(ErrorResponse) -> Order {
412415
return try await getOrderByIdWithRequestBuilder(orderId: orderId).execute().body
@@ -556,6 +559,7 @@ open class StoreAPI {
556559
- parameter body: (body) order placed for purchasing the pet
557560
- returns: Order
558561
*/
562+
@concurrent
559563
@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
560564
open func placeOrder(body: Order) async throws(ErrorResponse) -> Order {
561565
return try await placeOrderWithRequestBuilder(body: body).execute().body

0 commit comments

Comments
 (0)