mirror of
				https://github.com/OpenAPITools/openapi-generator.git
				synced 2025-10-31 00:33:49 +00:00 
			
		
		
		
	[Swift3] Add sample for unwrapRequired. (#5853)
This commit is contained in:
		
							parent
							
								
									3c6696be40
								
							
						
					
					
						commit
						6b40bc6d30
					
				| @ -38,3 +38,7 @@ java $JAVA_OPTS -jar $executable $ags | |||||||
| ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift3 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -c ./bin/swift3-petstore-rxswift.json -o samples/client/petstore/swift3/rxswift" | ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift3 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -c ./bin/swift3-petstore-rxswift.json -o samples/client/petstore/swift3/rxswift" | ||||||
| echo "#### Petstore Swift API client (rxswift) ####" | echo "#### Petstore Swift API client (rxswift) ####" | ||||||
| java $JAVA_OPTS -jar $executable $ags | java $JAVA_OPTS -jar $executable $ags | ||||||
|  | 
 | ||||||
|  | ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift3 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -c ./bin/swift3-petstore-unwraprequired.json -o samples/client/petstore/swift3/unwraprequired" | ||||||
|  | echo "#### Petstore Swift API client (unwraprequired) ####" | ||||||
|  | java $JAVA_OPTS -jar $executable $ags | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								bin/swift3-petstore-unwraprequired.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								bin/swift3-petstore-unwraprequired.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,7 @@ | |||||||
|  | { | ||||||
|  |   "podSummary": "PetstoreClient", | ||||||
|  |   "podHomepage": "https://github.com/swagger-api/swagger-codegen", | ||||||
|  |   "podAuthors": "", | ||||||
|  |   "projectName": "PetstoreClient", | ||||||
|  |   "unwrapRequired": true | ||||||
|  | } | ||||||
							
								
								
									
										31
									
								
								bin/swift3-petstore-unwraprequired.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										31
									
								
								bin/swift3-petstore-unwraprequired.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,31 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | 
 | ||||||
|  | SCRIPT="$0" | ||||||
|  | 
 | ||||||
|  | while [ -h "$SCRIPT" ] ; do | ||||||
|  |   ls=`ls -ld "$SCRIPT"` | ||||||
|  |   link=`expr "$ls" : '.*-> \(.*\)$'` | ||||||
|  |   if expr "$link" : '/.*' > /dev/null; then | ||||||
|  |     SCRIPT="$link" | ||||||
|  |   else | ||||||
|  |     SCRIPT=`dirname "$SCRIPT"`/"$link" | ||||||
|  |   fi | ||||||
|  | done | ||||||
|  | 
 | ||||||
|  | if [ ! -d "${APP_DIR}" ]; then | ||||||
|  |   APP_DIR=`dirname "$SCRIPT"`/.. | ||||||
|  |   APP_DIR=`cd "${APP_DIR}"; pwd` | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar" | ||||||
|  | 
 | ||||||
|  | if [ ! -f "$executable" ] | ||||||
|  | then | ||||||
|  |   mvn clean package | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | # if you've executed sbt assembly previously it will use that instead. | ||||||
|  | export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties" | ||||||
|  | ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift3 -i modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -l swift3 -c ./bin/swift3-petstore-unwraprequired.json -o samples/client/petstore/swift3/unwraprequired" | ||||||
|  | 
 | ||||||
|  | java $JAVA_OPTS -jar $executable $ags | ||||||
							
								
								
									
										63
									
								
								samples/client/petstore/swift3/unwraprequired/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										63
									
								
								samples/client/petstore/swift3/unwraprequired/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,63 @@ | |||||||
|  | # Xcode | ||||||
|  | # | ||||||
|  | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore | ||||||
|  | 
 | ||||||
|  | ## Build generated | ||||||
|  | build/ | ||||||
|  | DerivedData | ||||||
|  | 
 | ||||||
|  | ## Various settings | ||||||
|  | *.pbxuser | ||||||
|  | !default.pbxuser | ||||||
|  | *.mode1v3 | ||||||
|  | !default.mode1v3 | ||||||
|  | *.mode2v3 | ||||||
|  | !default.mode2v3 | ||||||
|  | *.perspectivev3 | ||||||
|  | !default.perspectivev3 | ||||||
|  | xcuserdata | ||||||
|  | 
 | ||||||
|  | ## Other | ||||||
|  | *.xccheckout | ||||||
|  | *.moved-aside | ||||||
|  | *.xcuserstate | ||||||
|  | *.xcscmblueprint | ||||||
|  | 
 | ||||||
|  | ## Obj-C/Swift specific | ||||||
|  | *.hmap | ||||||
|  | *.ipa | ||||||
|  | 
 | ||||||
|  | ## Playgrounds | ||||||
|  | timeline.xctimeline | ||||||
|  | playground.xcworkspace | ||||||
|  | 
 | ||||||
|  | # Swift Package Manager | ||||||
|  | # | ||||||
|  | # Add this line if you want to avoid checking in source code from Swift Package Manager dependencies. | ||||||
|  | # Packages/ | ||||||
|  | .build/ | ||||||
|  | 
 | ||||||
|  | # CocoaPods | ||||||
|  | # | ||||||
|  | # We recommend against adding the Pods directory to your .gitignore. However | ||||||
|  | # you should judge for yourself, the pros and cons are mentioned at: | ||||||
|  | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control | ||||||
|  | # | ||||||
|  | # Pods/ | ||||||
|  | 
 | ||||||
|  | # Carthage | ||||||
|  | # | ||||||
|  | # Add this line if you want to avoid checking in source code from Carthage dependencies. | ||||||
|  | # Carthage/Checkouts | ||||||
|  | 
 | ||||||
|  | Carthage/Build | ||||||
|  | 
 | ||||||
|  | # fastlane | ||||||
|  | # | ||||||
|  | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the  | ||||||
|  | # screenshots whenever they are needed. | ||||||
|  | # For more information about the recommended setup visit: | ||||||
|  | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md | ||||||
|  | 
 | ||||||
|  | fastlane/report.xml | ||||||
|  | fastlane/screenshots | ||||||
| @ -0,0 +1,23 @@ | |||||||
|  | # Swagger Codegen Ignore | ||||||
|  | # Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen | ||||||
|  | 
 | ||||||
|  | # Use this file to prevent files from being overwritten by the generator. | ||||||
|  | # The patterns follow closely to .gitignore or .dockerignore. | ||||||
|  | 
 | ||||||
|  | # As an example, the C# client generator defines ApiClient.cs. | ||||||
|  | # You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line: | ||||||
|  | #ApiClient.cs | ||||||
|  | 
 | ||||||
|  | # You can match any string of characters against a directory, file or extension with a single asterisk (*): | ||||||
|  | #foo/*/qux | ||||||
|  | # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux | ||||||
|  | 
 | ||||||
|  | # You can recursively match patterns against a directory, file or extension with a double asterisk (**): | ||||||
|  | #foo/**/qux | ||||||
|  | # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux | ||||||
|  | 
 | ||||||
|  | # You can also negate patterns with an exclamation (!). | ||||||
|  | # For example, you can ignore all files in a docs folder with the file extension .md: | ||||||
|  | #docs/*.md | ||||||
|  | # Then explicitly reverse the ignore rule for a single file: | ||||||
|  | #!docs/README.md | ||||||
| @ -0,0 +1 @@ | |||||||
|  | 2.3.0-SNAPSHOT | ||||||
							
								
								
									
										1
									
								
								samples/client/petstore/swift3/unwraprequired/Cartfile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								samples/client/petstore/swift3/unwraprequired/Cartfile
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1 @@ | |||||||
|  | github "Alamofire/Alamofire" >= 3.1.0 | ||||||
| @ -0,0 +1,13 @@ | |||||||
|  | Pod::Spec.new do |s| | ||||||
|  |   s.name = 'PetstoreClient' | ||||||
|  |   s.ios.deployment_target = '9.0' | ||||||
|  |   s.osx.deployment_target = '10.11' | ||||||
|  |   s.version = '0.0.1' | ||||||
|  |   s.source = { :git => 'git@github.com:swagger-api/swagger-mustache.git', :tag => 'v1.0.0' } | ||||||
|  |   s.authors = '' | ||||||
|  |   s.license = 'Proprietary' | ||||||
|  |   s.homepage = 'https://github.com/swagger-api/swagger-codegen' | ||||||
|  |   s.summary = 'PetstoreClient' | ||||||
|  |   s.source_files = 'PetstoreClient/Classes/Swaggers/**/*.swift' | ||||||
|  |   s.dependency 'Alamofire', '~> 4.0' | ||||||
|  | end | ||||||
| @ -0,0 +1,79 @@ | |||||||
|  | // APIHelper.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | class APIHelper { | ||||||
|  |     static func rejectNil(_ source: [String:Any?]) -> [String:Any]? { | ||||||
|  |         var destination = [String:Any]() | ||||||
|  |         for (key, nillableValue) in source { | ||||||
|  |             if let value: Any = nillableValue { | ||||||
|  |                 destination[key] = value | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         if destination.isEmpty { | ||||||
|  |             return nil | ||||||
|  |         } | ||||||
|  |         return destination | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func rejectNilHeaders(_ source: [String:Any?]) -> [String:String] { | ||||||
|  |         var destination = [String:String]() | ||||||
|  |         for (key, nillableValue) in source { | ||||||
|  |             if let value: Any = nillableValue { | ||||||
|  |                 destination[key] = "\(value)" | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return destination | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func convertBoolToString(_ source: [String: Any]?) -> [String:Any]? { | ||||||
|  |         guard let source = source else { | ||||||
|  |             return nil | ||||||
|  |         } | ||||||
|  |         var destination = [String:Any]() | ||||||
|  |         let theTrue = NSNumber(value: true as Bool) | ||||||
|  |         let theFalse = NSNumber(value: false as Bool) | ||||||
|  |         for (key, value) in source { | ||||||
|  |             switch value { | ||||||
|  |             case let x where x as? NSNumber === theTrue || x as? NSNumber === theFalse: | ||||||
|  |                 destination[key] = "\(value as! Bool)" as Any? | ||||||
|  |             default: | ||||||
|  |                 destination[key] = value | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return destination | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func mapValuesToQueryItems(values: [String:Any?]) -> [URLQueryItem]? { | ||||||
|  |         let returnValues = values | ||||||
|  |             .filter { $0.1 != nil } | ||||||
|  |             .map { (item: (_key: String, _value: Any?)) -> [URLQueryItem] in | ||||||
|  |                 if let value = item._value as? Array<String> { | ||||||
|  |                     return value.map { (v) -> URLQueryItem in | ||||||
|  |                         URLQueryItem( | ||||||
|  |                             name: item._key, | ||||||
|  |                             value: v | ||||||
|  |                         ) | ||||||
|  |                     } | ||||||
|  |                 } else { | ||||||
|  |                     return [URLQueryItem( | ||||||
|  |                         name: item._key, | ||||||
|  |                         value: "\(item._value!)" | ||||||
|  |                     )] | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             .flatMap { $0 } | ||||||
|  | 
 | ||||||
|  |         if returnValues.count == 0 { | ||||||
|  |             return nil | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return returnValues | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,77 @@ | |||||||
|  | // APIs.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | open class PetstoreClientAPI { | ||||||
|  |     open static var basePath = "http://petstore.swagger.io:80/v2" | ||||||
|  |     open static var credential: URLCredential? | ||||||
|  |     open static var customHeaders: [String:String] = [:] | ||||||
|  |     open static var requestBuilderFactory: RequestBuilderFactory = AlamofireRequestBuilderFactory() | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | open class APIBase { | ||||||
|  |     func toParameters(_ encodable: JSONEncodable?) -> [String: Any]? { | ||||||
|  |         let encoded: Any? = encodable?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         if encoded! is [Any] { | ||||||
|  |             var dictionary = [String:Any]() | ||||||
|  |             for (index, item) in (encoded as! [Any]).enumerated() { | ||||||
|  |                 dictionary["\(index)"] = item | ||||||
|  |             } | ||||||
|  |             return dictionary | ||||||
|  |         } else { | ||||||
|  |             return encoded as? [String:Any] | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | open class RequestBuilder<T> { | ||||||
|  |     var credential: URLCredential? | ||||||
|  |     var headers: [String:String] | ||||||
|  |     let parameters: [String:Any]? | ||||||
|  |     let isBody: Bool | ||||||
|  |     let method: String | ||||||
|  |     let URLString: String | ||||||
|  | 
 | ||||||
|  |     /// Optional block to obtain a reference to the request's progress instance when available. | ||||||
|  |     public var onProgressReady: ((Progress) -> ())? | ||||||
|  | 
 | ||||||
|  |     required public init(method: String, URLString: String, parameters: [String:Any]?, isBody: Bool, headers: [String:String] = [:]) { | ||||||
|  |         self.method = method | ||||||
|  |         self.URLString = URLString | ||||||
|  |         self.parameters = parameters | ||||||
|  |         self.isBody = isBody | ||||||
|  |         self.headers = headers | ||||||
|  | 
 | ||||||
|  |         addHeaders(PetstoreClientAPI.customHeaders) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     open func addHeaders(_ aHeaders:[String:String]) { | ||||||
|  |         for (header, value) in aHeaders { | ||||||
|  |             headers[header] = value | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { } | ||||||
|  | 
 | ||||||
|  |     public func addHeader(name: String, value: String) -> Self { | ||||||
|  |         if !value.isEmpty { | ||||||
|  |             headers[name] = value | ||||||
|  |         } | ||||||
|  |         return self | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     open func addCredential() -> Self { | ||||||
|  |         self.credential = PetstoreClientAPI.credential | ||||||
|  |         return self | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | public protocol RequestBuilderFactory { | ||||||
|  |     func getBuilder<T>() -> RequestBuilder<T>.Type | ||||||
|  | } | ||||||
|  | 
 | ||||||
| @ -0,0 +1,424 @@ | |||||||
|  | // | ||||||
|  | // FakeAPI.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | import Alamofire | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class FakeAPI: APIBase { | ||||||
|  |     /** | ||||||
|  |      - parameter body: (body) Input boolean as post body (optional) | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func fakeOuterBooleanSerialize(body: OuterBoolean? = nil, completion: @escaping ((_ data: OuterBoolean?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      - POST /fake/outer/boolean | ||||||
|  |      - Test serialization of outer boolean types | ||||||
|  | 
 | ||||||
|  |      - examples: [{contentType=application/json, example={ }}] | ||||||
|  |      - parameter body: (body) Input boolean as post body (optional) | ||||||
|  |      - returns: RequestBuilder<OuterBoolean>  | ||||||
|  |      */ | ||||||
|  |     open class func fakeOuterBooleanSerializeWithRequestBuilder(body: OuterBoolean? = nil) -> RequestBuilder<OuterBoolean> { | ||||||
|  |         let path = "/fake/outer/boolean" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body?.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<OuterBoolean>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      - parameter body: (body) Input composite as post body (optional) | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      - POST /fake/outer/composite | ||||||
|  |      - Test serialization of object with outer number type | ||||||
|  | 
 | ||||||
|  |      - examples: [{contentType=application/json, example={ | ||||||
|  |   "my_string" : { }, | ||||||
|  |   "my_number" : { }, | ||||||
|  |   "my_boolean" : { } | ||||||
|  | }}] | ||||||
|  |      - parameter body: (body) Input composite as post body (optional) | ||||||
|  |      - returns: RequestBuilder<OuterComposite>  | ||||||
|  |      */ | ||||||
|  |     open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder<OuterComposite> { | ||||||
|  |         let path = "/fake/outer/composite" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body?.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<OuterComposite>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      - parameter body: (body) Input number as post body (optional) | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func fakeOuterNumberSerialize(body: OuterNumber? = nil, completion: @escaping ((_ data: OuterNumber?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         fakeOuterNumberSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      - POST /fake/outer/number | ||||||
|  |      - Test serialization of outer number types | ||||||
|  | 
 | ||||||
|  |      - examples: [{contentType=application/json, example={ }}] | ||||||
|  |      - parameter body: (body) Input number as post body (optional) | ||||||
|  |      - returns: RequestBuilder<OuterNumber>  | ||||||
|  |      */ | ||||||
|  |     open class func fakeOuterNumberSerializeWithRequestBuilder(body: OuterNumber? = nil) -> RequestBuilder<OuterNumber> { | ||||||
|  |         let path = "/fake/outer/number" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body?.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<OuterNumber>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      - parameter body: (body) Input string as post body (optional) | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func fakeOuterStringSerialize(body: OuterString? = nil, completion: @escaping ((_ data: OuterString?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         fakeOuterStringSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      - POST /fake/outer/string | ||||||
|  |      - Test serialization of outer string types | ||||||
|  | 
 | ||||||
|  |      - examples: [{contentType=application/json, example={ }}] | ||||||
|  |      - parameter body: (body) Input string as post body (optional) | ||||||
|  |      - returns: RequestBuilder<OuterString>  | ||||||
|  |      */ | ||||||
|  |     open class func fakeOuterStringSerializeWithRequestBuilder(body: OuterString? = nil) -> RequestBuilder<OuterString> { | ||||||
|  |         let path = "/fake/outer/string" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body?.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<OuterString>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      To test \"client\" model | ||||||
|  |      - parameter body: (body) client model  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func testClientModel(body: Client, completion: @escaping ((_ data: Client?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         testClientModelWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      To test \"client\" model | ||||||
|  |      - PATCH /fake | ||||||
|  |      - To test \"client\" model | ||||||
|  | 
 | ||||||
|  |      - examples: [{contentType=application/json, example={ | ||||||
|  |   "client" : "aeiou" | ||||||
|  | }}] | ||||||
|  |      - parameter body: (body) client model  | ||||||
|  |      - returns: RequestBuilder<Client>  | ||||||
|  |      */ | ||||||
|  |     open class func testClientModelWithRequestBuilder(body: Client) -> RequestBuilder<Client> { | ||||||
|  |         let path = "/fake" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Client>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트  | ||||||
|  |      - parameter number: (form) None  | ||||||
|  |      - parameter double: (form) None  | ||||||
|  |      - parameter patternWithoutDelimiter: (form) None  | ||||||
|  |      - parameter byte: (form) None  | ||||||
|  |      - parameter integer: (form) None (optional) | ||||||
|  |      - parameter int32: (form) None (optional) | ||||||
|  |      - parameter int64: (form) None (optional) | ||||||
|  |      - parameter float: (form) None (optional) | ||||||
|  |      - parameter string: (form) None (optional) | ||||||
|  |      - parameter binary: (form) None (optional) | ||||||
|  |      - parameter date: (form) None (optional) | ||||||
|  |      - parameter dateTime: (form) None (optional) | ||||||
|  |      - parameter password: (form) None (optional) | ||||||
|  |      - parameter callback: (form) None (optional) | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func testEndpointParameters(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int32? = nil, int32: Int32? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: ISOFullDate? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         testEndpointParametersWithRequestBuilder(number: number, double: double, patternWithoutDelimiter: patternWithoutDelimiter, byte: byte, integer: integer, int32: int32, int64: int64, float: float, string: string, binary: binary, date: date, dateTime: dateTime, password: password, callback: callback).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트  | ||||||
|  |      - POST /fake | ||||||
|  |      - Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트  | ||||||
|  |      - BASIC: | ||||||
|  |        - type: basic | ||||||
|  |        - name: http_basic_test | ||||||
|  |      - parameter number: (form) None  | ||||||
|  |      - parameter double: (form) None  | ||||||
|  |      - parameter patternWithoutDelimiter: (form) None  | ||||||
|  |      - parameter byte: (form) None  | ||||||
|  |      - parameter integer: (form) None (optional) | ||||||
|  |      - parameter int32: (form) None (optional) | ||||||
|  |      - parameter int64: (form) None (optional) | ||||||
|  |      - parameter float: (form) None (optional) | ||||||
|  |      - parameter string: (form) None (optional) | ||||||
|  |      - parameter binary: (form) None (optional) | ||||||
|  |      - parameter date: (form) None (optional) | ||||||
|  |      - parameter dateTime: (form) None (optional) | ||||||
|  |      - parameter password: (form) None (optional) | ||||||
|  |      - parameter callback: (form) None (optional) | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func testEndpointParametersWithRequestBuilder(number: Double, double: Double, patternWithoutDelimiter: String, byte: Data, integer: Int32? = nil, int32: Int32? = nil, int64: Int64? = nil, float: Float? = nil, string: String? = nil, binary: Data? = nil, date: ISOFullDate? = nil, dateTime: Date? = nil, password: String? = nil, callback: String? = nil) -> RequestBuilder<Void> { | ||||||
|  |         let path = "/fake" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let formParams: [String:Any?] = [ | ||||||
|  |             "integer": integer?.encodeToJSON(), | ||||||
|  |             "int32": int32?.encodeToJSON(), | ||||||
|  |             "int64": int64?.encodeToJSON(), | ||||||
|  |             "number": number, | ||||||
|  |             "float": float, | ||||||
|  |             "double": double, | ||||||
|  |             "string": string, | ||||||
|  |             "pattern_without_delimiter": patternWithoutDelimiter, | ||||||
|  |             "byte": byte, | ||||||
|  |             "binary": binary, | ||||||
|  |             "date": date?.encodeToJSON(), | ||||||
|  |             "dateTime": dateTime?.encodeToJSON(), | ||||||
|  |             "password": password, | ||||||
|  |             "callback": callback | ||||||
|  |         ] | ||||||
|  | 
 | ||||||
|  |         let nonNullParameters = APIHelper.rejectNil(formParams) | ||||||
|  |         let parameters = APIHelper.convertBoolToString(nonNullParameters) | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * enum for parameter enumFormStringArray | ||||||
|  |      */ | ||||||
|  |     public enum EnumFormStringArray_testEnumParameters: String {  | ||||||
|  |         case greaterThan = ">" | ||||||
|  |         case dollar = "$" | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * enum for parameter enumFormString | ||||||
|  |      */ | ||||||
|  |     public enum EnumFormString_testEnumParameters: String {  | ||||||
|  |         case abc = "_abc" | ||||||
|  |         case efg = "-efg" | ||||||
|  |         case xyz = "(xyz)" | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * enum for parameter enumHeaderStringArray | ||||||
|  |      */ | ||||||
|  |     public enum EnumHeaderStringArray_testEnumParameters: String {  | ||||||
|  |         case greaterThan = ">" | ||||||
|  |         case dollar = "$" | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * enum for parameter enumHeaderString | ||||||
|  |      */ | ||||||
|  |     public enum EnumHeaderString_testEnumParameters: String {  | ||||||
|  |         case abc = "_abc" | ||||||
|  |         case efg = "-efg" | ||||||
|  |         case xyz = "(xyz)" | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * enum for parameter enumQueryStringArray | ||||||
|  |      */ | ||||||
|  |     public enum EnumQueryStringArray_testEnumParameters: String {  | ||||||
|  |         case greaterThan = ">" | ||||||
|  |         case dollar = "$" | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * enum for parameter enumQueryString | ||||||
|  |      */ | ||||||
|  |     public enum EnumQueryString_testEnumParameters: String {  | ||||||
|  |         case abc = "_abc" | ||||||
|  |         case efg = "-efg" | ||||||
|  |         case xyz = "(xyz)" | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * enum for parameter enumQueryInteger | ||||||
|  |      */ | ||||||
|  |     public enum EnumQueryInteger_testEnumParameters: Int32 {  | ||||||
|  |         case _1 = 1 | ||||||
|  |         case numberminus2 = -2 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * enum for parameter enumQueryDouble | ||||||
|  |      */ | ||||||
|  |     public enum EnumQueryDouble_testEnumParameters: Double {  | ||||||
|  |         case _11 = 1.1 | ||||||
|  |         case numberminus12 = -1.2 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      To test enum parameters | ||||||
|  |      - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional) | ||||||
|  |      - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to -efg) | ||||||
|  |      - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) | ||||||
|  |      - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to -efg) | ||||||
|  |      - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) | ||||||
|  |      - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to -efg) | ||||||
|  |      - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) | ||||||
|  |      - parameter enumQueryDouble: (form) Query parameter enum test (double) (optional) | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func testEnumParameters(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         testEnumParametersWithRequestBuilder(enumFormStringArray: enumFormStringArray, enumFormString: enumFormString, enumHeaderStringArray: enumHeaderStringArray, enumHeaderString: enumHeaderString, enumQueryStringArray: enumQueryStringArray, enumQueryString: enumQueryString, enumQueryInteger: enumQueryInteger, enumQueryDouble: enumQueryDouble).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      To test enum parameters | ||||||
|  |      - GET /fake | ||||||
|  |      - To test enum parameters | ||||||
|  | 
 | ||||||
|  |      - parameter enumFormStringArray: (form) Form parameter enum test (string array) (optional) | ||||||
|  |      - parameter enumFormString: (form) Form parameter enum test (string) (optional, default to -efg) | ||||||
|  |      - parameter enumHeaderStringArray: (header) Header parameter enum test (string array) (optional) | ||||||
|  |      - parameter enumHeaderString: (header) Header parameter enum test (string) (optional, default to -efg) | ||||||
|  |      - parameter enumQueryStringArray: (query) Query parameter enum test (string array) (optional) | ||||||
|  |      - parameter enumQueryString: (query) Query parameter enum test (string) (optional, default to -efg) | ||||||
|  |      - parameter enumQueryInteger: (query) Query parameter enum test (double) (optional) | ||||||
|  |      - parameter enumQueryDouble: (form) Query parameter enum test (double) (optional) | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func testEnumParametersWithRequestBuilder(enumFormStringArray: [String]? = nil, enumFormString: EnumFormString_testEnumParameters? = nil, enumHeaderStringArray: [String]? = nil, enumHeaderString: EnumHeaderString_testEnumParameters? = nil, enumQueryStringArray: [String]? = nil, enumQueryString: EnumQueryString_testEnumParameters? = nil, enumQueryInteger: EnumQueryInteger_testEnumParameters? = nil, enumQueryDouble: EnumQueryDouble_testEnumParameters? = nil) -> RequestBuilder<Void> { | ||||||
|  |         let path = "/fake" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let formParams: [String:Any?] = [ | ||||||
|  |             "enum_form_string_array": enumFormStringArray, | ||||||
|  |             "enum_form_string": enumFormString?.rawValue, | ||||||
|  |             "enum_query_double": enumQueryDouble?.rawValue | ||||||
|  |         ] | ||||||
|  | 
 | ||||||
|  |         let nonNullParameters = APIHelper.rejectNil(formParams) | ||||||
|  |         let parameters = APIHelper.convertBoolToString(nonNullParameters) | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  |         url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ | ||||||
|  |             "enum_query_string_array": enumQueryStringArray,  | ||||||
|  |             "enum_query_string": enumQueryString?.rawValue,  | ||||||
|  |             "enum_query_integer": enumQueryInteger?.rawValue | ||||||
|  |         ]) | ||||||
|  |         let nillableHeaders: [String: Any?] = [ | ||||||
|  |             "enum_header_string_array": enumHeaderStringArray, | ||||||
|  |             "enum_header_string": enumHeaderString?.rawValue | ||||||
|  |         ] | ||||||
|  |         let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      test json serialization of form data | ||||||
|  |      - parameter param: (form) field1  | ||||||
|  |      - parameter param2: (form) field2  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func testJsonFormData(param: String, param2: String, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         testJsonFormDataWithRequestBuilder(param: param, param2: param2).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      test json serialization of form data | ||||||
|  |      - GET /fake/jsonFormData | ||||||
|  |      -  | ||||||
|  | 
 | ||||||
|  |      - parameter param: (form) field1  | ||||||
|  |      - parameter param2: (form) field2  | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func testJsonFormDataWithRequestBuilder(param: String, param2: String) -> RequestBuilder<Void> { | ||||||
|  |         let path = "/fake/jsonFormData" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let formParams: [String:Any?] = [ | ||||||
|  |             "param": param, | ||||||
|  |             "param2": param2 | ||||||
|  |         ] | ||||||
|  | 
 | ||||||
|  |         let nonNullParameters = APIHelper.rejectNil(formParams) | ||||||
|  |         let parameters = APIHelper.convertBoolToString(nonNullParameters) | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,47 @@ | |||||||
|  | // | ||||||
|  | // Fake_classname_tags123API.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | import Alamofire | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Fake_classname_tags123API: APIBase { | ||||||
|  |     /** | ||||||
|  |      To test class name in snake case | ||||||
|  |      - parameter body: (body) client model  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func testClassname(body: Client, completion: @escaping ((_ data: Client?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         testClassnameWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      To test class name in snake case | ||||||
|  |      - PATCH /fake_classname_test | ||||||
|  | 
 | ||||||
|  |      - examples: [{contentType=application/json, example={ | ||||||
|  |   "client" : "aeiou" | ||||||
|  | }}] | ||||||
|  |      - parameter body: (body) client model  | ||||||
|  |      - returns: RequestBuilder<Client>  | ||||||
|  |      */ | ||||||
|  |     open class func testClassnameWithRequestBuilder(body: Client) -> RequestBuilder<Client> { | ||||||
|  |         let path = "/fake_classname_test" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Client>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "PATCH", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,473 @@ | |||||||
|  | // | ||||||
|  | // PetAPI.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | import Alamofire | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class PetAPI: APIBase { | ||||||
|  |     /** | ||||||
|  |      Add a new pet to the store | ||||||
|  |      - parameter body: (body) Pet object that needs to be added to the store  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func addPet(body: Pet, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         addPetWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Add a new pet to the store | ||||||
|  |      - POST /pet | ||||||
|  |      -  | ||||||
|  |      - OAuth: | ||||||
|  |        - type: oauth2 | ||||||
|  |        - name: petstore_auth | ||||||
|  |      - parameter body: (body) Pet object that needs to be added to the store  | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func addPetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> { | ||||||
|  |         let path = "/pet" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Deletes a pet | ||||||
|  |      - parameter petId: (path) Pet id to delete  | ||||||
|  |      - parameter apiKey: (header)  (optional) | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func deletePet(petId: Int64, apiKey: String? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         deletePetWithRequestBuilder(petId: petId, apiKey: apiKey).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Deletes a pet | ||||||
|  |      - DELETE /pet/{petId} | ||||||
|  |      -  | ||||||
|  |      - OAuth: | ||||||
|  |        - type: oauth2 | ||||||
|  |        - name: petstore_auth | ||||||
|  |      - parameter petId: (path) Pet id to delete  | ||||||
|  |      - parameter apiKey: (header)  (optional) | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func deletePetWithRequestBuilder(petId: Int64, apiKey: String? = nil) -> RequestBuilder<Void> { | ||||||
|  |         var path = "/pet/{petId}" | ||||||
|  |         path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil) | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  |         let nillableHeaders: [String: Any?] = [ | ||||||
|  |             "api_key": apiKey | ||||||
|  |         ] | ||||||
|  |         let headerParameters = APIHelper.rejectNilHeaders(nillableHeaders) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false, headers: headerParameters) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * enum for parameter status | ||||||
|  |      */ | ||||||
|  |     public enum Status_findPetsByStatus: String {  | ||||||
|  |         case available = "available" | ||||||
|  |         case pending = "pending" | ||||||
|  |         case sold = "sold" | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Finds Pets by status | ||||||
|  |      - parameter status: (query) Status values that need to be considered for filter  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func findPetsByStatus(status: [String], completion: @escaping ((_ data: [Pet]?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         findPetsByStatusWithRequestBuilder(status: status).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Finds Pets by status | ||||||
|  |      - GET /pet/findByStatus | ||||||
|  |      - Multiple status values can be provided with comma separated strings | ||||||
|  |      - OAuth: | ||||||
|  |        - type: oauth2 | ||||||
|  |        - name: petstore_auth | ||||||
|  |      - examples: [{contentType=application/xml, example=<Pet> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <name>doggie</name> | ||||||
|  |   <photoUrls> | ||||||
|  |     <photoUrls>aeiou</photoUrls> | ||||||
|  |   </photoUrls> | ||||||
|  |   <tags> | ||||||
|  |   </tags> | ||||||
|  |   <status>aeiou</status> | ||||||
|  | </Pet>}, {contentType=application/json, example=[ { | ||||||
|  |   "photoUrls" : [ "aeiou" ], | ||||||
|  |   "name" : "doggie", | ||||||
|  |   "id" : 0, | ||||||
|  |   "category" : { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 6 | ||||||
|  |   }, | ||||||
|  |   "tags" : [ { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 1 | ||||||
|  |   } ], | ||||||
|  |   "status" : "available" | ||||||
|  | } ]}] | ||||||
|  |      - examples: [{contentType=application/xml, example=<Pet> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <name>doggie</name> | ||||||
|  |   <photoUrls> | ||||||
|  |     <photoUrls>aeiou</photoUrls> | ||||||
|  |   </photoUrls> | ||||||
|  |   <tags> | ||||||
|  |   </tags> | ||||||
|  |   <status>aeiou</status> | ||||||
|  | </Pet>}, {contentType=application/json, example=[ { | ||||||
|  |   "photoUrls" : [ "aeiou" ], | ||||||
|  |   "name" : "doggie", | ||||||
|  |   "id" : 0, | ||||||
|  |   "category" : { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 6 | ||||||
|  |   }, | ||||||
|  |   "tags" : [ { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 1 | ||||||
|  |   } ], | ||||||
|  |   "status" : "available" | ||||||
|  | } ]}] | ||||||
|  |      - parameter status: (query) Status values that need to be considered for filter  | ||||||
|  |      - returns: RequestBuilder<[Pet]>  | ||||||
|  |      */ | ||||||
|  |     open class func findPetsByStatusWithRequestBuilder(status: [String]) -> RequestBuilder<[Pet]> { | ||||||
|  |         let path = "/pet/findByStatus" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  |         url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ | ||||||
|  |             "status": status | ||||||
|  |         ]) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Finds Pets by tags | ||||||
|  |      - parameter tags: (query) Tags to filter by  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func findPetsByTags(tags: [String], completion: @escaping ((_ data: [Pet]?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         findPetsByTagsWithRequestBuilder(tags: tags).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Finds Pets by tags | ||||||
|  |      - GET /pet/findByTags | ||||||
|  |      - Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. | ||||||
|  |      - OAuth: | ||||||
|  |        - type: oauth2 | ||||||
|  |        - name: petstore_auth | ||||||
|  |      - examples: [{contentType=application/xml, example=<Pet> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <name>doggie</name> | ||||||
|  |   <photoUrls> | ||||||
|  |     <photoUrls>aeiou</photoUrls> | ||||||
|  |   </photoUrls> | ||||||
|  |   <tags> | ||||||
|  |   </tags> | ||||||
|  |   <status>aeiou</status> | ||||||
|  | </Pet>}, {contentType=application/json, example=[ { | ||||||
|  |   "photoUrls" : [ "aeiou" ], | ||||||
|  |   "name" : "doggie", | ||||||
|  |   "id" : 0, | ||||||
|  |   "category" : { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 6 | ||||||
|  |   }, | ||||||
|  |   "tags" : [ { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 1 | ||||||
|  |   } ], | ||||||
|  |   "status" : "available" | ||||||
|  | } ]}] | ||||||
|  |      - examples: [{contentType=application/xml, example=<Pet> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <name>doggie</name> | ||||||
|  |   <photoUrls> | ||||||
|  |     <photoUrls>aeiou</photoUrls> | ||||||
|  |   </photoUrls> | ||||||
|  |   <tags> | ||||||
|  |   </tags> | ||||||
|  |   <status>aeiou</status> | ||||||
|  | </Pet>}, {contentType=application/json, example=[ { | ||||||
|  |   "photoUrls" : [ "aeiou" ], | ||||||
|  |   "name" : "doggie", | ||||||
|  |   "id" : 0, | ||||||
|  |   "category" : { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 6 | ||||||
|  |   }, | ||||||
|  |   "tags" : [ { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 1 | ||||||
|  |   } ], | ||||||
|  |   "status" : "available" | ||||||
|  | } ]}] | ||||||
|  |      - parameter tags: (query) Tags to filter by  | ||||||
|  |      - returns: RequestBuilder<[Pet]>  | ||||||
|  |      */ | ||||||
|  |     open class func findPetsByTagsWithRequestBuilder(tags: [String]) -> RequestBuilder<[Pet]> { | ||||||
|  |         let path = "/pet/findByTags" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  |         url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ | ||||||
|  |             "tags": tags | ||||||
|  |         ]) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<[Pet]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Find pet by ID | ||||||
|  |      - parameter petId: (path) ID of pet to return  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func getPetById(petId: Int64, completion: @escaping ((_ data: Pet?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         getPetByIdWithRequestBuilder(petId: petId).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Find pet by ID | ||||||
|  |      - GET /pet/{petId} | ||||||
|  |      - Returns a single pet | ||||||
|  |      - API Key: | ||||||
|  |        - type: apiKey api_key  | ||||||
|  |        - name: api_key | ||||||
|  |      - examples: [{contentType=application/xml, example=<Pet> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <name>doggie</name> | ||||||
|  |   <photoUrls> | ||||||
|  |     <photoUrls>aeiou</photoUrls> | ||||||
|  |   </photoUrls> | ||||||
|  |   <tags> | ||||||
|  |   </tags> | ||||||
|  |   <status>aeiou</status> | ||||||
|  | </Pet>}, {contentType=application/json, example={ | ||||||
|  |   "photoUrls" : [ "aeiou" ], | ||||||
|  |   "name" : "doggie", | ||||||
|  |   "id" : 0, | ||||||
|  |   "category" : { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 6 | ||||||
|  |   }, | ||||||
|  |   "tags" : [ { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 1 | ||||||
|  |   } ], | ||||||
|  |   "status" : "available" | ||||||
|  | }}] | ||||||
|  |      - examples: [{contentType=application/xml, example=<Pet> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <name>doggie</name> | ||||||
|  |   <photoUrls> | ||||||
|  |     <photoUrls>aeiou</photoUrls> | ||||||
|  |   </photoUrls> | ||||||
|  |   <tags> | ||||||
|  |   </tags> | ||||||
|  |   <status>aeiou</status> | ||||||
|  | </Pet>}, {contentType=application/json, example={ | ||||||
|  |   "photoUrls" : [ "aeiou" ], | ||||||
|  |   "name" : "doggie", | ||||||
|  |   "id" : 0, | ||||||
|  |   "category" : { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 6 | ||||||
|  |   }, | ||||||
|  |   "tags" : [ { | ||||||
|  |     "name" : "aeiou", | ||||||
|  |     "id" : 1 | ||||||
|  |   } ], | ||||||
|  |   "status" : "available" | ||||||
|  | }}] | ||||||
|  |      - parameter petId: (path) ID of pet to return  | ||||||
|  |      - returns: RequestBuilder<Pet>  | ||||||
|  |      */ | ||||||
|  |     open class func getPetByIdWithRequestBuilder(petId: Int64) -> RequestBuilder<Pet> { | ||||||
|  |         var path = "/pet/{petId}" | ||||||
|  |         path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil) | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Pet>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Update an existing pet | ||||||
|  |      - parameter body: (body) Pet object that needs to be added to the store  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func updatePet(body: Pet, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         updatePetWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Update an existing pet | ||||||
|  |      - PUT /pet | ||||||
|  |      -  | ||||||
|  |      - OAuth: | ||||||
|  |        - type: oauth2 | ||||||
|  |        - name: petstore_auth | ||||||
|  |      - parameter body: (body) Pet object that needs to be added to the store  | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func updatePetWithRequestBuilder(body: Pet) -> RequestBuilder<Void> { | ||||||
|  |         let path = "/pet" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Updates a pet in the store with form data | ||||||
|  |      - parameter petId: (path) ID of pet that needs to be updated  | ||||||
|  |      - parameter name: (form) Updated name of the pet (optional) | ||||||
|  |      - parameter status: (form) Updated status of the pet (optional) | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func updatePetWithForm(petId: Int64, name: String? = nil, status: String? = nil, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         updatePetWithFormWithRequestBuilder(petId: petId, name: name, status: status).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Updates a pet in the store with form data | ||||||
|  |      - POST /pet/{petId} | ||||||
|  |      -  | ||||||
|  |      - OAuth: | ||||||
|  |        - type: oauth2 | ||||||
|  |        - name: petstore_auth | ||||||
|  |      - parameter petId: (path) ID of pet that needs to be updated  | ||||||
|  |      - parameter name: (form) Updated name of the pet (optional) | ||||||
|  |      - parameter status: (form) Updated status of the pet (optional) | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func updatePetWithFormWithRequestBuilder(petId: Int64, name: String? = nil, status: String? = nil) -> RequestBuilder<Void> { | ||||||
|  |         var path = "/pet/{petId}" | ||||||
|  |         path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil) | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let formParams: [String:Any?] = [ | ||||||
|  |             "name": name, | ||||||
|  |             "status": status | ||||||
|  |         ] | ||||||
|  | 
 | ||||||
|  |         let nonNullParameters = APIHelper.rejectNil(formParams) | ||||||
|  |         let parameters = APIHelper.convertBoolToString(nonNullParameters) | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      uploads an image | ||||||
|  |      - parameter petId: (path) ID of pet to update  | ||||||
|  |      - parameter additionalMetadata: (form) Additional data to pass to server (optional) | ||||||
|  |      - parameter file: (form) file to upload (optional) | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func uploadFile(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil, completion: @escaping ((_ data: ApiResponse?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         uploadFileWithRequestBuilder(petId: petId, additionalMetadata: additionalMetadata, file: file).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      uploads an image | ||||||
|  |      - POST /pet/{petId}/uploadImage | ||||||
|  |      -  | ||||||
|  |      - OAuth: | ||||||
|  |        - type: oauth2 | ||||||
|  |        - name: petstore_auth | ||||||
|  |      - examples: [{contentType=application/json, example={ | ||||||
|  |   "code" : 0, | ||||||
|  |   "type" : "aeiou", | ||||||
|  |   "message" : "aeiou" | ||||||
|  | }}] | ||||||
|  |      - parameter petId: (path) ID of pet to update  | ||||||
|  |      - parameter additionalMetadata: (form) Additional data to pass to server (optional) | ||||||
|  |      - parameter file: (form) file to upload (optional) | ||||||
|  |      - returns: RequestBuilder<ApiResponse>  | ||||||
|  |      */ | ||||||
|  |     open class func uploadFileWithRequestBuilder(petId: Int64, additionalMetadata: String? = nil, file: URL? = nil) -> RequestBuilder<ApiResponse> { | ||||||
|  |         var path = "/pet/{petId}/uploadImage" | ||||||
|  |         path = path.replacingOccurrences(of: "{petId}", with: "\(petId)", options: .literal, range: nil) | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let formParams: [String:Any?] = [ | ||||||
|  |             "additionalMetadata": additionalMetadata, | ||||||
|  |             "file": file | ||||||
|  |         ] | ||||||
|  | 
 | ||||||
|  |         let nonNullParameters = APIHelper.rejectNil(formParams) | ||||||
|  |         let parameters = APIHelper.convertBoolToString(nonNullParameters) | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<ApiResponse>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,206 @@ | |||||||
|  | // | ||||||
|  | // StoreAPI.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | import Alamofire | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class StoreAPI: APIBase { | ||||||
|  |     /** | ||||||
|  |      Delete purchase order by ID | ||||||
|  |      - parameter orderId: (path) ID of the order that needs to be deleted  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func deleteOrder(orderId: String, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         deleteOrderWithRequestBuilder(orderId: orderId).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Delete purchase order by ID | ||||||
|  |      - DELETE /store/order/{order_id} | ||||||
|  |      - For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors | ||||||
|  | 
 | ||||||
|  |      - parameter orderId: (path) ID of the order that needs to be deleted  | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func deleteOrderWithRequestBuilder(orderId: String) -> RequestBuilder<Void> { | ||||||
|  |         var path = "/store/order/{order_id}" | ||||||
|  |         path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil) | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Returns pet inventories by status | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func getInventory(completion: @escaping ((_ data: [String:Int32]?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         getInventoryWithRequestBuilder().execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Returns pet inventories by status | ||||||
|  |      - GET /store/inventory | ||||||
|  |      - Returns a map of status codes to quantities | ||||||
|  |      - API Key: | ||||||
|  |        - type: apiKey api_key  | ||||||
|  |        - name: api_key | ||||||
|  |      - examples: [{contentType=application/json, example={ | ||||||
|  |   "key" : 0 | ||||||
|  | }}] | ||||||
|  |      - returns: RequestBuilder<[String:Int32]>  | ||||||
|  |      */ | ||||||
|  |     open class func getInventoryWithRequestBuilder() -> RequestBuilder<[String:Int32]> { | ||||||
|  |         let path = "/store/inventory" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<[String:Int32]>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Find purchase order by ID | ||||||
|  |      - parameter orderId: (path) ID of pet that needs to be fetched  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func getOrderById(orderId: Int64, completion: @escaping ((_ data: Order?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         getOrderByIdWithRequestBuilder(orderId: orderId).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Find purchase order by ID | ||||||
|  |      - GET /store/order/{order_id} | ||||||
|  |      - For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions | ||||||
|  | 
 | ||||||
|  |      - examples: [{contentType=application/xml, example=<Order> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <petId>123456789</petId> | ||||||
|  |   <quantity>123</quantity> | ||||||
|  |   <shipDate>2000-01-23T04:56:07.000Z</shipDate> | ||||||
|  |   <status>aeiou</status> | ||||||
|  |   <complete>true</complete> | ||||||
|  | </Order>}, {contentType=application/json, example={ | ||||||
|  |   "petId" : 6, | ||||||
|  |   "quantity" : 1, | ||||||
|  |   "id" : 0, | ||||||
|  |   "shipDate" : "2000-01-23T04:56:07.000+00:00", | ||||||
|  |   "complete" : false, | ||||||
|  |   "status" : "placed" | ||||||
|  | }}] | ||||||
|  |      - examples: [{contentType=application/xml, example=<Order> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <petId>123456789</petId> | ||||||
|  |   <quantity>123</quantity> | ||||||
|  |   <shipDate>2000-01-23T04:56:07.000Z</shipDate> | ||||||
|  |   <status>aeiou</status> | ||||||
|  |   <complete>true</complete> | ||||||
|  | </Order>}, {contentType=application/json, example={ | ||||||
|  |   "petId" : 6, | ||||||
|  |   "quantity" : 1, | ||||||
|  |   "id" : 0, | ||||||
|  |   "shipDate" : "2000-01-23T04:56:07.000+00:00", | ||||||
|  |   "complete" : false, | ||||||
|  |   "status" : "placed" | ||||||
|  | }}] | ||||||
|  |      - parameter orderId: (path) ID of pet that needs to be fetched  | ||||||
|  |      - returns: RequestBuilder<Order>  | ||||||
|  |      */ | ||||||
|  |     open class func getOrderByIdWithRequestBuilder(orderId: Int64) -> RequestBuilder<Order> { | ||||||
|  |         var path = "/store/order/{order_id}" | ||||||
|  |         path = path.replacingOccurrences(of: "{order_id}", with: "\(orderId)", options: .literal, range: nil) | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Place an order for a pet | ||||||
|  |      - parameter body: (body) order placed for purchasing the pet  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func placeOrder(body: Order, completion: @escaping ((_ data: Order?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         placeOrderWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Place an order for a pet | ||||||
|  |      - POST /store/order | ||||||
|  |      -  | ||||||
|  | 
 | ||||||
|  |      - examples: [{contentType=application/xml, example=<Order> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <petId>123456789</petId> | ||||||
|  |   <quantity>123</quantity> | ||||||
|  |   <shipDate>2000-01-23T04:56:07.000Z</shipDate> | ||||||
|  |   <status>aeiou</status> | ||||||
|  |   <complete>true</complete> | ||||||
|  | </Order>}, {contentType=application/json, example={ | ||||||
|  |   "petId" : 6, | ||||||
|  |   "quantity" : 1, | ||||||
|  |   "id" : 0, | ||||||
|  |   "shipDate" : "2000-01-23T04:56:07.000+00:00", | ||||||
|  |   "complete" : false, | ||||||
|  |   "status" : "placed" | ||||||
|  | }}] | ||||||
|  |      - examples: [{contentType=application/xml, example=<Order> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <petId>123456789</petId> | ||||||
|  |   <quantity>123</quantity> | ||||||
|  |   <shipDate>2000-01-23T04:56:07.000Z</shipDate> | ||||||
|  |   <status>aeiou</status> | ||||||
|  |   <complete>true</complete> | ||||||
|  | </Order>}, {contentType=application/json, example={ | ||||||
|  |   "petId" : 6, | ||||||
|  |   "quantity" : 1, | ||||||
|  |   "id" : 0, | ||||||
|  |   "shipDate" : "2000-01-23T04:56:07.000+00:00", | ||||||
|  |   "complete" : false, | ||||||
|  |   "status" : "placed" | ||||||
|  | }}] | ||||||
|  |      - parameter body: (body) order placed for purchasing the pet  | ||||||
|  |      - returns: RequestBuilder<Order>  | ||||||
|  |      */ | ||||||
|  |     open class func placeOrderWithRequestBuilder(body: Order) -> RequestBuilder<Order> { | ||||||
|  |         let path = "/store/order" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Order>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,320 @@ | |||||||
|  | // | ||||||
|  | // UserAPI.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | import Alamofire | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class UserAPI: APIBase { | ||||||
|  |     /** | ||||||
|  |      Create user | ||||||
|  |      - parameter body: (body) Created user object  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func createUser(body: User, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         createUserWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Create user | ||||||
|  |      - POST /user | ||||||
|  |      - This can only be done by the logged in user. | ||||||
|  | 
 | ||||||
|  |      - parameter body: (body) Created user object  | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func createUserWithRequestBuilder(body: User) -> RequestBuilder<Void> { | ||||||
|  |         let path = "/user" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Creates list of users with given input array | ||||||
|  |      - parameter body: (body) List of user object  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func createUsersWithArrayInput(body: [User], completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         createUsersWithArrayInputWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Creates list of users with given input array | ||||||
|  |      - POST /user/createWithArray | ||||||
|  |      -  | ||||||
|  | 
 | ||||||
|  |      - parameter body: (body) List of user object  | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func createUsersWithArrayInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> { | ||||||
|  |         let path = "/user/createWithArray" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Creates list of users with given input array | ||||||
|  |      - parameter body: (body) List of user object  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func createUsersWithListInput(body: [User], completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         createUsersWithListInputWithRequestBuilder(body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Creates list of users with given input array | ||||||
|  |      - POST /user/createWithList | ||||||
|  |      -  | ||||||
|  | 
 | ||||||
|  |      - parameter body: (body) List of user object  | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func createUsersWithListInputWithRequestBuilder(body: [User]) -> RequestBuilder<Void> { | ||||||
|  |         let path = "/user/createWithList" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Delete user | ||||||
|  |      - parameter username: (path) The name that needs to be deleted  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func deleteUser(username: String, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         deleteUserWithRequestBuilder(username: username).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Delete user | ||||||
|  |      - DELETE /user/{username} | ||||||
|  |      - This can only be done by the logged in user. | ||||||
|  | 
 | ||||||
|  |      - parameter username: (path) The name that needs to be deleted  | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func deleteUserWithRequestBuilder(username: String) -> RequestBuilder<Void> { | ||||||
|  |         var path = "/user/{username}" | ||||||
|  |         path = path.replacingOccurrences(of: "{username}", with: "\(username)", options: .literal, range: nil) | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "DELETE", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Get user by user name | ||||||
|  |      - parameter username: (path) The name that needs to be fetched. Use user1 for testing.   | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func getUserByName(username: String, completion: @escaping ((_ data: User?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         getUserByNameWithRequestBuilder(username: username).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Get user by user name | ||||||
|  |      - GET /user/{username} | ||||||
|  |      -  | ||||||
|  | 
 | ||||||
|  |      - examples: [{contentType=application/xml, example=<User> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <username>aeiou</username> | ||||||
|  |   <firstName>aeiou</firstName> | ||||||
|  |   <lastName>aeiou</lastName> | ||||||
|  |   <email>aeiou</email> | ||||||
|  |   <password>aeiou</password> | ||||||
|  |   <phone>aeiou</phone> | ||||||
|  |   <userStatus>123</userStatus> | ||||||
|  | </User>}, {contentType=application/json, example={ | ||||||
|  |   "firstName" : "aeiou", | ||||||
|  |   "lastName" : "aeiou", | ||||||
|  |   "password" : "aeiou", | ||||||
|  |   "userStatus" : 6, | ||||||
|  |   "phone" : "aeiou", | ||||||
|  |   "id" : 0, | ||||||
|  |   "email" : "aeiou", | ||||||
|  |   "username" : "aeiou" | ||||||
|  | }}] | ||||||
|  |      - examples: [{contentType=application/xml, example=<User> | ||||||
|  |   <id>123456789</id> | ||||||
|  |   <username>aeiou</username> | ||||||
|  |   <firstName>aeiou</firstName> | ||||||
|  |   <lastName>aeiou</lastName> | ||||||
|  |   <email>aeiou</email> | ||||||
|  |   <password>aeiou</password> | ||||||
|  |   <phone>aeiou</phone> | ||||||
|  |   <userStatus>123</userStatus> | ||||||
|  | </User>}, {contentType=application/json, example={ | ||||||
|  |   "firstName" : "aeiou", | ||||||
|  |   "lastName" : "aeiou", | ||||||
|  |   "password" : "aeiou", | ||||||
|  |   "userStatus" : 6, | ||||||
|  |   "phone" : "aeiou", | ||||||
|  |   "id" : 0, | ||||||
|  |   "email" : "aeiou", | ||||||
|  |   "username" : "aeiou" | ||||||
|  | }}] | ||||||
|  |      - parameter username: (path) The name that needs to be fetched. Use user1 for testing.   | ||||||
|  |      - returns: RequestBuilder<User>  | ||||||
|  |      */ | ||||||
|  |     open class func getUserByNameWithRequestBuilder(username: String) -> RequestBuilder<User> { | ||||||
|  |         var path = "/user/{username}" | ||||||
|  |         path = path.replacingOccurrences(of: "{username}", with: "\(username)", options: .literal, range: nil) | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<User>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Logs user into the system | ||||||
|  |      - parameter username: (query) The user name for login  | ||||||
|  |      - parameter password: (query) The password for login in clear text  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func loginUser(username: String, password: String, completion: @escaping ((_ data: String?, _ error: ErrorResponse?) -> Void)) { | ||||||
|  |         loginUserWithRequestBuilder(username: username, password: password).execute { (response, error) -> Void in | ||||||
|  |             completion(response?.body, error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Logs user into the system | ||||||
|  |      - GET /user/login | ||||||
|  |      -  | ||||||
|  | 
 | ||||||
|  |      - responseHeaders: [X-Rate-Limit(Int32), X-Expires-After(Date)] | ||||||
|  |      - responseHeaders: [X-Rate-Limit(Int32), X-Expires-After(Date)] | ||||||
|  |      - examples: [{contentType=application/xml, example=aeiou}, {contentType=application/json, example="aeiou"}] | ||||||
|  |      - examples: [{contentType=application/xml, example=aeiou}, {contentType=application/json, example="aeiou"}] | ||||||
|  |      - parameter username: (query) The user name for login  | ||||||
|  |      - parameter password: (query) The password for login in clear text  | ||||||
|  |      - returns: RequestBuilder<String>  | ||||||
|  |      */ | ||||||
|  |     open class func loginUserWithRequestBuilder(username: String, password: String) -> RequestBuilder<String> { | ||||||
|  |         let path = "/user/login" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  |         url?.queryItems = APIHelper.mapValuesToQueryItems(values:[ | ||||||
|  |             "username": username,  | ||||||
|  |             "password": password | ||||||
|  |         ]) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<String>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Logs out current logged in user session | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func logoutUser(completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         logoutUserWithRequestBuilder().execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Logs out current logged in user session | ||||||
|  |      - GET /user/logout | ||||||
|  |      -  | ||||||
|  | 
 | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func logoutUserWithRequestBuilder() -> RequestBuilder<Void> { | ||||||
|  |         let path = "/user/logout" | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters: [String:Any]? = nil | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "GET", URLString: (url?.string ?? URLString), parameters: parameters, isBody: false) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Updated user | ||||||
|  |      - parameter username: (path) name that need to be deleted  | ||||||
|  |      - parameter body: (body) Updated user object  | ||||||
|  |      - parameter completion: completion handler to receive the data and the error objects | ||||||
|  |      */ | ||||||
|  |     open class func updateUser(username: String, body: User, completion: @escaping ((_ error: ErrorResponse?) -> Void)) { | ||||||
|  |         updateUserWithRequestBuilder(username: username, body: body).execute { (response, error) -> Void in | ||||||
|  |             completion(error) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Updated user | ||||||
|  |      - PUT /user/{username} | ||||||
|  |      - This can only be done by the logged in user. | ||||||
|  | 
 | ||||||
|  |      - parameter username: (path) name that need to be deleted  | ||||||
|  |      - parameter body: (body) Updated user object  | ||||||
|  |      - returns: RequestBuilder<Void>  | ||||||
|  |      */ | ||||||
|  |     open class func updateUserWithRequestBuilder(username: String, body: User) -> RequestBuilder<Void> { | ||||||
|  |         var path = "/user/{username}" | ||||||
|  |         path = path.replacingOccurrences(of: "{username}", with: "\(username)", options: .literal, range: nil) | ||||||
|  |         let URLString = PetstoreClientAPI.basePath + path | ||||||
|  |         let parameters = body.encodeToJSON() as? [String:AnyObject] | ||||||
|  | 
 | ||||||
|  |         let url = NSURLComponents(string: URLString) | ||||||
|  | 
 | ||||||
|  |         let requestBuilder: RequestBuilder<Void>.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() | ||||||
|  | 
 | ||||||
|  |         return requestBuilder.init(method: "PUT", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
| @ -0,0 +1,256 @@ | |||||||
|  | // AlamofireImplementations.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | import Alamofire | ||||||
|  | 
 | ||||||
|  | class AlamofireRequestBuilderFactory: RequestBuilderFactory { | ||||||
|  |     func getBuilder<T>() -> RequestBuilder<T>.Type { | ||||||
|  |         return AlamofireRequestBuilder<T>.self | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | private struct SynchronizedDictionary<K: Hashable, V> { | ||||||
|  | 
 | ||||||
|  |     private var dictionary = [K: V]() | ||||||
|  |     private let queue = DispatchQueue( | ||||||
|  |         label: "SynchronizedDictionary", | ||||||
|  |         qos: DispatchQoS.userInitiated, | ||||||
|  |         attributes: [DispatchQueue.Attributes.concurrent], | ||||||
|  |         autoreleaseFrequency: DispatchQueue.AutoreleaseFrequency.inherit, | ||||||
|  |         target: nil | ||||||
|  |     ) | ||||||
|  | 
 | ||||||
|  |     public subscript(key: K) -> V? { | ||||||
|  |         get { | ||||||
|  |             var value: V? | ||||||
|  | 
 | ||||||
|  |             queue.sync { | ||||||
|  |                 value = self.dictionary[key] | ||||||
|  |             } | ||||||
|  | 
 | ||||||
|  |             return value | ||||||
|  |         } | ||||||
|  |         set { | ||||||
|  |             queue.sync(flags: DispatchWorkItemFlags.barrier) { | ||||||
|  |                 self.dictionary[key] = newValue | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | // Store manager to retain its reference | ||||||
|  | private var managerStore = SynchronizedDictionary<String, Alamofire.SessionManager>() | ||||||
|  | 
 | ||||||
|  | open class AlamofireRequestBuilder<T>: RequestBuilder<T> { | ||||||
|  |     required public init(method: String, URLString: String, parameters: [String : Any]?, isBody: Bool, headers: [String : String] = [:]) { | ||||||
|  |         super.init(method: method, URLString: URLString, parameters: parameters, isBody: isBody, headers: headers) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      May be overridden by a subclass if you want to control the session | ||||||
|  |      configuration. | ||||||
|  |      */ | ||||||
|  |     open func createSessionManager() -> Alamofire.SessionManager { | ||||||
|  |         let configuration = URLSessionConfiguration.default | ||||||
|  |         configuration.httpAdditionalHeaders = buildHeaders() | ||||||
|  |         return Alamofire.SessionManager(configuration: configuration) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      May be overridden by a subclass if you want to control the Content-Type | ||||||
|  |      that is given to an uploaded form part. | ||||||
|  | 
 | ||||||
|  |      Return nil to use the default behavior (inferring the Content-Type from | ||||||
|  |      the file extension).  Return the desired Content-Type otherwise. | ||||||
|  |      */ | ||||||
|  |     open func contentTypeForFormPart(fileURL: URL) -> String? { | ||||||
|  |         return nil | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      May be overridden by a subclass if you want to control the request | ||||||
|  |      configuration (e.g. to override the cache policy). | ||||||
|  |      */ | ||||||
|  |     open func makeRequest(manager: SessionManager, method: HTTPMethod, encoding: ParameterEncoding, headers: [String:String]) -> DataRequest { | ||||||
|  |         return manager.request(URLString, method: method, parameters: parameters, encoding: encoding, headers: headers) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     override open func execute(_ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { | ||||||
|  |         let managerId:String = UUID().uuidString | ||||||
|  |         // Create a new manager for each request to customize its request header | ||||||
|  |         let manager = createSessionManager() | ||||||
|  |         managerStore[managerId] = manager | ||||||
|  | 
 | ||||||
|  |         let encoding:ParameterEncoding = isBody ? JSONEncoding() : URLEncoding() | ||||||
|  | 
 | ||||||
|  |         let xMethod = Alamofire.HTTPMethod(rawValue: method) | ||||||
|  |         let fileKeys = parameters == nil ? [] : parameters!.filter { $1 is NSURL } | ||||||
|  |                                                            .map { $0.0 } | ||||||
|  | 
 | ||||||
|  |         if fileKeys.count > 0 { | ||||||
|  |             manager.upload(multipartFormData: { mpForm in | ||||||
|  |                 for (k, v) in self.parameters! { | ||||||
|  |                     switch v { | ||||||
|  |                     case let fileURL as URL: | ||||||
|  |                         if let mimeType = self.contentTypeForFormPart(fileURL: fileURL) { | ||||||
|  |                             mpForm.append(fileURL, withName: k, fileName: fileURL.lastPathComponent, mimeType: mimeType) | ||||||
|  |                         } | ||||||
|  |                         else { | ||||||
|  |                             mpForm.append(fileURL, withName: k) | ||||||
|  |                         } | ||||||
|  |                         break | ||||||
|  |                     case let string as String: | ||||||
|  |                         mpForm.append(string.data(using: String.Encoding.utf8)!, withName: k) | ||||||
|  |                         break | ||||||
|  |                     case let number as NSNumber: | ||||||
|  |                         mpForm.append(number.stringValue.data(using: String.Encoding.utf8)!, withName: k) | ||||||
|  |                         break | ||||||
|  |                     default: | ||||||
|  |                         fatalError("Unprocessable value \(v) with key \(k)") | ||||||
|  |                         break | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |                 }, to: URLString, method: xMethod!, headers: nil, encodingCompletion: { encodingResult in | ||||||
|  |                 switch encodingResult { | ||||||
|  |                 case .success(let upload, _, _): | ||||||
|  |                     if let onProgressReady = self.onProgressReady { | ||||||
|  |                         onProgressReady(upload.uploadProgress) | ||||||
|  |                     } | ||||||
|  |                     self.processRequest(request: upload, managerId, completion) | ||||||
|  |                 case .failure(let encodingError): | ||||||
|  |                     completion(nil, ErrorResponse.HttpError(statusCode: 415, data: nil, error: encodingError)) | ||||||
|  |                 } | ||||||
|  |             }) | ||||||
|  |         } else { | ||||||
|  |             let request = makeRequest(manager: manager, method: xMethod!, encoding: encoding, headers: headers) | ||||||
|  |             if let onProgressReady = self.onProgressReady { | ||||||
|  |                 onProgressReady(request.progress) | ||||||
|  |             } | ||||||
|  |             processRequest(request: request, managerId, completion) | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     private func processRequest(request: DataRequest, _ managerId: String, _ completion: @escaping (_ response: Response<T>?, _ error: ErrorResponse?) -> Void) { | ||||||
|  |         if let credential = self.credential { | ||||||
|  |             request.authenticate(usingCredential: credential) | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         let cleanupRequest = { | ||||||
|  |             managerStore[managerId] = nil | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         let validatedRequest = request.validate() | ||||||
|  | 
 | ||||||
|  |         switch T.self { | ||||||
|  |         case is String.Type: | ||||||
|  |             validatedRequest.responseString(completionHandler: { (stringResponse) in | ||||||
|  |                 cleanupRequest() | ||||||
|  | 
 | ||||||
|  |                 if stringResponse.result.isFailure { | ||||||
|  |                     completion( | ||||||
|  |                         nil, | ||||||
|  |                         ErrorResponse.HttpError(statusCode: stringResponse.response?.statusCode ?? 500, data: stringResponse.data, error: stringResponse.result.error as Error!) | ||||||
|  |                     ) | ||||||
|  |                     return | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 completion( | ||||||
|  |                     Response( | ||||||
|  |                         response: stringResponse.response!, | ||||||
|  |                         body: ((stringResponse.result.value ?? "") as! T) | ||||||
|  |                     ), | ||||||
|  |                     nil | ||||||
|  |                 ) | ||||||
|  |             }) | ||||||
|  |         case is Void.Type: | ||||||
|  |             validatedRequest.responseData(completionHandler: { (voidResponse) in | ||||||
|  |                 cleanupRequest() | ||||||
|  | 
 | ||||||
|  |                 if voidResponse.result.isFailure { | ||||||
|  |                     completion( | ||||||
|  |                         nil, | ||||||
|  |                         ErrorResponse.HttpError(statusCode: voidResponse.response?.statusCode ?? 500, data: voidResponse.data, error: voidResponse.result.error!) | ||||||
|  |                     ) | ||||||
|  |                     return | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 completion( | ||||||
|  |                     Response( | ||||||
|  |                         response: voidResponse.response!, | ||||||
|  |                         body: nil), | ||||||
|  |                     nil | ||||||
|  |                 ) | ||||||
|  |             }) | ||||||
|  |         case is Data.Type: | ||||||
|  |             validatedRequest.responseData(completionHandler: { (dataResponse) in | ||||||
|  |                 cleanupRequest() | ||||||
|  | 
 | ||||||
|  |                 if (dataResponse.result.isFailure) { | ||||||
|  |                     completion( | ||||||
|  |                         nil, | ||||||
|  |                         ErrorResponse.HttpError(statusCode: dataResponse.response?.statusCode ?? 500, data: dataResponse.data, error: dataResponse.result.error!) | ||||||
|  |                     ) | ||||||
|  |                     return | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 completion( | ||||||
|  |                     Response( | ||||||
|  |                         response: dataResponse.response!, | ||||||
|  |                         body: (dataResponse.data as! T) | ||||||
|  |                     ), | ||||||
|  |                     nil | ||||||
|  |                 ) | ||||||
|  |             }) | ||||||
|  |         default: | ||||||
|  |             validatedRequest.responseJSON(options: .allowFragments) { response in | ||||||
|  |                 cleanupRequest() | ||||||
|  | 
 | ||||||
|  |                 if response.result.isFailure { | ||||||
|  |                     completion(nil, ErrorResponse.HttpError(statusCode: response.response?.statusCode ?? 500, data: response.data, error: response.result.error!)) | ||||||
|  |                     return | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 // handle HTTP 204 No Content | ||||||
|  |                 // NSNull would crash decoders | ||||||
|  |                 if response.response?.statusCode == 204 && response.result.value is NSNull{ | ||||||
|  |                     completion(nil, nil) | ||||||
|  |                     return | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 if () is T { | ||||||
|  |                     completion(Response(response: response.response!, body: (() as! T)), nil) | ||||||
|  |                     return | ||||||
|  |                 } | ||||||
|  |                 if let json: Any = response.result.value { | ||||||
|  |                     let decoded = Decoders.decode(clazz: T.self, source: json as AnyObject, instance: nil) | ||||||
|  |                     switch decoded { | ||||||
|  |                     case let .success(object): completion(Response(response: response.response!, body: object), nil) | ||||||
|  |                     case let .failure(error): completion(nil, ErrorResponse.DecodeError(response: response.data, decodeError: error)) | ||||||
|  |                     } | ||||||
|  |                     return | ||||||
|  |                 } else if "" is T { | ||||||
|  |                     // swagger-parser currently doesn't support void, which will be fixed in future swagger-parser release | ||||||
|  |                     // https://github.com/swagger-api/swagger-parser/pull/34 | ||||||
|  |                     completion(Response(response: response.response!, body: ("" as! T)), nil) | ||||||
|  |                     return | ||||||
|  |                 } | ||||||
|  | 
 | ||||||
|  |                 completion(nil, ErrorResponse.HttpError(statusCode: 500, data: nil, error: NSError(domain: "localhost", code: 500, userInfo: ["reason": "unreacheable code"]))) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     open func buildHeaders() -> [String: String] { | ||||||
|  |         var httpHeaders = SessionManager.defaultHTTPHeaders | ||||||
|  |         for (key, value) in self.headers { | ||||||
|  |             httpHeaders[key] = value | ||||||
|  |         } | ||||||
|  |         return httpHeaders | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,187 @@ | |||||||
|  | // Extensions.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | import Alamofire | ||||||
|  | 
 | ||||||
|  | extension Bool: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { return self as Any } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension Float: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { return self as Any } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension Int: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { return self as Any } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension Int32: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { return NSNumber(value: self as Int32) } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension Int64: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { return NSNumber(value: self as Int64) } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension Double: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { return self as Any } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension String: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { return self as Any } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | private func encodeIfPossible<T>(_ object: T) -> Any { | ||||||
|  |     if let encodableObject = object as? JSONEncodable { | ||||||
|  |         return encodableObject.encodeToJSON() | ||||||
|  |     } else { | ||||||
|  |         return object as Any | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension Array: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { | ||||||
|  |         return self.map(encodeIfPossible) | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension Dictionary: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { | ||||||
|  |         var dictionary = [AnyHashable: Any]() | ||||||
|  |         for (key, value) in self { | ||||||
|  |             dictionary[key as! NSObject] = encodeIfPossible(value) | ||||||
|  |         } | ||||||
|  |         return dictionary as Any | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension Data: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { | ||||||
|  |         return self.base64EncodedString(options: Data.Base64EncodingOptions()) | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | private let dateFormatter: DateFormatter = { | ||||||
|  |     let fmt = DateFormatter() | ||||||
|  |     fmt.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ" | ||||||
|  |     fmt.locale = Locale(identifier: "en_US_POSIX") | ||||||
|  |     return fmt | ||||||
|  | }() | ||||||
|  | 
 | ||||||
|  | extension Date: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { | ||||||
|  |         return dateFormatter.string(from: self) as Any | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension UUID: JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any { | ||||||
|  |         return self.uuidString | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | /// Represents an ISO-8601 full-date (RFC-3339). | ||||||
|  | /// ex: 12-31-1999 | ||||||
|  | /// https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14 | ||||||
|  | public final class ISOFullDate: CustomStringConvertible { | ||||||
|  | 
 | ||||||
|  |     public let year: Int | ||||||
|  |     public let month: Int | ||||||
|  |     public let day: Int | ||||||
|  | 
 | ||||||
|  |     public init(year: Int, month: Int, day: Int) { | ||||||
|  |         self.year = year | ||||||
|  |         self.month = month | ||||||
|  |         self.day = day | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Converts a Date to an ISOFullDate. Only interested in the year, month, day components. | ||||||
|  | 
 | ||||||
|  |      - parameter date: The date to convert. | ||||||
|  | 
 | ||||||
|  |      - returns: An ISOFullDate constructed from the year, month, day of the date. | ||||||
|  |      */ | ||||||
|  |     public static func from(date: Date) -> ISOFullDate? { | ||||||
|  |         let calendar = Calendar(identifier: .gregorian) | ||||||
|  | 
 | ||||||
|  |         let components = calendar.dateComponents( | ||||||
|  |             [ | ||||||
|  |                 .year, | ||||||
|  |                 .month, | ||||||
|  |                 .day, | ||||||
|  |             ], | ||||||
|  |             from: date | ||||||
|  |         ) | ||||||
|  | 
 | ||||||
|  |         guard | ||||||
|  |             let year = components.year, | ||||||
|  |             let month = components.month, | ||||||
|  |             let day = components.day | ||||||
|  |         else { | ||||||
|  |             return nil | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         return ISOFullDate( | ||||||
|  |             year: year, | ||||||
|  |             month: month, | ||||||
|  |             day: day | ||||||
|  |         ) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Converts a ISO-8601 full-date string to an ISOFullDate. | ||||||
|  | 
 | ||||||
|  |      - parameter string: The ISO-8601 full-date format string to convert. | ||||||
|  | 
 | ||||||
|  |      - returns: An ISOFullDate constructed from the string. | ||||||
|  |      */ | ||||||
|  |     public static func from(string: String) -> ISOFullDate? { | ||||||
|  |         let components = string | ||||||
|  |             .characters | ||||||
|  |             .split(separator: "-") | ||||||
|  |             .map(String.init) | ||||||
|  |             .flatMap { Int($0) } | ||||||
|  |         guard components.count == 3 else { return nil } | ||||||
|  | 
 | ||||||
|  |         return ISOFullDate( | ||||||
|  |             year: components[0], | ||||||
|  |             month: components[1], | ||||||
|  |             day: components[2] | ||||||
|  |         ) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      Converts the receiver to a Date, in the default time zone. | ||||||
|  | 
 | ||||||
|  |      - returns: A Date from the components of the receiver, in the default time zone. | ||||||
|  |      */ | ||||||
|  |     public func toDate() -> Date? { | ||||||
|  |         var components = DateComponents() | ||||||
|  |         components.year = year | ||||||
|  |         components.month = month | ||||||
|  |         components.day = day | ||||||
|  |         components.timeZone = TimeZone.ReferenceType.default | ||||||
|  |         let calendar = Calendar(identifier: .gregorian) | ||||||
|  |         return calendar.date(from: components) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     // MARK: CustomStringConvertible | ||||||
|  | 
 | ||||||
|  |     public var description: String { | ||||||
|  |         return "\(year)-\(month)-\(day)" | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | extension ISOFullDate: JSONEncodable { | ||||||
|  |     public func encodeToJSON() -> Any { | ||||||
|  |         return "\(year)-\(month)-\(day)" | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| @ -0,0 +1,951 @@ | |||||||
|  | // Models.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | protocol JSONEncodable { | ||||||
|  |     func encodeToJSON() -> Any | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | public enum ErrorResponse : Error { | ||||||
|  |     case HttpError(statusCode: Int, data: Data?, error: Error) | ||||||
|  |     case DecodeError(response: Data?, decodeError: DecodeError) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | open class Response<T> { | ||||||
|  |     open let statusCode: Int | ||||||
|  |     open let header: [String: String] | ||||||
|  |     open let body: T? | ||||||
|  | 
 | ||||||
|  |     public init(statusCode: Int, header: [String: String], body: T?) { | ||||||
|  |         self.statusCode = statusCode | ||||||
|  |         self.header = header | ||||||
|  |         self.body = body | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     public convenience init(response: HTTPURLResponse, body: T?) { | ||||||
|  |         let rawHeader = response.allHeaderFields | ||||||
|  |         var header = [String:String]() | ||||||
|  |         for (key, value) in rawHeader { | ||||||
|  |             header[key as! String] = value as? String | ||||||
|  |         } | ||||||
|  |         self.init(statusCode: response.statusCode, header: header, body: body) | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | public enum Decoded<ValueType> { | ||||||
|  |     case success(ValueType) | ||||||
|  |     case failure(DecodeError) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | public extension Decoded { | ||||||
|  |     var value: ValueType? { | ||||||
|  |         switch self { | ||||||
|  |         case let .success(value): | ||||||
|  |             return value | ||||||
|  |         case .failure: | ||||||
|  |             return nil | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | public enum DecodeError { | ||||||
|  |     case typeMismatch(expected: String, actual: String) | ||||||
|  |     case missingKey(key: String) | ||||||
|  |     case parseError(message: String) | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | private var once = Int() | ||||||
|  | class Decoders { | ||||||
|  |     static fileprivate var decoders = Dictionary<String, ((AnyObject, AnyObject?) -> AnyObject)>() | ||||||
|  | 
 | ||||||
|  |     static func addDecoder<T>(clazz: T.Type, decoder: @escaping ((AnyObject, AnyObject?) -> Decoded<T>)) { | ||||||
|  |         let key = "\(T.self)" | ||||||
|  |         decoders[key] = { decoder($0, $1) as AnyObject } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func decode<T>(clazz: T.Type, discriminator: String, source: AnyObject) -> Decoded<T> { | ||||||
|  |         let key = discriminator | ||||||
|  |         if let decoder = decoders[key], let value = decoder(source, nil) as? Decoded<T> { | ||||||
|  |             return value | ||||||
|  |         } else { | ||||||
|  |             return .failure(.typeMismatch(expected: String(describing: clazz), actual: String(describing: source))) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func decode<T>(clazz: [T].Type, source: AnyObject) -> Decoded<[T]> { | ||||||
|  |         if let sourceArray = source as? [AnyObject] { | ||||||
|  |             var values = [T]() | ||||||
|  |             for sourceValue in sourceArray { | ||||||
|  |                 switch Decoders.decode(clazz: T.self, source: sourceValue, instance: nil) { | ||||||
|  |                 case let .success(value): | ||||||
|  |                     values.append(value) | ||||||
|  |                 case let .failure(error): | ||||||
|  |                     return .failure(error) | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             return .success(values) | ||||||
|  |         } else { | ||||||
|  |             return .failure(.typeMismatch(expected: String(describing: clazz), actual: String(describing: source))) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func decode<T, Key: Hashable>(clazz: [Key:T].Type, source: AnyObject) -> Decoded<[Key:T]> { | ||||||
|  |         if let sourceDictionary = source as? [Key: AnyObject] { | ||||||
|  |             var dictionary = [Key:T]() | ||||||
|  |             for (key, value) in sourceDictionary { | ||||||
|  |                 switch Decoders.decode(clazz: T.self, source: value, instance: nil) { | ||||||
|  |                 case let .success(value): | ||||||
|  |                     dictionary[key] = value | ||||||
|  |                 case let .failure(error): | ||||||
|  |                     return .failure(error) | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             return .success(dictionary) | ||||||
|  |         } else { | ||||||
|  |             return .failure(.typeMismatch(expected: String(describing: clazz), actual: String(describing: source))) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func decodeOptional<T: RawRepresentable>(clazz: T.Type, source: AnyObject?) -> Decoded<T?> { | ||||||
|  |         guard !(source is NSNull), source != nil else { return .success(nil) } | ||||||
|  |         if let value = source as? T.RawValue { | ||||||
|  |             if let enumValue = T.init(rawValue: value) { | ||||||
|  |                 return .success(enumValue) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "A value from the enumeration \(T.self)", actual: "\(value)")) | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             return .failure(.typeMismatch(expected: "\(T.RawValue.self) matching a case from the enumeration \(T.self)", actual: String(describing: type(of: source)))) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func decode<T>(clazz: T.Type, source: AnyObject, instance: AnyObject?) -> Decoded<T> { | ||||||
|  |         initialize() | ||||||
|  |         if let value = source.int32Value as? T, source is NSNumber, T.self is Int32.Type { | ||||||
|  |             return .success(value) | ||||||
|  |         } | ||||||
|  |         if let value = source.int32Value as? T, source is NSNumber, T.self is Int64.Type { | ||||||
|  |             return .success(value) | ||||||
|  |         } | ||||||
|  |         if let intermediate = source as? String, let value = UUID(uuidString: intermediate) as? T, source is String, T.self is UUID.Type { | ||||||
|  |             return .success(value) | ||||||
|  |         } | ||||||
|  |         if let value = source as? T { | ||||||
|  |             return .success(value) | ||||||
|  |         } | ||||||
|  |         if let intermediate = source as? String, let value = Data(base64Encoded: intermediate) as? T { | ||||||
|  |             return .success(value) | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         let key = "\(T.self)" | ||||||
|  |         if let decoder = decoders[key], let value = decoder(source, instance) as? Decoded<T> { | ||||||
|  |            return value | ||||||
|  |         } else { | ||||||
|  |             return .failure(.typeMismatch(expected: String(describing: clazz), actual: String(describing: source))) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     //Convert a Decoded so that its value is optional. DO WE STILL NEED THIS? | ||||||
|  |     static func toOptional<T>(decoded: Decoded<T>) -> Decoded<T?> { | ||||||
|  |         return .success(decoded.value) | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func decodeOptional<T>(clazz: T.Type, source: AnyObject?) -> Decoded<T?> { | ||||||
|  |         if let source = source, !(source is NSNull) { | ||||||
|  |             switch Decoders.decode(clazz: clazz, source: source, instance: nil) { | ||||||
|  |             case let .success(value): return .success(value) | ||||||
|  |             case let .failure(error): return .failure(error) | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             return .success(nil) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func decodeOptional<T>(clazz: [T].Type, source: AnyObject?) -> Decoded<[T]?> { | ||||||
|  |         if let source = source as? [AnyObject] { | ||||||
|  |             var values = [T]() | ||||||
|  |             for sourceValue in source { | ||||||
|  |                 switch Decoders.decode(clazz: T.self, source: sourceValue, instance: nil) { | ||||||
|  |                 case let .success(value): values.append(value) | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             return .success(values) | ||||||
|  |         } else { | ||||||
|  |             return .success(nil) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func decodeOptional<T, Key: Hashable>(clazz: [Key:T].Type, source: AnyObject?) -> Decoded<[Key:T]?> { | ||||||
|  |         if let sourceDictionary = source as? [Key: AnyObject] { | ||||||
|  |             var dictionary = [Key:T]() | ||||||
|  |             for (key, value) in sourceDictionary { | ||||||
|  |                 switch Decoders.decode(clazz: T.self, source: value, instance: nil) { | ||||||
|  |                 case let .success(value): dictionary[key] = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             return .success(dictionary) | ||||||
|  |         } else { | ||||||
|  |             return .success(nil) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     static func decodeOptional<T: RawRepresentable, U: AnyObject where T.RawValue == U>(clazz: T, source: AnyObject) -> Decoded<T?> { | ||||||
|  |         if let value = source as? U { | ||||||
|  |             if let enumValue = T.init(rawValue: value) { | ||||||
|  |                 return .success(enumValue) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "A value from the enumeration \(T.self)", actual: "\(value)")) | ||||||
|  |             } | ||||||
|  |         } else { | ||||||
|  |             return .failure(.typeMismatch(expected: "String", actual: String(describing: type(of: source)))) | ||||||
|  |         } | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     private static var __once: () = { | ||||||
|  |         let formatters = [ | ||||||
|  |             "yyyy-MM-dd", | ||||||
|  |             "yyyy-MM-dd'T'HH:mm:ssZZZZZ", | ||||||
|  |             "yyyy-MM-dd'T'HH:mm:ss.SSSZZZZZ", | ||||||
|  |             "yyyy-MM-dd'T'HH:mm:ss'Z'", | ||||||
|  |             "yyyy-MM-dd'T'HH:mm:ss.SSS", | ||||||
|  |             "yyyy-MM-dd HH:mm:ss" | ||||||
|  |         ].map { (format: String) -> DateFormatter in | ||||||
|  |             let formatter = DateFormatter() | ||||||
|  |             formatter.dateFormat = format | ||||||
|  |             return formatter | ||||||
|  |         } | ||||||
|  |         // Decoder for Date | ||||||
|  |         Decoders.addDecoder(clazz: Date.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Date> in | ||||||
|  |            if let sourceString = source as? String { | ||||||
|  |                 for formatter in formatters { | ||||||
|  |                     if let date = formatter.date(from: sourceString) { | ||||||
|  |                         return .success(date) | ||||||
|  |                     } | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |             if let sourceInt = source as? Int { | ||||||
|  |                 // treat as a java date | ||||||
|  |                 return .success(Date(timeIntervalSince1970: Double(sourceInt / 1000) )) | ||||||
|  |             } | ||||||
|  |             if source is String || source is Int { | ||||||
|  |                 return .failure(.parseError(message: "Could not decode date")) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "String or Int", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // Decoder for ISOFullDate | ||||||
|  |         Decoders.addDecoder(clazz: ISOFullDate.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<ISOFullDate> in | ||||||
|  |             if let string = source as? String, | ||||||
|  |                let isoDate = ISOFullDate.from(string: string) { | ||||||
|  |                 return .success(isoDate) | ||||||
|  |             } else { | ||||||
|  |             	return .failure(.typeMismatch(expected: "ISO date", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|  |         // Decoder for AdditionalPropertiesClass | ||||||
|  |         Decoders.addDecoder(clazz: AdditionalPropertiesClass.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<AdditionalPropertiesClass> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = AdditionalPropertiesClass() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [String:String].self, source: sourceDictionary["map_property"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.mapProperty = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [String:[String:String]].self, source: sourceDictionary["map_of_map_property"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.mapOfMapProperty = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "AdditionalPropertiesClass", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Animal | ||||||
|  |         Decoders.addDecoder(clazz: Animal.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Animal> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 // Check discriminator to support inheritance | ||||||
|  |                 if let discriminator = sourceDictionary["className"] as? String, instance == nil && discriminator != "Animal"{ | ||||||
|  |                     return Decoders.decode(clazz: Animal.self, discriminator: discriminator, source: source) | ||||||
|  |                 } | ||||||
|  |                 guard let classNameSource = sourceDictionary["className"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "className")) | ||||||
|  |                 } | ||||||
|  |                 guard let className = Decoders.decode(clazz: String.self.self, source: classNameSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "Animal", actual: "\(classNameSource)")) | ||||||
|  |                 } | ||||||
|  |                 let result = Animal(className: className) | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["color"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.color = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Animal", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for ApiResponse | ||||||
|  |         Decoders.addDecoder(clazz: ApiResponse.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<ApiResponse> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = ApiResponse() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["code"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.code = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["type"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.type = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["message"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.message = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "ApiResponse", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for ArrayOfArrayOfNumberOnly | ||||||
|  |         Decoders.addDecoder(clazz: ArrayOfArrayOfNumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<ArrayOfArrayOfNumberOnly> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = ArrayOfArrayOfNumberOnly() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [[Double]].self, source: sourceDictionary["ArrayArrayNumber"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.arrayArrayNumber = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "ArrayOfArrayOfNumberOnly", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for ArrayOfNumberOnly | ||||||
|  |         Decoders.addDecoder(clazz: ArrayOfNumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<ArrayOfNumberOnly> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = ArrayOfNumberOnly() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [Double].self, source: sourceDictionary["ArrayNumber"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.arrayNumber = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "ArrayOfNumberOnly", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for ArrayTest | ||||||
|  |         Decoders.addDecoder(clazz: ArrayTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<ArrayTest> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = ArrayTest() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [String].self, source: sourceDictionary["array_of_string"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.arrayOfString = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [[Int64]].self, source: sourceDictionary["array_array_of_integer"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.arrayArrayOfInteger = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [[ReadOnlyFirst]].self, source: sourceDictionary["array_array_of_model"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.arrayArrayOfModel = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "ArrayTest", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Capitalization | ||||||
|  |         Decoders.addDecoder(clazz: Capitalization.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Capitalization> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = Capitalization() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["smallCamel"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.smallCamel = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["CapitalCamel"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.capitalCamel = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["small_Snake"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.smallSnake = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["Capital_Snake"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.capitalSnake = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["SCA_ETH_Flow_Points"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.sCAETHFlowPoints = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["ATT_NAME"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.ATT_NAME = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Capitalization", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Category | ||||||
|  |         Decoders.addDecoder(clazz: Category.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Category> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = Category() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.id = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.name = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Category", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for ClassModel | ||||||
|  |         Decoders.addDecoder(clazz: ClassModel.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<ClassModel> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = ClassModel() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["_class"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance._class = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "ClassModel", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Client | ||||||
|  |         Decoders.addDecoder(clazz: Client.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Client> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = Client() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["client"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.client = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Client", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for EnumArrays | ||||||
|  |         Decoders.addDecoder(clazz: EnumArrays.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<EnumArrays> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = EnumArrays() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: EnumArrays.JustSymbol.self, source: sourceDictionary["just_symbol"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.justSymbol = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Array<EnumArrays.ArrayEnum>.self, source: sourceDictionary["array_enum"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.arrayEnum = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "EnumArrays", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for EnumClass | ||||||
|  |         Decoders.addDecoder(clazz: EnumClass.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<EnumClass> in | ||||||
|  |             //TODO: I don't think we need this anymore | ||||||
|  |             return Decoders.decode(clazz: EnumClass.self, source: source, instance: instance) | ||||||
|  |         } | ||||||
|  |         // Decoder for EnumTest | ||||||
|  |         Decoders.addDecoder(clazz: EnumTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<EnumTest> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = EnumTest() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: EnumTest.EnumString.self, source: sourceDictionary["enum_string"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.enumString = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: EnumTest.EnumInteger.self, source: sourceDictionary["enum_integer"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.enumInteger = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: EnumTest.EnumNumber.self, source: sourceDictionary["enum_number"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.enumNumber = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: OuterEnum.self, source: sourceDictionary["outerEnum"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.outerEnum = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "EnumTest", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for FormatTest | ||||||
|  |         Decoders.addDecoder(clazz: FormatTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<FormatTest> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 guard let numberSource = sourceDictionary["number"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "number")) | ||||||
|  |                 } | ||||||
|  |                 guard let number = Decoders.decode(clazz: Double.self.self, source: numberSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "FormatTest", actual: "\(numberSource)")) | ||||||
|  |                 } | ||||||
|  |                 guard let byteSource = sourceDictionary["byte"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "byte")) | ||||||
|  |                 } | ||||||
|  |                 guard let byte = Decoders.decode(clazz: Data.self.self, source: byteSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "FormatTest", actual: "\(byteSource)")) | ||||||
|  |                 } | ||||||
|  |                 guard let dateSource = sourceDictionary["date"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "date")) | ||||||
|  |                 } | ||||||
|  |                 guard let date = Decoders.decode(clazz: ISOFullDate.self.self, source: dateSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "FormatTest", actual: "\(dateSource)")) | ||||||
|  |                 } | ||||||
|  |                 guard let passwordSource = sourceDictionary["password"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "password")) | ||||||
|  |                 } | ||||||
|  |                 guard let password = Decoders.decode(clazz: String.self.self, source: passwordSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "FormatTest", actual: "\(passwordSource)")) | ||||||
|  |                 } | ||||||
|  |                 let result = FormatTest(number: number, byte: byte, date: date, password: password) | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["integer"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.integer = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["int32"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.int32 = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["int64"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.int64 = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Float.self, source: sourceDictionary["float"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.float = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Double.self, source: sourceDictionary["double"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.double = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["string"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.string = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Data.self, source: sourceDictionary["binary"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.binary = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Date.self, source: sourceDictionary["dateTime"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.dateTime = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: UUID.self, source: sourceDictionary["uuid"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.uuid = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "FormatTest", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for HasOnlyReadOnly | ||||||
|  |         Decoders.addDecoder(clazz: HasOnlyReadOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<HasOnlyReadOnly> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = HasOnlyReadOnly() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["bar"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.bar = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["foo"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.foo = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "HasOnlyReadOnly", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for List | ||||||
|  |         Decoders.addDecoder(clazz: List.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<List> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = List() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["123-list"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance._123List = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "List", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for MapTest | ||||||
|  |         Decoders.addDecoder(clazz: MapTest.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<MapTest> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = MapTest() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [String:[String:String]].self, source: sourceDictionary["map_map_of_string"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.mapMapOfString = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: MapTest.MapOfEnumString.self, source: sourceDictionary["map_of_enum_string"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.mapOfEnumString = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "MapTest", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for MixedPropertiesAndAdditionalPropertiesClass | ||||||
|  |         Decoders.addDecoder(clazz: MixedPropertiesAndAdditionalPropertiesClass.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<MixedPropertiesAndAdditionalPropertiesClass> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = MixedPropertiesAndAdditionalPropertiesClass() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: UUID.self, source: sourceDictionary["uuid"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.uuid = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Date.self, source: sourceDictionary["dateTime"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.dateTime = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [String:Animal].self, source: sourceDictionary["map"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.map = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "MixedPropertiesAndAdditionalPropertiesClass", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Model200Response | ||||||
|  |         Decoders.addDecoder(clazz: Model200Response.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Model200Response> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = Model200Response() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["name"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.name = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["class"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance._class = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Model200Response", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Name | ||||||
|  |         Decoders.addDecoder(clazz: Name.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Name> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 guard let nameSource = sourceDictionary["name"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "name")) | ||||||
|  |                 } | ||||||
|  |                 guard let name = Decoders.decode(clazz: Int32.self.self, source: nameSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "Name", actual: "\(nameSource)")) | ||||||
|  |                 } | ||||||
|  |                 let result = Name(name: name) | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["snake_case"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.snakeCase = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["property"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.property = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["123Number"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance._123Number = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Name", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for NumberOnly | ||||||
|  |         Decoders.addDecoder(clazz: NumberOnly.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<NumberOnly> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = NumberOnly() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Double.self, source: sourceDictionary["JustNumber"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.justNumber = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "NumberOnly", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Order | ||||||
|  |         Decoders.addDecoder(clazz: Order.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Order> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = Order() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.id = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["petId"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.petId = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["quantity"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.quantity = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Date.self, source: sourceDictionary["shipDate"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.shipDate = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Order.Status.self, source: sourceDictionary["status"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.status = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["complete"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.complete = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Order", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for OuterBoolean | ||||||
|  |         Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterBoolean> in | ||||||
|  |             if let source = source as? Bool { | ||||||
|  |                 return .success(source) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Typealias OuterBoolean", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for OuterComposite | ||||||
|  |         Decoders.addDecoder(clazz: OuterComposite.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterComposite> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = OuterComposite() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: OuterNumber.self, source: sourceDictionary["my_number"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.myNumber = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: OuterString.self, source: sourceDictionary["my_string"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.myString = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: OuterBoolean.self, source: sourceDictionary["my_boolean"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.myBoolean = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "OuterComposite", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for OuterEnum | ||||||
|  |         Decoders.addDecoder(clazz: OuterEnum.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterEnum> in | ||||||
|  |             //TODO: I don't think we need this anymore | ||||||
|  |             return Decoders.decode(clazz: OuterEnum.self, source: source, instance: instance) | ||||||
|  |         } | ||||||
|  |         // Decoder for OuterNumber | ||||||
|  |         Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterNumber> in | ||||||
|  |             if let source = source as? Double { | ||||||
|  |                 return .success(source) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Typealias OuterNumber", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for OuterString | ||||||
|  |         Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<OuterString> in | ||||||
|  |             if let source = source as? String { | ||||||
|  |                 return .success(source) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Typealias OuterString", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Pet | ||||||
|  |         Decoders.addDecoder(clazz: Pet.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Pet> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 guard let nameSource = sourceDictionary["name"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "name")) | ||||||
|  |                 } | ||||||
|  |                 guard let name = Decoders.decode(clazz: String.self.self, source: nameSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "Pet", actual: "\(nameSource)")) | ||||||
|  |                 } | ||||||
|  |                 guard let photoUrlsSource = sourceDictionary["photoUrls"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "photoUrls")) | ||||||
|  |                 } | ||||||
|  |                 guard let photoUrls = Decoders.decode(clazz: [String].self.self, source: photoUrlsSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "Pet", actual: "\(photoUrlsSource)")) | ||||||
|  |                 } | ||||||
|  |                 let result = Pet(name: name, photoUrls: photoUrls) | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.id = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Category.self, source: sourceDictionary["category"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.category = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: [Tag].self, source: sourceDictionary["tags"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.tags = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Pet.Status.self, source: sourceDictionary["status"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.status = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Pet", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for ReadOnlyFirst | ||||||
|  |         Decoders.addDecoder(clazz: ReadOnlyFirst.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<ReadOnlyFirst> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = ReadOnlyFirst() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["bar"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.bar = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["baz"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.baz = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "ReadOnlyFirst", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Return | ||||||
|  |         Decoders.addDecoder(clazz: Return.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Return> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = Return() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["return"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance._return = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Return", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for SpecialModelName | ||||||
|  |         Decoders.addDecoder(clazz: SpecialModelName.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<SpecialModelName> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = SpecialModelName() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["$special[property.name]"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.specialPropertyName = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "SpecialModelName", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Tag | ||||||
|  |         Decoders.addDecoder(clazz: Tag.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Tag> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = Tag() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.id = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["name"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.name = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Tag", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for User | ||||||
|  |         Decoders.addDecoder(clazz: User.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<User> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 let result = User() | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int64.self, source: sourceDictionary["id"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.id = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["username"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.username = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["firstName"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.firstName = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["lastName"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.lastName = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["email"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.email = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["password"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.password = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["phone"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.phone = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Int32.self, source: sourceDictionary["userStatus"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.userStatus = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "User", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Cat | ||||||
|  |         Decoders.addDecoder(clazz: Cat.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Cat> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 guard let classNameSource = sourceDictionary["className"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "className")) | ||||||
|  |                 } | ||||||
|  |                 guard let className = Decoders.decode(clazz: String.self.self, source: classNameSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "Cat", actual: "\(classNameSource)")) | ||||||
|  |                 } | ||||||
|  |                 let result = Cat(className: className) | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["color"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.color = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: Bool.self, source: sourceDictionary["declawed"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.declawed = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Cat", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         // Decoder for Dog | ||||||
|  |         Decoders.addDecoder(clazz: Dog.self) { (source: AnyObject, instance: AnyObject?) -> Decoded<Dog> in | ||||||
|  |             if let sourceDictionary = source as? [AnyHashable: Any] { | ||||||
|  |                 guard let classNameSource = sourceDictionary["className"] as AnyObject? else { | ||||||
|  |                     return .failure(.missingKey(key: "className")) | ||||||
|  |                 } | ||||||
|  |                 guard let className = Decoders.decode(clazz: String.self.self, source: classNameSource).value else { | ||||||
|  |                     return .failure(.typeMismatch(expected: "Dog", actual: "\(classNameSource)")) | ||||||
|  |                 } | ||||||
|  |                 let result = Dog(className: className) | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["color"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.color = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 switch Decoders.decodeOptional(clazz: String.self, source: sourceDictionary["breed"] as AnyObject?) { | ||||||
|  |                 case let .success(value): instance.breed = value | ||||||
|  |                 case let .failure(error): return .failure(error) | ||||||
|  |                 } | ||||||
|  |                 return .success(result) | ||||||
|  |             } else { | ||||||
|  |                 return .failure(.typeMismatch(expected: "Dog", actual: "\(source)")) | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |     }() | ||||||
|  | 
 | ||||||
|  |     static fileprivate func initialize() { | ||||||
|  |         _ = Decoders.__once | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,30 @@ | |||||||
|  | // | ||||||
|  | // AdditionalPropertiesClass.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class AdditionalPropertiesClass: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var mapProperty: [String:String]? | ||||||
|  |     public var mapOfMapProperty: [String:[String:String]]? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(mapProperty: [String:String]?=nil, mapOfMapProperty: [String:[String:String]]?=nil) { | ||||||
|  |         self.mapProperty = mapProperty | ||||||
|  |         self.mapOfMapProperty = mapOfMapProperty | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["map_property"] = self.mapProperty?.encodeToJSON() | ||||||
|  |         nillableDictionary["map_of_map_property"] = self.mapOfMapProperty?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,30 @@ | |||||||
|  | // | ||||||
|  | // Animal.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Animal: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var className: String | ||||||
|  |     public var color: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(className: String, color: String?=nil) { | ||||||
|  |         self.className = className | ||||||
|  |         self.color = color | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["className"] = self.className | ||||||
|  |         nillableDictionary["color"] = self.color | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,11 @@ | |||||||
|  | // | ||||||
|  | // AnimalFarm.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public typealias AnimalFarm = [Animal] | ||||||
| @ -0,0 +1,33 @@ | |||||||
|  | // | ||||||
|  | // ApiResponse.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class ApiResponse: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var code: Int32? | ||||||
|  |     public var type: String? | ||||||
|  |     public var message: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(code: Int32?=nil, type: String?=nil, message: String?=nil) { | ||||||
|  |         self.code = code | ||||||
|  |         self.type = type | ||||||
|  |         self.message = message | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["code"] = self.code?.encodeToJSON() | ||||||
|  |         nillableDictionary["type"] = self.type | ||||||
|  |         nillableDictionary["message"] = self.message | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | // | ||||||
|  | // ArrayOfArrayOfNumberOnly.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class ArrayOfArrayOfNumberOnly: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var arrayArrayNumber: [[Double]]? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(arrayArrayNumber: [[Double]]?=nil) { | ||||||
|  |         self.arrayArrayNumber = arrayArrayNumber | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["ArrayArrayNumber"] = self.arrayArrayNumber?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | // | ||||||
|  | // ArrayOfNumberOnly.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class ArrayOfNumberOnly: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var arrayNumber: [Double]? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(arrayNumber: [Double]?=nil) { | ||||||
|  |         self.arrayNumber = arrayNumber | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["ArrayNumber"] = self.arrayNumber?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,33 @@ | |||||||
|  | // | ||||||
|  | // ArrayTest.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class ArrayTest: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var arrayOfString: [String]? | ||||||
|  |     public var arrayArrayOfInteger: [[Int64]]? | ||||||
|  |     public var arrayArrayOfModel: [[ReadOnlyFirst]]? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(arrayOfString: [String]?=nil, arrayArrayOfInteger: [[Int64]]?=nil, arrayArrayOfModel: [[ReadOnlyFirst]]?=nil) { | ||||||
|  |         self.arrayOfString = arrayOfString | ||||||
|  |         self.arrayArrayOfInteger = arrayArrayOfInteger | ||||||
|  |         self.arrayArrayOfModel = arrayArrayOfModel | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["array_of_string"] = self.arrayOfString?.encodeToJSON() | ||||||
|  |         nillableDictionary["array_array_of_integer"] = self.arrayArrayOfInteger?.encodeToJSON() | ||||||
|  |         nillableDictionary["array_array_of_model"] = self.arrayArrayOfModel?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,43 @@ | |||||||
|  | // | ||||||
|  | // Capitalization.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Capitalization: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var smallCamel: String? | ||||||
|  |     public var capitalCamel: String? | ||||||
|  |     public var smallSnake: String? | ||||||
|  |     public var capitalSnake: String? | ||||||
|  |     public var sCAETHFlowPoints: String? | ||||||
|  |     /** Name of the pet  */ | ||||||
|  |     public var ATT_NAME: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(smallCamel: String?=nil, capitalCamel: String?=nil, smallSnake: String?=nil, capitalSnake: String?=nil, sCAETHFlowPoints: String?=nil, ATT_NAME: String?=nil) { | ||||||
|  |         self.smallCamel = smallCamel | ||||||
|  |         self.capitalCamel = capitalCamel | ||||||
|  |         self.smallSnake = smallSnake | ||||||
|  |         self.capitalSnake = capitalSnake | ||||||
|  |         self.sCAETHFlowPoints = sCAETHFlowPoints | ||||||
|  |         self.ATT_NAME = ATT_NAME | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["smallCamel"] = self.smallCamel | ||||||
|  |         nillableDictionary["CapitalCamel"] = self.capitalCamel | ||||||
|  |         nillableDictionary["small_Snake"] = self.smallSnake | ||||||
|  |         nillableDictionary["Capital_Snake"] = self.capitalSnake | ||||||
|  |         nillableDictionary["SCA_ETH_Flow_Points"] = self.sCAETHFlowPoints | ||||||
|  |         nillableDictionary["ATT_NAME"] = self.ATT_NAME | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | // | ||||||
|  | // Cat.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Cat: Animal { | ||||||
|  | 
 | ||||||
|  |     public var declawed: Bool? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(className: String, color: String?=nil, declawed: Bool?=nil) { | ||||||
|  |         self.declawed = declawed | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     override open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = super.encodeToJSON() as? [String:Any?] ?? [String:Any?]() | ||||||
|  |         nillableDictionary["declawed"] = self.declawed | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,30 @@ | |||||||
|  | // | ||||||
|  | // Category.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Category: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var id: Int64? | ||||||
|  |     public var name: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(id: Int64?=nil, name: String?=nil) { | ||||||
|  |         self.id = id | ||||||
|  |         self.name = name | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["id"] = self.id?.encodeToJSON() | ||||||
|  |         nillableDictionary["name"] = self.name | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,28 @@ | |||||||
|  | // | ||||||
|  | // ClassModel.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /** Model for testing model with \"_class\" property */ | ||||||
|  | open class ClassModel: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var _class: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(_class: String?=nil) { | ||||||
|  |         self._class = _class | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["_class"] = self._class | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | // | ||||||
|  | // Client.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Client: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var client: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(client: String?=nil) { | ||||||
|  |         self.client = client | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["client"] = self.client | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | // | ||||||
|  | // Dog.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Dog: Animal { | ||||||
|  | 
 | ||||||
|  |     public var breed: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(className: String, color: String?=nil, breed: String?=nil) { | ||||||
|  |         self.breed = breed | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     override open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = super.encodeToJSON() as? [String:Any?] ?? [String:Any?]() | ||||||
|  |         nillableDictionary["breed"] = self.breed | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,38 @@ | |||||||
|  | // | ||||||
|  | // EnumArrays.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class EnumArrays: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public enum JustSymbol: String {  | ||||||
|  |         case greaterThanOrEqualTo = ">=" | ||||||
|  |         case dollar = "$" | ||||||
|  |     } | ||||||
|  |     public enum ArrayEnum: String {  | ||||||
|  |         case fish = "fish" | ||||||
|  |         case crab = "crab" | ||||||
|  |     } | ||||||
|  |     public var justSymbol: JustSymbol? | ||||||
|  |     public var arrayEnum: [ArrayEnum]? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(justSymbol: JustSymbol?=nil, arrayEnum: [ArrayEnum]?=nil) { | ||||||
|  |         self.justSymbol = justSymbol | ||||||
|  |         self.arrayEnum = arrayEnum | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["just_symbol"] = self.justSymbol?.rawValue | ||||||
|  |         nillableDictionary["array_enum"] = self.arrayEnum?.map({$0.rawValue}).encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,17 @@ | |||||||
|  | // | ||||||
|  | // EnumClass.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public enum EnumClass: String { | ||||||
|  |     case abc = "_abc" | ||||||
|  |     case efg = "-efg" | ||||||
|  |     case xyz = "(xyz)" | ||||||
|  | 
 | ||||||
|  |     func encodeToJSON() -> Any { return self.rawValue } | ||||||
|  | } | ||||||
| @ -0,0 +1,49 @@ | |||||||
|  | // | ||||||
|  | // EnumTest.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class EnumTest: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public enum EnumString: String {  | ||||||
|  |         case upper = "UPPER" | ||||||
|  |         case lower = "lower" | ||||||
|  |         case empty = "" | ||||||
|  |     } | ||||||
|  |     public enum EnumInteger: Int32 {  | ||||||
|  |         case _1 = 1 | ||||||
|  |         case numberminus1 = -1 | ||||||
|  |     } | ||||||
|  |     public enum EnumNumber: Double {  | ||||||
|  |         case _11 = 1.1 | ||||||
|  |         case numberminus12 = -1.2 | ||||||
|  |     } | ||||||
|  |     public var enumString: EnumString? | ||||||
|  |     public var enumInteger: EnumInteger? | ||||||
|  |     public var enumNumber: EnumNumber? | ||||||
|  |     public var outerEnum: OuterEnum? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(enumString: EnumString?=nil, enumInteger: EnumInteger?=nil, enumNumber: EnumNumber?=nil, outerEnum: OuterEnum?=nil) { | ||||||
|  |         self.enumString = enumString | ||||||
|  |         self.enumInteger = enumInteger | ||||||
|  |         self.enumNumber = enumNumber | ||||||
|  |         self.outerEnum = outerEnum | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["enum_string"] = self.enumString?.rawValue | ||||||
|  |         nillableDictionary["enum_integer"] = self.enumInteger?.rawValue | ||||||
|  |         nillableDictionary["enum_number"] = self.enumNumber?.rawValue | ||||||
|  |         nillableDictionary["outerEnum"] = self.outerEnum?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,63 @@ | |||||||
|  | // | ||||||
|  | // FormatTest.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class FormatTest: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var integer: Int32? | ||||||
|  |     public var int32: Int32? | ||||||
|  |     public var int64: Int64? | ||||||
|  |     public var number: Double | ||||||
|  |     public var float: Float? | ||||||
|  |     public var double: Double? | ||||||
|  |     public var string: String? | ||||||
|  |     public var byte: Data | ||||||
|  |     public var binary: Data? | ||||||
|  |     public var date: ISOFullDate | ||||||
|  |     public var dateTime: Date? | ||||||
|  |     public var uuid: UUID? | ||||||
|  |     public var password: String | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(integer: Int32?=nil, int32: Int32?=nil, int64: Int64?=nil, number: Double, float: Float?=nil, double: Double?=nil, string: String?=nil, byte: Data, binary: Data?=nil, date: ISOFullDate, dateTime: Date?=nil, uuid: UUID?=nil, password: String) { | ||||||
|  |         self.integer = integer | ||||||
|  |         self.int32 = int32 | ||||||
|  |         self.int64 = int64 | ||||||
|  |         self.number = number | ||||||
|  |         self.float = float | ||||||
|  |         self.double = double | ||||||
|  |         self.string = string | ||||||
|  |         self.byte = byte | ||||||
|  |         self.binary = binary | ||||||
|  |         self.date = date | ||||||
|  |         self.dateTime = dateTime | ||||||
|  |         self.uuid = uuid | ||||||
|  |         self.password = password | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["integer"] = self.integer?.encodeToJSON() | ||||||
|  |         nillableDictionary["int32"] = self.int32?.encodeToJSON() | ||||||
|  |         nillableDictionary["int64"] = self.int64?.encodeToJSON() | ||||||
|  |         nillableDictionary["number"] = self.number | ||||||
|  |         nillableDictionary["float"] = self.float | ||||||
|  |         nillableDictionary["double"] = self.double | ||||||
|  |         nillableDictionary["string"] = self.string | ||||||
|  |         nillableDictionary["byte"] = self.byte.encodeToJSON() | ||||||
|  |         nillableDictionary["binary"] = self.binary?.encodeToJSON() | ||||||
|  |         nillableDictionary["date"] = self.date.encodeToJSON() | ||||||
|  |         nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() | ||||||
|  |         nillableDictionary["uuid"] = self.uuid?.encodeToJSON() | ||||||
|  |         nillableDictionary["password"] = self.password | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,30 @@ | |||||||
|  | // | ||||||
|  | // HasOnlyReadOnly.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class HasOnlyReadOnly: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var bar: String? | ||||||
|  |     public var foo: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(bar: String?=nil, foo: String?=nil) { | ||||||
|  |         self.bar = bar | ||||||
|  |         self.foo = foo | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["bar"] = self.bar | ||||||
|  |         nillableDictionary["foo"] = self.foo | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | // | ||||||
|  | // List.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class List: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var _123List: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(_123List: String?=nil) { | ||||||
|  |         self._123List = _123List | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["123-list"] = self._123List | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,33 @@ | |||||||
|  | // | ||||||
|  | // MapTest.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class MapTest: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public enum MapOfEnumString: String {  | ||||||
|  |         case upper = "UPPER" | ||||||
|  |         case lower = "lower" | ||||||
|  |     } | ||||||
|  |     public var mapMapOfString: [String:[String:String]]? | ||||||
|  |     public var mapOfEnumString: [String:String]? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(mapMapOfString: [String:[String:String]]?=nil, mapOfEnumString: [String:String]?=nil) { | ||||||
|  |         self.mapMapOfString = mapMapOfString | ||||||
|  |         self.mapOfEnumString = mapOfEnumString | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["map_map_of_string"] = self.mapMapOfString?.encodeToJSON()//TODO: handle enum map scenario | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,33 @@ | |||||||
|  | // | ||||||
|  | // MixedPropertiesAndAdditionalPropertiesClass.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class MixedPropertiesAndAdditionalPropertiesClass: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var uuid: UUID? | ||||||
|  |     public var dateTime: Date? | ||||||
|  |     public var map: [String:Animal]? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(uuid: UUID?=nil, dateTime: Date?=nil, map: [String:Animal]?=nil) { | ||||||
|  |         self.uuid = uuid | ||||||
|  |         self.dateTime = dateTime | ||||||
|  |         self.map = map | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["uuid"] = self.uuid?.encodeToJSON() | ||||||
|  |         nillableDictionary["dateTime"] = self.dateTime?.encodeToJSON() | ||||||
|  |         nillableDictionary["map"] = self.map?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,31 @@ | |||||||
|  | // | ||||||
|  | // Model200Response.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /** Model for testing model name starting with number */ | ||||||
|  | open class Model200Response: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var name: Int32? | ||||||
|  |     public var _class: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(name: Int32?=nil, _class: String?=nil) { | ||||||
|  |         self.name = name | ||||||
|  |         self._class = _class | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["name"] = self.name?.encodeToJSON() | ||||||
|  |         nillableDictionary["class"] = self._class | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,37 @@ | |||||||
|  | // | ||||||
|  | // Name.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /** Model for testing model name same as property name */ | ||||||
|  | open class Name: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var name: Int32 | ||||||
|  |     public var snakeCase: Int32? | ||||||
|  |     public var property: String? | ||||||
|  |     public var _123Number: Int32? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(name: Int32, snakeCase: Int32?=nil, property: String?=nil, _123Number: Int32?=nil) { | ||||||
|  |         self.name = name | ||||||
|  |         self.snakeCase = snakeCase | ||||||
|  |         self.property = property | ||||||
|  |         self._123Number = _123Number | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["name"] = self.name.encodeToJSON() | ||||||
|  |         nillableDictionary["snake_case"] = self.snakeCase?.encodeToJSON() | ||||||
|  |         nillableDictionary["property"] = self.property | ||||||
|  |         nillableDictionary["123Number"] = self._123Number?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | // | ||||||
|  | // NumberOnly.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class NumberOnly: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var justNumber: Double? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(justNumber: Double?=nil) { | ||||||
|  |         self.justNumber = justNumber | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["JustNumber"] = self.justNumber | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,48 @@ | |||||||
|  | // | ||||||
|  | // Order.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Order: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public enum Status: String {  | ||||||
|  |         case placed = "placed" | ||||||
|  |         case approved = "approved" | ||||||
|  |         case delivered = "delivered" | ||||||
|  |     } | ||||||
|  |     public var id: Int64? | ||||||
|  |     public var petId: Int64? | ||||||
|  |     public var quantity: Int32? | ||||||
|  |     public var shipDate: Date? | ||||||
|  |     /** Order Status */ | ||||||
|  |     public var status: Status? | ||||||
|  |     public var complete: Bool? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(id: Int64?=nil, petId: Int64?=nil, quantity: Int32?=nil, shipDate: Date?=nil, status: Status?=nil, complete: Bool?=nil) { | ||||||
|  |         self.id = id | ||||||
|  |         self.petId = petId | ||||||
|  |         self.quantity = quantity | ||||||
|  |         self.shipDate = shipDate | ||||||
|  |         self.status = status | ||||||
|  |         self.complete = complete | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["id"] = self.id?.encodeToJSON() | ||||||
|  |         nillableDictionary["petId"] = self.petId?.encodeToJSON() | ||||||
|  |         nillableDictionary["quantity"] = self.quantity?.encodeToJSON() | ||||||
|  |         nillableDictionary["shipDate"] = self.shipDate?.encodeToJSON() | ||||||
|  |         nillableDictionary["status"] = self.status?.rawValue | ||||||
|  |         nillableDictionary["complete"] = self.complete | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,11 @@ | |||||||
|  | // | ||||||
|  | // OuterBoolean.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public typealias OuterBoolean = Bool | ||||||
| @ -0,0 +1,33 @@ | |||||||
|  | // | ||||||
|  | // OuterComposite.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class OuterComposite: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var myNumber: OuterNumber? | ||||||
|  |     public var myString: OuterString? | ||||||
|  |     public var myBoolean: OuterBoolean? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(myNumber: OuterNumber?=nil, myString: OuterString?=nil, myBoolean: OuterBoolean?=nil) { | ||||||
|  |         self.myNumber = myNumber | ||||||
|  |         self.myString = myString | ||||||
|  |         self.myBoolean = myBoolean | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["my_number"] = self.myNumber?.encodeToJSON() | ||||||
|  |         nillableDictionary["my_string"] = self.myString?.encodeToJSON() | ||||||
|  |         nillableDictionary["my_boolean"] = self.myBoolean?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,17 @@ | |||||||
|  | // | ||||||
|  | // OuterEnum.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public enum OuterEnum: String { | ||||||
|  |     case placed = "placed" | ||||||
|  |     case approved = "approved" | ||||||
|  |     case delivered = "delivered" | ||||||
|  | 
 | ||||||
|  |     func encodeToJSON() -> Any { return self.rawValue } | ||||||
|  | } | ||||||
| @ -0,0 +1,11 @@ | |||||||
|  | // | ||||||
|  | // OuterNumber.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public typealias OuterNumber = Double | ||||||
| @ -0,0 +1,11 @@ | |||||||
|  | // | ||||||
|  | // OuterString.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | public typealias OuterString = String | ||||||
| @ -0,0 +1,48 @@ | |||||||
|  | // | ||||||
|  | // Pet.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Pet: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public enum Status: String {  | ||||||
|  |         case available = "available" | ||||||
|  |         case pending = "pending" | ||||||
|  |         case sold = "sold" | ||||||
|  |     } | ||||||
|  |     public var id: Int64? | ||||||
|  |     public var category: Category? | ||||||
|  |     public var name: String | ||||||
|  |     public var photoUrls: [String] | ||||||
|  |     public var tags: [Tag]? | ||||||
|  |     /** pet status in the store */ | ||||||
|  |     public var status: Status? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(id: Int64?=nil, category: Category?=nil, name: String, photoUrls: [String], tags: [Tag]?=nil, status: Status?=nil) { | ||||||
|  |         self.id = id | ||||||
|  |         self.category = category | ||||||
|  |         self.name = name | ||||||
|  |         self.photoUrls = photoUrls | ||||||
|  |         self.tags = tags | ||||||
|  |         self.status = status | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["id"] = self.id?.encodeToJSON() | ||||||
|  |         nillableDictionary["category"] = self.category?.encodeToJSON() | ||||||
|  |         nillableDictionary["name"] = self.name | ||||||
|  |         nillableDictionary["photoUrls"] = self.photoUrls.encodeToJSON() | ||||||
|  |         nillableDictionary["tags"] = self.tags?.encodeToJSON() | ||||||
|  |         nillableDictionary["status"] = self.status?.rawValue | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,30 @@ | |||||||
|  | // | ||||||
|  | // ReadOnlyFirst.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class ReadOnlyFirst: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var bar: String? | ||||||
|  |     public var baz: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(bar: String?=nil, baz: String?=nil) { | ||||||
|  |         self.bar = bar | ||||||
|  |         self.baz = baz | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["bar"] = self.bar | ||||||
|  |         nillableDictionary["baz"] = self.baz | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,28 @@ | |||||||
|  | // | ||||||
|  | // Return.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | /** Model for testing reserved words */ | ||||||
|  | open class Return: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var _return: Int32? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(_return: Int32?=nil) { | ||||||
|  |         self._return = _return | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["return"] = self._return?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,27 @@ | |||||||
|  | // | ||||||
|  | // SpecialModelName.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class SpecialModelName: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var specialPropertyName: Int64? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(specialPropertyName: Int64?=nil) { | ||||||
|  |         self.specialPropertyName = specialPropertyName | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["$special[property.name]"] = self.specialPropertyName?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,30 @@ | |||||||
|  | // | ||||||
|  | // Tag.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class Tag: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var id: Int64? | ||||||
|  |     public var name: String? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(id: Int64?=nil, name: String?=nil) { | ||||||
|  |         self.id = id | ||||||
|  |         self.name = name | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["id"] = self.id?.encodeToJSON() | ||||||
|  |         nillableDictionary["name"] = self.name | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
| @ -0,0 +1,49 @@ | |||||||
|  | // | ||||||
|  | // User.swift | ||||||
|  | // | ||||||
|  | // Generated by swagger-codegen | ||||||
|  | // https://github.com/swagger-api/swagger-codegen | ||||||
|  | // | ||||||
|  | 
 | ||||||
|  | import Foundation | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | open class User: JSONEncodable { | ||||||
|  | 
 | ||||||
|  |     public var id: Int64? | ||||||
|  |     public var username: String? | ||||||
|  |     public var firstName: String? | ||||||
|  |     public var lastName: String? | ||||||
|  |     public var email: String? | ||||||
|  |     public var password: String? | ||||||
|  |     public var phone: String? | ||||||
|  |     /** User Status */ | ||||||
|  |     public var userStatus: Int32? | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  |     public init(id: Int64?=nil, username: String?=nil, firstName: String?=nil, lastName: String?=nil, email: String?=nil, password: String?=nil, phone: String?=nil, userStatus: Int32?=nil) { | ||||||
|  |         self.id = id | ||||||
|  |         self.username = username | ||||||
|  |         self.firstName = firstName | ||||||
|  |         self.lastName = lastName | ||||||
|  |         self.email = email | ||||||
|  |         self.password = password | ||||||
|  |         self.phone = phone | ||||||
|  |         self.userStatus = userStatus | ||||||
|  |     } | ||||||
|  |     // MARK: JSONEncodable | ||||||
|  |     open func encodeToJSON() -> Any { | ||||||
|  |         var nillableDictionary = [String:Any?]() | ||||||
|  |         nillableDictionary["id"] = self.id?.encodeToJSON() | ||||||
|  |         nillableDictionary["username"] = self.username | ||||||
|  |         nillableDictionary["firstName"] = self.firstName | ||||||
|  |         nillableDictionary["lastName"] = self.lastName | ||||||
|  |         nillableDictionary["email"] = self.email | ||||||
|  |         nillableDictionary["password"] = self.password | ||||||
|  |         nillableDictionary["phone"] = self.phone | ||||||
|  |         nillableDictionary["userStatus"] = self.userStatus?.encodeToJSON() | ||||||
|  | 
 | ||||||
|  |         let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] | ||||||
|  |         return dictionary | ||||||
|  |     } | ||||||
|  | } | ||||||
							
								
								
									
										52
									
								
								samples/client/petstore/swift3/unwraprequired/git_push.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								samples/client/petstore/swift3/unwraprequired/git_push.sh
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | |||||||
|  | #!/bin/sh | ||||||
|  | # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ | ||||||
|  | # | ||||||
|  | # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update" | ||||||
|  | 
 | ||||||
|  | git_user_id=$1 | ||||||
|  | git_repo_id=$2 | ||||||
|  | release_note=$3 | ||||||
|  | 
 | ||||||
|  | if [ "$git_user_id" = "" ]; then | ||||||
|  |     git_user_id="GIT_USER_ID" | ||||||
|  |     echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | if [ "$git_repo_id" = "" ]; then | ||||||
|  |     git_repo_id="GIT_REPO_ID" | ||||||
|  |     echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | if [ "$release_note" = "" ]; then | ||||||
|  |     release_note="Minor update" | ||||||
|  |     echo "[INFO] No command line input provided. Set \$release_note to $release_note" | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | # Initialize the local directory as a Git repository | ||||||
|  | git init | ||||||
|  | 
 | ||||||
|  | # Adds the files in the local repository and stages them for commit. | ||||||
|  | git add . | ||||||
|  | 
 | ||||||
|  | # Commits the tracked changes and prepares them to be pushed to a remote repository.  | ||||||
|  | git commit -m "$release_note" | ||||||
|  | 
 | ||||||
|  | # Sets the new remote | ||||||
|  | git_remote=`git remote` | ||||||
|  | if [ "$git_remote" = "" ]; then # git remote not defined | ||||||
|  | 
 | ||||||
|  |     if [ "$GIT_TOKEN" = "" ]; then | ||||||
|  |         echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git crediential in your environment." | ||||||
|  |         git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git | ||||||
|  |     else | ||||||
|  |         git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git | ||||||
|  |     fi | ||||||
|  | 
 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | git pull origin master | ||||||
|  | 
 | ||||||
|  | # Pushes (Forces) the changes in the local repository up to the remote repository | ||||||
|  | echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git" | ||||||
|  | git push origin master 2>&1 | grep -v 'To https' | ||||||
|  | 
 | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user