Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.
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)| Parameter | Type | Description |
|---|---|---|
| auth | GamificationForceAuthenticator | An instance of the GamificationForceAuthenticator protocol. |
| forceNetworkManager | NetworkManagerProtocol | A 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)| Parameter | Type | Description |
|---|---|---|
| type | T.Type | The model to be used by the JSON decoder. |
| file | String | The file name of a local JSON file. |
| bundle | Bundle | The app bundle name. |
fetch
Returns a decoded JSON response result.
1public func fetch<T: Decodable>(type: T.Type, with request: URLRequest, urlSession: URLSession = .shared)| Parameter | Type | Description |
|---|---|---|
| type | T.Type | The model to be used by the JSON decoder. |
| request | URLRequest | The URL request to be executed by the URL session. |
| urlSession | URLSession | An instance of URLSession to execute the request. |