mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-11-22 11:33:58 +00:00
* Add a swift4 client generator * Updates per review comments: - Changed Alamofire dependency from 4.0 to 4.5 - Added "Codable", "Encodable", and "Decodable" to list of reserved words in generator - Ran "pod update" in default, promisekit, and rxswift samples test projects
37 lines
886 B
Plaintext
37 lines
886 B
Plaintext
// 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 Error(Int, Data?, Error)
|
|
}
|
|
|
|
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)
|
|
}
|
|
}
|