From a5a64435a8978b76b0c2632e9af26597f2f3be18 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Wed, 25 Sep 2024 09:33:19 +0200 Subject: [PATCH 1/3] feat (Conversation/Credentials): Agnostic credentials type for 'ConversationChannelCredentials' based onto injected sources and hidden fields --- ...annelCredentialsRequestBuilderFactory.java | 111 ------------- .../v1/credentials/ChannelCredentials.java | 3 + ...ationChannelCredentialsBuilderFactory.java | 95 +++++++++++ ...nChannelCredentialsBuilderFactoryTest.java | 150 ++++++++++++++++++ .../e2e/domains/conversation/AppsSteps.java | 8 +- .../conversation/models/v1/AppDtoTest.java | 19 ++- ...ConversationChannelCredentialsDtoTest.java | 58 ++++--- .../conversation/application/Create.java | 30 ++-- .../conversation/application/Update.java | 4 +- 9 files changed, 306 insertions(+), 172 deletions(-) delete mode 100644 client/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialsRequestBuilderFactory.java create mode 100644 client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ChannelCredentials.java create mode 100644 client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactory.java create mode 100644 client/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactoryTest.java diff --git a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialsRequestBuilderFactory.java b/client/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialsRequestBuilderFactory.java deleted file mode 100644 index 18eea73c5..000000000 --- a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialsRequestBuilderFactory.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.sinch.sdk.domains.conversation.models.v1.app.request; - -import com.sinch.sdk.domains.conversation.models.v1.ConversationChannel; -import com.sinch.sdk.domains.conversation.models.v1.credentials.AppleBusinessChatCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.InstagramCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.KakaoTalkChatCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.KakaoTalkCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.LineCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.MMSCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.StaticBearerCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.StaticTokenCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.TelegramCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.WeChatCredentials; - -public class ConversationChannelCredentialsRequestBuilderFactory { - - public static ConversationChannelCredentialRequest.Builder appleBc( - AppleBusinessChatCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.APPLEBC) - .setApplebcCredentials(credentials); - } - - public static ConversationChannelCredentialRequest.Builder instagram( - InstagramCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.INSTAGRAM) - .setInstagramCredentials(credentials); - } - - public static ConversationChannelCredentialRequest.Builder kakaoTalk( - KakaoTalkCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.KAKAOTALK) - .setKakaotalkCredentials(credentials); - } - - public static ConversationChannelCredentialRequest.Builder kakaoTalkChat( - KakaoTalkChatCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.KAKAOTALKCHAT) - .setKakaotalkchatCredentials(credentials); - } - - public static ConversationChannelCredentialRequest.Builder line(LineCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.LINE) - .setLineCredentials(credentials); - } - - public static ConversationChannelCredentialRequest.Builder messenger( - StaticTokenCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.MESSENGER) - .setStaticToken(credentials); - } - - public static ConversationChannelCredentialRequest.Builder mms(MMSCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.MMS) - .setMmsCredentials(credentials); - } - - public static ConversationChannelCredentialRequest.Builder rcs( - StaticBearerCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.RCS) - .setStaticBearer(credentials); - } - - public static ConversationChannelCredentialRequest.Builder sms( - StaticBearerCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.SMS) - .setStaticBearer(credentials); - } - - public static ConversationChannelCredentialRequest.Builder telegram( - TelegramCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.TELEGRAM) - .setTelegramCredentials(credentials); - } - - public static ConversationChannelCredentialRequest.Builder viber( - StaticTokenCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.VIBER) - .setStaticToken(credentials); - } - - public static ConversationChannelCredentialRequest.Builder viberBm( - StaticBearerCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.VIBERBM) - .setStaticBearer(credentials); - } - - public static ConversationChannelCredentialRequest.Builder weChat(WeChatCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.WECHAT) - .setWechatCredentials(credentials); - } - - public static ConversationChannelCredentialRequest.Builder whatsApp( - StaticBearerCredentials credentials) { - return ConversationChannelCredentialRequest.builder() - .setChannel(ConversationChannel.WHATSAPP) - .setStaticBearer(credentials); - } -} diff --git a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ChannelCredentials.java b/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ChannelCredentials.java new file mode 100644 index 000000000..2bf9650f4 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ChannelCredentials.java @@ -0,0 +1,3 @@ +package com.sinch.sdk.domains.conversation.models.v1.credentials; + +public interface ChannelCredentials {} diff --git a/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactory.java b/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactory.java new file mode 100644 index 000000000..53fdc81e5 --- /dev/null +++ b/client/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactory.java @@ -0,0 +1,95 @@ +package com.sinch.sdk.domains.conversation.models.v1.credentials; + +import com.sinch.sdk.domains.conversation.models.v1.ConversationChannel; + +public class ConversationChannelCredentialsBuilderFactory { + + public static ConversationChannelCredentials.Builder appleBc( + AppleBusinessChatCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.APPLEBC) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder instagram(InstagramCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.INSTAGRAM) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder kakaoTalk(KakaoTalkCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.KAKAOTALK) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder kakaoTalkChat( + KakaoTalkChatCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.KAKAOTALKCHAT) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder line(LineCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.LINE) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder messenger( + StaticTokenCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.MESSENGER) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder mms(MMSCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.MMS) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder rcs(StaticBearerCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.RCS) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder sms(StaticBearerCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.SMS) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder telegram(TelegramCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.TELEGRAM) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder viber(StaticTokenCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.VIBER) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder viberBm( + StaticBearerCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.VIBERBM) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder weChat(WeChatCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.WECHAT) + .setCredentials(credentials); + } + + public static ConversationChannelCredentials.Builder whatsApp( + StaticBearerCredentials credentials) { + return ConversationChannelCredentials.builder() + .setChannel(ConversationChannel.WHATSAPP) + .setCredentials(credentials); + } +} diff --git a/client/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactoryTest.java b/client/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactoryTest.java new file mode 100644 index 000000000..451a3ba51 --- /dev/null +++ b/client/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsBuilderFactoryTest.java @@ -0,0 +1,150 @@ +package com.sinch.sdk.domains.conversation.models.v1.credentials; + +import static org.junit.jupiter.api.Assertions.*; + +import com.sinch.sdk.core.TestHelpers; +import com.sinch.sdk.domains.conversation.models.v1.ConversationChannel; +import org.junit.jupiter.api.Test; + +class ConversationChannelCredentialsBuilderFactoryTest { + + @Test + void appleBc() { + AppleBusinessChatCredentials credentials = AppleBusinessChatCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.appleBc(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.APPLEBC); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void instagram() { + InstagramCredentials credentials = InstagramCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.instagram(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.INSTAGRAM); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void kakaoTalk() { + KakaoTalkCredentials credentials = KakaoTalkCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.kakaoTalk(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.KAKAOTALK); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void kakaoTalkChat() { + KakaoTalkChatCredentials credentials = KakaoTalkChatCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.kakaoTalkChat(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.KAKAOTALKCHAT); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void line() { + LineCredentials credentials = LineCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.line(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.LINE); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void messenger() { + StaticTokenCredentials credentials = StaticTokenCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.messenger(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.MESSENGER); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void mms() { + MMSCredentials credentials = MMSCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.mms(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.MMS); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void rcs() { + StaticBearerCredentials credentials = StaticBearerCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.rcs(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.RCS); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void sms() { + StaticBearerCredentials credentials = StaticBearerCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.sms(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.SMS); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void telegram() { + TelegramCredentials credentials = TelegramCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.telegram(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.TELEGRAM); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void viber() { + StaticTokenCredentials credentials = StaticTokenCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.viber(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.VIBER); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void viberBm() { + StaticBearerCredentials credentials = StaticBearerCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.viberBm(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.VIBERBM); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void weChat() { + WeChatCredentials credentials = WeChatCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.weChat(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.WECHAT); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } + + @Test + void whatsApp() { + StaticBearerCredentials credentials = StaticBearerCredentials.builder().build(); + ConversationChannelCredentials conversationChannelCredentials = + ConversationChannelCredentialsBuilderFactory.whatsApp(credentials).build(); + + assertEquals(conversationChannelCredentials.getChannel(), ConversationChannel.WHATSAPP); + TestHelpers.recursiveEquals(conversationChannelCredentials.getCredentials(), credentials); + } +} diff --git a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/AppsSteps.java b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/AppsSteps.java index 90f79b152..70ad29668 100644 --- a/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/AppsSteps.java +++ b/client/src/test/java/com/sinch/sdk/e2e/domains/conversation/AppsSteps.java @@ -5,10 +5,10 @@ import com.sinch.sdk.domains.conversation.models.v1.app.ConversationMetadataReportView; import com.sinch.sdk.domains.conversation.models.v1.app.request.AppCreateRequest; import com.sinch.sdk.domains.conversation.models.v1.app.request.AppUpdateRequest; -import com.sinch.sdk.domains.conversation.models.v1.app.request.ConversationChannelCredentialRequest; -import com.sinch.sdk.domains.conversation.models.v1.app.request.ConversationChannelCredentialsRequestBuilderFactory; import com.sinch.sdk.domains.conversation.models.v1.app.response.AppResponse; import com.sinch.sdk.domains.conversation.models.v1.credentials.ChannelIntegrationStatus; +import com.sinch.sdk.domains.conversation.models.v1.credentials.ConversationChannelCredentials; +import com.sinch.sdk.domains.conversation.models.v1.credentials.ConversationChannelCredentialsBuilderFactory; import com.sinch.sdk.domains.conversation.models.v1.credentials.StaticBearerCredentials; import com.sinch.sdk.e2e.Config; import io.cucumber.java.en.Given; @@ -41,8 +41,8 @@ public void create() { String token = "00112233445566778899aabbccddeeff"; String displayName = "E2E Conversation App"; - ConversationChannelCredentialRequest credentials = - ConversationChannelCredentialsRequestBuilderFactory.sms( + ConversationChannelCredentials credentials = + ConversationChannelCredentialsBuilderFactory.sms( StaticBearerCredentials.builder() .setClaimedIdentity(identity) .setToken(token) diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/AppDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/AppDtoTest.java index af9f536ba..5a4b2de99 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/AppDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/AppDtoTest.java @@ -15,7 +15,6 @@ import com.sinch.sdk.domains.conversation.models.v1.app.SmartConversation; import com.sinch.sdk.domains.conversation.models.v1.app.request.AppCreateRequest; import com.sinch.sdk.domains.conversation.models.v1.app.request.AppUpdateRequest; -import com.sinch.sdk.domains.conversation.models.v1.app.request.ConversationChannelCredentialRequest; import com.sinch.sdk.domains.conversation.models.v1.app.response.AppResponse; import com.sinch.sdk.domains.conversation.models.v1.app.response.ListAppsResponse; import com.sinch.sdk.domains.conversation.models.v1.app.response.QueueStats; @@ -42,7 +41,7 @@ public class AppDtoTest extends BaseTest { Collections.singletonList( ConversationChannelCredentials.builder() .setChannel(ConversationChannel.MESSENGER) - .setStaticToken(StaticTokenCredentials.builder().setToken("my token").build()) + .setCredentials(StaticTokenCredentials.builder().setToken("my token").build()) .setCallbackSecret("foo value") .setState( ChannelIntegrationState.builder() @@ -85,14 +84,14 @@ public class AppDtoTest extends BaseTest { AppCreateRequest.builder() .setChannelCredentials( Arrays.asList( - ConversationChannelCredentialRequest.builder() + ConversationChannelCredentials.builder() .setChannel(ConversationChannel.MESSENGER) - .setStaticToken(StaticTokenCredentials.builder().setToken("my token").build()) + .setCredentials(StaticTokenCredentials.builder().setToken("my token").build()) .setCallbackSecret("foo value") .build(), - ConversationChannelCredentialRequest.builder() + ConversationChannelCredentials.builder() .setChannel(ConversationChannel.SMS) - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("my identity") .setToken("sms token") @@ -120,14 +119,14 @@ public class AppDtoTest extends BaseTest { AppUpdateRequest.builder() .setChannelCredentials( Arrays.asList( - ConversationChannelCredentialRequest.builder() + ConversationChannelCredentials.builder() .setChannel(ConversationChannel.MESSENGER) - .setStaticToken(StaticTokenCredentials.builder().setToken("my token").build()) + .setCredentials(StaticTokenCredentials.builder().setToken("my token").build()) .setCallbackSecret("foo value") .build(), - ConversationChannelCredentialRequest.builder() + ConversationChannelCredentials.builder() .setChannel(ConversationChannel.SMS) - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("my identity") .setToken("sms token") diff --git a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsDtoTest.java b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsDtoTest.java index 00e86a7ce..0e758b9a4 100644 --- a/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsDtoTest.java +++ b/openapi-contracts/src/test/java/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsDtoTest.java @@ -32,7 +32,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setApplebcCredentials( + .setCredentials( AppleBusinessChatCredentials.builder() .setBusinessChatAccountId("appleBc business_chat_account_id value") .setMerchantId("appleBc merchant_id value") @@ -46,7 +46,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.APPLEBC) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setApplebcCredentials( + .setCredentials( AppleBusinessChatCredentials.builder() .setBusinessChatAccountId("appleBc business_chat_account_id value") .setMerchantId("appleBc merchant_id value") @@ -73,7 +73,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setInstagramCredentials( + .setCredentials( InstagramCredentials.builder() .setToken("instagramChannel token") .setBusinessAccountId("instagramChannel business account id") @@ -84,7 +84,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.INSTAGRAM) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setInstagramCredentials( + .setCredentials( InstagramCredentials.builder() .setToken("instagramChannel token") .setBusinessAccountId("instagramChannel business account id") @@ -109,7 +109,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setKakaotalkCredentials( + .setCredentials( KakaoTalkCredentials.builder() .setKakaotalkPlusFriendId("kakaoTalkChannel a friend id") .setKakaotalkSenderKey("kakaoTalkChannel a sender key") @@ -120,7 +120,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.KAKAOTALK) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setKakaotalkCredentials( + .setCredentials( KakaoTalkCredentials.builder() .setKakaotalkPlusFriendId("kakaoTalkChannel a friend id") .setKakaotalkSenderKey("kakaoTalkChannel a sender key") @@ -145,7 +145,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setKakaotalkchatCredentials( + .setCredentials( KakaoTalkChatCredentials.builder() .setKakaotalkPlusFriendId("kakaoTalkChatChannel a friend id") .setApiKey("") @@ -156,7 +156,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.KAKAOTALKCHAT) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setKakaotalkchatCredentials( + .setCredentials( KakaoTalkChatCredentials.builder() .setKakaotalkPlusFriendId("kakaoTalkChatChannel a friend id") .setApiKey("") @@ -179,7 +179,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setLineCredentials( + .setCredentials( LineCredentials.builder() .setToken("lineChannel a token value") .setSecret("lineChannel a secret value") @@ -190,7 +190,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.LINE) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setLineCredentials( + .setCredentials( LineCredentials.builder() .setToken("lineChannel a token value") .setSecret("lineChannel a secret value") @@ -215,7 +215,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setStaticToken( + .setCredentials( StaticTokenCredentials.builder().setToken("messengerChannel a token value").build()) .build(); public static ConversationChannelCredentials conversationChannelMessengerRequestDto = @@ -223,7 +223,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.MESSENGER) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setStaticToken( + .setCredentials( StaticTokenCredentials.builder().setToken("messengerChannel a token value").build()) .build(); @@ -243,7 +243,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setMmsCredentials( + .setCredentials( MMSCredentials.builder() .setBasicAuth( BasicAuthCredentials.builder() @@ -260,7 +260,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.MMS) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setMmsCredentials( + .setCredentials( MMSCredentials.builder() .setBasicAuth( BasicAuthCredentials.builder() @@ -289,7 +289,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("rcsChannel my claimed identity") .setToken("rcsChannel my token") @@ -300,7 +300,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.RCS) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("rcsChannel my claimed identity") .setToken("rcsChannel my token") @@ -323,7 +323,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("smsChannel my claimed identity") .setToken("smsChannel my token") @@ -334,7 +334,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.SMS) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("smsChannel my claimed identity") .setToken("smsChannel my token") @@ -359,16 +359,14 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setTelegramCredentials( - TelegramCredentials.builder().setToken("telegramChannel token").build()) + .setCredentials(TelegramCredentials.builder().setToken("telegramChannel token").build()) .build(); public static ConversationChannelCredentials conversationChannelTelegramRequestDto = ConversationChannelCredentials.builder() .setChannel(ConversationChannel.TELEGRAM) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setTelegramCredentials( - TelegramCredentials.builder().setToken("telegramChannel token").build()) + .setCredentials(TelegramCredentials.builder().setToken("telegramChannel token").build()) .build(); @GivenTextResource("/domains/conversation/v1/credentials/ConversationChannelViberRequestDto.json") @@ -388,14 +386,14 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setStaticToken(StaticTokenCredentials.builder().setToken("viberChannel token").build()) + .setCredentials(StaticTokenCredentials.builder().setToken("viberChannel token").build()) .build(); public static ConversationChannelCredentials conversationChannelViberRequestDto = ConversationChannelCredentials.builder() .setChannel(ConversationChannel.VIBER) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setStaticToken(StaticTokenCredentials.builder().setToken("viberChannel token").build()) + .setCredentials(StaticTokenCredentials.builder().setToken("viberChannel token").build()) .build(); @GivenTextResource( @@ -416,7 +414,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("viberBMChannel my claimed identity") .setToken("viberBMChannel my token") @@ -427,7 +425,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.VIBERBM) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("viberBMChannel my claimed identity") .setToken("viberBMChannel my token") @@ -452,7 +450,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setWechatCredentials( + .setCredentials( WeChatCredentials.builder() .setAppId("wechatChannel app id") .setAppSecret("wechatChannel secret") @@ -465,7 +463,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.WECHAT) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setWechatCredentials( + .setCredentials( WeChatCredentials.builder() .setAppId("wechatChannel app id") .setAppSecret("wechatChannel secret") @@ -492,7 +490,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setStatus(ChannelIntegrationStatus.PENDING) .setDescription("description value") .build()) - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("whatsAppChannel my claimed identity") .setToken("whatsAppChannel my token") @@ -503,7 +501,7 @@ public class ConversationChannelCredentialsDtoTest extends BaseTest { .setChannel(ConversationChannel.WHATSAPP) .setCallbackSecret("callback secret") .setChannelKnownId("channel id") - .setStaticBearer( + .setCredentials( StaticBearerCredentials.builder() .setClaimedIdentity("whatsAppChannel my claimed identity") .setToken("whatsAppChannel my token") diff --git a/sample-app/src/main/java/com/sinch/sample/conversation/application/Create.java b/sample-app/src/main/java/com/sinch/sample/conversation/application/Create.java index bdbeb331b..6c5351acd 100644 --- a/sample-app/src/main/java/com/sinch/sample/conversation/application/Create.java +++ b/sample-app/src/main/java/com/sinch/sample/conversation/application/Create.java @@ -3,9 +3,9 @@ import com.sinch.sample.BaseApplication; import com.sinch.sdk.domains.conversation.api.v1.AppService; import com.sinch.sdk.domains.conversation.models.v1.app.request.AppCreateRequest; -import com.sinch.sdk.domains.conversation.models.v1.app.request.ConversationChannelCredentialsRequestBuilderFactory; import com.sinch.sdk.domains.conversation.models.v1.credentials.AppleBusinessChatCredentials; import com.sinch.sdk.domains.conversation.models.v1.credentials.BasicAuthCredentials; +import com.sinch.sdk.domains.conversation.models.v1.credentials.ConversationChannelCredentialsBuilderFactory; import com.sinch.sdk.domains.conversation.models.v1.credentials.InstagramCredentials; import com.sinch.sdk.domains.conversation.models.v1.credentials.KakaoTalkChatCredentials; import com.sinch.sdk.domains.conversation.models.v1.credentials.KakaoTalkCredentials; @@ -41,7 +41,7 @@ public void run() { LOGGER.info("Create conversation Application"); var appleBcChannel = - ConversationChannelCredentialsRequestBuilderFactory.appleBc( + ConversationChannelCredentialsBuilderFactory.appleBc( AppleBusinessChatCredentials.builder() .setApplePayCertificatePassword("appleBc password") .setApplePayCertificateReference("appleBc certificate reference") @@ -51,7 +51,7 @@ public void run() { .build(); var instagramChannel = - ConversationChannelCredentialsRequestBuilderFactory.instagram( + ConversationChannelCredentialsBuilderFactory.instagram( InstagramCredentials.builder() .setBusinessAccountId("instagramChannel business account id") .setToken("instagramChannel token") @@ -59,7 +59,7 @@ public void run() { .build(); var kakaoTalkChannel = - ConversationChannelCredentialsRequestBuilderFactory.kakaoTalk( + ConversationChannelCredentialsBuilderFactory.kakaoTalk( KakaoTalkCredentials.builder() .setKakaotalkPlusFriendId("kakaoTalkChannel a friend id") .setKakaotalkSenderKey("kakaoTalkChannel a sender key") @@ -67,7 +67,7 @@ public void run() { .build(); var kakaoTalkChatChannel = - ConversationChannelCredentialsRequestBuilderFactory.kakaoTalkChat( + ConversationChannelCredentialsBuilderFactory.kakaoTalkChat( KakaoTalkChatCredentials.builder() .setKakaotalkPlusFriendId("kakaoTalkChatChannel a friend id") .setApiKey("kakaoTalkChatChannel api key") @@ -75,7 +75,7 @@ public void run() { .build(); var lineChannel = - ConversationChannelCredentialsRequestBuilderFactory.line( + ConversationChannelCredentialsBuilderFactory.line( LineCredentials.builder() .setToken("lineChannel a token value") .setSecret("lineChannel a secret value") @@ -83,12 +83,12 @@ public void run() { .build(); var messengerChannel = - ConversationChannelCredentialsRequestBuilderFactory.messenger( + ConversationChannelCredentialsBuilderFactory.messenger( StaticTokenCredentials.builder().setToken("messengerChannel a token value").build()) .build(); var mmsChannel = - ConversationChannelCredentialsRequestBuilderFactory.mms( + ConversationChannelCredentialsBuilderFactory.mms( MMSCredentials.builder() .setApiKey("mmsChannel an api key") .setAccountId("mmsChannel an account id") @@ -102,7 +102,7 @@ public void run() { .build(); var rcsChannel = - ConversationChannelCredentialsRequestBuilderFactory.rcs( + ConversationChannelCredentialsBuilderFactory.rcs( StaticBearerCredentials.builder() .setClaimedIdentity("rcsChannel my claimed identity") .setToken("rcsChannel my token") @@ -110,7 +110,7 @@ public void run() { .build(); var smsChannel = - ConversationChannelCredentialsRequestBuilderFactory.sms( + ConversationChannelCredentialsBuilderFactory.sms( StaticBearerCredentials.builder() .setClaimedIdentity(smsServicePlanId) .setToken(smsApiToken) @@ -118,17 +118,17 @@ public void run() { .build(); var telegramChannel = - ConversationChannelCredentialsRequestBuilderFactory.telegram( + ConversationChannelCredentialsBuilderFactory.telegram( TelegramCredentials.builder().setToken("telegramChannel token").build()) .build(); var viberChannel = - ConversationChannelCredentialsRequestBuilderFactory.viber( + ConversationChannelCredentialsBuilderFactory.viber( StaticTokenCredentials.builder().setToken("viberChannel token").build()) .build(); var viberBMChannel = - ConversationChannelCredentialsRequestBuilderFactory.viberBm( + ConversationChannelCredentialsBuilderFactory.viberBm( StaticBearerCredentials.builder() .setClaimedIdentity("viberBMChannel my claimed identity") .setToken("viberBMChannel my token") @@ -136,7 +136,7 @@ public void run() { .build(); var wechatChannel = - ConversationChannelCredentialsRequestBuilderFactory.weChat( + ConversationChannelCredentialsBuilderFactory.weChat( WeChatCredentials.builder() .setAesKey("wechatChannel AES key") .setAppId("wechatChannel app id") @@ -145,7 +145,7 @@ public void run() { .build()) .build(); var whatsAppChannel = - ConversationChannelCredentialsRequestBuilderFactory.whatsApp( + ConversationChannelCredentialsBuilderFactory.whatsApp( StaticBearerCredentials.builder() .setClaimedIdentity("whatsAppChannel my claimed identity") .setToken("whatsAppChannel my token") diff --git a/sample-app/src/main/java/com/sinch/sample/conversation/application/Update.java b/sample-app/src/main/java/com/sinch/sample/conversation/application/Update.java index 122c9a6de..73d84a5eb 100644 --- a/sample-app/src/main/java/com/sinch/sample/conversation/application/Update.java +++ b/sample-app/src/main/java/com/sinch/sample/conversation/application/Update.java @@ -4,7 +4,7 @@ import com.sinch.sdk.domains.conversation.api.v1.AppService; import com.sinch.sdk.domains.conversation.models.v1.app.CallbackSettings; import com.sinch.sdk.domains.conversation.models.v1.app.request.AppUpdateRequest; -import com.sinch.sdk.domains.conversation.models.v1.app.request.ConversationChannelCredentialsRequestBuilderFactory; +import com.sinch.sdk.domains.conversation.models.v1.credentials.ConversationChannelCredentialsBuilderFactory; import com.sinch.sdk.domains.conversation.models.v1.credentials.StaticBearerCredentials; import java.io.IOException; import java.util.Arrays; @@ -32,7 +32,7 @@ public void run() { LOGGER.info(String.format("Updating application '%s'", conversationAppId)); var smsChannel = - ConversationChannelCredentialsRequestBuilderFactory.sms( + ConversationChannelCredentialsBuilderFactory.sms( StaticBearerCredentials.builder() .setClaimedIdentity(smsServicePlanId) .setToken(smsApiToken) From fda13364c285178fa17c0dab16ef65bfb56c9420 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Wed, 25 Sep 2024 09:34:08 +0200 Subject: [PATCH 2/3] feat (Conversation/Credentials): Generated sources synch --- .../v1/app/request/AppCreateRequest.java | 5 +- .../v1/app/request/AppCreateRequestImpl.java | 15 +- .../v1/app/request/AppUpdateRequest.java | 5 +- .../v1/app/request/AppUpdateRequestImpl.java | 15 +- .../ConversationChannelCredentialRequest.java | 245 ---------- ...versationChannelCredentialRequestImpl.java | 443 ------------------ .../AppleBusinessChatCredentials.java | 2 +- .../AppleBusinessChatCredentialsImpl.java | 3 +- .../v1/credentials/BasicAuthCredentials.java | 2 +- .../credentials/BasicAuthCredentialsImpl.java | 2 +- .../ConversationChannelCredentials.java | 156 +----- .../ConversationChannelCredentialsImpl.java | 55 +++ .../v1/credentials/InstagramCredentials.java | 2 +- .../credentials/InstagramCredentialsImpl.java | 2 +- .../credentials/KakaoTalkChatCredentials.java | 2 +- .../KakaoTalkChatCredentialsImpl.java | 2 +- .../v1/credentials/KakaoTalkCredentials.java | 2 +- .../credentials/KakaoTalkCredentialsImpl.java | 2 +- .../v1/credentials/LineCredentials.java | 2 +- .../v1/credentials/LineCredentialsImpl.java | 2 +- .../models/v1/credentials/MMSCredentials.java | 2 +- .../v1/credentials/MMSCredentialsImpl.java | 2 +- .../credentials/StaticBearerCredentials.java | 2 +- .../StaticBearerCredentialsImpl.java | 2 +- .../credentials/StaticTokenCredentials.java | 2 +- .../StaticTokenCredentialsImpl.java | 2 +- .../v1/credentials/TelegramCredentials.java | 2 +- .../credentials/TelegramCredentialsImpl.java | 2 +- .../v1/credentials/WeChatCredentials.java | 2 +- .../v1/credentials/WeChatCredentialsImpl.java | 2 +- 30 files changed, 104 insertions(+), 880 deletions(-) delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialRequest.java delete mode 100644 openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialRequestImpl.java diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppCreateRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppCreateRequest.java index db0de8b37..878c001a3 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppCreateRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppCreateRequest.java @@ -19,6 +19,7 @@ import com.sinch.sdk.domains.conversation.models.v1.app.MessageRetrySettings; import com.sinch.sdk.domains.conversation.models.v1.app.RetentionPolicy; import com.sinch.sdk.domains.conversation.models.v1.app.SmartConversation; +import com.sinch.sdk.domains.conversation.models.v1.credentials.ConversationChannelCredentials; import java.util.List; /** The request sent to the API endpoint to create a new app. */ @@ -30,7 +31,7 @@ public interface AppCreateRequest { * * @return channelCredentials */ - List getChannelCredentials(); + List getChannelCredentials(); /** * Get conversationMetadataReportView @@ -114,7 +115,7 @@ interface Builder { * @return Current builder * @see #getChannelCredentials */ - Builder setChannelCredentials(List channelCredentials); + Builder setChannelCredentials(List channelCredentials); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppCreateRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppCreateRequestImpl.java index 392a6ab90..99f6f5706 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppCreateRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppCreateRequestImpl.java @@ -15,6 +15,7 @@ import com.sinch.sdk.domains.conversation.models.v1.app.MessageRetrySettings; import com.sinch.sdk.domains.conversation.models.v1.app.RetentionPolicy; import com.sinch.sdk.domains.conversation.models.v1.app.SmartConversation; +import com.sinch.sdk.domains.conversation.models.v1.credentials.ConversationChannelCredentials; import java.util.List; import java.util.Objects; @@ -37,7 +38,7 @@ public class AppCreateRequestImpl implements AppCreateRequest { public static final String JSON_PROPERTY_CHANNEL_CREDENTIALS = "channel_credentials"; - private OptionalValue> channelCredentials; + private OptionalValue> channelCredentials; public static final String JSON_PROPERTY_CONVERSATION_METADATA_REPORT_VIEW = "conversation_metadata_report_view"; @@ -80,7 +81,7 @@ public class AppCreateRequestImpl implements AppCreateRequest { public AppCreateRequestImpl() {} protected AppCreateRequestImpl( - OptionalValue> channelCredentials, + OptionalValue> channelCredentials, OptionalValue conversationMetadataReportView, OptionalValue displayName, OptionalValue retentionPolicy, @@ -103,13 +104,13 @@ protected AppCreateRequestImpl( } @JsonIgnore - public List getChannelCredentials() { + public List getChannelCredentials() { return channelCredentials.orElse(null); } @JsonProperty(JSON_PROPERTY_CHANNEL_CREDENTIALS) @JsonInclude(value = JsonInclude.Include.ALWAYS) - public OptionalValue> channelCredentials() { + public OptionalValue> channelCredentials() { return channelCredentials; } @@ -289,8 +290,7 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements AppCreateRequest.Builder { - OptionalValue> channelCredentials = - OptionalValue.empty(); + OptionalValue> channelCredentials = OptionalValue.empty(); OptionalValue conversationMetadataReportView = OptionalValue.empty(); OptionalValue displayName = OptionalValue.empty(); @@ -303,8 +303,7 @@ static class Builder implements AppCreateRequest.Builder { OptionalValue deliveryReportBasedFallback = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_CHANNEL_CREDENTIALS) - public Builder setChannelCredentials( - List channelCredentials) { + public Builder setChannelCredentials(List channelCredentials) { this.channelCredentials = OptionalValue.of(channelCredentials); return this; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppUpdateRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppUpdateRequest.java index c581e5bdd..bf4f164bb 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppUpdateRequest.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppUpdateRequest.java @@ -19,6 +19,7 @@ import com.sinch.sdk.domains.conversation.models.v1.app.MessageRetrySettings; import com.sinch.sdk.domains.conversation.models.v1.app.RetentionPolicy; import com.sinch.sdk.domains.conversation.models.v1.app.SmartConversation; +import com.sinch.sdk.domains.conversation.models.v1.credentials.ConversationChannelCredentials; import java.util.List; /** The request sent to the API endpoint to update the configuration of an app. */ @@ -30,7 +31,7 @@ public interface AppUpdateRequest { * * @return channelCredentials */ - List getChannelCredentials(); + List getChannelCredentials(); /** * Get conversationMetadataReportView @@ -114,7 +115,7 @@ interface Builder { * @return Current builder * @see #getChannelCredentials */ - Builder setChannelCredentials(List channelCredentials); + Builder setChannelCredentials(List channelCredentials); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppUpdateRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppUpdateRequestImpl.java index 1168d42bb..2ebf03342 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppUpdateRequestImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/AppUpdateRequestImpl.java @@ -15,6 +15,7 @@ import com.sinch.sdk.domains.conversation.models.v1.app.MessageRetrySettings; import com.sinch.sdk.domains.conversation.models.v1.app.RetentionPolicy; import com.sinch.sdk.domains.conversation.models.v1.app.SmartConversation; +import com.sinch.sdk.domains.conversation.models.v1.credentials.ConversationChannelCredentials; import java.util.List; import java.util.Objects; @@ -37,7 +38,7 @@ public class AppUpdateRequestImpl implements AppUpdateRequest { public static final String JSON_PROPERTY_CHANNEL_CREDENTIALS = "channel_credentials"; - private OptionalValue> channelCredentials; + private OptionalValue> channelCredentials; public static final String JSON_PROPERTY_CONVERSATION_METADATA_REPORT_VIEW = "conversation_metadata_report_view"; @@ -80,7 +81,7 @@ public class AppUpdateRequestImpl implements AppUpdateRequest { public AppUpdateRequestImpl() {} protected AppUpdateRequestImpl( - OptionalValue> channelCredentials, + OptionalValue> channelCredentials, OptionalValue conversationMetadataReportView, OptionalValue displayName, OptionalValue retentionPolicy, @@ -103,13 +104,13 @@ protected AppUpdateRequestImpl( } @JsonIgnore - public List getChannelCredentials() { + public List getChannelCredentials() { return channelCredentials.orElse(null); } @JsonProperty(JSON_PROPERTY_CHANNEL_CREDENTIALS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue> channelCredentials() { + public OptionalValue> channelCredentials() { return channelCredentials; } @@ -289,8 +290,7 @@ private String toIndentedString(Object o) { @JsonPOJOBuilder(withPrefix = "set") static class Builder implements AppUpdateRequest.Builder { - OptionalValue> channelCredentials = - OptionalValue.empty(); + OptionalValue> channelCredentials = OptionalValue.empty(); OptionalValue conversationMetadataReportView = OptionalValue.empty(); OptionalValue displayName = OptionalValue.empty(); @@ -303,8 +303,7 @@ static class Builder implements AppUpdateRequest.Builder { OptionalValue deliveryReportBasedFallback = OptionalValue.empty(); @JsonProperty(JSON_PROPERTY_CHANNEL_CREDENTIALS) - public Builder setChannelCredentials( - List channelCredentials) { + public Builder setChannelCredentials(List channelCredentials) { this.channelCredentials = OptionalValue.of(channelCredentials); return this; } diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialRequest.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialRequest.java deleted file mode 100644 index a944ec48c..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialRequest.java +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Conversation API | Sinch - * - * OpenAPI document version: 1.0 - * Contact: support@sinch.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * Do not edit the class manually. - */ - -package com.sinch.sdk.domains.conversation.models.v1.app.request; - -import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.sinch.sdk.domains.conversation.models.v1.ConversationChannel; -import com.sinch.sdk.domains.conversation.models.v1.credentials.AppleBusinessChatCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.InstagramCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.KakaoTalkChatCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.KakaoTalkCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.LineCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.MMSCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.StaticBearerCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.StaticTokenCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.TelegramCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.WeChatCredentials; - -/** Enables access to the underlying messaging channel. */ -@JsonDeserialize(builder = ConversationChannelCredentialRequestImpl.Builder.class) -public interface ConversationChannelCredentialRequest { - - /** - * Get staticBearer - * - * @return staticBearer - */ - StaticBearerCredentials getStaticBearer(); - - /** - * Get staticToken - * - * @return staticToken - */ - StaticTokenCredentials getStaticToken(); - - /** - * Get mmsCredentials - * - * @return mmsCredentials - */ - MMSCredentials getMmsCredentials(); - - /** - * Get kakaotalkCredentials - * - * @return kakaotalkCredentials - */ - KakaoTalkCredentials getKakaotalkCredentials(); - - /** - * Get telegramCredentials - * - * @return telegramCredentials - */ - TelegramCredentials getTelegramCredentials(); - - /** - * Get lineCredentials - * - * @return lineCredentials - */ - LineCredentials getLineCredentials(); - - /** - * Get wechatCredentials - * - * @return wechatCredentials - */ - WeChatCredentials getWechatCredentials(); - - /** - * Get instagramCredentials - * - * @return instagramCredentials - */ - InstagramCredentials getInstagramCredentials(); - - /** - * Get applebcCredentials - * - * @return applebcCredentials - */ - AppleBusinessChatCredentials getApplebcCredentials(); - - /** - * Get kakaotalkchatCredentials - * - * @return kakaotalkchatCredentials - */ - KakaoTalkChatCredentials getKakaotalkchatCredentials(); - - /** - * The secret used to verify the channel callbacks for channels which support callback - * verification. The callback verification is not needed for Sinch-managed channels because the - * callbacks are not leaving Sinch internal networks. Max length is 256 characters. Note: leaving - * channel_callback_secret empty for channels with callback verification will disable the - * verification. - * - * @return callbackSecret - */ - String getCallbackSecret(); - - /** - * Get channel - * - * @return channel - */ - ConversationChannel getChannel(); - - /** - * Getting builder - * - * @return New Builder instance - */ - static Builder builder() { - return new ConversationChannelCredentialRequestImpl.Builder(); - } - - /** Dedicated Builder */ - interface Builder { - - /** - * see getter - * - * @param staticBearer see getter - * @return Current builder - * @see #getStaticBearer - */ - Builder setStaticBearer(StaticBearerCredentials staticBearer); - - /** - * see getter - * - * @param staticToken see getter - * @return Current builder - * @see #getStaticToken - */ - Builder setStaticToken(StaticTokenCredentials staticToken); - - /** - * see getter - * - * @param mmsCredentials see getter - * @return Current builder - * @see #getMmsCredentials - */ - Builder setMmsCredentials(MMSCredentials mmsCredentials); - - /** - * see getter - * - * @param kakaotalkCredentials see getter - * @return Current builder - * @see #getKakaotalkCredentials - */ - Builder setKakaotalkCredentials(KakaoTalkCredentials kakaotalkCredentials); - - /** - * see getter - * - * @param telegramCredentials see getter - * @return Current builder - * @see #getTelegramCredentials - */ - Builder setTelegramCredentials(TelegramCredentials telegramCredentials); - - /** - * see getter - * - * @param lineCredentials see getter - * @return Current builder - * @see #getLineCredentials - */ - Builder setLineCredentials(LineCredentials lineCredentials); - - /** - * see getter - * - * @param wechatCredentials see getter - * @return Current builder - * @see #getWechatCredentials - */ - Builder setWechatCredentials(WeChatCredentials wechatCredentials); - - /** - * see getter - * - * @param instagramCredentials see getter - * @return Current builder - * @see #getInstagramCredentials - */ - Builder setInstagramCredentials(InstagramCredentials instagramCredentials); - - /** - * see getter - * - * @param applebcCredentials see getter - * @return Current builder - * @see #getApplebcCredentials - */ - Builder setApplebcCredentials(AppleBusinessChatCredentials applebcCredentials); - - /** - * see getter - * - * @param kakaotalkchatCredentials see getter - * @return Current builder - * @see #getKakaotalkchatCredentials - */ - Builder setKakaotalkchatCredentials(KakaoTalkChatCredentials kakaotalkchatCredentials); - - /** - * see getter - * - * @param callbackSecret see getter - * @return Current builder - * @see #getCallbackSecret - */ - Builder setCallbackSecret(String callbackSecret); - - /** - * see getter - * - * @param channel see getter - * @return Current builder - * @see #getChannel - */ - Builder setChannel(ConversationChannel channel); - - /** - * Create instance - * - * @return The instance build with current builder values - */ - ConversationChannelCredentialRequest build(); - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialRequestImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialRequestImpl.java deleted file mode 100644 index fe88706ce..000000000 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/app/request/ConversationChannelCredentialRequestImpl.java +++ /dev/null @@ -1,443 +0,0 @@ -package com.sinch.sdk.domains.conversation.models.v1.app.request; - -import com.fasterxml.jackson.annotation.JsonFilter; -import com.fasterxml.jackson.annotation.JsonIgnore; -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; -import com.sinch.sdk.core.models.OptionalValue; -import com.sinch.sdk.domains.conversation.models.v1.ConversationChannel; -import com.sinch.sdk.domains.conversation.models.v1.credentials.AppleBusinessChatCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.InstagramCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.KakaoTalkChatCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.KakaoTalkCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.LineCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.MMSCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.StaticBearerCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.StaticTokenCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.TelegramCredentials; -import com.sinch.sdk.domains.conversation.models.v1.credentials.WeChatCredentials; -import java.util.Objects; - -@JsonPropertyOrder({ - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_STATIC_BEARER, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_STATIC_TOKEN, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_MMS_CREDENTIALS, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_KAKAOTALK_CREDENTIALS, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_TELEGRAM_CREDENTIALS, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_LINE_CREDENTIALS, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_WECHAT_CREDENTIALS, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_INSTAGRAM_CREDENTIALS, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_APPLEBC_CREDENTIALS, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_KAKAOTALKCHAT_CREDENTIALS, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_CALLBACK_SECRET, - ConversationChannelCredentialRequestImpl.JSON_PROPERTY_CHANNEL -}) -@JsonFilter("uninitializedFilter") -@JsonInclude(value = JsonInclude.Include.CUSTOM) -public class ConversationChannelCredentialRequestImpl - implements ConversationChannelCredentialRequest { - private static final long serialVersionUID = 1L; - - public static final String JSON_PROPERTY_STATIC_BEARER = "static_bearer"; - - private OptionalValue staticBearer; - - public static final String JSON_PROPERTY_STATIC_TOKEN = "static_token"; - - private OptionalValue staticToken; - - public static final String JSON_PROPERTY_MMS_CREDENTIALS = "mms_credentials"; - - private OptionalValue mmsCredentials; - - public static final String JSON_PROPERTY_KAKAOTALK_CREDENTIALS = "kakaotalk_credentials"; - - private OptionalValue kakaotalkCredentials; - - public static final String JSON_PROPERTY_TELEGRAM_CREDENTIALS = "telegram_credentials"; - - private OptionalValue telegramCredentials; - - public static final String JSON_PROPERTY_LINE_CREDENTIALS = "line_credentials"; - - private OptionalValue lineCredentials; - - public static final String JSON_PROPERTY_WECHAT_CREDENTIALS = "wechat_credentials"; - - private OptionalValue wechatCredentials; - - public static final String JSON_PROPERTY_INSTAGRAM_CREDENTIALS = "instagram_credentials"; - - private OptionalValue instagramCredentials; - - public static final String JSON_PROPERTY_APPLEBC_CREDENTIALS = "applebc_credentials"; - - private OptionalValue applebcCredentials; - - public static final String JSON_PROPERTY_KAKAOTALKCHAT_CREDENTIALS = "kakaotalkchat_credentials"; - - private OptionalValue kakaotalkchatCredentials; - - public static final String JSON_PROPERTY_CALLBACK_SECRET = "callback_secret"; - - private OptionalValue callbackSecret; - - public static final String JSON_PROPERTY_CHANNEL = "channel"; - - private OptionalValue channel; - - public ConversationChannelCredentialRequestImpl() {} - - protected ConversationChannelCredentialRequestImpl( - OptionalValue staticBearer, - OptionalValue staticToken, - OptionalValue mmsCredentials, - OptionalValue kakaotalkCredentials, - OptionalValue telegramCredentials, - OptionalValue lineCredentials, - OptionalValue wechatCredentials, - OptionalValue instagramCredentials, - OptionalValue applebcCredentials, - OptionalValue kakaotalkchatCredentials, - OptionalValue callbackSecret, - OptionalValue channel) { - this.staticBearer = staticBearer; - this.staticToken = staticToken; - this.mmsCredentials = mmsCredentials; - this.kakaotalkCredentials = kakaotalkCredentials; - this.telegramCredentials = telegramCredentials; - this.lineCredentials = lineCredentials; - this.wechatCredentials = wechatCredentials; - this.instagramCredentials = instagramCredentials; - this.applebcCredentials = applebcCredentials; - this.kakaotalkchatCredentials = kakaotalkchatCredentials; - this.callbackSecret = callbackSecret; - this.channel = channel; - } - - @JsonIgnore - public StaticBearerCredentials getStaticBearer() { - return staticBearer.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_STATIC_BEARER) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue staticBearer() { - return staticBearer; - } - - @JsonIgnore - public StaticTokenCredentials getStaticToken() { - return staticToken.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_STATIC_TOKEN) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue staticToken() { - return staticToken; - } - - @JsonIgnore - public MMSCredentials getMmsCredentials() { - return mmsCredentials.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_MMS_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue mmsCredentials() { - return mmsCredentials; - } - - @JsonIgnore - public KakaoTalkCredentials getKakaotalkCredentials() { - return kakaotalkCredentials.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_KAKAOTALK_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue kakaotalkCredentials() { - return kakaotalkCredentials; - } - - @JsonIgnore - public TelegramCredentials getTelegramCredentials() { - return telegramCredentials.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_TELEGRAM_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue telegramCredentials() { - return telegramCredentials; - } - - @JsonIgnore - public LineCredentials getLineCredentials() { - return lineCredentials.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_LINE_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue lineCredentials() { - return lineCredentials; - } - - @JsonIgnore - public WeChatCredentials getWechatCredentials() { - return wechatCredentials.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_WECHAT_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue wechatCredentials() { - return wechatCredentials; - } - - @JsonIgnore - public InstagramCredentials getInstagramCredentials() { - return instagramCredentials.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_INSTAGRAM_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue instagramCredentials() { - return instagramCredentials; - } - - @JsonIgnore - public AppleBusinessChatCredentials getApplebcCredentials() { - return applebcCredentials.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_APPLEBC_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue applebcCredentials() { - return applebcCredentials; - } - - @JsonIgnore - public KakaoTalkChatCredentials getKakaotalkchatCredentials() { - return kakaotalkchatCredentials.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_KAKAOTALKCHAT_CREDENTIALS) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue kakaotalkchatCredentials() { - return kakaotalkchatCredentials; - } - - @JsonIgnore - public String getCallbackSecret() { - return callbackSecret.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_SECRET) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue callbackSecret() { - return callbackSecret; - } - - @JsonIgnore - public ConversationChannel getChannel() { - return channel.orElse(null); - } - - @JsonProperty(JSON_PROPERTY_CHANNEL) - @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - public OptionalValue channel() { - return channel; - } - - /** Return true if this ConversationChannelCredentialRequest object is equal to o. */ - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - ConversationChannelCredentialRequestImpl conversationChannelCredentialRequest = - (ConversationChannelCredentialRequestImpl) o; - return Objects.equals(this.staticBearer, conversationChannelCredentialRequest.staticBearer) - && Objects.equals(this.staticToken, conversationChannelCredentialRequest.staticToken) - && Objects.equals(this.mmsCredentials, conversationChannelCredentialRequest.mmsCredentials) - && Objects.equals( - this.kakaotalkCredentials, conversationChannelCredentialRequest.kakaotalkCredentials) - && Objects.equals( - this.telegramCredentials, conversationChannelCredentialRequest.telegramCredentials) - && Objects.equals( - this.lineCredentials, conversationChannelCredentialRequest.lineCredentials) - && Objects.equals( - this.wechatCredentials, conversationChannelCredentialRequest.wechatCredentials) - && Objects.equals( - this.instagramCredentials, conversationChannelCredentialRequest.instagramCredentials) - && Objects.equals( - this.applebcCredentials, conversationChannelCredentialRequest.applebcCredentials) - && Objects.equals( - this.kakaotalkchatCredentials, - conversationChannelCredentialRequest.kakaotalkchatCredentials) - && Objects.equals(this.callbackSecret, conversationChannelCredentialRequest.callbackSecret) - && Objects.equals(this.channel, conversationChannelCredentialRequest.channel); - } - - @Override - public int hashCode() { - return Objects.hash( - staticBearer, - staticToken, - mmsCredentials, - kakaotalkCredentials, - telegramCredentials, - lineCredentials, - wechatCredentials, - instagramCredentials, - applebcCredentials, - kakaotalkchatCredentials, - callbackSecret, - channel); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append("class ConversationChannelCredentialRequestImpl {\n"); - sb.append(" staticBearer: ").append(toIndentedString(staticBearer)).append("\n"); - sb.append(" staticToken: ").append(toIndentedString(staticToken)).append("\n"); - sb.append(" mmsCredentials: ").append(toIndentedString(mmsCredentials)).append("\n"); - sb.append(" kakaotalkCredentials: ") - .append(toIndentedString(kakaotalkCredentials)) - .append("\n"); - sb.append(" telegramCredentials: ") - .append(toIndentedString(telegramCredentials)) - .append("\n"); - sb.append(" lineCredentials: ").append(toIndentedString(lineCredentials)).append("\n"); - sb.append(" wechatCredentials: ").append(toIndentedString(wechatCredentials)).append("\n"); - sb.append(" instagramCredentials: ") - .append(toIndentedString(instagramCredentials)) - .append("\n"); - sb.append(" applebcCredentials: ").append(toIndentedString(applebcCredentials)).append("\n"); - sb.append(" kakaotalkchatCredentials: ") - .append(toIndentedString(kakaotalkchatCredentials)) - .append("\n"); - sb.append(" callbackSecret: ").append(toIndentedString("***")).append("\n"); - sb.append(" channel: ").append(toIndentedString(channel)).append("\n"); - sb.append("}"); - return sb.toString(); - } - - /** - * Convert the given object to string with each line indented by 4 spaces (except the first line). - */ - private String toIndentedString(Object o) { - if (o == null) { - return "null"; - } - return o.toString().replace("\n", "\n "); - } - - @JsonPOJOBuilder(withPrefix = "set") - static class Builder implements ConversationChannelCredentialRequest.Builder { - OptionalValue staticBearer = OptionalValue.empty(); - OptionalValue staticToken = OptionalValue.empty(); - OptionalValue mmsCredentials = OptionalValue.empty(); - OptionalValue kakaotalkCredentials = OptionalValue.empty(); - OptionalValue telegramCredentials = OptionalValue.empty(); - OptionalValue lineCredentials = OptionalValue.empty(); - OptionalValue wechatCredentials = OptionalValue.empty(); - OptionalValue instagramCredentials = OptionalValue.empty(); - OptionalValue applebcCredentials = OptionalValue.empty(); - OptionalValue kakaotalkchatCredentials = OptionalValue.empty(); - OptionalValue callbackSecret = OptionalValue.empty(); - OptionalValue channel = OptionalValue.empty(); - - @JsonProperty(JSON_PROPERTY_STATIC_BEARER) - public Builder setStaticBearer(StaticBearerCredentials staticBearer) { - this.staticBearer = OptionalValue.of(staticBearer); - return this; - } - - @JsonProperty(JSON_PROPERTY_STATIC_TOKEN) - public Builder setStaticToken(StaticTokenCredentials staticToken) { - this.staticToken = OptionalValue.of(staticToken); - return this; - } - - @JsonProperty(JSON_PROPERTY_MMS_CREDENTIALS) - public Builder setMmsCredentials(MMSCredentials mmsCredentials) { - this.mmsCredentials = OptionalValue.of(mmsCredentials); - return this; - } - - @JsonProperty(JSON_PROPERTY_KAKAOTALK_CREDENTIALS) - public Builder setKakaotalkCredentials(KakaoTalkCredentials kakaotalkCredentials) { - this.kakaotalkCredentials = OptionalValue.of(kakaotalkCredentials); - return this; - } - - @JsonProperty(JSON_PROPERTY_TELEGRAM_CREDENTIALS) - public Builder setTelegramCredentials(TelegramCredentials telegramCredentials) { - this.telegramCredentials = OptionalValue.of(telegramCredentials); - return this; - } - - @JsonProperty(JSON_PROPERTY_LINE_CREDENTIALS) - public Builder setLineCredentials(LineCredentials lineCredentials) { - this.lineCredentials = OptionalValue.of(lineCredentials); - return this; - } - - @JsonProperty(JSON_PROPERTY_WECHAT_CREDENTIALS) - public Builder setWechatCredentials(WeChatCredentials wechatCredentials) { - this.wechatCredentials = OptionalValue.of(wechatCredentials); - return this; - } - - @JsonProperty(JSON_PROPERTY_INSTAGRAM_CREDENTIALS) - public Builder setInstagramCredentials(InstagramCredentials instagramCredentials) { - this.instagramCredentials = OptionalValue.of(instagramCredentials); - return this; - } - - @JsonProperty(JSON_PROPERTY_APPLEBC_CREDENTIALS) - public Builder setApplebcCredentials(AppleBusinessChatCredentials applebcCredentials) { - this.applebcCredentials = OptionalValue.of(applebcCredentials); - return this; - } - - @JsonProperty(JSON_PROPERTY_KAKAOTALKCHAT_CREDENTIALS) - public Builder setKakaotalkchatCredentials(KakaoTalkChatCredentials kakaotalkchatCredentials) { - this.kakaotalkchatCredentials = OptionalValue.of(kakaotalkchatCredentials); - return this; - } - - @JsonProperty(JSON_PROPERTY_CALLBACK_SECRET) - public Builder setCallbackSecret(String callbackSecret) { - this.callbackSecret = OptionalValue.of(callbackSecret); - return this; - } - - @JsonProperty(JSON_PROPERTY_CHANNEL) - public Builder setChannel(ConversationChannel channel) { - this.channel = OptionalValue.of(channel); - return this; - } - - public ConversationChannelCredentialRequest build() { - return new ConversationChannelCredentialRequestImpl( - staticBearer, - staticToken, - mmsCredentials, - kakaotalkCredentials, - telegramCredentials, - lineCredentials, - wechatCredentials, - instagramCredentials, - applebcCredentials, - kakaotalkchatCredentials, - callbackSecret, - channel); - } - } -} diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/AppleBusinessChatCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/AppleBusinessChatCredentials.java index 0724e91f3..d201a526b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/AppleBusinessChatCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/AppleBusinessChatCredentials.java @@ -17,7 +17,7 @@ * must include this object. */ @JsonDeserialize(builder = AppleBusinessChatCredentialsImpl.Builder.class) -public interface AppleBusinessChatCredentials { +public interface AppleBusinessChatCredentials extends ChannelCredentials { /** * The ID that identifies a Business Chat Account (BCA). diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/AppleBusinessChatCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/AppleBusinessChatCredentialsImpl.java index c75333e5d..973d1d592 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/AppleBusinessChatCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/AppleBusinessChatCredentialsImpl.java @@ -17,7 +17,8 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class AppleBusinessChatCredentialsImpl implements AppleBusinessChatCredentials { +public class AppleBusinessChatCredentialsImpl + implements AppleBusinessChatCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_BUSINESS_CHAT_ACCOUNT_ID = "business_chat_account_id"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentials.java index df674e8f4..f758518f8 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentials.java @@ -14,7 +14,7 @@ /** It consists of a username and a password. */ @JsonDeserialize(builder = BasicAuthCredentialsImpl.Builder.class) -public interface BasicAuthCredentials { +public interface BasicAuthCredentials extends ChannelCredentials { /** * Basic auth password. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentialsImpl.java index b88b4fddc..6b0f0214b 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentialsImpl.java @@ -15,7 +15,7 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class BasicAuthCredentialsImpl implements BasicAuthCredentials { +public class BasicAuthCredentialsImpl implements BasicAuthCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_PASSWORD = "password"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentials.java index be70c7cad..76843c003 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentials.java @@ -18,74 +18,11 @@ public interface ConversationChannelCredentials { /** - * Get staticBearer + * Get credentials related to conversation channel * - * @return staticBearer + * @return credentials */ - StaticBearerCredentials getStaticBearer(); - - /** - * Get staticToken - * - * @return staticToken - */ - StaticTokenCredentials getStaticToken(); - - /** - * Get mmsCredentials - * - * @return mmsCredentials - */ - MMSCredentials getMmsCredentials(); - - /** - * Get kakaotalkCredentials - * - * @return kakaotalkCredentials - */ - KakaoTalkCredentials getKakaotalkCredentials(); - - /** - * Get telegramCredentials - * - * @return telegramCredentials - */ - TelegramCredentials getTelegramCredentials(); - - /** - * Get lineCredentials - * - * @return lineCredentials - */ - LineCredentials getLineCredentials(); - - /** - * Get wechatCredentials - * - * @return wechatCredentials - */ - WeChatCredentials getWechatCredentials(); - - /** - * Get instagramCredentials - * - * @return instagramCredentials - */ - InstagramCredentials getInstagramCredentials(); - - /** - * Get applebcCredentials - * - * @return applebcCredentials - */ - AppleBusinessChatCredentials getApplebcCredentials(); - - /** - * Get kakaotalkchatCredentials - * - * @return kakaotalkchatCredentials - */ - KakaoTalkChatCredentials getKakaotalkchatCredentials(); + ChannelCredentials getCredentials(); /** * The secret used to verify the channel callbacks for channels which support callback @@ -134,92 +71,11 @@ interface Builder { /** * see getter * - * @param staticBearer see getter - * @return Current builder - * @see #getStaticBearer - */ - Builder setStaticBearer(StaticBearerCredentials staticBearer); - - /** - * see getter - * - * @param staticToken see getter - * @return Current builder - * @see #getStaticToken - */ - Builder setStaticToken(StaticTokenCredentials staticToken); - - /** - * see getter - * - * @param mmsCredentials see getter - * @return Current builder - * @see #getMmsCredentials - */ - Builder setMmsCredentials(MMSCredentials mmsCredentials); - - /** - * see getter - * - * @param kakaotalkCredentials see getter - * @return Current builder - * @see #getKakaotalkCredentials - */ - Builder setKakaotalkCredentials(KakaoTalkCredentials kakaotalkCredentials); - - /** - * see getter - * - * @param telegramCredentials see getter - * @return Current builder - * @see #getTelegramCredentials - */ - Builder setTelegramCredentials(TelegramCredentials telegramCredentials); - - /** - * see getter - * - * @param lineCredentials see getter - * @return Current builder - * @see #getLineCredentials - */ - Builder setLineCredentials(LineCredentials lineCredentials); - - /** - * see getter - * - * @param wechatCredentials see getter - * @return Current builder - * @see #getWechatCredentials - */ - Builder setWechatCredentials(WeChatCredentials wechatCredentials); - - /** - * see getter - * - * @param instagramCredentials see getter - * @return Current builder - * @see #getInstagramCredentials - */ - Builder setInstagramCredentials(InstagramCredentials instagramCredentials); - - /** - * see getter - * - * @param applebcCredentials see getter - * @return Current builder - * @see #getApplebcCredentials - */ - Builder setApplebcCredentials(AppleBusinessChatCredentials applebcCredentials); - - /** - * see getter - * - * @param kakaotalkchatCredentials see getter + * @param credentials see getter * @return Current builder - * @see #getKakaotalkchatCredentials + * @see #getCredentials */ - Builder setKakaotalkchatCredentials(KakaoTalkChatCredentials kakaotalkchatCredentials); + Builder setCredentials(ChannelCredentials credentials); /** * see getter diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsImpl.java index 030e11f0e..9a44a4c0f 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/ConversationChannelCredentialsImpl.java @@ -9,6 +9,7 @@ import com.sinch.sdk.core.models.OptionalValue; import com.sinch.sdk.domains.conversation.models.v1.ConversationChannel; import java.util.Objects; +import java.util.stream.Stream; @JsonPropertyOrder({ ConversationChannelCredentialsImpl.JSON_PROPERTY_STATIC_BEARER, @@ -120,6 +121,25 @@ protected ConversationChannelCredentialsImpl( this.channelKnownId = channelKnownId; } + @JsonIgnore + public ChannelCredentials getCredentials() { + return Stream.of( + applebcCredentials, + instagramCredentials, + kakaotalkCredentials, + kakaotalkchatCredentials, + lineCredentials, + mmsCredentials, + staticBearer, + staticToken, + telegramCredentials, + wechatCredentials) + .filter(OptionalValue::isPresent) + .map(OptionalValue::get) + .findFirst() + .orElse(null); + } + @JsonIgnore public StaticBearerCredentials getStaticBearer() { return staticBearer.orElse(null); @@ -382,6 +402,41 @@ static class Builder implements ConversationChannelCredentials.Builder { OptionalValue state = OptionalValue.empty(); OptionalValue channelKnownId = OptionalValue.empty(); + @JsonIgnore + public Builder setCredentials(ChannelCredentials credentials) { + if (credentials instanceof StaticBearerCredentials) { + setStaticBearer((StaticBearerCredentials) credentials); + } + if (credentials instanceof StaticTokenCredentials) { + setStaticToken((StaticTokenCredentials) credentials); + } + if (credentials instanceof MMSCredentials) { + setMmsCredentials((MMSCredentials) credentials); + } + if (credentials instanceof KakaoTalkCredentials) { + setKakaotalkCredentials((KakaoTalkCredentials) credentials); + } + if (credentials instanceof TelegramCredentials) { + setTelegramCredentials((TelegramCredentials) credentials); + } + if (credentials instanceof LineCredentials) { + setLineCredentials((LineCredentials) credentials); + } + if (credentials instanceof WeChatCredentials) { + setWechatCredentials((WeChatCredentials) credentials); + } + if (credentials instanceof InstagramCredentials) { + setInstagramCredentials((InstagramCredentials) credentials); + } + if (credentials instanceof AppleBusinessChatCredentials) { + setApplebcCredentials((AppleBusinessChatCredentials) credentials); + } + if (credentials instanceof KakaoTalkChatCredentials) { + setKakaotalkchatCredentials((KakaoTalkChatCredentials) credentials); + } + return this; + } + @JsonProperty(JSON_PROPERTY_STATIC_BEARER) public Builder setStaticBearer(StaticBearerCredentials staticBearer) { this.staticBearer = OptionalValue.of(staticBearer); diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/InstagramCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/InstagramCredentials.java index d2e04ec8f..b997f3a6d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/InstagramCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/InstagramCredentials.java @@ -17,7 +17,7 @@ * must include this object. */ @JsonDeserialize(builder = InstagramCredentialsImpl.Builder.class) -public interface InstagramCredentials { +public interface InstagramCredentials extends ChannelCredentials { /** * The static token. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/InstagramCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/InstagramCredentialsImpl.java index 3675c73eb..8ba7fdbe2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/InstagramCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/InstagramCredentialsImpl.java @@ -15,7 +15,7 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class InstagramCredentialsImpl implements InstagramCredentials { +public class InstagramCredentialsImpl implements InstagramCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_TOKEN = "token"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkChatCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkChatCredentials.java index 4c03b4f47..1eb8a5e28 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkChatCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkChatCredentials.java @@ -17,7 +17,7 @@ * you must include this object. */ @JsonDeserialize(builder = KakaoTalkChatCredentialsImpl.Builder.class) -public interface KakaoTalkChatCredentials { +public interface KakaoTalkChatCredentials extends ChannelCredentials { /** * Kakaotalk Plus friend ID. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkChatCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkChatCredentialsImpl.java index daf8b9afb..f23805f4e 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkChatCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkChatCredentialsImpl.java @@ -15,7 +15,7 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class KakaoTalkChatCredentialsImpl implements KakaoTalkChatCredentials { +public class KakaoTalkChatCredentialsImpl implements KakaoTalkChatCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_KAKAOTALK_PLUS_FRIEND_ID = "kakaotalk_plus_friend_id"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkCredentials.java index caa94a27c..a22cefb51 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkCredentials.java @@ -17,7 +17,7 @@ * must include this object. */ @JsonDeserialize(builder = KakaoTalkCredentialsImpl.Builder.class) -public interface KakaoTalkCredentials { +public interface KakaoTalkCredentials extends ChannelCredentials { /** * KakaoTalk Business Channel ID. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkCredentialsImpl.java index 5c6f4f16b..158457031 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/KakaoTalkCredentialsImpl.java @@ -15,7 +15,7 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class KakaoTalkCredentialsImpl implements KakaoTalkCredentials { +public class KakaoTalkCredentialsImpl implements KakaoTalkCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_KAKAOTALK_PLUS_FRIEND_ID = "kakaotalk_plus_friend_id"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/LineCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/LineCredentials.java index 5d0a00a45..d178d53c2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/LineCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/LineCredentials.java @@ -17,7 +17,7 @@ * include this object. */ @JsonDeserialize(builder = LineCredentialsImpl.Builder.class) -public interface LineCredentials { +public interface LineCredentials extends ChannelCredentials { /** * The token for the LINE channel to which you are connecting. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/LineCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/LineCredentialsImpl.java index d203227b3..27f2b9e19 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/LineCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/LineCredentialsImpl.java @@ -15,7 +15,7 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class LineCredentialsImpl implements LineCredentials { +public class LineCredentialsImpl implements LineCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_TOKEN = "token"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/MMSCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/MMSCredentials.java index 7342e1275..d8f066f23 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/MMSCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/MMSCredentials.java @@ -17,7 +17,7 @@ * include this object. */ @JsonDeserialize(builder = MMSCredentialsImpl.Builder.class) -public interface MMSCredentials { +public interface MMSCredentials extends ChannelCredentials { /** * MMS Account ID. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/MMSCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/MMSCredentialsImpl.java index b013f0806..8b2b60670 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/MMSCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/MMSCredentialsImpl.java @@ -16,7 +16,7 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class MMSCredentialsImpl implements MMSCredentials { +public class MMSCredentialsImpl implements MMSCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_ACCOUNT_ID = "account_id"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticBearerCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticBearerCredentials.java index 046c67491..157232b34 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticBearerCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticBearerCredentials.java @@ -16,7 +16,7 @@ * This object is required for channels which use a bearer-type of credential for authentication. */ @JsonDeserialize(builder = StaticBearerCredentialsImpl.Builder.class) -public interface StaticBearerCredentials { +public interface StaticBearerCredentials extends ChannelCredentials { /** * The claimed identity for the channel. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticBearerCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticBearerCredentialsImpl.java index 37c976a75..1f8eb1766 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticBearerCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticBearerCredentialsImpl.java @@ -15,7 +15,7 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class StaticBearerCredentialsImpl implements StaticBearerCredentials { +public class StaticBearerCredentialsImpl implements StaticBearerCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_CLAIMED_IDENTITY = "claimed_identity"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticTokenCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticTokenCredentials.java index d99222d20..934e91626 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticTokenCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticTokenCredentials.java @@ -14,7 +14,7 @@ /** This object is required for channels which use a static token credential for authentication. */ @JsonDeserialize(builder = StaticTokenCredentialsImpl.Builder.class) -public interface StaticTokenCredentials { +public interface StaticTokenCredentials extends ChannelCredentials { /** * The static token for the channel. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticTokenCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticTokenCredentialsImpl.java index 0dfc57e3a..4efd3d94d 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticTokenCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/StaticTokenCredentialsImpl.java @@ -12,7 +12,7 @@ @JsonPropertyOrder({StaticTokenCredentialsImpl.JSON_PROPERTY_TOKEN}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class StaticTokenCredentialsImpl implements StaticTokenCredentials { +public class StaticTokenCredentialsImpl implements StaticTokenCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_TOKEN = "token"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/TelegramCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/TelegramCredentials.java index 002b269df..3cad824de 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/TelegramCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/TelegramCredentials.java @@ -17,7 +17,7 @@ * you must include this object. */ @JsonDeserialize(builder = TelegramCredentialsImpl.Builder.class) -public interface TelegramCredentials { +public interface TelegramCredentials extends ChannelCredentials { /** * The token for the Telegram bot to which you are connecting. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/TelegramCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/TelegramCredentialsImpl.java index 152035af1..8432a7af2 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/TelegramCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/TelegramCredentialsImpl.java @@ -12,7 +12,7 @@ @JsonPropertyOrder({TelegramCredentialsImpl.JSON_PROPERTY_TOKEN}) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class TelegramCredentialsImpl implements TelegramCredentials { +public class TelegramCredentialsImpl implements TelegramCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_TOKEN = "token"; diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/WeChatCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/WeChatCredentials.java index f7c701e45..c00bc6307 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/WeChatCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/WeChatCredentials.java @@ -17,7 +17,7 @@ * include this object. */ @JsonDeserialize(builder = WeChatCredentialsImpl.Builder.class) -public interface WeChatCredentials { +public interface WeChatCredentials extends ChannelCredentials { /** * The AppID(Developer ID) for the WeChat channel to which you are connecting. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/WeChatCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/WeChatCredentialsImpl.java index 88e56378a..094049933 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/WeChatCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/WeChatCredentialsImpl.java @@ -17,7 +17,7 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class WeChatCredentialsImpl implements WeChatCredentials { +public class WeChatCredentialsImpl implements WeChatCredentials, ChannelCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_APP_ID = "app_id"; From a2e0ed07fbdb7990360b38ead519e8fd0f59c437 Mon Sep 17 00:00:00 2001 From: Jean-Pierre Portier Date: Wed, 25 Sep 2024 10:57:25 +0200 Subject: [PATCH 3/3] feat (Conversation/Credentials): Generated sources synch --- .../models/v1/credentials/BasicAuthCredentials.java | 2 +- .../models/v1/credentials/BasicAuthCredentialsImpl.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentials.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentials.java index f758518f8..df674e8f4 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentials.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentials.java @@ -14,7 +14,7 @@ /** It consists of a username and a password. */ @JsonDeserialize(builder = BasicAuthCredentialsImpl.Builder.class) -public interface BasicAuthCredentials extends ChannelCredentials { +public interface BasicAuthCredentials { /** * Basic auth password. diff --git a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentialsImpl.java b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentialsImpl.java index 6b0f0214b..b88b4fddc 100644 --- a/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentialsImpl.java +++ b/openapi-contracts/src/main/com/sinch/sdk/domains/conversation/models/v1/credentials/BasicAuthCredentialsImpl.java @@ -15,7 +15,7 @@ }) @JsonFilter("uninitializedFilter") @JsonInclude(value = JsonInclude.Include.CUSTOM) -public class BasicAuthCredentialsImpl implements BasicAuthCredentials, ChannelCredentials { +public class BasicAuthCredentialsImpl implements BasicAuthCredentials { private static final long serialVersionUID = 1L; public static final String JSON_PROPERTY_PASSWORD = "password";