From 840720aa54717d95a04014247f71aaaed34e9624 Mon Sep 17 00:00:00 2001 From: Jonas Reichert Date: Fri, 11 Jul 2025 08:39:31 +0200 Subject: [PATCH 1/5] Fix image upload for content-type image --- .../libraries/urlsession/URLSessionImplementations.mustache | 2 +- .../libraries/urlsession/URLSessionImplementations.mustache | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache index 3f60f35560ea..d305f167903a 100644 --- a/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift5/libraries/urlsession/URLSessionImplementations.mustache @@ -140,7 +140,7 @@ private var credentialStore = SynchronizedDictionary() encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache index af45cadbeb5c..191545c3d70e 100644 --- a/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache +++ b/modules/openapi-generator/src/main/resources/swift6/libraries/urlsession/URLSessionImplementations.mustache @@ -140,7 +140,7 @@ fileprivate class URLSessionRequestBuilderConfiguration: @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") From 4a3bf4ce4e7cf252ddd0e264012ce953afc415d6 Mon Sep 17 00:00:00 2001 From: Jonas Reichert Date: Fri, 11 Jul 2025 08:42:19 +0200 Subject: [PATCH 2/5] update samples --- .../Classes/OpenAPIs/URLSessionImplementations.swift | 2 +- .../Classes/OpenAPIs/URLSessionImplementations.swift | 2 +- .../Classes/OpenAPIs/URLSessionImplementations.swift | 2 +- .../Classes/OpenAPIs/URLSessionImplementations.swift | 2 +- .../Classes/OpenAPIs/URLSessionImplementations.swift | 2 +- .../Classes/OpenAPIs/URLSessionImplementations.swift | 2 +- .../Classes/OpenAPIs/URLSessionImplementations.swift | 2 +- .../Classes/OpenAPIs/URLSessionImplementations.swift | 2 +- .../Sources/PetstoreClient/URLSessionImplementations.swift | 2 +- .../Classes/OpenAPIs/URLSessionImplementations.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- .../Infrastructure/URLSessionImplementations.swift | 2 +- .../OpenAPIs/Infrastructure/URLSessionImplementations.swift | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index aa6558b927bb..6f10c3cae311 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index aa6558b927bb..6f10c3cae311 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index aa6558b927bb..6f10c3cae311 100644 --- a/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/default/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index aa6558b927bb..6f10c3cae311 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index aa6558b927bb..6f10c3cae311 100644 --- a/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/oneOf/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index aa6558b927bb..6f10c3cae311 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index 8d45a2bbb69f..7525c158b9a6 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -140,7 +140,7 @@ internal class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index aa6558b927bb..6f10c3cae311 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift index aa6558b927bb..6f10c3cae311 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift index aa6558b927bb..6f10c3cae311 100644 --- a/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift +++ b/samples/client/petstore/swift5/validation/PetstoreClient/Classes/OpenAPIs/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/default/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/oneOf/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index d787d429b317..06b39a401202 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ internal class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendab encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") diff --git a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift index 802e927474b3..93bcea293c65 100644 --- a/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift +++ b/samples/client/petstore/swift6/validation/PetstoreClient/Classes/OpenAPIs/Infrastructure/URLSessionImplementations.swift @@ -140,7 +140,7 @@ open class URLSessionRequestBuilder: RequestBuilder, @unchecked Sendable { encoding = FormDataEncoding(contentTypeForFormPart: contentTypeForFormPart(fileURL:)) } else if contentType.hasPrefix("application/x-www-form-urlencoded") { encoding = FormURLEncoding() - } else if contentType.hasPrefix("application/octet-stream"){ + } else if contentType.hasPrefix("application/octet-stream") || contentType.hasPrefix("image/") { encoding = OctetStreamEncoding() } else { fatalError("Unsupported Media Type - \(contentType)") From 92202dd8506b2482cda69fe1d95a61d5a51881e3 Mon Sep 17 00:00:00 2001 From: Jonas Reichert Date: Fri, 11 Jul 2025 09:03:45 +0200 Subject: [PATCH 3/5] add test case in spec and update samples --- ...ith-fake-endpoints-models-for-testing.yaml | 35 ++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 51 ++++++ .../swift5/alamofireLibrary/README.md | 1 + .../swift5/alamofireLibrary/docs/PetAPI.md | 51 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 43 +++++ .../swift5/asyncAwaitLibrary/README.md | 1 + .../swift5/asyncAwaitLibrary/docs/PetAPI.md | 51 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 60 +++++++ .../petstore/swift5/combineLibrary/README.md | 1 + .../swift5/combineLibrary/docs/PetAPI.md | 51 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 51 ++++++ .../petstore/swift5/objcCompatible/README.md | 1 + .../swift5/objcCompatible/docs/PetAPI.md | 51 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 51 ++++++ .../swift5/promisekitLibrary/README.md | 1 + .../swift5/promisekitLibrary/docs/PetAPI.md | 48 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 51 ++++++ .../petstore/swift5/resultLibrary/README.md | 1 + .../swift5/resultLibrary/docs/PetAPI.md | 51 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 57 +++++++ .../petstore/swift5/rxswiftLibrary/README.md | 1 + .../swift5/rxswiftLibrary/docs/PetAPI.md | 41 +++++ .../swift5/urlsessionLibrary/README.md | 1 + .../Sources/PetstoreClient/APIs/PetAPI.swift | 51 ++++++ .../swift5/urlsessionLibrary/docs/PetAPI.md | 51 ++++++ .../swift6/alamofireLibrary/README.md | 1 + .../Sources/PetstoreClient/APIs/PetAPI.swift | 52 ++++++ .../swift6/alamofireLibrary/docs/PetAPI.md | 51 ++++++ .../swift6/apiNonStaticMethod/README.md | 1 + .../Sources/PetstoreClient/APIs/PetAPI.swift | 158 ++++++++++++++++++ .../swift6/apiNonStaticMethod/docs/PetAPI.md | 50 ++++++ .../swift6/asyncAwaitLibrary/README.md | 1 + .../Sources/PetstoreClient/APIs/PetAPI.swift | 45 +++++ .../swift6/asyncAwaitLibrary/docs/PetAPI.md | 51 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 65 +++++++ .../swift6/combineDeferredLibrary/README.md | 1 + .../combineDeferredLibrary/docs/PetAPI.md | 51 ++++++ .../petstore/swift6/combineLibrary/README.md | 1 + .../Sources/CombineLibrary/APIs/PetAPI.swift | 63 +++++++ .../swift6/combineLibrary/docs/PetAPI.md | 51 ++++++ .../petstore/swift6/objcCompatible/README.md | 1 + .../Sources/PetstoreClient/APIs/PetAPI.swift | 52 ++++++ .../swift6/objcCompatible/docs/PetAPI.md | 51 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 53 ++++++ .../swift6/promisekitLibrary/README.md | 1 + .../swift6/promisekitLibrary/docs/PetAPI.md | 48 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 52 ++++++ .../petstore/swift6/resultLibrary/README.md | 1 + .../swift6/resultLibrary/docs/PetAPI.md | 51 ++++++ .../Classes/OpenAPIs/APIs/PetAPI.swift | 58 +++++++ .../petstore/swift6/rxswiftLibrary/README.md | 1 + .../swift6/rxswiftLibrary/docs/PetAPI.md | 41 +++++ .../swift6/urlsessionLibrary/README.md | 1 + .../Sources/PetstoreClient/APIs/PetAPI.swift | 52 ++++++ .../swift6/urlsessionLibrary/docs/PetAPI.md | 51 ++++++ 55 files changed, 2009 insertions(+) diff --git a/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml index 27e1524dab47..c7b36127b1f6 100644 --- a/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml @@ -273,6 +273,38 @@ paths: - petstore_auth: - 'write:pets' - 'read:pets' + put: + tags: + - pet + summary: updates an existing image + description: '' + operationId: updateImageFile + consumes: + - image/jpeg + produces: + - application/json + parameters: + - name: petId + in: path + description: ID of pet to update + required: true + type: integer + format: int64 + - name: imageData + in: body + description: file to upload + required: false + schema: + $ref: '#/definitions/InputStream' + responses: + '200': + description: successful operation + schema: + $ref: '#/definitions/ApiResponse' + security: + - petstore_auth: + - 'write:pets' + - 'read:pets' /store/inventory: get: tags: @@ -1642,3 +1674,6 @@ definitions: - 1 - 2 - 3 + InputStream: + type: string + format: binary \ No newline at end of file diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 747cb1406a87..502a26b1bdd9 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -273,6 +273,57 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift5/alamofireLibrary/README.md b/samples/client/petstore/swift5/alamofireLibrary/README.md index 9878ab2fc016..ccb031b6990c 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/README.md +++ b/samples/client/petstore/swift5/alamofireLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md index e6219c37c4ec..0c5c6692c04f 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index dfefa61d1d58..e03218ec5044 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -233,6 +233,49 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: ApiResponse + */ + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + open class func updateImageFile(petId: Int64, imageData: URL? = nil) async throws -> ApiResponse { + return try await updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute().body + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/README.md b/samples/client/petstore/swift5/asyncAwaitLibrary/README.md index 59c41d91dbbc..8fc3353c2500 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/README.md +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md index e6219c37c4ec..0c5c6692c04f 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index b206cde011e3..e2d8fe77943c 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -321,6 +321,66 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: AnyPublisher + */ + #if canImport(Combine) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + open class func updateImageFile(petId: Int64, imageData: URL? = nil) -> AnyPublisher { + let requestBuilder = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData) + let requestTask = requestBuilder.requestTask + return Future { promise in + requestBuilder.execute { result in + switch result { + case let .success(response): + promise(.success(response.body)) + case let .failure(error): + promise(.failure(error)) + } + } + } + .handleEvents(receiveCancel: { + requestTask.cancel() + }) + .eraseToAnyPublisher() + } + #endif + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift5/combineLibrary/README.md b/samples/client/petstore/swift5/combineLibrary/README.md index 59c41d91dbbc..8fc3353c2500 100644 --- a/samples/client/petstore/swift5/combineLibrary/README.md +++ b/samples/client/petstore/swift5/combineLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md index e6219c37c4ec..0c5c6692c04f 100644 --- a/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 5510610fcd5b..b2775cefb9a0 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -273,6 +273,57 @@ import AnyCodable return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift5/objcCompatible/README.md b/samples/client/petstore/swift5/objcCompatible/README.md index 59c41d91dbbc..8fc3353c2500 100644 --- a/samples/client/petstore/swift5/objcCompatible/README.md +++ b/samples/client/petstore/swift5/objcCompatible/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md b/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md index 508d13dae383..8bbf6c485f1e 100644 --- a/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md +++ b/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index c2813aa9f6ed..fb95432030aa 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -274,6 +274,57 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: Promise + */ + open class func updateImageFile( petId: Int64, imageData: URL? = nil) -> Promise { + let deferred = Promise.pending() + updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in + switch result { + case let .success(response): + deferred.resolver.fulfill(response.body) + case let .failure(error): + deferred.resolver.reject(error) + } + } + return deferred.promise + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift5/promisekitLibrary/README.md b/samples/client/petstore/swift5/promisekitLibrary/README.md index 59c41d91dbbc..8fc3353c2500 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/README.md +++ b/samples/client/petstore/swift5/promisekitLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md index 73755de2c49a..05a8beb15e7b 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -248,6 +249,53 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile( petId: Int64, imageData: URL? = nil) -> Promise +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData).then { + // when the promise is fulfilled + }.always { + // regardless of whether the promise is fulfilled, or rejected + }.catch { errorType in + // when the promise is rejected +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet( body: Pet) -> Promise diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 9c18968b6567..b122dc98a7dc 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -273,6 +273,57 @@ internal class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the result + */ + @discardableResult + internal class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in + switch result { + case let .success(response): + completion(.success(response.body)) + case let .failure(error): + completion(.failure(error)) + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: RequestBuilder + */ + internal class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift5/resultLibrary/README.md b/samples/client/petstore/swift5/resultLibrary/README.md index 59c41d91dbbc..8fc3353c2500 100644 --- a/samples/client/petstore/swift5/resultLibrary/README.md +++ b/samples/client/petstore/swift5/resultLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md index 5d22a913fc65..dce53a9395bd 100644 --- a/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + internal class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift internal class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 161cac524b57..2aeea4fbe882 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -304,6 +304,63 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - returns: Observable + */ + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { + return Observable.create { observer -> Disposable in + let requestTask = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in + switch result { + case let .success(response): + observer.onNext(response.body) + case let .failure(error): + observer.onError(error) + } + observer.onCompleted() + } + + return Disposables.create { + requestTask.cancel() + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift5/rxswiftLibrary/README.md b/samples/client/petstore/swift5/rxswiftLibrary/README.md index 59c41d91dbbc..8fc3353c2500 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/README.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md index 6a03adef99da..206146747928 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -213,6 +214,46 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil) -> Observable +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet) -> Observable diff --git a/samples/client/petstore/swift5/urlsessionLibrary/README.md b/samples/client/petstore/swift5/urlsessionLibrary/README.md index 59c41d91dbbc..8fc3353c2500 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/README.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index 3741d7f42773..0908ea889e34 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -276,6 +276,57 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiResponseQueue: The queue on which api response is dispatched. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: Any?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md index e6219c37c4ec..0c5c6692c04f 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/alamofireLibrary/README.md b/samples/client/petstore/swift6/alamofireLibrary/README.md index c3325e8a8df2..74ddce04833c 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/README.md +++ b/samples/client/petstore/swift6/alamofireLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index 9db9ecc94dd6..6c7bf7ecfb53 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -275,6 +275,58 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/alamofireLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/alamofireLibrary/docs/PetAPI.md index e6219c37c4ec..0c5c6692c04f 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/alamofireLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/README.md b/samples/client/petstore/swift6/apiNonStaticMethod/README.md index 9d2e16b15277..40ce4b5ce545 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/README.md +++ b/samples/client/petstore/swift6/apiNonStaticMethod/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift index fb4c4debdc92..a1b36ab3945a 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift @@ -799,6 +799,164 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open func updateImageFile(petId: Int64, imageData: Data? = nil, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: Promise + */ + open func updateImageFile(petId: Int64, imageData: Data? = nil) -> Promise { + let deferred = Promise.pending() + updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in + switch result { + case let .success(response): + deferred.resolver.fulfill(response.body) + case let .failure(error): + deferred.resolver.reject(error) + } + } + return deferred.promise + } + + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: Observable + */ + open func updateImageFile(petId: Int64, imageData: Data? = nil) -> Observable { + return Observable.create { observer -> Disposable in + let requestTask = self.updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in + switch result { + case let .success(response): + observer.onNext(response.body) + case let .failure(error): + observer.onError(error) + } + observer.onCompleted() + } + + return Disposables.create { + requestTask.cancel() + } + } + } + + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: AnyPublisher + */ + #if canImport(Combine) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + open func updateImageFile(petId: Int64, imageData: Data? = nil) -> AnyPublisher { + let requestBuilder = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData) + let requestTask = requestBuilder.requestTask + return Deferred { Future { promise in + nonisolated(unsafe) let promise = promise + requestBuilder.execute { result in + switch result { + case let .success(response): + promise(.success(response.body)) + case let .failure(error): + promise(.failure(error)) + } + } + } + .handleEvents(receiveCancel: { + requestTask.cancel() + }) + .eraseToAnyPublisher() + } + .eraseToAnyPublisher() + } + #endif + + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: ApiResponse + */ + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + open func updateImageFile(petId: Int64, imageData: Data? = nil) async throws(ErrorResponse) -> ApiResponse { + return try await updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute().body + } + + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter completion: completion handler to receive the result + */ + @discardableResult + open func updateImageFile(petId: Int64, imageData: Data? = nil, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in + switch result { + case let .success(response): + completion(.success(response.body)) + case let .failure(error): + completion(.failure(error)) + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - returns: RequestBuilder + */ + open func updateImageFileWithRequestBuilder(petId: Int64, imageData: Data? = nil) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md b/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md index b675fdb7bb78..52123941cb20 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md +++ b/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -258,6 +259,55 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile( petId: Int64, imageData: Data? = nil) -> Promise + open class func updateImageFile(petId: Int64, imageData: Data? = nil) -> Observable +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = Data([9, 8, 7]) // Data | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData).then { + // when the promise is fulfilled + }.always { + // regardless of whether the promise is fulfilled, or rejected + }.catch { errorType in + // when the promise is rejected +} +// TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **Data** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet( body: Pet) -> Promise diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/README.md b/samples/client/petstore/swift6/asyncAwaitLibrary/README.md index 2b8b1303fd01..2b7f6e13f90c 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/README.md +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index e7e2b597031e..eb44e2672f55 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -240,6 +240,51 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: ApiResponse + */ + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> ApiResponse { + return try await updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute().body + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/asyncAwaitLibrary/docs/PetAPI.md index e6219c37c4ec..0c5c6692c04f 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index eed0d1d858bc..d36c5c0eab06 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -343,6 +343,71 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: AnyPublisher + */ + #if canImport(Combine) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration) + let requestTask = requestBuilder.requestTask + return Deferred { Future { promise in + nonisolated(unsafe) let promise = promise + requestBuilder.execute { result in + switch result { + case let .success(response): + promise(.success(response.body)) + case let .failure(error): + promise(.failure(error)) + } + } + } + .handleEvents(receiveCancel: { + requestTask.cancel() + }) + .eraseToAnyPublisher() + } + .eraseToAnyPublisher() + } + #endif + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/README.md b/samples/client/petstore/swift6/combineDeferredLibrary/README.md index 2b8b1303fd01..2b7f6e13f90c 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/README.md +++ b/samples/client/petstore/swift6/combineDeferredLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/combineDeferredLibrary/docs/PetAPI.md index e6219c37c4ec..0c5c6692c04f 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/combineDeferredLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/combineLibrary/README.md b/samples/client/petstore/swift6/combineLibrary/README.md index 2b8b1303fd01..2b7f6e13f90c 100644 --- a/samples/client/petstore/swift6/combineLibrary/README.md +++ b/samples/client/petstore/swift6/combineLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift index 903bf2abb822..d9e3cb779981 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift @@ -333,6 +333,69 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: AnyPublisher + */ + #if canImport(Combine) + @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { + let requestBuilder = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration) + let requestTask = requestBuilder.requestTask + return Future { promise in + nonisolated(unsafe) let promise = promise + requestBuilder.execute { result in + switch result { + case let .success(response): + promise(.success(response.body)) + case let .failure(error): + promise(.failure(error)) + } + } + } + .handleEvents(receiveCancel: { + requestTask.cancel() + }) + .eraseToAnyPublisher() + } + #endif + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/combineLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/combineLibrary/docs/PetAPI.md index e6219c37c4ec..0c5c6692c04f 100644 --- a/samples/client/petstore/swift6/combineLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/combineLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/objcCompatible/README.md b/samples/client/petstore/swift6/objcCompatible/README.md index 2b8b1303fd01..2b7f6e13f90c 100644 --- a/samples/client/petstore/swift6/objcCompatible/README.md +++ b/samples/client/petstore/swift6/objcCompatible/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift index 7ab17f299334..b346f0465c24 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift @@ -275,6 +275,58 @@ import Foundation return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/objcCompatible/docs/PetAPI.md b/samples/client/petstore/swift6/objcCompatible/docs/PetAPI.md index 508d13dae383..8bbf6c485f1e 100644 --- a/samples/client/petstore/swift6/objcCompatible/docs/PetAPI.md +++ b/samples/client/petstore/swift6/objcCompatible/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index a81fce6ea032..919b3a8ae606 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -281,6 +281,59 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: Promise + */ + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { + let deferred = Promise.pending() + updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in + switch result { + case let .success(response): + deferred.resolver.fulfill(response.body) + case let .failure(error): + deferred.resolver.reject(error) + } + } + return deferred.promise + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/promisekitLibrary/README.md b/samples/client/petstore/swift6/promisekitLibrary/README.md index 2b8b1303fd01..2b7f6e13f90c 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/README.md +++ b/samples/client/petstore/swift6/promisekitLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/promisekitLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/promisekitLibrary/docs/PetAPI.md index 73755de2c49a..05a8beb15e7b 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/promisekitLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -248,6 +249,53 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile( petId: Int64, imageData: URL? = nil) -> Promise +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData).then { + // when the promise is fulfilled + }.always { + // regardless of whether the promise is fulfilled, or rejected + }.catch { errorType in + // when the promise is rejected +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet( body: Pet) -> Promise diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index fba46c581846..63d74cdb32af 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -275,6 +275,58 @@ internal class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - parameter completion: completion handler to receive the result + */ + @discardableResult + internal class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in + switch result { + case let .success(response): + completion(.success(response.body)) + case let .failure(error): + completion(.failure(error)) + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: RequestBuilder + */ + internal class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/resultLibrary/README.md b/samples/client/petstore/swift6/resultLibrary/README.md index 2b8b1303fd01..2b7f6e13f90c 100644 --- a/samples/client/petstore/swift6/resultLibrary/README.md +++ b/samples/client/petstore/swift6/resultLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/resultLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/resultLibrary/docs/PetAPI.md index 5d22a913fc65..dce53a9395bd 100644 --- a/samples/client/petstore/swift6/resultLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/resultLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + internal class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift internal class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 4a60300c9e73..4d846b0efd8c 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -306,6 +306,64 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: Observable + */ + open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { + return Observable.create { observer -> Disposable in + let requestTask = self.updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in + switch result { + case let .success(response): + observer.onNext(response.body) + case let .failure(error): + observer.onError(error) + } + observer.onCompleted() + } + + return Disposables.create { + requestTask.cancel() + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/rxswiftLibrary/README.md b/samples/client/petstore/swift6/rxswiftLibrary/README.md index 2b8b1303fd01..2b7f6e13f90c 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/README.md +++ b/samples/client/petstore/swift6/rxswiftLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/rxswiftLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/rxswiftLibrary/docs/PetAPI.md index 6a03adef99da..206146747928 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/rxswiftLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -213,6 +214,46 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: URL? = nil) -> Observable +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) + +// TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **URL** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet) -> Observable diff --git a/samples/client/petstore/swift6/urlsessionLibrary/README.md b/samples/client/petstore/swift6/urlsessionLibrary/README.md index 2b8b1303fd01..2b7f6e13f90c 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/README.md +++ b/samples/client/petstore/swift6/urlsessionLibrary/README.md @@ -45,6 +45,7 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index ac1b663d3c49..e768d7ea80c9 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -278,6 +278,58 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } + /** + updates an existing image + + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - parameter completion: completion handler to receive the data and the error objects + */ + @discardableResult + open class func updateImageFile(petId: Int64, imageData: Data? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { + return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in + switch result { + case let .success(response): + completion(response.body, nil) + case let .failure(error): + completion(nil, error) + } + } + } + + /** + updates an existing image + - PUT /pet/{petId}/uploadImage + - OAuth: + - type: oauth2 + - name: petstore_auth + - parameter petId: (path) ID of pet to update + - parameter imageData: (body) file to upload (optional) + - parameter apiConfiguration: The configuration for the http request. + - returns: RequestBuilder + */ + open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: Data? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { + var localVariablePath = "/pet/{petId}/uploadImage" + let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" + let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" + localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) + let localVariableURLString = apiConfiguration.basePath + localVariablePath + let localVariableParameters = ["body": imageData] + + let localVariableUrlComponents = URLComponents(string: localVariableURLString) + + let localVariableNillableHeaders: [String: (any Sendable)?] = [ + "Content-Type": "image/jpeg", + ] + + let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) + + let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() + + return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) + } + /** Update an existing pet diff --git a/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md index 2b3e7c153186..a008c559e3a5 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md @@ -9,6 +9,7 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID +[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -263,6 +264,56 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **updateImageFile** +```swift + open class func updateImageFile(petId: Int64, imageData: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) +``` + +updates an existing image + +### Example +```swift +// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new +import PetstoreClient + +let petId = 987 // Int64 | ID of pet to update +let imageData = Data([9, 8, 7]) // Data | file to upload (optional) + +// updates an existing image +PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in + guard error == nil else { + print(error) + return + } + + if (response) { + dump(response) + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **petId** | **Int64** | ID of pet to update | + **imageData** | **Data** | file to upload | [optional] + +### Return type + +[**ApiResponse**](ApiResponse.md) + +### Authorization + +[petstore_auth](../README.md#petstore_auth) + +### HTTP request headers + + - **Content-Type**: image/jpeg + - **Accept**: application/json + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) From 222fa448c421443135c075b9add069b3a5e37087 Mon Sep 17 00:00:00 2001 From: Jonas Reichert Date: Fri, 11 Jul 2025 13:31:13 +0200 Subject: [PATCH 4/5] update bitrise stack so we get xcpretty 0.4.1 --- bitrise.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitrise.yml b/bitrise.yml index 69390c39ae63..b4af07734108 100644 --- a/bitrise.yml +++ b/bitrise.yml @@ -48,4 +48,4 @@ workflows: meta: bitrise.io: - stack: osx-xcode-16.0.x + stack: osx-xcode-16.3.x From 9cc8a172648088d7361a7389b3914dbfe18a4a5e Mon Sep 17 00:00:00 2001 From: Jonas Reichert Date: Fri, 11 Jul 2025 13:50:24 +0200 Subject: [PATCH 5/5] Revert "add test case in spec and update samples" This reverts commit 92202dd8506b2482cda69fe1d95a61d5a51881e3. --- ...ith-fake-endpoints-models-for-testing.yaml | 35 ---- .../Classes/OpenAPIs/APIs/PetAPI.swift | 51 ------ .../swift5/alamofireLibrary/README.md | 1 - .../swift5/alamofireLibrary/docs/PetAPI.md | 51 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 43 ----- .../swift5/asyncAwaitLibrary/README.md | 1 - .../swift5/asyncAwaitLibrary/docs/PetAPI.md | 51 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 60 ------- .../petstore/swift5/combineLibrary/README.md | 1 - .../swift5/combineLibrary/docs/PetAPI.md | 51 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 51 ------ .../petstore/swift5/objcCompatible/README.md | 1 - .../swift5/objcCompatible/docs/PetAPI.md | 51 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 51 ------ .../swift5/promisekitLibrary/README.md | 1 - .../swift5/promisekitLibrary/docs/PetAPI.md | 48 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 51 ------ .../petstore/swift5/resultLibrary/README.md | 1 - .../swift5/resultLibrary/docs/PetAPI.md | 51 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 57 ------- .../petstore/swift5/rxswiftLibrary/README.md | 1 - .../swift5/rxswiftLibrary/docs/PetAPI.md | 41 ----- .../swift5/urlsessionLibrary/README.md | 1 - .../Sources/PetstoreClient/APIs/PetAPI.swift | 51 ------ .../swift5/urlsessionLibrary/docs/PetAPI.md | 51 ------ .../swift6/alamofireLibrary/README.md | 1 - .../Sources/PetstoreClient/APIs/PetAPI.swift | 52 ------ .../swift6/alamofireLibrary/docs/PetAPI.md | 51 ------ .../swift6/apiNonStaticMethod/README.md | 1 - .../Sources/PetstoreClient/APIs/PetAPI.swift | 158 ------------------ .../swift6/apiNonStaticMethod/docs/PetAPI.md | 50 ------ .../swift6/asyncAwaitLibrary/README.md | 1 - .../Sources/PetstoreClient/APIs/PetAPI.swift | 45 ----- .../swift6/asyncAwaitLibrary/docs/PetAPI.md | 51 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 65 ------- .../swift6/combineDeferredLibrary/README.md | 1 - .../combineDeferredLibrary/docs/PetAPI.md | 51 ------ .../petstore/swift6/combineLibrary/README.md | 1 - .../Sources/CombineLibrary/APIs/PetAPI.swift | 63 ------- .../swift6/combineLibrary/docs/PetAPI.md | 51 ------ .../petstore/swift6/objcCompatible/README.md | 1 - .../Sources/PetstoreClient/APIs/PetAPI.swift | 52 ------ .../swift6/objcCompatible/docs/PetAPI.md | 51 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 53 ------ .../swift6/promisekitLibrary/README.md | 1 - .../swift6/promisekitLibrary/docs/PetAPI.md | 48 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 52 ------ .../petstore/swift6/resultLibrary/README.md | 1 - .../swift6/resultLibrary/docs/PetAPI.md | 51 ------ .../Classes/OpenAPIs/APIs/PetAPI.swift | 58 ------- .../petstore/swift6/rxswiftLibrary/README.md | 1 - .../swift6/rxswiftLibrary/docs/PetAPI.md | 41 ----- .../swift6/urlsessionLibrary/README.md | 1 - .../Sources/PetstoreClient/APIs/PetAPI.swift | 52 ------ .../swift6/urlsessionLibrary/docs/PetAPI.md | 51 ------ 55 files changed, 2009 deletions(-) diff --git a/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml index c7b36127b1f6..27e1524dab47 100644 --- a/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/swift/petstore-with-fake-endpoints-models-for-testing.yaml @@ -273,38 +273,6 @@ paths: - petstore_auth: - 'write:pets' - 'read:pets' - put: - tags: - - pet - summary: updates an existing image - description: '' - operationId: updateImageFile - consumes: - - image/jpeg - produces: - - application/json - parameters: - - name: petId - in: path - description: ID of pet to update - required: true - type: integer - format: int64 - - name: imageData - in: body - description: file to upload - required: false - schema: - $ref: '#/definitions/InputStream' - responses: - '200': - description: successful operation - schema: - $ref: '#/definitions/ApiResponse' - security: - - petstore_auth: - - 'write:pets' - - 'read:pets' /store/inventory: get: tags: @@ -1674,6 +1642,3 @@ definitions: - 1 - 2 - 3 - InputStream: - type: string - format: binary \ No newline at end of file diff --git a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 502a26b1bdd9..747cb1406a87 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/alamofireLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -273,57 +273,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiResponseQueue: The queue on which api response is dispatched. - - parameter completion: completion handler to receive the data and the error objects - */ - @discardableResult - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in - switch result { - case let .success(response): - completion(response.body, nil) - case let .failure(error): - completion(nil, error) - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift5/alamofireLibrary/README.md b/samples/client/petstore/swift5/alamofireLibrary/README.md index ccb031b6990c..9878ab2fc016 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/README.md +++ b/samples/client/petstore/swift5/alamofireLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md index 0c5c6692c04f..e6219c37c4ec 100644 --- a/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/alamofireLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index e03218ec5044..dfefa61d1d58 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -233,49 +233,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: ApiResponse - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open class func updateImageFile(petId: Int64, imageData: URL? = nil) async throws -> ApiResponse { - return try await updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute().body - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/README.md b/samples/client/petstore/swift5/asyncAwaitLibrary/README.md index 8fc3353c2500..59c41d91dbbc 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/README.md +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md index 0c5c6692c04f..e6219c37c4ec 100644 --- a/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/asyncAwaitLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index e2d8fe77943c..b206cde011e3 100644 --- a/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/combineLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -321,66 +321,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: AnyPublisher - */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open class func updateImageFile(petId: Int64, imageData: URL? = nil) -> AnyPublisher { - let requestBuilder = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData) - let requestTask = requestBuilder.requestTask - return Future { promise in - requestBuilder.execute { result in - switch result { - case let .success(response): - promise(.success(response.body)) - case let .failure(error): - promise(.failure(error)) - } - } - } - .handleEvents(receiveCancel: { - requestTask.cancel() - }) - .eraseToAnyPublisher() - } - #endif - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift5/combineLibrary/README.md b/samples/client/petstore/swift5/combineLibrary/README.md index 8fc3353c2500..59c41d91dbbc 100644 --- a/samples/client/petstore/swift5/combineLibrary/README.md +++ b/samples/client/petstore/swift5/combineLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md index 0c5c6692c04f..e6219c37c4ec 100644 --- a/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/combineLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index b2775cefb9a0..5510610fcd5b 100644 --- a/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/objcCompatible/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -273,57 +273,6 @@ import AnyCodable return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiResponseQueue: The queue on which api response is dispatched. - - parameter completion: completion handler to receive the data and the error objects - */ - @discardableResult - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in - switch result { - case let .success(response): - completion(response.body, nil) - case let .failure(error): - completion(nil, error) - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift5/objcCompatible/README.md b/samples/client/petstore/swift5/objcCompatible/README.md index 8fc3353c2500..59c41d91dbbc 100644 --- a/samples/client/petstore/swift5/objcCompatible/README.md +++ b/samples/client/petstore/swift5/objcCompatible/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md b/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md index 8bbf6c485f1e..508d13dae383 100644 --- a/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md +++ b/samples/client/petstore/swift5/objcCompatible/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index fb95432030aa..c2813aa9f6ed 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -274,57 +274,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: Promise - */ - open class func updateImageFile( petId: Int64, imageData: URL? = nil) -> Promise { - let deferred = Promise.pending() - updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in - switch result { - case let .success(response): - deferred.resolver.fulfill(response.body) - case let .failure(error): - deferred.resolver.reject(error) - } - } - return deferred.promise - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift5/promisekitLibrary/README.md b/samples/client/petstore/swift5/promisekitLibrary/README.md index 8fc3353c2500..59c41d91dbbc 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/README.md +++ b/samples/client/petstore/swift5/promisekitLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md index 05a8beb15e7b..73755de2c49a 100644 --- a/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/promisekitLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -249,53 +248,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile( petId: Int64, imageData: URL? = nil) -> Promise -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData).then { - // when the promise is fulfilled - }.always { - // regardless of whether the promise is fulfilled, or rejected - }.catch { errorType in - // when the promise is rejected -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet( body: Pet) -> Promise diff --git a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index b122dc98a7dc..9c18968b6567 100644 --- a/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -273,57 +273,6 @@ internal class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiResponseQueue: The queue on which api response is dispatched. - - parameter completion: completion handler to receive the result - */ - @discardableResult - internal class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ result: Swift.Result) -> Void)) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in - switch result { - case let .success(response): - completion(.success(response.body)) - case let .failure(error): - completion(.failure(error)) - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: RequestBuilder - */ - internal class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift5/resultLibrary/README.md b/samples/client/petstore/swift5/resultLibrary/README.md index 8fc3353c2500..59c41d91dbbc 100644 --- a/samples/client/petstore/swift5/resultLibrary/README.md +++ b/samples/client/petstore/swift5/resultLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md index dce53a9395bd..5d22a913fc65 100644 --- a/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/resultLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - internal class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift internal class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 2aeea4fbe882..161cac524b57 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -304,63 +304,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiResponseQueue: The queue on which api response is dispatched. - - returns: Observable - */ - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue) -> Observable { - return Observable.create { observer -> Disposable in - let requestTask = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in - switch result { - case let .success(response): - observer.onNext(response.body) - case let .failure(error): - observer.onError(error) - } - observer.onCompleted() - } - - return Disposables.create { - requestTask.cancel() - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift5/rxswiftLibrary/README.md b/samples/client/petstore/swift5/rxswiftLibrary/README.md index 8fc3353c2500..59c41d91dbbc 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/README.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md index 206146747928..6a03adef99da 100644 --- a/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/rxswiftLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -214,46 +213,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil) -> Observable -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet) -> Observable diff --git a/samples/client/petstore/swift5/urlsessionLibrary/README.md b/samples/client/petstore/swift5/urlsessionLibrary/README.md index 8fc3353c2500..59c41d91dbbc 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/README.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index 0908ea889e34..3741d7f42773 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift5/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -276,57 +276,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiResponseQueue: The queue on which api response is dispatched. - - parameter completion: completion handler to receive the data and the error objects - */ - @discardableResult - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiResponseQueue: DispatchQueue = PetstoreClientAPI.apiResponseQueue, completion: @escaping ((_ data: ApiResponse?, _ error: Error?) -> Void)) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute(apiResponseQueue) { result in - switch result { - case let .success(response): - completion(response.body, nil) - case let .failure(error): - completion(nil, error) - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = PetstoreClientAPI.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: Any?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md b/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md index 0c5c6692c04f..e6219c37c4ec 100644 --- a/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift5/urlsessionLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/alamofireLibrary/README.md b/samples/client/petstore/swift6/alamofireLibrary/README.md index 74ddce04833c..c3325e8a8df2 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/README.md +++ b/samples/client/petstore/swift6/alamofireLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index 6c7bf7ecfb53..9db9ecc94dd6 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/alamofireLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -275,58 +275,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - parameter completion: completion handler to receive the data and the error objects - */ - @discardableResult - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in - switch result { - case let .success(response): - completion(response.body, nil) - case let .failure(error): - completion(nil, error) - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/alamofireLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/alamofireLibrary/docs/PetAPI.md index 0c5c6692c04f..e6219c37c4ec 100644 --- a/samples/client/petstore/swift6/alamofireLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/alamofireLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/README.md b/samples/client/petstore/swift6/apiNonStaticMethod/README.md index 40ce4b5ce545..9d2e16b15277 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/README.md +++ b/samples/client/petstore/swift6/apiNonStaticMethod/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift index a1b36ab3945a..fb4c4debdc92 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/apiNonStaticMethod/Sources/PetstoreClient/APIs/PetAPI.swift @@ -799,164 +799,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter completion: completion handler to receive the data and the error objects - */ - @discardableResult - open func updateImageFile(petId: Int64, imageData: Data? = nil, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in - switch result { - case let .success(response): - completion(response.body, nil) - case let .failure(error): - completion(nil, error) - } - } - } - - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: Promise - */ - open func updateImageFile(petId: Int64, imageData: Data? = nil) -> Promise { - let deferred = Promise.pending() - updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in - switch result { - case let .success(response): - deferred.resolver.fulfill(response.body) - case let .failure(error): - deferred.resolver.reject(error) - } - } - return deferred.promise - } - - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: Observable - */ - open func updateImageFile(petId: Int64, imageData: Data? = nil) -> Observable { - return Observable.create { observer -> Disposable in - let requestTask = self.updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in - switch result { - case let .success(response): - observer.onNext(response.body) - case let .failure(error): - observer.onError(error) - } - observer.onCompleted() - } - - return Disposables.create { - requestTask.cancel() - } - } - } - - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: AnyPublisher - */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open func updateImageFile(petId: Int64, imageData: Data? = nil) -> AnyPublisher { - let requestBuilder = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData) - let requestTask = requestBuilder.requestTask - return Deferred { Future { promise in - nonisolated(unsafe) let promise = promise - requestBuilder.execute { result in - switch result { - case let .success(response): - promise(.success(response.body)) - case let .failure(error): - promise(.failure(error)) - } - } - } - .handleEvents(receiveCancel: { - requestTask.cancel() - }) - .eraseToAnyPublisher() - } - .eraseToAnyPublisher() - } - #endif - - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: ApiResponse - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open func updateImageFile(petId: Int64, imageData: Data? = nil) async throws(ErrorResponse) -> ApiResponse { - return try await updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute().body - } - - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter completion: completion handler to receive the result - */ - @discardableResult - open func updateImageFile(petId: Int64, imageData: Data? = nil, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData).execute { result in - switch result { - case let .success(response): - completion(.success(response.body)) - case let .failure(error): - completion(.failure(error)) - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - returns: RequestBuilder - */ - open func updateImageFileWithRequestBuilder(petId: Int64, imageData: Data? = nil) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md b/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md index 52123941cb20..b675fdb7bb78 100644 --- a/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md +++ b/samples/client/petstore/swift6/apiNonStaticMethod/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -259,55 +258,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile( petId: Int64, imageData: Data? = nil) -> Promise - open class func updateImageFile(petId: Int64, imageData: Data? = nil) -> Observable -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = Data([9, 8, 7]) // Data | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData).then { - // when the promise is fulfilled - }.always { - // regardless of whether the promise is fulfilled, or rejected - }.catch { errorType in - // when the promise is rejected -} -// TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **Data** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet( body: Pet) -> Promise diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/README.md b/samples/client/petstore/swift6/asyncAwaitLibrary/README.md index 2b7f6e13f90c..2b8b1303fd01 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/README.md +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index eb44e2672f55..e7e2b597031e 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -240,51 +240,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: ApiResponse - */ - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) async throws(ErrorResponse) -> ApiResponse { - return try await updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute().body - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/asyncAwaitLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/asyncAwaitLibrary/docs/PetAPI.md index 0c5c6692c04f..e6219c37c4ec 100644 --- a/samples/client/petstore/swift6/asyncAwaitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/asyncAwaitLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index d36c5c0eab06..eed0d1d858bc 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/combineDeferredLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -343,71 +343,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: AnyPublisher - */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { - let requestBuilder = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration) - let requestTask = requestBuilder.requestTask - return Deferred { Future { promise in - nonisolated(unsafe) let promise = promise - requestBuilder.execute { result in - switch result { - case let .success(response): - promise(.success(response.body)) - case let .failure(error): - promise(.failure(error)) - } - } - } - .handleEvents(receiveCancel: { - requestTask.cancel() - }) - .eraseToAnyPublisher() - } - .eraseToAnyPublisher() - } - #endif - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/README.md b/samples/client/petstore/swift6/combineDeferredLibrary/README.md index 2b7f6e13f90c..2b8b1303fd01 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/README.md +++ b/samples/client/petstore/swift6/combineDeferredLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/combineDeferredLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/combineDeferredLibrary/docs/PetAPI.md index 0c5c6692c04f..e6219c37c4ec 100644 --- a/samples/client/petstore/swift6/combineDeferredLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/combineDeferredLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/combineLibrary/README.md b/samples/client/petstore/swift6/combineLibrary/README.md index 2b7f6e13f90c..2b8b1303fd01 100644 --- a/samples/client/petstore/swift6/combineLibrary/README.md +++ b/samples/client/petstore/swift6/combineLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift index d9e3cb779981..903bf2abb822 100644 --- a/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/combineLibrary/Sources/CombineLibrary/APIs/PetAPI.swift @@ -333,69 +333,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: AnyPublisher - */ - #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> AnyPublisher { - let requestBuilder = updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration) - let requestTask = requestBuilder.requestTask - return Future { promise in - nonisolated(unsafe) let promise = promise - requestBuilder.execute { result in - switch result { - case let .success(response): - promise(.success(response.body)) - case let .failure(error): - promise(.failure(error)) - } - } - } - .handleEvents(receiveCancel: { - requestTask.cancel() - }) - .eraseToAnyPublisher() - } - #endif - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/combineLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/combineLibrary/docs/PetAPI.md index 0c5c6692c04f..e6219c37c4ec 100644 --- a/samples/client/petstore/swift6/combineLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/combineLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/objcCompatible/README.md b/samples/client/petstore/swift6/objcCompatible/README.md index 2b7f6e13f90c..2b8b1303fd01 100644 --- a/samples/client/petstore/swift6/objcCompatible/README.md +++ b/samples/client/petstore/swift6/objcCompatible/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift index b346f0465c24..7ab17f299334 100644 --- a/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/objcCompatible/Sources/PetstoreClient/APIs/PetAPI.swift @@ -275,58 +275,6 @@ import Foundation return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - parameter completion: completion handler to receive the data and the error objects - */ - @discardableResult - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in - switch result { - case let .success(response): - completion(response.body, nil) - case let .failure(error): - completion(nil, error) - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/objcCompatible/docs/PetAPI.md b/samples/client/petstore/swift6/objcCompatible/docs/PetAPI.md index 8bbf6c485f1e..508d13dae383 100644 --- a/samples/client/petstore/swift6/objcCompatible/docs/PetAPI.md +++ b/samples/client/petstore/swift6/objcCompatible/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 919b3a8ae606..a81fce6ea032 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/promisekitLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -281,59 +281,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: Promise - */ - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Promise { - let deferred = Promise.pending() - updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in - switch result { - case let .success(response): - deferred.resolver.fulfill(response.body) - case let .failure(error): - deferred.resolver.reject(error) - } - } - return deferred.promise - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/promisekitLibrary/README.md b/samples/client/petstore/swift6/promisekitLibrary/README.md index 2b7f6e13f90c..2b8b1303fd01 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/README.md +++ b/samples/client/petstore/swift6/promisekitLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/promisekitLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/promisekitLibrary/docs/PetAPI.md index 05a8beb15e7b..73755de2c49a 100644 --- a/samples/client/petstore/swift6/promisekitLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/promisekitLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -249,53 +248,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile( petId: Int64, imageData: URL? = nil) -> Promise -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData).then { - // when the promise is fulfilled - }.always { - // regardless of whether the promise is fulfilled, or rejected - }.catch { errorType in - // when the promise is rejected -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet( body: Pet) -> Promise diff --git a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 63d74cdb32af..fba46c581846 100644 --- a/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/resultLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -275,58 +275,6 @@ internal class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - parameter completion: completion handler to receive the result - */ - @discardableResult - internal class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ result: Swift.Result) -> Void) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in - switch result { - case let .success(response): - completion(.success(response.body)) - case let .failure(error): - completion(.failure(error)) - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: RequestBuilder - */ - internal class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/resultLibrary/README.md b/samples/client/petstore/swift6/resultLibrary/README.md index 2b7f6e13f90c..2b8b1303fd01 100644 --- a/samples/client/petstore/swift6/resultLibrary/README.md +++ b/samples/client/petstore/swift6/resultLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/resultLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/resultLibrary/docs/PetAPI.md index dce53a9395bd..5d22a913fc65 100644 --- a/samples/client/petstore/swift6/resultLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/resultLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - internal class func updateImageFile(petId: Int64, imageData: URL? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift internal class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void) diff --git a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift index 4d846b0efd8c..4a60300c9e73 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/rxswiftLibrary/PetstoreClient/Classes/OpenAPIs/APIs/PetAPI.swift @@ -306,64 +306,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: Observable - */ - open class func updateImageFile(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> Observable { - return Observable.create { observer -> Disposable in - let requestTask = self.updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in - switch result { - case let .success(response): - observer.onNext(response.body) - case let .failure(error): - observer.onError(error) - } - observer.onCompleted() - } - - return Disposables.create { - requestTask.cancel() - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: URL? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/rxswiftLibrary/README.md b/samples/client/petstore/swift6/rxswiftLibrary/README.md index 2b7f6e13f90c..2b8b1303fd01 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/README.md +++ b/samples/client/petstore/swift6/rxswiftLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/rxswiftLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/rxswiftLibrary/docs/PetAPI.md index 206146747928..6a03adef99da 100644 --- a/samples/client/petstore/swift6/rxswiftLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/rxswiftLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -214,46 +213,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: URL? = nil) -> Observable -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = URL(string: "https://example.com")! // URL | file to upload (optional) - -// TODO RxSwift sample code not yet implemented. To contribute, please open a ticket via http://github.com/OpenAPITools/openapi-generator/issues/new -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **URL** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet) -> Observable diff --git a/samples/client/petstore/swift6/urlsessionLibrary/README.md b/samples/client/petstore/swift6/urlsessionLibrary/README.md index 2b7f6e13f90c..2b8b1303fd01 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/README.md +++ b/samples/client/petstore/swift6/urlsessionLibrary/README.md @@ -45,7 +45,6 @@ Class | Method | HTTP request | Description *PetAPI* | [**findPetsByStatus**](docs/PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status *PetAPI* | [**findPetsByTags**](docs/PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags *PetAPI* | [**getPetById**](docs/PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -*PetAPI* | [**updateImageFile**](docs/PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image *PetAPI* | [**updatePet**](docs/PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet *PetAPI* | [**updatePetWithForm**](docs/PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data *PetAPI* | [**uploadFile**](docs/PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image diff --git a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift index e768d7ea80c9..ac1b663d3c49 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift +++ b/samples/client/petstore/swift6/urlsessionLibrary/Sources/PetstoreClient/APIs/PetAPI.swift @@ -278,58 +278,6 @@ open class PetAPI { return localVariableRequestBuilder.init(method: "GET", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) } - /** - updates an existing image - - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - parameter completion: completion handler to receive the data and the error objects - */ - @discardableResult - open class func updateImageFile(petId: Int64, imageData: Data? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared, completion: @Sendable @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -> RequestTask { - return updateImageFileWithRequestBuilder(petId: petId, imageData: imageData, apiConfiguration: apiConfiguration).execute { result in - switch result { - case let .success(response): - completion(response.body, nil) - case let .failure(error): - completion(nil, error) - } - } - } - - /** - updates an existing image - - PUT /pet/{petId}/uploadImage - - OAuth: - - type: oauth2 - - name: petstore_auth - - parameter petId: (path) ID of pet to update - - parameter imageData: (body) file to upload (optional) - - parameter apiConfiguration: The configuration for the http request. - - returns: RequestBuilder - */ - open class func updateImageFileWithRequestBuilder(petId: Int64, imageData: Data? = nil, apiConfiguration: PetstoreClientAPIConfiguration = PetstoreClientAPIConfiguration.shared) -> RequestBuilder { - var localVariablePath = "/pet/{petId}/uploadImage" - let petIdPreEscape = "\(APIHelper.mapValueToPathItem(petId))" - let petIdPostEscape = petIdPreEscape.addingPercentEncoding(withAllowedCharacters: .urlPathAllowed) ?? "" - localVariablePath = localVariablePath.replacingOccurrences(of: "{petId}", with: petIdPostEscape, options: .literal, range: nil) - let localVariableURLString = apiConfiguration.basePath + localVariablePath - let localVariableParameters = ["body": imageData] - - let localVariableUrlComponents = URLComponents(string: localVariableURLString) - - let localVariableNillableHeaders: [String: (any Sendable)?] = [ - "Content-Type": "image/jpeg", - ] - - let localVariableHeaderParameters = APIHelper.rejectNilHeaders(localVariableNillableHeaders) - - let localVariableRequestBuilder: RequestBuilder.Type = apiConfiguration.requestBuilderFactory.getBuilder() - - return localVariableRequestBuilder.init(method: "PUT", URLString: (localVariableUrlComponents?.string ?? localVariableURLString), parameters: localVariableParameters, headers: localVariableHeaderParameters, requiresAuthentication: true, apiConfiguration: apiConfiguration) - } - /** Update an existing pet diff --git a/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md b/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md index a008c559e3a5..2b3e7c153186 100644 --- a/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md +++ b/samples/client/petstore/swift6/urlsessionLibrary/docs/PetAPI.md @@ -9,7 +9,6 @@ Method | HTTP request | Description [**findPetsByStatus**](PetAPI.md#findpetsbystatus) | **GET** /pet/findByStatus | Finds Pets by status [**findPetsByTags**](PetAPI.md#findpetsbytags) | **GET** /pet/findByTags | Finds Pets by tags [**getPetById**](PetAPI.md#getpetbyid) | **GET** /pet/{petId} | Find pet by ID -[**updateImageFile**](PetAPI.md#updateimagefile) | **PUT** /pet/{petId}/uploadImage | updates an existing image [**updatePet**](PetAPI.md#updatepet) | **PUT** /pet | Update an existing pet [**updatePetWithForm**](PetAPI.md#updatepetwithform) | **POST** /pet/{petId} | Updates a pet in the store with form data [**uploadFile**](PetAPI.md#uploadfile) | **POST** /pet/{petId}/uploadImage | uploads an image @@ -264,56 +263,6 @@ Name | Type | Description | Notes [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) -# **updateImageFile** -```swift - open class func updateImageFile(petId: Int64, imageData: Data? = nil, completion: @escaping (_ data: ApiResponse?, _ error: Error?) -> Void) -``` - -updates an existing image - -### Example -```swift -// The following code samples are still beta. For any issue, please report via http://github.com/OpenAPITools/openapi-generator/issues/new -import PetstoreClient - -let petId = 987 // Int64 | ID of pet to update -let imageData = Data([9, 8, 7]) // Data | file to upload (optional) - -// updates an existing image -PetAPI.updateImageFile(petId: petId, imageData: imageData) { (response, error) in - guard error == nil else { - print(error) - return - } - - if (response) { - dump(response) - } -} -``` - -### Parameters - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **petId** | **Int64** | ID of pet to update | - **imageData** | **Data** | file to upload | [optional] - -### Return type - -[**ApiResponse**](ApiResponse.md) - -### Authorization - -[petstore_auth](../README.md#petstore_auth) - -### HTTP request headers - - - **Content-Type**: image/jpeg - - **Accept**: application/json - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **updatePet** ```swift open class func updatePet(body: Pet, completion: @escaping (_ data: Void?, _ error: Error?) -> Void)