DataManager
public protocol DataManager
The base protocol for all data managers. Contains functionality common to all data managers.
-
The HTTP environment manager used for determining the appropriate environment when communicating with the API.
Declaration
Swift
var environmentManager: HTTPEnvironmentManager
-
The HTTP client used for communication with the API.
Declaration
Swift
var httpClient: HTTPClient
-
The Session Manager used for handling session id for the app
Declaration
Swift
var sessionManager: SessionManager
-
headers(forEnvironment:)
Default implementationReturns the headers to be passed through the HTTP request for the specified environment
Parameter
Parameter environment: The specific HTTPEnvironment under considerationReturns
Headers for the current environmentDefault Implementation
Returns the headers to be passed through the HTTP request for the specified environment
Parameter
Parameter environment: The specific HTTPEnvironment under considerationReturns
Headers for the current environmentDeclaration
Swift
func headers(forEnvironment environment: HTTPEnvironment) -> Headers
Parameters
environment
The specific HTTPEnvironment under consideration
Return Value
Headers for the current environment
-
isSessionError(error:)
Extension methodUndocumented
Declaration
Swift
public protocol DataManager
-
resetSession(request:completion:)
Extension methodResets the user’s session and performs the call initiated before receiving an error related with the session.
- Parameters:
- request: The request to perform after the session is reset.
- completion: The completion block of the original request.
Declaration
Swift
public func resetSession<T: Decodable>(request: HTTPRequest, completion: @escaping (T?, Swift.Error?) -> Void)
Parameters
request
The request to perform after the session is reset.
completion
The completion block of the original request.
- Parameters:
-
resetSession(request:completion:)
Extension methodResets the user’s session and performs the call initiated before receiving an error related with the session.
- Parameters:
- request: The request to perform after the session is reset.
- completion: The completion block of the original request.
Declaration
Swift
public func resetSession<T: Decodable>(request: HTTPRequest, completion: @escaping ([T], Swift.Error?) -> Void)
Parameters
request
The request to perform after the session is reset.
completion
The completion block of the original request.
- Parameters:
-
perform(request:completion:)
Extension methodPerforms the given HTTP request for returning a single object.
- Parameters:
- request: The request to perform.
- completion: The completion block.
Declaration
Swift
public func perform<T: Decodable>(request: HTTPRequest, completion: @escaping (T?, Swift.Error?) -> Void)
Parameters
request
The request to perform.
completion
The completion block.
- Parameters:
-
perform(request:completion:)
Extension methodPerforms the given HTTP request for returning an array of objects.
- Parameters:
- request: The request to perform.
- completion: The completion block.
Declaration
Swift
public func perform<T: Decodable>(request: HTTPRequest, completion: @escaping ([T], Swift.Error?) -> Void)
Parameters
request
The request to perform.
completion
The completion block.
- Parameters: