Package io.pdfapi.client
Class PdfApiClientFactory
java.lang.Object
io.pdfapi.client.PdfApiClientFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PdfApiClientcreateClient(PdfApiClientConfig config) Creates a new instance of PdfApiClient using the default HTTP client implementation (OkHttp).static PdfApiClientCreates a new instance of PdfApiClient using Apache HTTP Client implementation with default configuration.static PdfApiClientcreateWithApacheHttpClient(PdfApiClientConfig config, org.apache.http.impl.client.CloseableHttpClient httpClient) Creates a new instance of PdfApiClient using a pre-configured Apache HTTP client.static PdfApiClientcreateWithCustomHttpClient(PdfApiClientConfig config, HttpClient httpClient) Creates a new instance of PdfApiClient using custom HTTP client implementation.static PdfApiClientcreateWithOkHttp(PdfApiClientConfig config) Creates a new instance of PdfApiClient using OkHttp implementation with default configuration.static PdfApiClientcreateWithOkHttp(PdfApiClientConfig config, okhttp3.OkHttpClient okHttpClient) Creates a new instance of PdfApiClient using a pre-configured OkHttp client.static PdfApiClientCreates a new instance of PdfApiClient using Spring RestTemplate implementation with default configuration.static PdfApiClientcreateWithRestTemplate(PdfApiClientConfig config, org.springframework.web.client.RestTemplate restTemplate) Creates a new instance of PdfApiClient using a pre-configured RestTemplate.
-
Constructor Details
-
PdfApiClientFactory
public PdfApiClientFactory()
-
-
Method Details
-
createClient
Creates a new instance of PdfApiClient using the default HTTP client implementation (OkHttp). For specific HTTP client implementations, usecreateWithOkHttp(PdfApiClientConfig)orcreateWithApacheHttpClient(PdfApiClientConfig).- Parameters:
config- client configuration- Returns:
- new client instance
-
createWithOkHttp
Creates a new instance of PdfApiClient using OkHttp implementation with default configuration. This implementation is optimized for performance and is the recommended choice for most use cases.- Parameters:
config- client configuration- Returns:
- new client instance
-
createWithOkHttp
public static PdfApiClient createWithOkHttp(PdfApiClientConfig config, okhttp3.OkHttpClient okHttpClient) Creates a new instance of PdfApiClient using a pre-configured OkHttp client. Use this when you need to customize the OkHttp client configuration beyond timeouts.- Parameters:
config- client configurationokHttpClient- pre-configured OkHttp client instance- Returns:
- new client instance
-
createWithApacheHttpClient
Creates a new instance of PdfApiClient using Apache HTTP Client implementation with default configuration. This implementation is provided as an alternative for environments where Apache HTTP Client is preferred or already in use.- Parameters:
config- client configuration- Returns:
- new client instance
-
createWithApacheHttpClient
public static PdfApiClient createWithApacheHttpClient(PdfApiClientConfig config, org.apache.http.impl.client.CloseableHttpClient httpClient) Creates a new instance of PdfApiClient using a pre-configured Apache HTTP client. Use this when you need to customize the Apache HTTP client configuration.- Parameters:
config- client configurationhttpClient- pre-configured Apache HTTP client instance- Returns:
- new client instance
-
createWithRestTemplate
Creates a new instance of PdfApiClient using Spring RestTemplate implementation with default configuration. This implementation is suitable for Spring-based applications.- Parameters:
config- client configuration- Returns:
- new client instance
-
createWithRestTemplate
public static PdfApiClient createWithRestTemplate(PdfApiClientConfig config, org.springframework.web.client.RestTemplate restTemplate) Creates a new instance of PdfApiClient using a pre-configured RestTemplate. Use this when you need to customize the RestTemplate configuration or share an existing instance.- Parameters:
config- client configurationrestTemplate- pre-configured RestTemplate instance- Returns:
- new client instance
-
createWithCustomHttpClient
public static PdfApiClient createWithCustomHttpClient(PdfApiClientConfig config, HttpClient httpClient) Creates a new instance of PdfApiClient using custom HTTP client implementation. Use this method when you need to provide your own HTTP client implementation that conforms to theHttpClientinterface.- Parameters:
config- client configurationhttpClient- custom HTTP client implementation- Returns:
- new client instance
-