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 implementation

    Returns the headers to be passed through the HTTP request for the specified environment

    Parameter

    Parameter environment: The specific HTTPEnvironment under consideration

    Returns

    Headers for the current environment

    Default Implementation

    Returns the headers to be passed through the HTTP request for the specified environment

    Parameter

    Parameter environment: The specific HTTPEnvironment under consideration

    Returns

    Headers for the current environment

    Declaration

    Swift

    func headers(forEnvironment environment: HTTPEnvironment) -> Headers

    Parameters

    environment

    The specific HTTPEnvironment under consideration

    Return Value

    Headers for the current environment

  • isSessionError(error:) Extension method

    Undocumented

    Declaration

    Swift

    public protocol DataManager
  • Resets 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.

  • Resets 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.

  • perform(request:completion:) Extension method

    Performs 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.

  • perform(request:completion:) Extension method

    Performs 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.