Skip to content
This repository was archived by the owner on Jul 24, 2023. It is now read-only.

Commit 9a68ee1

Browse files
committed
Initial beta
0 parents  commit 9a68ee1

File tree

961 files changed

+100113
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

961 files changed

+100113
-0
lines changed

.gitignore

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Xcode
2+
#
3+
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4+
5+
## Build generated
6+
build/
7+
DerivedData
8+
9+
## Various settings
10+
*.pbxuser
11+
!default.pbxuser
12+
*.mode1v3
13+
!default.mode1v3
14+
*.mode2v3
15+
!default.mode2v3
16+
*.perspectivev3
17+
!default.perspectivev3
18+
xcuserdata
19+
20+
## Other
21+
*.xccheckout
22+
*.moved-aside
23+
*.xcuserstate
24+
*.xcscmblueprint
25+
26+
## Obj-C/Swift specific
27+
*.hmap
28+
*.ipa
29+
30+
## Playgrounds
31+
timeline.xctimeline
32+
playground.xcworkspace
33+
34+
# Swift Package Manager
35+
#
36+
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
37+
# Packages/
38+
.build/
39+
40+
# CocoaPods
41+
#
42+
# We recommend against adding the Pods directory to your .gitignore. However
43+
# you should judge for yourself, the pros and cons are mentioned at:
44+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
45+
#
46+
# Pods/
47+
48+
# Carthage
49+
#
50+
# Add this line if you want to avoid checking in source code from Carthage dependencies.
51+
# Carthage/Checkouts
52+
53+
Carthage/Build
54+
55+
# fastlane
56+
#
57+
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
58+
# screenshots whenever they are needed.
59+
# For more information about the recommended setup visit:
60+
# https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md
61+
62+
fastlane/report.xml
63+
fastlane/screenshots

.openapi-generator-ignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# OpenAPI Generator Ignore
2+
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
3+
4+
# Use this file to prevent files from being overwritten by the generator.
5+
# The patterns follow closely to .gitignore or .dockerignore.
6+
7+
# As an example, the C# client generator defines ApiClient.cs.
8+
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
9+
#ApiClient.cs
10+
11+
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
12+
#foo/*/qux
13+
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
14+
15+
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
16+
#foo/**/qux
17+
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
18+
19+
# You can also negate patterns with an exclamation (!).
20+
# For example, you can ignore all files in a docs folder with the file extension .md:
21+
#docs/*.md
22+
# Then explicitly reverse the ignore rule for a single file:
23+
#!docs/README.md

.openapi-generator/FILES

Lines changed: 638 additions & 0 deletions
Large diffs are not rendered by default.

.openapi-generator/VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
5.1.1

Cartfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
github "mxcl/PromiseKit" ~> 6.13.1
3+
github "Flight-School/AnyCodable" ~> 0.4.0

