feat: add request preprocessor for OpenAPI security requirements
This commit is contained in:
parent
c5db547b82
commit
784743082d
|
|
@ -1,5 +1,10 @@
|
|||
# Changelog
|
||||
|
||||
### 1.20.0
|
||||
|
||||
- **Add**: OpenAPI security schemes support for EndpointRequest's.
|
||||
- **Update**: Replace `AdditionalHeadersPlugin` with `SecuritySchemePreprocessor` and `EndpointRequestPreprocessor` (with default implementations)
|
||||
|
||||
### 1.19.0
|
||||
|
||||
- **Add**: Add presenter protocols to `TISwiftUICore` and `TIUIKitCore` modules
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = "LeadKit"
|
||||
s.version = "1.19.0"
|
||||
s.version = "1.20.0"
|
||||
s.summary = "iOS framework with a bunch of tools for rapid development"
|
||||
s.homepage = "https://github.com/TouchInstinct/LeadKit"
|
||||
s.license = "Apache License, Version 2.0"
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIAppleMapUtils'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting using Apple MapKit.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIAuth'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Login, registration, confirmation and other related actions'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIFoundationUtils'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Set of helpers for Foundation framework classes.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIGoogleMapUtils'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting using Google Maps SDK.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIKeychainUtils'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Set of helpers for Keychain classes.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIMapUtils'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -41,18 +41,20 @@ open class DefaultJsonNetworkService {
|
|||
public var jsonDecoder: JSONDecoder
|
||||
public var jsonEncoder: JSONEncoder
|
||||
|
||||
public var defaultServer: Server
|
||||
public var openApi: OpenAPI
|
||||
|
||||
public var plugins: [PluginType] = []
|
||||
|
||||
public var preprocessors: [EndpointRequestPreprocessor] = []
|
||||
|
||||
public init(session: Session,
|
||||
jsonCodingConfigurator: JsonCodingConfigurator,
|
||||
defaultServer: Server) {
|
||||
openApi: OpenAPI) {
|
||||
|
||||
self.session = session
|
||||
self.jsonDecoder = jsonCodingConfigurator.jsonDecoder
|
||||
self.jsonEncoder = jsonCodingConfigurator.jsonEncoder
|
||||
self.defaultServer = defaultServer
|
||||
self.openApi = openApi
|
||||
}
|
||||
|
||||
open func createProvider() -> MoyaProvider<SerializedRequest> {
|
||||
|
|
@ -63,7 +65,7 @@ open class DefaultJsonNetworkService {
|
|||
|
||||
open func serialize<B: Encodable, S: Decodable>(request: EndpointRequest<B, S>) throws -> SerializedRequest {
|
||||
try request.serialize(using: ApplicationJsonBodySerializer(jsonEncoder: jsonEncoder),
|
||||
defaultServer: defaultServer)
|
||||
defaultServer: openApi.defaultServer)
|
||||
}
|
||||
|
||||
@available(iOS 13.0.0, *)
|
||||
|
|
@ -104,14 +106,18 @@ open class DefaultJsonNetworkService {
|
|||
mapMoyaError: @escaping Closure<MoyaError, R>,
|
||||
completion: @escaping ParameterClosure<R>) -> Cancellable {
|
||||
|
||||
ScopeCancellable { [serializationQueue, callbackQueue] scope in
|
||||
ScopeCancellable { [serializationQueue, callbackQueue, preprocessors] scope in
|
||||
let workItem = DispatchWorkItem {
|
||||
guard !scope.isCancelled else {
|
||||
return
|
||||
}
|
||||
|
||||
do {
|
||||
let serializedRequest = try self.serialize(request: request)
|
||||
let preprocessedRequest = try preprocessors.reduce(request) {
|
||||
try $1.preprocess(request: $0)
|
||||
}
|
||||
|
||||
let serializedRequest = try self.serialize(request: preprocessedRequest)
|
||||
|
||||
scope.add(cancellable: self.process(request: serializedRequest,
|
||||
mapSuccess: mapSuccess,
|
||||
|
|
@ -195,4 +201,15 @@ open class DefaultJsonNetworkService {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func register<T: RawRepresentable>(securityPreprocessors: [T: SecuritySchemePreprocessor]) where T.RawValue == String {
|
||||
let schemePreprocessors = Dictionary(uniqueKeysWithValues: securityPreprocessors.map {
|
||||
($0.key.rawValue, $0.value)
|
||||
})
|
||||
|
||||
let securityPreprocessor = DefaultEndpointSecurityPreprocessor(openApi: openApi,
|
||||
schemePreprocessors: schemePreprocessors)
|
||||
|
||||
preprocessors.append(securityPreprocessor)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
import Moya
|
||||
import Alamofire
|
||||
import Foundation
|
||||
|
||||
public protocol AdditionalHeadersPlugin: PluginType {
|
||||
var additionalHeaders: HTTPHeaders { get }
|
||||
}
|
||||
|
||||
public extension AdditionalHeadersPlugin {
|
||||
func prepare(_ request: URLRequest, target: TargetType) -> URLRequest {
|
||||
var modifiedRequest = request
|
||||
|
||||
for header in additionalHeaders {
|
||||
modifiedRequest.addValue(header.value, forHTTPHeaderField: header.name)
|
||||
}
|
||||
|
||||
return modifiedRequest
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
//
|
||||
// Copyright (c) 2022 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import TINetworking
|
||||
|
||||
open class DefaultSecuritySchemePreprocessor: SecuritySchemePreprocessor {
|
||||
struct ValueNotProvidedError: Error {}
|
||||
|
||||
public typealias ValueProvider = () -> String?
|
||||
|
||||
private let valueProvider: ValueProvider
|
||||
|
||||
public init(valueProvider: @escaping ValueProvider) {
|
||||
self.valueProvider = valueProvider
|
||||
}
|
||||
|
||||
public init(staticValue: String?) {
|
||||
self.valueProvider = { staticValue }
|
||||
}
|
||||
|
||||
// MARK: - EndpointSecurityRequestPreprocessor
|
||||
|
||||
public func preprocess<B, S>(request: EndpointRequest<B, S>, using security: SecurityScheme) throws -> EndpointRequest<B, S> {
|
||||
var modifiedRequest = request
|
||||
|
||||
guard let value = valueProvider() else {
|
||||
throw ValueNotProvidedError()
|
||||
}
|
||||
|
||||
switch security {
|
||||
case let .http(authenticationScheme):
|
||||
let headerValue = "\(authenticationScheme.rawValue) \(value)"
|
||||
var headerParameters = modifiedRequest.headerParameters ?? [:]
|
||||
headerParameters.updateValue(.init(value: headerValue),
|
||||
forKey: "Authorization")
|
||||
|
||||
modifiedRequest.headerParameters = headerParameters
|
||||
case let .apiKey(parameterLocation, parameterName):
|
||||
switch parameterLocation {
|
||||
case .header:
|
||||
var headerParameters = modifiedRequest.headerParameters ?? [:]
|
||||
headerParameters.updateValue(.init(value: value),
|
||||
forKey: parameterName)
|
||||
|
||||
modifiedRequest.headerParameters = headerParameters
|
||||
case .query:
|
||||
modifiedRequest.queryParameters.updateValue(.init(value: value),
|
||||
forKey: parameterName)
|
||||
case .cookie:
|
||||
modifiedRequest.cookieParameters.updateValue(.init(value: value),
|
||||
forKey: parameterName)
|
||||
}
|
||||
}
|
||||
|
||||
return modifiedRequest
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
//
|
||||
// Copyright (c) 2022 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import TINetworking
|
||||
|
||||
open class DefaultEndpointSecurityPreprocessor: EndpointRequestPreprocessor {
|
||||
enum PreprocessError: Error {
|
||||
case missingSecurityScheme(String, [String: SecurityScheme])
|
||||
case unableToSatisfyRequirements(anyOfRequired: [[String]],
|
||||
registeredPreprocessors: [String: SecuritySchemePreprocessor])
|
||||
}
|
||||
|
||||
private let openApi: OpenAPI
|
||||
|
||||
private var schemePreprocessors: [String: SecuritySchemePreprocessor]
|
||||
|
||||
public init(openApi: OpenAPI, schemePreprocessors: [String: SecuritySchemePreprocessor] = [:]) {
|
||||
self.openApi = openApi
|
||||
self.schemePreprocessors = schemePreprocessors
|
||||
}
|
||||
|
||||
public func preprocess<B, S>(request: EndpointRequest<B, S>) throws -> EndpointRequest<B, S> {
|
||||
guard !request.security.compactMap({ $0 }).isEmpty else {
|
||||
return request
|
||||
}
|
||||
|
||||
let endpointSchemes: [[KeyValueTuple<String, SecurityScheme>]] = try request.security.map {
|
||||
try $0.map {
|
||||
guard let securityScheme = openApi.security[$0] else {
|
||||
throw PreprocessError.missingSecurityScheme($0, openApi.security)
|
||||
}
|
||||
|
||||
return ($0, securityScheme)
|
||||
}
|
||||
}
|
||||
|
||||
for schemeGroup in endpointSchemes {
|
||||
let preprocessorsGroup: [KeyValueTuple<SecurityScheme, SecuritySchemePreprocessor>] = schemeGroup.compactMap {
|
||||
guard let preprocessor = schemePreprocessors[$0.key] else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return ($0.value, preprocessor)
|
||||
}
|
||||
|
||||
guard preprocessorsGroup.count == schemeGroup.count else {
|
||||
continue // unable to satisfy group requirement
|
||||
}
|
||||
|
||||
do {
|
||||
return try preprocessorsGroup.reduce(request) {
|
||||
try $1.value.preprocess(request: $0, using: $1.key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw PreprocessError.unableToSatisfyRequirements(anyOfRequired: request.security,
|
||||
registeredPreprocessors: schemePreprocessors)
|
||||
}
|
||||
|
||||
public func register(preprocessor: SecuritySchemePreprocessor, for scheme: String) {
|
||||
schemePreprocessors[scheme] = preprocessor
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// Copyright (c) 2022 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import TINetworking
|
||||
|
||||
public protocol EndpointRequestPreprocessor {
|
||||
func preprocess<B,S>(request: EndpointRequest<B,S>) throws -> EndpointRequest<B,S>
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
//
|
||||
// Copyright (c) 2022 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
import TINetworking
|
||||
|
||||
public protocol SecuritySchemePreprocessor {
|
||||
func preprocess<B,S>(request: EndpointRequest<B,S>, using security: SecurityScheme) throws -> EndpointRequest<B,S>
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIMoyaNetworking'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Moya + Swagger network service.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ public struct EndpointRequest<Body, SuccessResponse> {
|
|||
public var headerParameters: [String: Parameter<LocationHeader>]?
|
||||
public var cookieParameters: [String: Parameter<LocationCookie>]
|
||||
public var acceptableStatusCodes: Set<Int>
|
||||
public var security: [[String]]
|
||||
public var server: Server?
|
||||
public var customServerVariables: [KeyValueTuple<String, String>]
|
||||
|
||||
|
|
@ -42,6 +43,7 @@ public struct EndpointRequest<Body, SuccessResponse> {
|
|||
headerParameters: [String: Parameter<LocationHeader>]? = nil,
|
||||
cookieParameters: [String: Parameter<LocationCookie>] = [:],
|
||||
acceptableStatusCodes: Set<Int> = HTTPCodes.success.asSet(),
|
||||
security: [[String]] = [],
|
||||
server: Server? = nil,
|
||||
customServerVariables: [KeyValueTuple<String, String>] = []) {
|
||||
|
||||
|
|
@ -55,5 +57,6 @@ public struct EndpointRequest<Body, SuccessResponse> {
|
|||
self.acceptableStatusCodes = acceptableStatusCodes
|
||||
self.server = server
|
||||
self.customServerVariables = customServerVariables
|
||||
self.security = security
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// Copyright (c) 2022 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
public struct HTTPAuthenticationScheme: RawRepresentable, Equatable, Hashable {
|
||||
public static let basic = HTTPAuthenticationScheme(rawValue: "Basic")
|
||||
public static let bearer = HTTPAuthenticationScheme(rawValue: "Bearer")
|
||||
|
||||
public let rawValue: String
|
||||
|
||||
public init(rawValue: String) {
|
||||
self.rawValue = rawValue
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// Copyright (c) 2022 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
public struct OpenAPI {
|
||||
public let defaultServer: Server
|
||||
public let security: [String: SecurityScheme]
|
||||
|
||||
public init(defaultServer: Server, security: [String: SecurityScheme]) {
|
||||
self.defaultServer = defaultServer
|
||||
self.security = security
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// Copyright (c) 2022 Touch Instinct
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
// of this software and associated documentation files (the Software), to deal
|
||||
// in the Software without restriction, including without limitation the rights
|
||||
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
// copies of the Software, and to permit persons to whom the Software is
|
||||
// furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in
|
||||
// all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
// THE SOFTWARE.
|
||||
//
|
||||
|
||||
public enum SecurityScheme {
|
||||
public enum ParameterLocation {
|
||||
case header
|
||||
case query
|
||||
case cookie
|
||||
}
|
||||
|
||||
case http(HTTPAuthenticationScheme)
|
||||
case apiKey(ParameterLocation, parameterName: String)
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TINetworking'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Swagger-frendly networking layer helpers.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TINetworkingCache'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Caching results of EndpointRequests.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIPagination'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Generic pagination component.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TISwiftUICore'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Core UI elements: protocols, views and helpers..'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TISwiftUtils'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Bunch of useful helpers for Swift development.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TITableKitUtils'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Set of helpers for TableKit classes.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TITransitions'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Set of custom transitions to present controller. '
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIUIElements'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Bunch of useful protocols and views.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIUIKitCore'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Core UI elements: protocols, views and helpers.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
Pod::Spec.new do |s|
|
||||
s.name = 'TIYandexMapUtils'
|
||||
s.version = '1.19.0'
|
||||
s.version = '1.20.0'
|
||||
s.summary = 'Set of helpers for map objects clustering and interacting using Yandex Maps SDK.'
|
||||
s.homepage = 'https://github.com/TouchInstinct/LeadKit/tree/' + s.version.to_s + '/' + s.name
|
||||
s.license = { :type => 'MIT', :file => 'LICENSE' }
|
||||
|
|
|
|||
Loading…
Reference in New Issue