From 9fbba80b2c39068c0bec78e7a55eece77bc27e49 Mon Sep 17 00:00:00 2001 From: Theis Egeberg Date: Fri, 10 Dec 2021 20:17:40 +0100 Subject: [PATCH] Added public memberwise initialiser to APIClient.Configuration to make it usable from outside the package, --- Sources/APIClient/APIClient.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Sources/APIClient/APIClient.swift b/Sources/APIClient/APIClient.swift index ceadf45..b0fc7ac 100644 --- a/Sources/APIClient/APIClient.swift +++ b/Sources/APIClient/APIClient.swift @@ -27,6 +27,16 @@ public actor APIClient { /// By default, uses encoder with `.iso8601` date encoding strategy. public var encoder: JSONEncoder? public var delegate: APIClientDelegate? + + public init(host: String, port: Int? = nil, isInsecure: Bool = false, sessionConfiguration: URLSessionConfiguration = .default, decoder: JSONDecoder? = nil, encoder: JSONEncoder? = nil, delegate: APIClientDelegate? = nil) { + self.host = host + self.port = port + self.isInsecure = isInsecure + self.sessionConfiguration = sessionConfiguration + self.decoder = decoder + self.encoder = encoder + self.delegate = delegate + } } /// Initializes the client with the given parameters.