GamificationForceClient

The GamificationForceClient class handles network requests using the GamificationForceAuthenticator protocol.

This class uses a NetworkManager instance to handle network requests and data processing.

Use this initializer to initialize the GamificationForceClient class.

1public init(auth: GamificationForceAuthenticator, forceNetworkManager: NetworkManagerProtocol = NetworkManager.shared)
ParameterTypeDescription
authGamificationForceAuthenticatorAn instance of the GamificationForceAuthenticator protocol.
forceNetworkManagerNetworkManagerProtocolA NetworkManager instance.

Methods 

fetchLocalJson 

Returns a decoded JSON response result from the given local JSON file.

1public func fetchLocalJson<T: Decodable>(type: T.Type, file: String, bundle: Bundle = Bundle.publicModule)
ParameterTypeDescription
typeT.TypeThe model to be used by the JSON decoder.
fileStringThe file name of a local JSON file.
bundleBundleThe app bundle name.

fetch 

Returns a decoded JSON response result.

1public func fetch<T: Decodable>(type: T.Type, with request: URLRequest, urlSession: URLSession = .shared)
ParameterTypeDescription
typeT.TypeThe model to be used by the JSON decoder.
requestURLRequestThe URL request to be executed by the URL session.
urlSessionURLSessionAn instance of URLSession to execute the request.