Skip to content
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

Added support for SMS v3 #43

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,33 @@ All notable changes to the library will be documented in this file.
The format of the file is based on [Keep a Changelog](http://keepachangelog.com/)
and this library adheres to [Semantic Versioning](http://semver.org/) as mentioned in [README.md][readme] file.

## [Unreleased]
## [ [4.4.0](https://github.com/infobip/infobip-api-java-client/releases/tag/4.4.0) ] - 2024-08-02

⚠️ **IMPORTANT NOTE:** This release contains compile time breaking changes.
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
* Most recent [Infobip SMS API](https://www.infobip.com/docs/api/channels/sms) feature set.
* Introduced `/sms/3/messages (V3)` replacing the `/sms/2/text/advanced (V2)` and `/sms/2/binary/advanced (V2)` endpoints.
* Introduced `/sms/3/reports (V3)` replacing `/sms/1/reports (V1)` endpoint.
* Introduced `/sms/3/logs (V3)` replacing `/sms/1/logs (V1)` endpoint.
* Added mock tests to verify the correctness of request payloads and response handling.
* Added `awaitility` and `wiremock` test dependencies.

### Changed
* **Fixes and changes**
* Changed 'sentAt', 'doneAt' field type in [MmsReport](src/main/java/com/infobip/model/MmsReport.java) from String to OffsetDateTime since it didn't correspond to the state of the endpoint.

* **Removed classes and unified structures**
* Removed delivery time window configuration classes (`SmsDeliveryTimeWindow`, `MmsDeliveryTimeWindow`, `ViberDeliveryTimeWindow`, `CallRoutingAllowedTimeWindow`, `CallsDeliveryTimeWindow`, `SmsDeliveryTimeWindow`, `CallsTimeWindow`) in favor of a unified class: [DeliveryTimeWindow](src/main/java/com/infobip/model/DeliveryTimeWindow.java)
* Removed delivery time configuration classes (`SmsDeliveryTimeFrom`, `SmsDeliveryTimeTo`, `MmsDeliveryTime`, `ViberDeliveryTime`, `CallsTimeWindowPoint`, `WebRtcTimeOfDay`, `CallRoutingAllowedTimeFrom`, `CallRoutingAllowedTimeTo`, `WebRtcTimeOfDay`) in favor of a unified class: [DeliveryTime](src/main/java/com/infobip/model/DeliveryTime.java)
* Removed delivery day enumeration classes (`SmsDeliveryDay`, `MmsDeliveryDay`, `CallsDeliveryDay`, `CallRoutingAllowedDay`) in favor of a unified class: [DeliveryDay](src/main/java/com/infobip/model/DeliveryDay.java)
* Removed recipient type enumeration class (`SmsIysRecipientType`) in favor of a unified class: [RecipientType](src/main/java/com/infobip/model/RecipientType.java)

* **Documentation**
* Fixed Javadoc.

## [ [4.3.1](https://github.com/infobip/infobip-api-java-client/releases/tag/4.3.1) ] - 2024-06-05

### Added
Expand Down
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Simply add the following in your project's POM file under `dependencies` tag:
<dependency>
<groupId>com.infobip</groupId>
<artifactId>infobip-api-java-client</artifactId>
<version>4.3.1</version>
<version>4.4.0</version>
</dependency>
```

Expand Down Expand Up @@ -85,25 +85,26 @@ See below, a simple example of sending a single SMS message to a single recipien

```java
SmsApi smsApi = new SmsApi(apiClient);
SmsTextualMessage smsMessage = new SmsTextualMessage()
.from("InfoSMS")
.addDestinationsItem(new SmsDestination().to("41793026727"))
.text("Hello World from infobip-api-java-client!");

SmsAdvancedTextualRequest smsMessageRequest = new SmsAdvancedTextualRequest()
.messages(List.of(smsMessage));
SmsMessage message = new SmsMessage()
.sender("InfoSMS")
ib-tjuhasz marked this conversation as resolved.
Show resolved Hide resolved
.destinations(new SmsDestination().to("41793026727"))
.content(new SmsTextMessageContent().text("Hello World from infobip-api-java-client!"));

SmsRequestEnvelope smsMessageRequest = new SmsRequestEnvelope()
.messages(List.of(message));
```
```java
try {
SmsResponse smsResponse = smsApi.sendSmsMessage(smsMessageRequest).execute();
SmsResponse smsResponse = smsApi.sendSmsMessages(smsMessageRequest).execute();
} catch (ApiException apiException) {
// HANDLE THE EXCEPTION
}
```

For asynchronous processing, you can use the following approach:
```java
smsApi.sendSmsMessage(smsMessageRequest)
smsApi.sendSmsMessages(smsMessageRequest)
.executeAsync(new ApiCallback<>() {
@Override
public void onSuccess(SmsResponse result, int responseStatusCode, Map<String, List<String>> responseHeaders) {
Expand Down Expand Up @@ -158,7 +159,7 @@ If you are for any reason unable to receive real-time delivery reports on your e
Each request will return a batch of delivery reports - only once. See [documentation](https://www.infobip.com/docs/api/channels/sms/sms-messaging/logs-and-status-reports/get-outbound-sms-message-delivery-reports) for more details.

```java
SmsDeliveryResult deliveryReports = smsApi.getOutboundSmsMessageDeliveryReports()
SmsDeliveryReports deliveryReports = smsApi.getOutboundSmsMessageDeliveryReports()
.bulkId(bulkId)
.execute();
for (SmsReport report : deliveryReports.getResults()) {
Expand Down Expand Up @@ -214,7 +215,7 @@ This code is auto generated, and we are unable to merge any pull request from he
For anything that requires our imminent attention, contact us @ [[email protected]](mailto:[email protected]).

[apidocs]: https://www.infobip.com/docs/api
[freetrial]: https://www.infobip.com/docs/essentials/free-trial
[freetrial]: https://www.infobip.com/docs/essentials/getting-started/free-trial
[signup]: https://www.infobip.com/signup
[semver]: https://semver.org
[license]: LICENSE
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.infobip</groupId>
<artifactId>infobip-api-java-client</artifactId>
<version>4.3.1</version>
<version>4.4.0</version>
<packaging>jar</packaging>

<name>infobip-api-java-client</name>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/infobip/RequestFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
*/
final class RequestFactory {

private static final String USER_AGENT_HEADER_VALUE = "infobip-api-client-java/4.3.1";
private static final String USER_AGENT_HEADER_VALUE = "infobip-api-client-java/4.4.0";

private final ApiKey apiKey;
private final BaseUrl baseUrl;
Expand Down
Loading
Loading