Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions MIGRATION-GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t
| conversation.response.ConversationsListRecentResponse | [conversations.response.RecentConversationsListResponse](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/conversation/models/v1/conversations/response/RecentConversationsListResponse.html) |
| events.request.EventsListRequest | [events.request.EventsListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/conversation/models/v1/events/request/EventsListQueryParameters.html) |
| messages.request.MessagesListRequest | [messages.request.MessagesListQueryParameters](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/conversation/models/v1/messages/request/MessagesListQueryParameters.html) |
| api.v1.MessagesService.MessageSource | [messages.request.MessageSource](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/conversation/models/v1/messages/request/MessageSource.html) |

#### Replacement Services
| Old package | New package |
Expand Down Expand Up @@ -78,6 +79,7 @@ This guide lists all removed classes and interfaces from V1 and how to migrate t
| WebhooksService.list(...) | Returned class is changed from `Collection<Webhook>` to `WebhooksListResponse` |
| TemplatesServiceV2.list(...) | Returned class is changed from `Collection<TemplateV2>` to `TemplatesV2ListResponse` |
| TemplatesServiceV2.listTranslations(...) | Returned class is changed from `Collection<TemplateTranslation>` to `TranslationV2ListResponse` |

### [`Numbers`](https://www.javadoc.io/doc/com.sinch.sdk/sinch-sdk-java/2.0.0/com/sinch/sdk/domains/numbers/package-summary.html)

