diff --git a/client/src/main/com/sinch/sdk/domains/conversation/ConversationService.java b/client/src/main/com/sinch/sdk/domains/conversation/ConversationService.java
index 317f075e..309c50cc 100644
--- a/client/src/main/com/sinch/sdk/domains/conversation/ConversationService.java
+++ b/client/src/main/com/sinch/sdk/domains/conversation/ConversationService.java
@@ -1,5 +1,7 @@
package com.sinch.sdk.domains.conversation;
+import com.sinch.sdk.domains.conversation.api.templates.TemplatesService;
+
/**
* Conversation Service
*
@@ -15,7 +17,21 @@ public interface ConversationService {
* @return V1 service instance for project
* @see Documentation
- * @since 1.2
+ * @since _NEXT_VERSION_
*/
com.sinch.sdk.domains.conversation.api.v1.ConversationService v1();
+
+ /**
+ * Templates service
+ *
+ *
The Template Management API offers a way to manage templates that can be used together with
+ * the Conversation API. Note that you may also use the Message Composer tool on the Sinch
+ * Customer Dashboard to manage templates.
+ *
+ * @return Service instance for project
+ * @see Documentation
+ * @since _NEXT_VERSION_
+ */
+ TemplatesService templates();
}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/adapters/ConversationService.java b/client/src/main/com/sinch/sdk/domains/conversation/adapters/ConversationService.java
index 961d1d5b..2341fc74 100644
--- a/client/src/main/com/sinch/sdk/domains/conversation/adapters/ConversationService.java
+++ b/client/src/main/com/sinch/sdk/domains/conversation/adapters/ConversationService.java
@@ -2,25 +2,44 @@
import com.sinch.sdk.core.http.HttpClient;
import com.sinch.sdk.core.models.ServerConfiguration;
+import com.sinch.sdk.domains.conversation.api.templates.adapters.TemplatesService;
import com.sinch.sdk.models.ConversationContext;
import com.sinch.sdk.models.UnifiedCredentials;
public class ConversationService implements com.sinch.sdk.domains.conversation.ConversationService {
- private final com.sinch.sdk.domains.conversation.api.v1.ConversationService v1;
+ private final UnifiedCredentials credentials;
+ private final ConversationContext context;
+ private final ServerConfiguration oAuthServer;
+ private final HttpClient httpClient;
+
+ private com.sinch.sdk.domains.conversation.api.v1.ConversationService conversationV1;
+ private TemplatesService templates;
public ConversationService(
UnifiedCredentials credentials,
ConversationContext context,
ServerConfiguration oAuthServer,
HttpClient httpClient) {
-
- this.v1 =
- new com.sinch.sdk.domains.conversation.api.v1.adapters.ConversationService(
- credentials, context, oAuthServer, httpClient);
+ this.credentials = credentials;
+ this.context = context;
+ this.oAuthServer = oAuthServer;
+ this.httpClient = httpClient;
}
public com.sinch.sdk.domains.conversation.api.v1.ConversationService v1() {
- return v1;
+ if (null == this.conversationV1) {
+ this.conversationV1 =
+ new com.sinch.sdk.domains.conversation.api.v1.adapters.ConversationService(
+ credentials, context, oAuthServer, httpClient);
+ }
+ return this.conversationV1;
+ }
+
+ public TemplatesService templates() {
+ if (null == this.templates) {
+ this.templates = new TemplatesService(credentials, context, oAuthServer, httpClient);
+ }
+ return this.templates;
}
}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/api/templates/TemplatesService.java b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/TemplatesService.java
new file mode 100644
index 00000000..11a98d20
--- /dev/null
+++ b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/TemplatesService.java
@@ -0,0 +1,31 @@
+package com.sinch.sdk.domains.conversation.api.templates;
+
+import com.sinch.sdk.domains.conversation.api.templates.v1.TemplatesServiceV1;
+import com.sinch.sdk.domains.conversation.api.templates.v2.TemplatesServiceV2;
+
+/**
+ * Service for working with templates
+ *
+ * @see online
+ * documentation
+ * @since _NEXT_VERSION_
+ */
+public interface TemplatesService {
+
+ /**
+ * Service for working with templates V1
+ *
+ * @return Templates V1 service
+ * @since _NEXT_VERSION_
+ */
+ TemplatesServiceV1 v1();
+
+ /**
+ * Service for working with templates V2
+ *
+ * @return Templates V2 service
+ * @since _NEXT_VERSION_
+ */
+ TemplatesServiceV2 v2();
+}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/api/templates/adapters/TemplatesService.java b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/adapters/TemplatesService.java
new file mode 100644
index 00000000..1f44085a
--- /dev/null
+++ b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/adapters/TemplatesService.java
@@ -0,0 +1,106 @@
+package com.sinch.sdk.domains.conversation.api.templates.adapters;
+
+import com.sinch.sdk.auth.adapters.OAuthManager;
+import com.sinch.sdk.core.http.AuthManager;
+import com.sinch.sdk.core.http.HttpClient;
+import com.sinch.sdk.core.http.HttpMapper;
+import com.sinch.sdk.core.models.ServerConfiguration;
+import com.sinch.sdk.core.utils.StringUtil;
+import com.sinch.sdk.domains.conversation.api.templates.adapters.v1.TemplatesServiceV1;
+import com.sinch.sdk.domains.conversation.api.templates.adapters.v2.TemplatesServiceV2;
+import com.sinch.sdk.domains.conversation.api.v1.adapters.ConversationService;
+import com.sinch.sdk.domains.conversation.templates.models.v2.ChannelTemplateOverrideMapper;
+import com.sinch.sdk.models.ConversationContext;
+import com.sinch.sdk.models.UnifiedCredentials;
+import java.util.AbstractMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.logging.Logger;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class TemplatesService
+ implements com.sinch.sdk.domains.conversation.api.templates.TemplatesService {
+
+ private static final Logger LOGGER = Logger.getLogger(TemplatesService.class.getName());
+ private static final String SECURITY_SCHEME_KEYWORD_ = "oAuth2";
+
+ private final String uriUUID;
+ private final ConversationContext context;
+ private final HttpClient httpClient;
+ private final Map authManagers;
+ private TemplatesServiceV1 v1;
+ private TemplatesServiceV2 v2;
+
+ static {
+ LocalLazyInit.init();
+ }
+
+ public TemplatesService(
+ UnifiedCredentials credentials,
+ ConversationContext context,
+ ServerConfiguration oAuthServer,
+ HttpClient httpClient) {
+
+ Objects.requireNonNull(credentials, "Templates service requires credentials to be defined");
+ Objects.requireNonNull(context, "Templates service requires context to be defined");
+ StringUtil.requireNonEmpty(
+ credentials.getKeyId(), "Templates service requires 'keyId' to be defined");
+ StringUtil.requireNonEmpty(
+ credentials.getKeySecret(), "Templates service requires 'keySecret' to be defined");
+ StringUtil.requireNonEmpty(
+ credentials.getProjectId(), "Templates service requires 'projectId' to be defined");
+
+ StringUtil.requireNonEmpty(
+ context.getTemplateManagementUrl(),
+ "Templates service requires 'templateManagementUrl' to be defined");
+
+ LOGGER.fine(
+ String.format(
+ "Activate templates API with template server: '%s",
+ context.getTemplateManagementServer().getUrl()));
+
+ this.uriUUID = credentials.getProjectId();
+ this.context = context;
+ this.httpClient = httpClient;
+
+ OAuthManager authManager =
+ new OAuthManager(credentials, oAuthServer, new HttpMapper(), httpClient);
+ authManagers =
+ Stream.of(new AbstractMap.SimpleEntry<>(SECURITY_SCHEME_KEYWORD_, authManager))
+ .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
+ }
+
+ public TemplatesServiceV1 v1() {
+ if (null == this.v1) {
+ this.v1 = new TemplatesServiceV1(uriUUID, context, httpClient, authManagers);
+ }
+ return this.v1;
+ }
+
+ public TemplatesServiceV2 v2() {
+ if (null == this.v2) {
+ this.v2 = new TemplatesServiceV2(uriUUID, context, httpClient, authManagers);
+ }
+ return this.v2;
+ }
+
+ static final class LocalLazyInit {
+
+ private LocalLazyInit() {
+ // Because of templates classes are depending of Conversation classes we need to init for a
+ // proper serialize/deserialize process
+ ConversationService.LocalLazyInit.init();
+ ChannelTemplateOverrideMapper.initMapper();
+ }
+
+ public static LocalLazyInit init() {
+ return LocalLazyInit.LazyHolder.INSTANCE;
+ }
+
+ private static class LazyHolder {
+
+ public static final LocalLazyInit INSTANCE = new LocalLazyInit();
+ }
+ }
+}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/api/templates/adapters/v1/TemplatesServiceV1.java b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/adapters/v1/TemplatesServiceV1.java
new file mode 100644
index 00000000..20441e4c
--- /dev/null
+++ b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/adapters/v1/TemplatesServiceV1.java
@@ -0,0 +1,52 @@
+package com.sinch.sdk.domains.conversation.api.templates.adapters.v1;
+
+import com.sinch.sdk.core.http.AuthManager;
+import com.sinch.sdk.core.http.HttpClient;
+import com.sinch.sdk.core.http.HttpMapper;
+import com.sinch.sdk.domains.conversation.templates.api.internal.TemplatesV1Api;
+import com.sinch.sdk.domains.conversation.templates.models.v1.TemplateV1;
+import com.sinch.sdk.models.ConversationContext;
+import java.util.Collection;
+import java.util.Map;
+
+public class TemplatesServiceV1
+ implements com.sinch.sdk.domains.conversation.api.templates.v1.TemplatesServiceV1 {
+
+ private final String uriUUID;
+ private final TemplatesV1Api api;
+
+ public TemplatesServiceV1(
+ String uriUUID,
+ ConversationContext context,
+ HttpClient httpClient,
+ Map authManagers) {
+ this.uriUUID = uriUUID;
+ this.api =
+ new TemplatesV1Api(
+ httpClient, context.getTemplateManagementServer(), authManagers, new HttpMapper());
+ }
+
+ protected TemplatesV1Api getApi() {
+ return this.api;
+ }
+
+ public Collection list() {
+ return getApi().templatesListTemplates(uriUUID).getTemplates();
+ }
+
+ public TemplateV1 create(TemplateV1 template) {
+ return getApi().templatesCreateTemplate(uriUUID, template);
+ }
+
+ public TemplateV1 get(String templateId) {
+ return getApi().templatesGetTemplate(uriUUID, templateId);
+ }
+
+ public void delete(String templateId) {
+ getApi().templatesDeleteTemplate(uriUUID, templateId);
+ }
+
+ public TemplateV1 update(String templateId, TemplateV1 template) {
+ return getApi().templatesUpdateTemplate(uriUUID, templateId, template, null);
+ }
+}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/api/templates/adapters/v2/TemplatesServiceV2.java b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/adapters/v2/TemplatesServiceV2.java
new file mode 100644
index 00000000..df114fc5
--- /dev/null
+++ b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/adapters/v2/TemplatesServiceV2.java
@@ -0,0 +1,76 @@
+package com.sinch.sdk.domains.conversation.api.templates.adapters.v2;
+
+import com.sinch.sdk.core.http.AuthManager;
+import com.sinch.sdk.core.http.HttpClient;
+import com.sinch.sdk.core.http.HttpMapper;
+import com.sinch.sdk.domains.conversation.templates.api.internal.TemplatesV2Api;
+import com.sinch.sdk.domains.conversation.templates.models.v2.TemplateTranslation;
+import com.sinch.sdk.domains.conversation.templates.models.v2.TemplateV2;
+import com.sinch.sdk.domains.conversation.templates.models.v2.internal.V2ListTranslationsResponseInternal;
+import com.sinch.sdk.domains.conversation.templates.models.v2.request.TranslationListRequest;
+import com.sinch.sdk.models.ConversationContext;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Map;
+import java.util.stream.Collectors;
+
+public class TemplatesServiceV2
+ implements com.sinch.sdk.domains.conversation.api.templates.v2.TemplatesServiceV2 {
+
+ private final String uriUUID;
+ private final TemplatesV2Api api;
+
+ public TemplatesServiceV2(
+ String uriUUID,
+ ConversationContext context,
+ HttpClient httpClient,
+ Map authManagers) {
+ this.uriUUID = uriUUID;
+ this.api =
+ new TemplatesV2Api(
+ httpClient, context.getTemplateManagementServer(), authManagers, new HttpMapper());
+ }
+
+ protected TemplatesV2Api getApi() {
+ return this.api;
+ }
+
+ public Collection list() {
+ return getApi().templatesV2ListTemplates(uriUUID).getTemplates();
+ }
+
+ public Collection listTranslations(
+ String templateId, TranslationListRequest request) {
+
+ if (null == request) {
+ request = TranslationListRequest.builder().build();
+ }
+ String languageCode = request.getLanguageCode().orElse(null);
+ String translationVersion = request.getTranslationVersion().orElse(null);
+
+ V2ListTranslationsResponseInternal response =
+ getApi().templatesV2ListTranslations(uriUUID, templateId, languageCode, translationVersion);
+ if (null == response || null == response.getTranslations()) {
+ return Collections.emptyList();
+ }
+ return response.getTranslations().stream()
+ .map(TemplateTranslation::from)
+ .collect(Collectors.toList());
+ }
+
+ public TemplateV2 create(TemplateV2 template) {
+ return getApi().templatesV2CreateTemplate(uriUUID, template);
+ }
+
+ public TemplateV2 get(String templateId) {
+ return getApi().templatesV2GetTemplate(uriUUID, templateId);
+ }
+
+ public void delete(String templateId) {
+ getApi().templatesV2DeleteTemplate(uriUUID, templateId);
+ }
+
+ public TemplateV2 update(String templateId, TemplateV2 template) {
+ return getApi().templatesV2UpdateTemplate(uriUUID, templateId, template);
+ }
+}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/api/templates/v1/TemplatesServiceV1.java b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/v1/TemplatesServiceV1.java
new file mode 100644
index 00000000..19ed4524
--- /dev/null
+++ b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/v1/TemplatesServiceV1.java
@@ -0,0 +1,59 @@
+package com.sinch.sdk.domains.conversation.api.templates.v1;
+
+import com.sinch.sdk.domains.conversation.templates.models.v1.TemplateV1;
+import java.util.Collection;
+
+/**
+ * Templates V1
+ *
+ * Version 1 endpoints for managing message templates. Currently maintained for existing users.
+ * Version 2 is recommended.
+ *
+ * @see online
+ * documentation
+ * @since _NEXT_VERSION_
+ */
+public interface TemplatesServiceV1 {
+
+ /**
+ * List all templates belonging to a project ID.
+ *
+ * @return List of templates * @since _NEXT_VERSION_
+ * @since _NEXT_VERSION_
+ */
+ Collection list();
+
+ /**
+ * Creates a template
+ *
+ * @param template Information for creation
+ * @return Created template
+ * @since _NEXT_VERSION_
+ */
+ TemplateV1 create(TemplateV1 template);
+
+ /***
+ * Get a template
+ * @param templateId The ID of the template to fetch.
+ * @return The template information
+ * @since _NEXT_VERSION_
+ */
+ TemplateV1 get(String templateId);
+
+ /***
+ * Delete a template
+ * @param templateId The ID of the template to delete.
+ * @since _NEXT_VERSION_
+ */
+ void delete(String templateId);
+
+ /**
+ * Updates a template
+ *
+ * @param template Information to be updated
+ * @return Updated template
+ * @since _NEXT_VERSION_
+ */
+ TemplateV1 update(String templateId, TemplateV1 template);
+}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/api/templates/v2/TemplatesServiceV2.java b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/v2/TemplatesServiceV2.java
new file mode 100644
index 00000000..8ea15f60
--- /dev/null
+++ b/client/src/main/com/sinch/sdk/domains/conversation/api/templates/v2/TemplatesServiceV2.java
@@ -0,0 +1,69 @@
+package com.sinch.sdk.domains.conversation.api.templates.v2;
+
+import com.sinch.sdk.domains.conversation.templates.models.v2.TemplateTranslation;
+import com.sinch.sdk.domains.conversation.templates.models.v2.TemplateV2;
+import com.sinch.sdk.domains.conversation.templates.models.v2.request.TranslationListRequest;
+import java.util.Collection;
+
+/**
+ * Templates V2
+ *
+ * @see online
+ * documentation
+ * @since _NEXT_VERSION_
+ */
+public interface TemplatesServiceV2 {
+
+ /**
+ * List all templates belonging to a project ID.
+ *
+ * @return List of templates
+ * @since _NEXT_VERSION_
+ */
+ Collection list();
+
+ /**
+ * List translations for a template
+ *
+ * @param templateId The ID of the template to fetch
+ * @param request Parameters for request
+ * @return The translations list
+ * @since _NEXT_VERSION_
+ */
+ Collection listTranslations(
+ String templateId, TranslationListRequest request);
+
+ /**
+ * Creates a template
+ *
+ * @param template Information for creation
+ * @return Created template
+ * @since _NEXT_VERSION_
+ */
+ TemplateV2 create(TemplateV2 template);
+
+ /***
+ * Get a template
+ * @param templateId The ID of the template to fetch.
+ * @return The template information
+ * @since _NEXT_VERSION_
+ */
+ TemplateV2 get(String templateId);
+
+ /***
+ * Delete a template
+ * @param templateId The ID of the template to delete.
+ * @since _NEXT_VERSION_
+ */
+ void delete(String templateId);
+
+ /**
+ * Updates a template
+ *
+ * @param template Information to be updated
+ * @return Updated template
+ * @since _NEXT_VERSION_
+ */
+ TemplateV2 update(String templateId, TemplateV2 template);
+}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/api/v1/adapters/ConversationService.java b/client/src/main/com/sinch/sdk/domains/conversation/api/v1/adapters/ConversationService.java
index 9aa2e945..96ec9192 100644
--- a/client/src/main/com/sinch/sdk/domains/conversation/api/v1/adapters/ConversationService.java
+++ b/client/src/main/com/sinch/sdk/domains/conversation/api/v1/adapters/ConversationService.java
@@ -6,6 +6,7 @@
import com.sinch.sdk.core.http.HttpMapper;
import com.sinch.sdk.core.models.ServerConfiguration;
import com.sinch.sdk.core.utils.StringUtil;
+import com.sinch.sdk.domains.conversation.api.templates.adapters.TemplatesService;
import com.sinch.sdk.domains.conversation.api.v1.adapters.events.app.AppEventMapper;
import com.sinch.sdk.domains.conversation.api.v1.adapters.events.contactmessage.internal.ContactMessageEventMapper;
import com.sinch.sdk.domains.conversation.api.v1.adapters.events.contacts.internal.ContactEventMapper;
@@ -23,6 +24,7 @@
import com.sinch.sdk.domains.conversation.models.v1.messages.types.carousel.CarouselMessageMapper;
import com.sinch.sdk.domains.conversation.models.v1.messages.types.internal.ChoiceMessageMapper;
import com.sinch.sdk.domains.conversation.models.v1.messages.types.template.TemplateMessageMapper;
+import com.sinch.sdk.domains.conversation.templates.models.v2.TemplateTranslationMapper;
import com.sinch.sdk.models.ConversationContext;
import com.sinch.sdk.models.UnifiedCredentials;
import java.util.AbstractMap;
@@ -39,6 +41,8 @@ public class ConversationService
private static final String SECURITY_SCHEME_KEYWORD_ = "oAuth2";
private final String uriUUID;
+ private final UnifiedCredentials credentials;
+ private final ServerConfiguration oAuthServer;
private final ConversationContext context;
private final HttpClient httpClient;
private final Map authManagers;
@@ -50,6 +54,7 @@ public class ConversationService
private TranscodingService transcoding;
private CapabilityService capability;
private WebHooksService webhooks;
+ private TemplatesService templates;
static {
LocalLazyInit.init();
@@ -71,18 +76,15 @@ public ConversationService(
credentials.getProjectId(), "Conversation service requires 'projectId' to be defined");
StringUtil.requireNonEmpty(
context.getUrl(), "Conversation service requires 'url' to be defined");
- StringUtil.requireNonEmpty(
- context.getTemplateManagementUrl(),
- "Conversation service requires 'templateManagementUrl' to be defined");
LOGGER.fine(
- String.format(
- "Activate conversation API with server: '%s', template server: '%s",
- context.getServer().getUrl(), context.getTemplateManagementServer().getUrl()));
+ String.format("Activate conversation API with server: '%s'", context.getServer().getUrl()));
this.uriUUID = credentials.getProjectId();
+ this.credentials = credentials;
this.context = context;
this.httpClient = httpClient;
+ this.oAuthServer = oAuthServer;
OAuthManager authManager =
new OAuthManager(credentials, oAuthServer, new HttpMapper(), httpClient);
@@ -153,7 +155,14 @@ public CapabilityService capability() {
return this.capability;
}
- static final class LocalLazyInit {
+ public TemplatesService templates() {
+ if (null == this.templates) {
+ this.templates = new TemplatesService(credentials, context, oAuthServer, httpClient);
+ }
+ return this.templates;
+ }
+
+ public static final class LocalLazyInit {
private LocalLazyInit() {
AppEventMapper.initMapper();
@@ -173,6 +182,7 @@ private LocalLazyInit() {
RecipientMapper.initMapper();
SendMessageRequestMapper.initMapper();
TemplateMessageMapper.initMapper();
+ TemplateTranslationMapper.initMapper();
WhatsAppInteractiveHeaderMapper.initMapper();
}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/templates/models/v2/ChannelTemplateOverrideMapper.java b/client/src/main/com/sinch/sdk/domains/conversation/templates/models/v2/ChannelTemplateOverrideMapper.java
new file mode 100644
index 00000000..0203deee
--- /dev/null
+++ b/client/src/main/com/sinch/sdk/domains/conversation/templates/models/v2/ChannelTemplateOverrideMapper.java
@@ -0,0 +1,39 @@
+package com.sinch.sdk.domains.conversation.templates.models.v2;
+
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.sinch.sdk.core.models.OptionalValue;
+import com.sinch.sdk.core.utils.databind.Mapper;
+import com.sinch.sdk.domains.conversation.models.v1.TemplateReference;
+import com.sinch.sdk.domains.conversation.models.v1.TemplateReferenceImpl;
+
+public class ChannelTemplateOverrideMapper {
+
+ public static void initMapper() {
+
+ Mapper.getInstance()
+ .addMixIn(ChannelTemplateOverride.class, ChannelTemplateOverrideMapperMixinSerializer.class)
+ .addMixIn(
+ ChannelTemplateOverride.Builder.class, ChannelTemplateOverrideBuilderMapperMixin.class);
+ }
+
+ static class ChannelTemplateOverrideMapperMixinSerializer extends ChannelTemplateOverrideImpl {
+
+ @Override
+ @JsonSerialize(using = TemplateReferenceImpl.DelegatedSerializer.class)
+ public OptionalValue templateReference() {
+ return super.templateReference();
+ }
+ }
+
+ static class ChannelTemplateOverrideBuilderMapperMixin
+ extends ChannelTemplateOverrideImpl.Builder {
+
+ @Override
+ @JsonDeserialize(using = TemplateReferenceImpl.DelegatedDeSerializer.class)
+ public ChannelTemplateOverrideImpl.Builder setTemplateReference(
+ TemplateReference templateReference) {
+ return super.setTemplateReference(templateReference);
+ }
+ }
+}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/templates/models/v2/TemplateTranslation.java b/client/src/main/com/sinch/sdk/domains/conversation/templates/models/v2/TemplateTranslation.java
new file mode 100644
index 00000000..44fb428c
--- /dev/null
+++ b/client/src/main/com/sinch/sdk/domains/conversation/templates/models/v2/TemplateTranslation.java
@@ -0,0 +1,48 @@
+package com.sinch.sdk.domains.conversation.templates.models.v2;
+
+import com.sinch.sdk.domains.conversation.models.v1.messages.AppMessageBody;
+
+/** Message to be injected */
+public interface TemplateTranslation extends TemplateTranslationBase {
+
+ /**
+ * Get translation message
+ *
+ * @return Body message
+ */
+ AppMessageBody getMessage();
+
+ /**
+ * Getting builder
+ *
+ * @return New Builder instance
+ */
+ @SuppressWarnings("rawtypes")
+ static Builder> builder() {
+ return new TemplateTranslationImpl.Builder();
+ }
+
+ static TemplateTranslation from(TemplateTranslationBase from) {
+ return new TemplateTranslationImpl(from);
+ }
+
+ /** Dedicated Builder */
+ interface Builder> extends TemplateTranslationBase.Builder {
+
+ /**
+ * see getter
+ *
+ * @param message see getter
+ * @return Current builder
+ * @see #getMessage()
+ */
+ B setMessage(AppMessageBody message);
+
+ /**
+ * Create instance
+ *
+ * @return The instance build with current builder values
+ */
+ TemplateTranslation build();
+ }
+}
diff --git a/client/src/main/com/sinch/sdk/domains/conversation/templates/models/v2/TemplateTranslationImpl.java b/client/src/main/com/sinch/sdk/domains/conversation/templates/models/v2/TemplateTranslationImpl.java
new file mode 100644
index 00000000..c1204af7
--- /dev/null
+++ b/client/src/main/com/sinch/sdk/domains/conversation/templates/models/v2/TemplateTranslationImpl.java
@@ -0,0 +1,159 @@
+package com.sinch.sdk.domains.conversation.templates.models.v2;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+import com.sinch.sdk.core.models.OptionalValue;
+import com.sinch.sdk.domains.conversation.models.v1.ConversationChannel;
+import com.sinch.sdk.domains.conversation.models.v1.messages.AppMessageBody;
+import com.sinch.sdk.domains.conversation.models.v1.messages.types.card.CardMessage;
+import com.sinch.sdk.domains.conversation.models.v1.messages.types.carousel.CarouselMessage;
+import com.sinch.sdk.domains.conversation.models.v1.messages.types.choice.ChoiceMessage;
+import com.sinch.sdk.domains.conversation.models.v1.messages.types.contactinfo.ContactInfoMessage;
+import com.sinch.sdk.domains.conversation.models.v1.messages.types.list.ListMessage;
+import com.sinch.sdk.domains.conversation.models.v1.messages.types.location.LocationMessage;
+import com.sinch.sdk.domains.conversation.models.v1.messages.types.media.MediaMessage;
+import com.sinch.sdk.domains.conversation.models.v1.messages.types.template.TemplateMessage;
+import com.sinch.sdk.domains.conversation.models.v1.messages.types.text.TextMessage;
+import com.sinch.sdk.domains.conversation.templates.models.TemplateVariable;
+import java.time.Instant;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Logger;
+
+public class TemplateTranslationImpl extends TemplateTranslationBaseImpl
+ implements TemplateTranslation {
+
+ private static final Logger LOGGER = Logger.getLogger(TemplateTranslationImpl.class.getName());
+
+ TemplateTranslationImpl(TemplateTranslationBase _from) {
+ super(
+ ((TemplateTranslationBaseImpl) _from).languageCode(),
+ ((TemplateTranslationBaseImpl) _from).version(),
+ ((TemplateTranslationBaseImpl) _from).channelTemplateOverrides(),
+ ((TemplateTranslationBaseImpl) _from).variables(),
+ ((TemplateTranslationBaseImpl) _from).createTime(),
+ ((TemplateTranslationBaseImpl) _from).updateTime(),
+ ((TemplateTranslationBaseImpl) _from).cardMessage(),
+ ((TemplateTranslationBaseImpl) _from).carouselMessage(),
+ ((TemplateTranslationBaseImpl) _from).choiceMessage(),
+ ((TemplateTranslationBaseImpl) _from).locationMessage(),
+ ((TemplateTranslationBaseImpl) _from).mediaMessage(),
+ ((TemplateTranslationBaseImpl) _from).templateMessage(),
+ ((TemplateTranslationBaseImpl) _from).textMessage(),
+ ((TemplateTranslationBaseImpl) _from).listMessage(),
+ ((TemplateTranslationBaseImpl) _from).contactInfoMessage());
+ }
+
+ @JsonIgnore
+ public AppMessageBody getMessage() {
+
+ if (cardMessage().isPresent()) {
+ return cardMessage().get();
+ } else if (carouselMessage().isPresent()) {
+ return carouselMessage().get();
+ } else if (choiceMessage().isPresent()) {
+ return choiceMessage().get();
+ } else if (contactInfoMessage().isPresent()) {
+ return contactInfoMessage().get();
+ } else if (listMessage().isPresent()) {
+ return listMessage().get();
+ } else if (locationMessage().isPresent()) {
+ return locationMessage().get();
+ } else if (mediaMessage().isPresent()) {
+ return mediaMessage().get();
+ } else if (templateMessage().isPresent()) {
+ return templateMessage().get();
+ } else if (textMessage().isPresent()) {
+ return textMessage().get();
+ }
+ return null;
+ }
+
+ protected TemplateTranslationImpl(
+ OptionalValue languageCode,
+ OptionalValue version,
+ OptionalValue