Skip to content

Commit 3f22503

Browse files
authored
feat: add proxy support (#73)
1 parent 37f03aa commit 3f22503

File tree

3 files changed

+69
-27
lines changed

3 files changed

+69
-27
lines changed

README.md

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,34 @@ Core Interfaces's Maven group ID is `io.apimatic`, and its artifact ID is `core-
2121

2222
## Interfaces
2323

24-
| Name | Description |
25-
|-------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|
26-
| [`Context`](./src/main/java/io/apimatic/coreinterfaces/http/Context.java) | To save both Request and Response after the completion of response |
27-
| [`Callback`](./src/main/java/io/apimatic/coreinterfaces/http/Callback.java) | To perform action before Request and after the completion of response |
28-
| [`HttpClient`](./src/main/java/io/apimatic/coreinterfaces/http/HttpClient.java) | To provide abstraction to execute API call in HttpClient |
29-
| [`HttpHeaders`](./src/main/java/io/apimatic/coreinterfaces/http/HttpHeaders.java) | To save additional information about the request and response |
30-
| [`ClientConfiguration`](./src/main/java/io/apimatic/coreinterfaces/http/ClientConfiguration.java) | To hold the default configurations for HttpClient |
31-
| [`Authentication`](./src/main/java/io/apimatic/coreinterfaces/authentication/Authentication.java) | To Provide abstraction for all Authentications |
32-
| [`Request`](./src/main/java/io/apimatic/coreinterfaces/http/request/Request.java) | To create and manage HTTP Requests |
33-
| [`Multipart`](./src/main/java/io/apimatic/coreinterfaces/http/request/Multipart.java) | To wrap byteArray and headers to be sent as part of a multipart request |
34-
| [`MultipartFile`](./src/main/java/io/apimatic/coreinterfaces/http/request/MultipartFile.java) | To wrap file and headers to be sent as part of a multipart request |
35-
| [`CoreEndpointConfiguration`](./src/main/java/io/apimatic/coreinterfaces/http/request/configuration/CoreEndpointConfiguration.java) | To Provide endpoint level configuration |
36-
| [`Response`](./src/main/java/io/apimatic/coreinterfaces/http/response/Response.java) | To get the properties from the instance of Response |
37-
| [`DynamicType`](./src/main/java/io/apimatic/coreinterfaces/http/response/DynamicType.java) | To get the properties from the instance of Dynamic Response Type |
38-
| [`ApiResponseType`](./src/main/java/io/apimatic/coreinterfaces/http/response/ApiResponseType.java) | To get the properties from the instance of ApiResponseType |
39-
| [`CompatibilityFactory`](./src/main/java/io/apimatic/coreinterfaces/compatibility/CompatibilityFactory.java) | Holds required converter methods to create SDK classes |
40-
| [`CoreFileWrapper`](./src/main/java/io/apimatic/coreinterfaces/type/CoreFileWrapper.java) | To wrap file and contentType to be sent as part of a HTTP request. |
41-
| [`HttpApiException`](./src/main/java/io/apimatic/coreinterfaces/type/HttpApiException.java) | Default interface for all the exception models in SDK |
42-
| [`ApiLogger`](./src/main/java/io/apimatic/coreinterfaces/logger/ApiLogger.java) | Interface for Loggin Api Calls. |
43-
| [`Logger`](./src/main/java/io/apimatic/coreinterfaces/logger/Logger.java) | Interface for logging at different levels. |
44-
| [`LoggingConfiguration`](./src/main/java/io/apimatic/coreinterfaces/logger/configuration/LoggingConfiguration.java) | To hold logging configuration |
45-
| [`HttpLoggingConfiguration`](./src/main/java/io/apimatic/coreinterfaces/logger/configuration/HttpLoggingConfiguration.java) | To hold configuration for http logging |
46-
| [`RequestLoggingConfiguration`](./src/main/java/io/apimatic/coreinterfaces/logger/configuration/RequestLoggingConfiguration.java) | To hold Request configuration for logging |
47-
| [`ResponseLoggingConfiguration`](./src/main/java/io/apimatic/coreinterfaces/logger/configuration/ResponseLoggingConfiguration.java) | To hold Response configuration for logging |
48-
| [`Deserializer`](./src/main/java/io/apimatic/coreinterfaces/type/functional/Deserializer.java) | Functional interface to apply the deserialization function |
49-
| [`ExceptionCreator`](./src/main/java/io/apimatic/coreinterfaces/type/functional/ExceptionCreator.java) | Functional interface to create the SDK exception |
50-
| [`Serializer`](./src/main/java/io/apimatic/coreinterfaces/type/functional/Serializer.java) | Functional interface to apply the serialization function |
24+
| Name | Description |
25+
|-------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------|
26+
| [`Context`](./src/main/java/io/apimatic/coreinterfaces/http/Context.java) | To save both Request and Response after the completion of response |
27+
| [`Callback`](./src/main/java/io/apimatic/coreinterfaces/http/Callback.java) | To perform action before Request and after the completion of response |
28+
| [`HttpClient`](./src/main/java/io/apimatic/coreinterfaces/http/HttpClient.java) | To provide abstraction to execute API call in HttpClient |
29+
| [`HttpHeaders`](./src/main/java/io/apimatic/coreinterfaces/http/HttpHeaders.java) | To save additional information about the request and response |
30+
| [`ClientConfiguration`](./src/main/java/io/apimatic/coreinterfaces/http/ClientConfiguration.java) | To hold the default configurations for HttpClient |
31+
| [`ProxyConfiguration`](./src/main/java/io/apimatic/coreinterfaces/http/proxy/ProxyConfiguration.java) | To hold the proxy configuration for the HttpClient |
32+
| [`Authentication`](./src/main/java/io/apimatic/coreinterfaces/authentication/Authentication.java) | To Provide abstraction for all Authentications |
33+
| [`Request`](./src/main/java/io/apimatic/coreinterfaces/http/request/Request.java) | To create and manage HTTP Requests |
34+
| [`Multipart`](./src/main/java/io/apimatic/coreinterfaces/http/request/Multipart.java) | To wrap byteArray and headers to be sent as part of a multipart request |
35+
| [`MultipartFile`](./src/main/java/io/apimatic/coreinterfaces/http/request/MultipartFile.java) | To wrap file and headers to be sent as part of a multipart request |
36+
| [`CoreEndpointConfiguration`](./src/main/java/io/apimatic/coreinterfaces/http/request/configuration/CoreEndpointConfiguration.java) | To Provide endpoint level configuration |
37+
| [`Response`](./src/main/java/io/apimatic/coreinterfaces/http/response/Response.java) | To get the properties from the instance of Response |
38+
| [`DynamicType`](./src/main/java/io/apimatic/coreinterfaces/http/response/DynamicType.java) | To get the properties from the instance of Dynamic Response Type |
39+
| [`ApiResponseType`](./src/main/java/io/apimatic/coreinterfaces/http/response/ApiResponseType.java) | To get the properties from the instance of ApiResponseType |
40+
| [`CompatibilityFactory`](./src/main/java/io/apimatic/coreinterfaces/compatibility/CompatibilityFactory.java) | Holds required converter methods to create SDK classes |
41+
| [`CoreFileWrapper`](./src/main/java/io/apimatic/coreinterfaces/type/CoreFileWrapper.java) | To wrap file and contentType to be sent as part of a HTTP request. |
42+
| [`HttpApiException`](./src/main/java/io/apimatic/coreinterfaces/type/HttpApiException.java) | Default interface for all the exception models in SDK |
43+
| [`ApiLogger`](./src/main/java/io/apimatic/coreinterfaces/logger/ApiLogger.java) | Interface for Loggin Api Calls. |
44+
| [`Logger`](./src/main/java/io/apimatic/coreinterfaces/logger/Logger.java) | Interface for logging at different levels. |
45+
| [`LoggingConfiguration`](./src/main/java/io/apimatic/coreinterfaces/logger/configuration/LoggingConfiguration.java) | To hold logging configuration |
46+
| [`HttpLoggingConfiguration`](./src/main/java/io/apimatic/coreinterfaces/logger/configuration/HttpLoggingConfiguration.java) | To hold configuration for http logging |
47+
| [`RequestLoggingConfiguration`](./src/main/java/io/apimatic/coreinterfaces/logger/configuration/RequestLoggingConfiguration.java) | To hold Request configuration for logging |
48+
| [`ResponseLoggingConfiguration`](./src/main/java/io/apimatic/coreinterfaces/logger/configuration/ResponseLoggingConfiguration.java) | To hold Response configuration for logging |
49+
| [`Deserializer`](./src/main/java/io/apimatic/coreinterfaces/type/functional/Deserializer.java) | Functional interface to apply the deserialization function |
50+
| [`ExceptionCreator`](./src/main/java/io/apimatic/coreinterfaces/type/functional/ExceptionCreator.java) | Functional interface to create the SDK exception |
51+
| [`Serializer`](./src/main/java/io/apimatic/coreinterfaces/type/functional/Serializer.java) | Functional interface to apply the serialization function |
5152
| [`ContextInitializer`](./src/main/java/io/apimatic/coreinterfaces/type/functional/ContextInitializer.java) | Functional Interface to apply the context initialization function for the response models |
5253

5354
## Enumerations

src/main/java/io/apimatic/coreinterfaces/http/ClientConfiguration.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package io.apimatic.coreinterfaces.http;
22

3+
import io.apimatic.coreinterfaces.http.proxy.ProxyConfiguration;
34
import java.util.Set;
45

56
/**
@@ -73,4 +74,12 @@ public interface ClientConfiguration {
7374
* @return a copy of skipSslCertVerification
7475
*/
7576
boolean skipSslCertVerification();
77+
78+
/**
79+
* Retrieves the proxy configuration containing the address, port, and optional credentials
80+
* used to connect through a proxy server.
81+
*
82+
* @return the {@link ProxyConfiguration} instance if no proxy is configured
83+
*/
84+
ProxyConfiguration getProxyConfiguration();
7685
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package io.apimatic.coreinterfaces.http.proxy;
2+
3+
public interface ProxyConfiguration {
4+
5+
/**
6+
* Returns the address (hostname or IP) of the proxy server.
7+
*
8+
* @return the proxy server address as a {@link String}
9+
*/
10+
String getAddress();
11+
12+
/**
13+
* Returns the port number on which the proxy server is listening.
14+
*
15+
* @return the proxy server port
16+
*/
17+
int getPort();
18+
19+
/**
20+
* Returns the username used for proxy authentication.
21+
*
22+
* @return the proxy authentication username as a {@link String}
23+
*/
24+
String getUsername();
25+
26+
/**
27+
* Returns the password associated with the proxy authentication username.
28+
*
29+
* @return the proxy authentication password as a {@link String}
30+
*/
31+
String getPassword();
32+
}

0 commit comments

Comments
 (0)