Interface FinchClient
-
- All Implemented Interfaces:
public interface FinchClientA client for interacting with the Finch REST API synchronously. You can also switch to asynchronous execution via the async method.
This client performs best when you create a single instance and reuse it for all interactions with the REST API. This is because each client holds its own connection pool and thread pools. Reusing connections and threads reduces latency and saves memory. The client also handles rate limiting per client. This means that creating and using multiple instances at the same time will not respect rate limits.
The threads and connections that are held will be released automatically if they remain idle. But if you are writing an application that needs to aggressively release unused resources, then you may call close.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceFinchClient.WithRawResponseA view of FinchClient that provides access to raw HTTP responses for each method.
-
Method Summary
Modifier and Type Method Description abstract FinchClientAsyncasync()Returns a version of this client that uses asynchronous execution. abstract FinchClient.WithRawResponsewithRawResponse()Returns a view of this service that provides access to raw HTTP responses for each method. abstract FinchClientwithOptions(Consumer<ClientOptions.Builder> modifier)Returns a view of this service with the given option modifications applied. abstract AccessTokenServiceaccessTokens()abstract HrisServicehris()abstract ProviderServiceproviders()abstract AccountServiceaccount()abstract WebhookServicewebhooks()abstract RequestForwardingServicerequestForwarding()abstract JobServicejobs()abstract SandboxServicesandbox()abstract PayrollServicepayroll()abstract ConnectServiceconnect()abstract StringgetAccessToken(String clientId, String clientSecret, String code, String redirectUri)abstract StringgetAuthUrl(String products, String redirectUri, Boolean sandbox)abstract FinchClientwithAccessToken(String accessToken)abstract Unitclose()Closes this client, relinquishing any underlying resources. -
-
Method Detail
-
async
abstract FinchClientAsync async()
Returns a version of this client that uses asynchronous execution.
The returned client shares its resources, like its connection pool and thread pools, with this client.
-
withRawResponse
abstract FinchClient.WithRawResponse withRawResponse()
Returns a view of this service that provides access to raw HTTP responses for each method.
-
withOptions
abstract FinchClient withOptions(Consumer<ClientOptions.Builder> modifier)
Returns a view of this service with the given option modifications applied.
The original service is not modified.
-
accessTokens
abstract AccessTokenService accessTokens()
-
hris
abstract HrisService hris()
-
providers
abstract ProviderService providers()
-
account
abstract AccountService account()
-
webhooks
abstract WebhookService webhooks()
-
requestForwarding
abstract RequestForwardingService requestForwarding()
-
jobs
abstract JobService jobs()
-
sandbox
abstract SandboxService sandbox()
-
payroll
abstract PayrollService payroll()
-
connect
abstract ConnectService connect()
-
getAccessToken
@Deprecated(message = "use client.accessTokens().create instead", replaceWith = @ReplaceWith(imports = {}, expression = "accessTokens().create()")) abstract String getAccessToken(String clientId, String clientSecret, String code, String redirectUri)
-
getAuthUrl
abstract String getAuthUrl(String products, String redirectUri, Boolean sandbox)
-
withAccessToken
abstract FinchClient withAccessToken(String accessToken)
-
close
abstract Unit close()
Closes this client, relinquishing any underlying resources.
This is purposefully not inherited from AutoCloseable because the client is long-lived and usually should not be synchronously closed via try-with-resources.
It's also usually not necessary to call this method at all. the default HTTP client automatically releases threads and connections if they remain idle, but if you are writing an application that needs to aggressively release unused resources, then you may call this method.
-
-
-
-