JcConnection
public protocol JcConnection
Convenience protocol to define connection parameters for API calls when using URLRequest
via JcConnectionRequest
-
URL including http/https excluding resource path and arguments
Declaration
Swift
var endPoint: URL { get }
-
true if the connection has already been tested and was successful
Declaration
Swift
var isConnected: Bool { get }
-
Reason for previous failure
Declaration
Swift
var failureReason: String? { get }
-
Credentials to be used when connecting
Declaration
Swift
var credentials: JcCredentials? { get }
-
Default header fields to be sent when making requests
Declaration
Swift
var headers: Dictionary<String, String>? { get }
-
function that will somehow test the connection and update
isConnected
,failureMessage
etc with resultsDeclaration
Swift
func connect<T>(completionHandler: @escaping (JcRequestResponse<T>) -> Void) throws -> URLSessionDataTask where T : Decodable, T : Encodable
Parameters
completionHandler
callback to receive connection results