#### Replacement models
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import com.sinch.sdk.domains.conversation.models.v1.messages.ConversationMessage;
import com.sinch.sdk.domains.conversation.models.v1.messages.ConversationMessageDtoTest;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.LastMessagesByChannelIdentityListQueryParameters;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.MessageSource;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.MessagesDeleteQueryParameters;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.MessagesGetQueryParameters;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.MessagesSource;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.MessagesUpdateQueryParameters;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.SendMessageDtoTest;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.UpdateMessageDtoTest;
Expand Down Expand Up @@ -154,7 +154,7 @@ void getBySource() throws ApiException {
HttpMethod.GET,
Arrays.asList(
new URLParameter(
"messages_source", MessagesSource.CONVERSATION_SOURCE, STYLE.FORM, true)),
"messages_source", MessageSource.CONVERSATION_SOURCE, STYLE.FORM, true)),
(String) null,
Collections.emptyMap(),
Collections.singletonList(HttpContentType.APPLICATION_JSON),
Expand All @@ -175,7 +175,7 @@ void getBySource() throws ApiException {

MessagesGetQueryParameters queryParameters =
MessagesGetQueryParameters.builder()
.setMessagesSource(MessagesSource.CONVERSATION_SOURCE)
.setMessagesSource(MessageSource.CONVERSATION_SOURCE)
.build();
ConversationMessage response =
service.get(
Expand Down Expand Up @@ -526,7 +526,7 @@ void deleteBySource() throws ApiException {
HttpMethod.DELETE,
Arrays.asList(
new URLParameter(
"messages_source", MessagesSource.DISPATCH_SOURCE, STYLE.FORM, true)),
"messages_source", MessageSource.DISPATCH_SOURCE, STYLE.FORM, true)),
(String) null,
Collections.emptyMap(),
Collections.singletonList(HttpContentType.APPLICATION_JSON),
Expand All @@ -547,7 +547,7 @@ void deleteBySource() throws ApiException {

MessagesDeleteQueryParameters queryParameters =
MessagesDeleteQueryParameters.builder()
.setMessagesSource(MessagesSource.DISPATCH_SOURCE)
.setMessagesSource(MessageSource.DISPATCH_SOURCE)
.build();

service.delete(
Expand Down Expand Up @@ -606,7 +606,7 @@ void updateBySource() throws ApiException {
HttpMethod.PATCH,
Arrays.asList(
new URLParameter(
"messages_source", MessagesSource.DISPATCH_SOURCE, STYLE.FORM, true)),
"messages_source", MessageSource.DISPATCH_SOURCE, STYLE.FORM, true)),
jsonMessageUpdateRequestDto,
Collections.emptyMap(),
Collections.singletonList(HttpContentType.APPLICATION_JSON),
Expand All @@ -627,7 +627,7 @@ void updateBySource() throws ApiException {

MessagesUpdateQueryParameters queryParameters =
MessagesUpdateQueryParameters.builder()
.setMessagesSource(MessagesSource.DISPATCH_SOURCE)
.setMessagesSource(MessageSource.DISPATCH_SOURCE)
.build();

ConversationMessage response =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.sinch.sdk.domains.conversation.models.v1.messages.AppMessage;
import com.sinch.sdk.domains.conversation.models.v1.messages.ConversationMessage;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.LastMessagesByChannelIdentityListQueryParameters;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.LastMessagesByChannelIdentityListQueryParameters.MessagesSourceEnum;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.MessageSource;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.MessageUpdateRequest;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.MessagesListQueryParameters;
import com.sinch.sdk.domains.conversation.models.v1.messages.request.SendMessageRequest;
Expand Down Expand Up @@ -111,7 +111,7 @@ public void listLastMessagesByChannelIdentity() {
LastMessagesByChannelIdentityListQueryParameters request =
LastMessagesByChannelIdentityListQueryParameters.builder()
.setChannelIdentities(Arrays.asList("12015555555", "12017777777", "7504610123456789"))
.setMessagesSource(MessagesSourceEnum.CONVERSATION_SOURCE)
.setMessagesSource(MessageSource.CONVERSATION_SOURCE)
.setPageSize(2)
.build();
listLastMessagesByChannelIdentityResponse = service.listLastMessagesByChannelIdentity(request);
Expand All @@ -123,7 +123,7 @@ public void listAllLastMessagesByChannelIdentity() {
LastMessagesByChannelIdentityListQueryParameters request =
LastMessagesByChannelIdentityListQueryParameters.builder()
.setChannelIdentities(Arrays.asList("12015555555", "12017777777", "7504610123456789"))
.setMessagesSource(MessagesSourceEnum.CONVERSATION_SOURCE)
.setMessagesSource(MessageSource.CONVERSATION_SOURCE)
.setPageSize(2)
.build();
listAllLastMessagesByChannelIdentityResponse =
Expand All @@ -136,7 +136,7 @@ public void listLastMessagesByChannelIdentityPageIterator() {
LastMessagesByChannelIdentityListQueryParameters request =
LastMessagesByChannelIdentityListQueryParameters.builder()
.setChannelIdentities(Arrays.asList("12015555555", "12017777777", "7504610123456789"))
.setMessagesSource(MessagesSourceEnum.CONVERSATION_SOURCE)
.setMessagesSource(MessageSource.CONVERSATION_SOURCE)
.setPageSize(2)
.build();
listPageIteratorLastMessagesByChannelIdentityResponse =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,20 @@ public class MessageTypeEnum extends EnumDynamic<String, MessageTypeEnum> {
public static final MessageTypeEnum COMMERCE = new MessageTypeEnum("COMMERCE");
public static final MessageTypeEnum CAROUSEL_COMMERCE =
new MessageTypeEnum("CAROUSEL_COMMERCE");
public static final MessageTypeEnum NOTIFICATION_MESSAGE_TEMPLATE =
new MessageTypeEnum("NOTIFICATION_MESSAGE_TEMPLATE");

private static final EnumSupportDynamic<String, MessageTypeEnum> ENUM_SUPPORT =
new EnumSupportDynamic<>(
MessageTypeEnum.class,
MessageTypeEnum::new,
Arrays.asList(FLOWS, ORDER_DETAILS, ORDER_STATUS, COMMERCE, CAROUSEL_COMMERCE));
Arrays.asList(
FLOWS,
ORDER_DETAILS,
ORDER_STATUS,
COMMERCE,
CAROUSEL_COMMERCE,
NOTIFICATION_MESSAGE_TEMPLATE));

private MessageTypeEnum(String value) {
super(value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.sinch.sdk.core.utils.databind.JSONNavigator;
import com.sinch.sdk.domains.conversation.models.v1.messages.types.channelspecific.kakaotalk.carousel.KakaoTalkCarouselCommerceChannelSpecificMessageImpl;
import com.sinch.sdk.domains.conversation.models.v1.messages.types.channelspecific.kakaotalk.commerce.KakaoTalkCommerceChannelSpecificMessageImpl;
import com.sinch.sdk.domains.conversation.models.v1.messages.types.channelspecific.line.LineNotificationMessageTemplateChannelSpecificMessageImpl;
import com.sinch.sdk.domains.conversation.models.v1.messages.types.channelspecific.whatsapp.flows.FlowChannelSpecificMessageImpl;
import com.sinch.sdk.domains.conversation.models.v1.messages.types.channelspecific.whatsapp.payment.OrderDetailsImpl;
import com.sinch.sdk.domains.conversation.models.v1.messages.types.channelspecific.whatsapp.payment.OrderStatusImpl;
Expand Down Expand Up @@ -227,6 +228,63 @@ public ChannelSpecificMessageMessageInternalImpl deserialize(
e);
}

// deserialize LineNotificationMessageTemplateChannelSpecificMessageImpl
try {
boolean attemptParsing = true;
// ensure that we respect type coercion as set on the client ObjectMapper
if (LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(Integer.class)
|| LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(Long.class)
|| LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(Float.class)
|| LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(Double.class)
|| LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(Boolean.class)
|| LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(
String.class)) {
attemptParsing = typeCoercion;
if (!attemptParsing) {
attemptParsing |=
((LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(
Integer.class)
|| LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(
Long.class))
&& token == JsonToken.VALUE_NUMBER_INT);
attemptParsing |=
((LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(
Float.class)
|| LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(
Double.class))
&& token == JsonToken.VALUE_NUMBER_FLOAT);
attemptParsing |=
(LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(
Boolean.class)
&& (token == JsonToken.VALUE_FALSE || token == JsonToken.VALUE_TRUE));
attemptParsing |=
(LineNotificationMessageTemplateChannelSpecificMessageImpl.class.equals(
String.class)
&& token == JsonToken.VALUE_STRING);
}
}
if (attemptParsing) {
deserialized =
tree.traverse(jp.getCodec())
.readValueAs(LineNotificationMessageTemplateChannelSpecificMessageImpl.class);
// TODO: there is no validation against JSON schema constraints
// (min, max, enum, pattern...), this does not perform a strict JSON
// validation, which means the 'match' count may be higher than it should be.
match++;
log.log(
Level.FINER,
"Input data matches schema"
+ " 'LineNotificationMessageTemplateChannelSpecificMessageImpl'");
}
} catch (Exception e) {
// deserialization failed, continue
log.log(
Level.FINER,
"Input data does not match schema"
+ " 'LineNotificationMessageTemplateChannelSpecificMessageImpl'",
e);
}

// deserialize OrderDetailsImpl
try {
boolean attemptParsing = true;
Expand Down Expand Up @@ -352,6 +410,12 @@ public ChannelSpecificMessageMessageInternalImpl(KakaoTalkCommerceChannelSpecifi
setActualInstance(o);
}

public ChannelSpecificMessageMessageInternalImpl(
LineNotificationMessageTemplateChannelSpecificMessageImpl o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
}

public ChannelSpecificMessageMessageInternalImpl(OrderDetailsImpl o) {
super("oneOf", Boolean.FALSE);
setActualInstance(o);
Expand All @@ -370,6 +434,9 @@ public ChannelSpecificMessageMessageInternalImpl(OrderStatusImpl o) {
schemas.put(
"KakaoTalkCommerceChannelSpecificMessageImpl",
KakaoTalkCommerceChannelSpecificMessageImpl.class);
schemas.put(
"LineNotificationMessageTemplateChannelSpecificMessageImpl",
LineNotificationMessageTemplateChannelSpecificMessageImpl.class);
schemas.put("OrderDetailsImpl", OrderDetailsImpl.class);
schemas.put("OrderStatusImpl", OrderStatusImpl.class);
JSONNavigator.registerDescendants(
Expand All @@ -385,7 +452,8 @@ public Map<String, Class<?>> getSchemas() {
* Set the instance that matches the oneOf child schema, check the instance parameter is valid
* against the oneOf child schemas: FlowChannelSpecificMessageImpl,
* KakaoTalkCarouselCommerceChannelSpecificMessageImpl,
* KakaoTalkCommerceChannelSpecificMessageImpl, OrderDetailsImpl, OrderStatusImpl
* KakaoTalkCommerceChannelSpecificMessageImpl,
* LineNotificationMessageTemplateChannelSpecificMessageImpl, OrderDetailsImpl, OrderStatusImpl
*
* <p>It could be an instance of the 'oneOf' schemas. The oneOf child schemas may themselves be a
* composed schema (allOf, anyOf, oneOf).
Expand All @@ -412,6 +480,14 @@ public void setActualInstance(Object instance) {
return;
}

if (JSONNavigator.isInstanceOf(
LineNotificationMessageTemplateChannelSpecificMessageImpl.class,
instance,
new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
}

if (JSONNavigator.isInstanceOf(OrderDetailsImpl.class, instance, new HashSet<Class<?>>())) {
super.setActualInstance(instance);
return;
Expand All @@ -425,17 +501,22 @@ public void setActualInstance(Object instance) {
throw new RuntimeException(
"Invalid instance type. Must be FlowChannelSpecificMessageImpl,"
+ " KakaoTalkCarouselCommerceChannelSpecificMessageImpl,"
+ " KakaoTalkCommerceChannelSpecificMessageImpl, OrderDetailsImpl, OrderStatusImpl");
+ " KakaoTalkCommerceChannelSpecificMessageImpl,"
+ " LineNotificationMessageTemplateChannelSpecificMessageImpl, OrderDetailsImpl,"
+ " OrderStatusImpl");
}

/**
* Get the actual instance, which can be the following: FlowChannelSpecificMessageImpl,
* KakaoTalkCarouselCommerceChannelSpecificMessageImpl,
* KakaoTalkCommerceChannelSpecificMessageImpl, OrderDetailsImpl, OrderStatusImpl
* KakaoTalkCommerceChannelSpecificMessageImpl,
* LineNotificationMessageTemplateChannelSpecificMessageImpl, OrderDetailsImpl, OrderStatusImpl
*
* @return The actual instance (FlowChannelSpecificMessageImpl,
* KakaoTalkCarouselCommerceChannelSpecificMessageImpl,
* KakaoTalkCommerceChannelSpecificMessageImpl, OrderDetailsImpl, OrderStatusImpl)
* KakaoTalkCommerceChannelSpecificMessageImpl,
* LineNotificationMessageTemplateChannelSpecificMessageImpl, OrderDetailsImpl,
* OrderStatusImpl)
*/
@Override
public Object getActualInstance() {
Expand Down Expand Up @@ -481,6 +562,20 @@ public FlowChannelSpecificMessageImpl getFlowChannelSpecificMessageImpl()
return (KakaoTalkCommerceChannelSpecificMessageImpl) super.getActualInstance();
}

/**
* Get the actual instance of `LineNotificationMessageTemplateChannelSpecificMessageImpl`. If the
* actual instance is not `LineNotificationMessageTemplateChannelSpecificMessageImpl`, the
* ClassCastException will be thrown.
*
* @return The actual instance of `LineNotificationMessageTemplateChannelSpecificMessageImpl`
* @throws ClassCastException if the instance is not
* `LineNotificationMessageTemplateChannelSpecificMessageImpl`
*/
public LineNotificationMessageTemplateChannelSpecificMessageImpl
getLineNotificationMessageTemplateChannelSpecificMessageImpl() throws ClassCastException {
return (LineNotificationMessageTemplateChannelSpecificMessageImpl) super.getActualInstance();
}

/**
* Get the actual instance of `OrderDetailsImpl`. If the actual instance is not
* `OrderDetailsImpl`, the ClassCastException will be thrown.
Expand Down
Loading
Loading