-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
APP-2813/APP-2812 - BDK2.0 modules setup #166
Changes from 1 commit
accbbd8
a4afb21
80b4f45
eea2307
655cc41
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>symphony-api-client-java-parent</artifactId> | ||
<groupId>com.symphony.platformsolutions</groupId> | ||
<version>1.2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>symphony-bdk-core-invokers</artifactId> | ||
<name>Symphony Java BDK Core Invokers</name> | ||
<description>Symphony Java BDK Core Invokers Module</description> | ||
<packaging>pom</packaging> | ||
|
||
<modules> | ||
<module>symphony-bdk-core-invoker-api</module> | ||
<module>symphony-bdk-core-invoker-jersey2</module> | ||
</modules> | ||
|
||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<artifactId>symphony-bdk-core-invokers</artifactId> | ||
<groupId>com.symphony.platformsolutions</groupId> | ||
<version>1.2.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>symphony-bdk-core-invoker-api</artifactId> | ||
<name>Symphony Java BDK Core Invoker API</name> | ||
<description>Symphony Java BDK Core Invoker API Module</description> | ||
|
||
<properties> | ||
<jersey.version>2.29.1</jersey.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.glassfish.jersey.core</groupId> | ||
<artifactId>jersey-client</artifactId> | ||
<version>${jersey.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
|
||
</project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
package com.symphony.bdk.core.api.invoker; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
import javax.ws.rs.core.GenericType; | ||
|
||
/** | ||
* Interface used to perform HTTP requests performed by the generated Swagger code. | ||
*/ | ||
public interface ApiClient { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. did we consider other http clients? (like feign for instance?) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, the one that we will implement soon is the WebClient for Spring integration There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That one because it is a reactive one has a terrible API (IMHO) but I hope we will hide the complexity of with our own API |
||
|
||
/** | ||
* Invoke API by sending HTTP request with the given options. | ||
* | ||
* @param <T> Type | ||
* @param path The sub-path of the HTTP URL | ||
* @param method The request method, one of "GET", "POST", "PUT", "HEAD" and "DELETE" | ||
* @param queryParams The query parameters | ||
* @param body The request body object | ||
* @param headerParams The header parameters | ||
* @param cookieParams The cookie parameters | ||
* @param formParams The form parameters | ||
* @param accept The request's Accept header | ||
* @param contentType The request's Content-Type header | ||
* @param authNames The authentications to apply | ||
* @param returnType The return type into which to deserialize the response | ||
* @return The response body in type of string | ||
* @throws ApiException API exception | ||
*/ | ||
<T> ApiResponse<T> invokeAPI( | ||
String path, | ||
String method, | ||
List<Pair> queryParams, | ||
Object body, | ||
Map<String, String> headerParams, | ||
Map<String, String> cookieParams, | ||
Map<String, Object> formParams, | ||
String accept, | ||
String contentType, | ||
String[] authNames, | ||
GenericType<T> returnType | ||
) throws ApiException; | ||
|
||
/** | ||
* Returns the API base path | ||
* @return API base path | ||
*/ | ||
String getBasePath(); | ||
|
||
/** | ||
* Set the API base path | ||
* @param basePath Base path | ||
* @return API client | ||
*/ | ||
ApiClient setBasePath(String basePath); | ||
|
||
/** | ||
* Set the User-Agent header's value (by adding to the default header map). | ||
* @param userAgent Http user agent | ||
* @return API client | ||
*/ | ||
ApiClient setUserAgent(String userAgent); | ||
|
||
/** | ||
* Add a default header. | ||
* @param key The header's key | ||
* @param value The header's value | ||
* @return API client | ||
*/ | ||
ApiClient addDefaultHeader(String key, String value); | ||
|
||
/** | ||
* The path of temporary folder used to store downloaded files from endpoints | ||
* with file response. The default value is <code>null</code>, i.e. using | ||
* the system's default tempopary folder. | ||
* @return Temp folder path | ||
*/ | ||
String getTempFolderPath(); | ||
|
||
/** | ||
* Set temp folder path | ||
* @param tempFolderPath Temp folder path | ||
* @return API client | ||
*/ | ||
ApiClient setTempFolderPath(String tempFolderPath); | ||
|
||
/** | ||
* Connect timeout (in milliseconds). | ||
* @return Connection timeout | ||
*/ | ||
int getConnectTimeout(); | ||
|
||
/** | ||
* Set the connect timeout (in milliseconds). | ||
* A value of 0 means no timeout, otherwise values must be between 1 and {@link Integer#MAX_VALUE}. | ||
* @param connectionTimeout Connection timeout in milliseconds | ||
* @return API client | ||
*/ | ||
ApiClient setConnectTimeout(int connectionTimeout); | ||
|
||
/** | ||
* read timeout (in milliseconds). | ||
* @return Read timeout | ||
*/ | ||
int getReadTimeout(); | ||
|
||
/** | ||
* Set the read timeout (in milliseconds). | ||
* A value of 0 means no timeout, otherwise values must be between 1 and | ||
* {@link Integer#MAX_VALUE}. | ||
* @param readTimeout Read timeout in milliseconds | ||
* @return API client | ||
*/ | ||
ApiClient setReadTimeout(int readTimeout); | ||
|
||
/** | ||
* Format the given parameter object into string. | ||
* @param param Object | ||
* @return Object in string format | ||
*/ | ||
String parameterToString(Object param); | ||
|
||
/** | ||
* Format to {@code Pair} objects. | ||
* @param collectionFormat Collection format | ||
* @param name Name | ||
* @param value Value | ||
* @return List of pairs | ||
*/ | ||
List<Pair> parameterToPairs(String collectionFormat, String name, Object value); | ||
|
||
/** | ||
* Select the Accept header's value from the given accepts array: | ||
* if JSON exists in the given array, use it; | ||
* otherwise use all of them (joining into a string) | ||
* @param accepts The accepts array to select from | ||
* @return The Accept header to use. If the given array is empty, | ||
* null will be returned (not to set the Accept header explicitly). | ||
*/ | ||
String selectHeaderAccept(String[] accepts); | ||
|
||
/** | ||
* Select the Content-Type header's value from the given array: | ||
* if JSON exists in the given array, use it; | ||
* otherwise use the first one of the array. | ||
* @param contentTypes The Content-Type array to select from | ||
* @return The Content-Type header to use. If the given array is empty, | ||
* JSON will be used. | ||
*/ | ||
String selectHeaderContentType(String[] contentTypes); | ||
|
||
/** | ||
* Escape the given string to be used as URL query value. | ||
* @param str String | ||
* @return Escaped string | ||
*/ | ||
String escapeString(String str); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we create another profile for legacy? it might be confusing if legacy is included in 2.0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Profile
2.0
is by default not activated since we don't want to start releasing related modules, but we still want to release legacy modules in any case. So yes, for me legacy modules are also part of the 2.0 (like JUnit5/Vintage : https://junit.org/junit5/docs/current/user-guide/#migrating-from-junit4)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, finally I introduced a
legacy
profile as well 😅 However it is activated by default which is not the case for the2.0
one