ForceClient
1public class ForceClientDefine Authentication
Handle the authentication process and encapsulate the logic to obtain and refresh the access token. Use this resource and signature to define the auth variable.
1auth1public var auth: ForceAuthenticatorDefine the Network Manager
Make HTTP requests to the Salesforce server and manage the responses. Use this resource and signature to define the forceNetworkManager variable.
ForceNetworkManager
1public var forceNetworkManager: NetworkManagerProtocolCreate an Instance from Force Authenticator
Create an instance from the ForceAuthenticator, and defines the required methods to handle access tokens in Salesforce API. Use this resource and signature to define the public initializer for the ForceClient class.
1public init(auth: ForceAuthenticator, forceNetworkManager: NetworkManagerProtocol = NetworkManager.sharedUse the parameters in this table to define an authentication instance.
| Parameters | Description |
|---|---|
| auth | A ForceAuthenticator instance that defines the required methods to handle access tokens in Salesforce API. |
| forceNetworkManager | A NetworkManagerProtocol instance that defines the requirements of a network manager. |
Fetch Authentication Requests
Get all the REST requests for authentication. This request returns a decoded JSON response result. Use this resource and signature to define the fetch request.
fetch(type:with:urlSession:)
1func fetch<T>(type: T.Type, with request: URLRequest, urlSession: URLSession = .shared) async throws -> T where T : DecodableUse the parameters in this table to create a fetch request.
| Parameters | Description |
|---|---|
| type | A type or model of data that you want to decode from the JSON format. |
| request | A URLRequest, which is executed by URLSession. |