4.0.0
[ 4.0.0 ] - 2023-03-02
🎉 NEW Major Version of infobip-api-java-client
.
All changes, including breaking changes, are addressed and explained in the list bellow.
If you find out that something was not addressed properly, please submit an issue.
Added
- Support for Infobip MMS API.
- Support for Infobip Voice API.
- Support for Infobip WebRTC API.
- Support for Infobip Viber API.
- Most recent Infobip SMS API feature set.
- Most recent Email feature set.
- Most recent WhatsApp feature set.
- Tests for the static parts of the auto-generated code.
There are multiple tests phases implemented in our auto-generation pipeline.
A part of the tests is now included as a library source code. - Base URL abstraction.
- Api Key abstraction.
- Deprecation notice log if deprecated or gone endpoints are used (
slf4j-api
dependency). - Snyk and Java version badges to README.
Changed
- The library now requires Java 11 or above.
- OkHttp dependency was bumped to version 4.10.0.
- From this version, an
ApiClient
instance must be constructed and configured using the Builder pattern:The additional OkHttp client configuration was removed from the library.ApiClient apiClient = ApiClient.forApiKey(givenApiKey) .withBaseUrl(givenBaseUrl) .withHttpClient(givenHttpClient) .withReadTimeout(givenReadTimeoutInSeconds) .withTempDirectoryPath(givenTempDirPath) .build();
Please check the Removed section for details. - API classes were refactored in a way that all functionalities are grouped under the same product.
For example,SendSmsApi
,ScheduledSmsApi
andReceiveSmsApi
classes are replaced with a singleSmsApi
class. - API class methods that trigger an API call were rewritten using a fluent style where all required parameters
must be passed to a request builder factory method.
On the other hand, optional parameters may be passed using a separate request builder methods.
The result can be fetched usingexecute
orexecuteAsync
methods.
That allows us to add optional parameters without introducing a breaking change to the library.
For example, in the previous version, to send a TFA pin code, we could use something like this:In the new version, the following pattern applies:TfaStartAuthenticationResponse response = tfaApi.sendTfaPinCodeOverSms(false, request);
TfaStartAuthenticationResponse sendCodeResponse = tfaApi .sendTfaPinCodeOverSms(request) .ncNeeded(false) .execute();
- Jackson (version 2.14.2) serialization library is used instead of Gson.
TheJSON
serialization utility now uses a preconfigured Jackson'sObjectMapper
.
Also, the support forInputStream
serialization was added. - All maven plugins were bumped to the most recent version.
Both unneeded plugins and the obsolete configuration were removed. - The API request and response processing was rewritten to increase maintainability and usability.
- The
ApiException
class was refactored to have fluent getters and a single accessible Builder. - From this version, the error response body is deserialized and stored in
details
property of theApiException
class. - The
palantir-java-format
is now used instead ofgoogle-java-format
to have the formatting closer to our internal coding style.
See the Spotless README for details. - Some products like Email and WhatsApp contain a few breaking changes since a new version of a few of the API endpoints was released.
If you have issues when migrating the existing implementation, please check the official API documentation or submit an issue.
Removed
- Basic, IBSSO Token Header and client credentials grant type OAuth2 authentication methods.
Use API Key Header authentication method instead.
The API Key should be injected into theApiClient
instance through the newly introducedforApiKey
factory method.
Examples can be found in the README. Configuration
utility class.
Having static default configuration is error-prone and provides an unnecessary overhead.
AnApiClient
instance should always be injected in the given API class.SSL
settings configuration methods from theApiClient
.
If you need to configure customSSL
related settings (custom client keys, disabled CA certificate and hostname verification, etc.),
configure them on theOkHttpClient
instance directly and pass the instance to theApiClient
usingwithHttpClient
builder method.- Date format customization methods from the
ApiClient
.
Only the default Infobip date format should be used.
The date formatter instance to be used is available through theJSON
class. - Header and cookie manipulation through
ApiClient
public interface.
However, it can still be achieved using OkHttp interceptors if needed.
Feel free to configure anOkHttpClient
instance with appropriate interceptors and pass the instance to theApiClient
usingwithHttpClient
builder method. - Explicit debugging option for
ApiClient
.
HttpLoggingInterceptor can always be included by providing a preconfigured HTTP client as described above. - Explicit gzip support for requests.
The support should be provided by the client itself like explained here. - Unused generated classes.
- Default network interceptor used for tracking upload and download progress.
The functionality can be re-added by using the official OkHttp recipe. ...WithHttpInfo
methods from API client classes.
If an additional info like response headers or the response code is needed, theexecuteAsync
method should be
used.
The required information is injected in the callback....buildCall
methods from API client classes.
The OkHttpCall
abstraction can be obtained by using theexecuteAsync
method.
We don't allow calling the API without processing the response internally anymore.