ElementsSDK.podspec

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
Pod::Spec.new do |s|
2+
s.name = 'ElementsSDK'
3+
s.ios.deployment_target = '9.0'
4+
s.osx.deployment_target = '10.11'
5+
s.tvos.deployment_target = '9.0'
6+
s.watchos.deployment_target = '3.0'
7+
s.version = '2'
8+
s.source = { :git => '[email protected]:OpenAPITools/openapi-generator.git', :tag => 'v2' }
9+
s.authors = 'OpenAPI Generator'
10+
s.license = 'Proprietary'
11+
s.homepage = 'https://github.com/OpenAPITools/openapi-generator'
12+
s.summary = 'ElementsSDK Swift SDK'
13+
s.source_files = 'ElementsSDK/Classes/**/*.swift'
14+
s.dependency 'PromiseKit/CorePromise', '~> 6.13.1'
15+
s.dependency 'AnyCodable-FlightSchool', '~> 0.4.0'
16+
end
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
// APIHelper.swift
2+
//
3+
// Generated by openapi-generator
4+
// https://openapi-generator.tech
5+
//
6+
7+
import Foundation
8+
9+
public struct APIHelper {
10+
public static func rejectNil(_ source: [String: Any?]) -> [String: Any]? {
11+
let destination = source.reduce(into: [String: Any]()) { result, item in
12+
if let value = item.value {
13+
result[item.key] = value
14+
}
15+
}
16+
17+
if destination.isEmpty {
18+
return nil
19+
}
20+
return destination
21+
}
22+
23+
public static func rejectNilHeaders(_ source: [String: Any?]) -> [String: String] {
24+
return source.reduce(into: [String: String]()) { result, item in
25+
if let collection = item.value as? [Any?] {
26+
result[item.key] = collection.filter { $0 != nil }.map { "\($0!)" }.joined(separator: ",")
27+
} else if let value: Any = item.value {
28+
result[item.key] = "\(value)"
29+
}
30+
}
31+
}
32+
33+
public static func convertBoolToString(_ source: [String: Any]?) -> [String: Any]? {
34+
guard let source = source else {
35+
return nil
36+
}
37+
38+
return source.reduce(into: [String: Any]()) { result, item in
39+
switch item.value {
40+
case let x as Bool:
41+
result[item.key] = x.description
42+
default:
43+
result[item.key] = item.value
44+
}
45+
}
46+
}
47+
48+
public static func mapValueToPathItem(_ source: Any) -> Any {
49+
if let collection = source as? [Any?] {
50+
return collection.filter { $0 != nil }.map { "\($0!)" }.joined(separator: ",")
51+
}
52+
return source
53+
}
54+
55+
public static func mapValuesToQueryItems(_ source: [String: Any?]) -> [URLQueryItem]? {
56+
let destination = source.filter { $0.value != nil }.reduce(into: [URLQueryItem]()) { result, item in
57+
if let collection = item.value as? [Any?] {
58+
collection.filter { $0 != nil }.map { "\($0!)" }.forEach { value in
59+
result.append(URLQueryItem(name: item.key, value: value))
60+
}
61+
} else if let value = item.value {
62+
result.append(URLQueryItem(name: item.key, value: "\(value)"))
63+
}
64+
}
65+
66+
if destination.isEmpty {
67+
return nil
68+
}
69+
return destination
70+
}
71+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// APIs.swift
2+
//
3+
// Generated by openapi-generator
4+
// https://openapi-generator.tech
5+
//
6+
7+
import Foundation
8+
9+
open class ElementsSDKAPI {
10+
public static var basePath = "https://elements.local"
11+
public static var credential: URLCredential?
12+
public static var customHeaders: [String: String] = [:]
13+
public static var requestBuilderFactory: RequestBuilderFactory = URLSessionRequestBuilderFactory()
14+
public static var apiResponseQueue: DispatchQueue = .main
15+
}
16+
17+
open class RequestBuilder<T> {
18+
var credential: URLCredential?
19+
var headers: [String: String]
20+
public let parameters: [String: Any]?
21+
public let method: String
22+
public let URLString: String
23+
24+
/// Optional block to obtain a reference to the request's progress instance when available.
25+
/// With the URLSession http client the request's progress only works on iOS 11.0, macOS 10.13, macCatalyst 13.0, tvOS 11.0, watchOS 4.0.
26+
/// If you need to get the request's progress in older OS versions, please use Alamofire http client.
27+
public var onProgressReady: ((Progress) -> Void)?
28+
29+
required public init(method: String, URLString: String, parameters: [String: Any]?, headers: [String: String] = [:]) {
30+
self.method = method
31+
self.URLString = URLString
32+
self.parameters = parameters
33+
self.headers = headers
34+
35+
addHeaders(ElementsSDKAPI.customHeaders)
36+
}
37+
38+
open func addHeaders(_ aHeaders: [String: String]) {
39+
for (header, value) in aHeaders {
40+
headers[header] = value
41+
}
42+
}
43+
44+
open func execute(_ apiResponseQueue: DispatchQueue = ElementsSDKAPI.apiResponseQueue, _ completion: @escaping (_ result: Swift.Result<Response<T>, Error>) -> Void) { }
45+
46+
public func addHeader(name: String, value: String) -> Self {
47+
if !value.isEmpty {
48+
headers[name] = value
49+
}
50+
return self
51+
}
52+
53+
open func addCredential() -> Self {
54+
credential = ElementsSDKAPI.credential
55+
return self
56+
}
57+
}
58+
59+
public protocol RequestBuilderFactory {
60+
func getNonDecodableBuilder<T>() -> RequestBuilder<T>.Type
61+
func getBuilder<T: Decodable>() -> RequestBuilder<T>.Type
62+
}

0 commit comments

Comments
 (0)