diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 331805d..f1c4512 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,9 +21,9 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: Checkout the repo - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 - name: Setup Java - uses: actions/setup-java@3a4f6e1af504cf6a31855fa899c6aa5355ba6c12 + uses: actions/setup-java@3b6c050358614dd082e53cdbc55580431fc4e437 with: distribution: 'temurin' java-version: ${{ matrix.java }} diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 4302acb..2f3c4be 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,4 +1,4 @@ -name: "CodeQL" +name: CodeQL on: push: branches: [ "main" ] @@ -27,13 +27,13 @@ jobs: build-mode: autobuild steps: - name: Checkout repository - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 + uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 - name: Initialize CodeQL - uses: github/codeql-action/init@1bb15d06a6fbb5d9d9ffd228746bf8ee208caec8 + uses: github/codeql-action/init@486ab5a2922b634015408a83e10f6867efb5922c with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@1bb15d06a6fbb5d9d9ffd228746bf8ee208caec8 + uses: github/codeql-action/analyze@486ab5a2922b634015408a83e10f6867efb5922c with: category: "/language:${{matrix.language}}" diff --git a/SNIPPETS.md b/SNIPPETS.md index b5b8408..8e3f71f 100644 --- a/SNIPPETS.md +++ b/SNIPPETS.md @@ -9,9 +9,7 @@ This file was generated by running [AggregateSnippets.java](src/main/java/Aggreg - [**Conversation**](#conversation) - [**Number Insight**](#number-insight) - [**JWT**](#jwt) -- [**Meetings**](#meetings) - [**Messages**](#messages) -- [**Fraud Detection**](#fraud-detection) - [**Numbers**](#numbers) - [**Redact**](#redact) - [**SIM Swap**](#sim-swap) @@ -88,9 +86,9 @@ System.out.println(response.getId() + " created at " + response.getCreated()); ### List Secrets ```java -ListSecretsResponse response = client.getAccountClient().listSecrets(ACCOUNT_ID); +List response = client.getAccountClient().listSecrets(ACCOUNT_ID); -for (SecretResponse secret : response.getSecrets()) { +for (SecretResponse secret : response) { System.out.println(secret.getId() + " created at " + secret.getCreated()); } ``` @@ -107,10 +105,16 @@ Application application = client.getApplicationClient().createApplication( Application.builder() .name(APPLICATION_NAME) .addCapability(Messages.builder() - .addWebhook(Webhook.Type.INBOUND, - new Webhook("https://example.com/webhooks/inbound", HttpMethod.POST)) - .addWebhook(Webhook.Type.STATUS, - new Webhook("https://example.com/webhooks/status", HttpMethod.POST)) + .inbound(Webhook.builder() + .address("https://example.com/webhooks/inbound") + .method(HttpMethod.POST) + .build() + ) + .status(Webhook.builder() + .address("https://example.com/webhooks/status") + .method(HttpMethod.POST) + .build() + ) .build() ) .build() @@ -142,22 +146,37 @@ ApplicationClient applicationClient = client.getApplicationClient(); Application existingApplication = applicationClient.getApplication(VONAGE_APPLICATION_ID); Capability messages = Messages.builder() - .addWebhook(Webhook.Type.INBOUND, - new Webhook("https://example.com/webhooks/inbound", HttpMethod.POST)) - .addWebhook(Webhook.Type.STATUS, - new Webhook("https://example.com/webhooks/status", HttpMethod.POST)) + .inbound(Webhook.builder() + .address("https://example.com/webhooks/inbound") + .method(HttpMethod.POST) + .build() + ) + .status(Webhook.builder() + .address("https://example.com/webhooks/status") + .method(HttpMethod.POST) + .build() + ) .build(); Capability voice = Voice.builder() - .addWebhook(Webhook.Type.ANSWER, - new Webhook("https://example.com/webhooks/answer", HttpMethod.POST)) - .addWebhook(Webhook.Type.EVENT, - new Webhook("https://example.com/webhooks/event", HttpMethod.POST)) + .answer(Webhook.builder() + .address("https://example.com/webhooks/answer") + .method(HttpMethod.POST) + .build() + ) + .event(Webhook.builder() + .address("https://example.com/webhooks/event") + .method(HttpMethod.POST) + .build() + ) .build(); Capability rtc = Rtc.builder() - .addWebhook(Webhook.Type.EVENT, - new Webhook("https://example.com/webhooks/event", HttpMethod.POST)) + .event(Webhook.builder() + .address("https://example.com/webhooks/event") + .method(HttpMethod.POST) + .build() + ) .build(); Capability vbc = Vbc.builder().build(); @@ -238,7 +257,7 @@ System.out.println(event); ```java var event = client.getConversationsClient().createEvent( - CONV_ID, CustomEvent.builder() + CONV_ID, CustomEvent.builder("my_custom_event_name") .from(CONV_MEMBER_ID) .body(Map.of("your", "data")) .build() @@ -336,7 +355,7 @@ if (roaming == null) { } else { System.out.println("Roaming status: " + roaming.getStatus()); - if (response.getRoaming().getStatus() == RoamingDetails.RoamingStatus.ROAMING) { + if (response.getRoaming().getStatus() == RoamingStatus.ROAMING) { System.out.print(" Currently roaming in: " + roaming.getRoamingCountryCode()); System.out.println(" on the network " + roaming.getRoamingNetworkName()); } @@ -362,9 +381,11 @@ System.out.println("Original carrier: " + response.getOriginalCarrier().getName( ### Advanced Insight Async ```java -client.getInsightClient().getAdvancedNumberInsight( - AdvancedInsightRequest.builder(INSIGHT_NUMBER) - .async(true).callback(INSIGHT_CALLBACK_URL).build() +var response = client.getInsightClient().getAdvancedAsyncNumberInsight( + AdvancedInsightAsyncRequest.builder() + .number(INSIGHT_NUMBER) + .callback(INSIGHT_CALLBACK_URL) + .build() ); ``` ### Advanced Insight With CNAM @@ -398,7 +419,7 @@ if (roaming == null) { } else { System.out.println("Roaming status: " + roaming.getStatus()); - if (response.getRoaming().getStatus() == RoamingDetails.RoamingStatus.ROAMING) { + if (response.getRoaming().getStatus() == RoamingStatus.ROAMING) { System.out.print(" Currently roaming in: " + roaming.getRoamingCountryCode()); System.out.println(" on the network " + roaming.getRoamingNetworkName()); } @@ -413,7 +434,7 @@ System.out.println("Type: " + response.getCallerIdentity().getType()); ```java port(3000); Spark.post("/webhooks/insight", (req, res) -> { - AdvancedInsightResponse response = AdvancedInsightResponse.fromJson(req.body()); + AdvancedInsightResponse response = Jsonable.fromJson(req.body()); System.out.println("Country: " + response.getCountryName()); res.status(204); @@ -465,119 +486,6 @@ String token = Jwt.builder() .build() .generate(); ``` -## Meetings -### Delete Theme - -```java -client.getMeetingsClient().deleteTheme(THEME_ID, true); -System.out.println("Deleted theme "+THEME_ID); -``` -### List Themes - -```java -List themes = client.getMeetingsClient().listThemes(); -themes.forEach(theme -> System.out.println(theme.getThemeName() + " ("+theme.getThemeId()+")")); -``` -### List Dial In Numbers - -```java -List dialInNumbers = client.getMeetingsClient().listDialNumbers(); -dialInNumbers.forEach(din -> System.out.println(din.getDisplayName()+": "+din.getNumber())); -``` -### Delete Recording - -```java -client.getMeetingsClient().deleteRecording(RECORDING_ID); -System.out.println("Deleted recording "+RECORDING_ID); -``` -### Get Room - -```java -MeetingRoom room = client.getMeetingsClient().getRoom(ROOM_ID); -System.out.println(room.getDisplayName() + " ("+room.getId()+")"); -``` -### Upload Logo - -```java -client.getMeetingsClient().updateThemeLogo(THEME_ID, LOGO_TYPE, LOGO_FILEPATH); -System.out.println("Updated '"+LOGO_TYPE+"' logo for theme "+THEME_ID); -``` -### Create Long Term Room - -```java -MeetingRoom room = MeetingRoom.builder(DISPLAY_NAME) - .type(RoomType.LONG_TERM) - .expiresAt(EXPIRATION_DATE) - .build(); -client.getMeetingsClient().createRoom(room); -System.out.println("Created room "+room.getId()); -``` -### Update Room - -```java -UpdateRoomRequest request = UpdateRoomRequest.builder().themeId(THEME_ID).build(); -MeetingRoom room = client.getMeetingsClient().updateRoom(ROOM_ID, request); -System.out.println("Updated room '"+room.getDisplayName()+"' ("+room.getId()+")"); -``` -### List Recordings - -```java -List recordings = client.getMeetingsClient().listRecordings(SESSION_ID); -recordings.forEach(recording -> System.out.println(recording.getId())); -``` -### Update Application - -```java -UpdateApplicationRequest request = UpdateApplicationRequest.builder() - .defaultThemeId(THEME_ID).build(); -Application application = client.getMeetingsClient().updateApplication(request); -System.out.println("Updated application "+application.getApplicationId()); -``` -### List Rooms By Theme - -```java -List rooms = client.getMeetingsClient().searchRoomsByTheme(THEME_ID); -rooms.forEach(room -> System.out.println(room.getDisplayName() + " ("+room.getId()+")")); -``` -### Update Theme - -```java -Theme theme = Theme.builder().mainColor(MAIN_COLOR).brandText(BRAND_TEXT).build(); -client.getMeetingsClient().updateTheme(THEME_ID, theme); -System.out.println("Updated theme '"+theme.getThemeName()+"' ("+theme.getThemeId()+")"); -``` -### Create Instant Room - -```java -MeetingRoom room = MeetingRoom.builder(DISPLAY_NAME).type(RoomType.INSTANT).build(); -client.getMeetingsClient().createRoom(room); -System.out.println("Created room "+room.getId()); -``` -### Get Recording - -```java -Recording recording = client.getMeetingsClient().getRecording(RECORDING_ID); -System.out.println(recording.getId()); -``` -### List Rooms - -```java -List rooms = client.getMeetingsClient().listRooms(); -rooms.forEach(room -> System.out.println(room.getDisplayName() + " ("+room.getId()+")")); -``` -### Get Theme - -```java -Theme theme = client.getMeetingsClient().getTheme(THEME_ID); -System.out.println(theme.getThemeName()); -``` -### Create Theme - -```java -Theme theme = Theme.builder().mainColor(MAIN_COLOR).brandText(BRAND_TEXT).build(); -client.getMeetingsClient().createTheme(theme); -System.out.println("Updated theme '"+theme.getThemeName()+"' ("+theme.getThemeId()+")"); -``` ## Messages ### SMS #### Send SMS Text @@ -1972,21 +1880,6 @@ var response = client.getMessagesClient().sendMessage( ); System.out.println("Message sent successfully. ID: "+response.getMessageUuid()); ``` -## Fraud Detection -### Fraud Score - -```java -var response = client.getNumberInsight2Client().fraudCheck(INSIGHT_NUMBER, Insight.FRAUD_SCORE); -var fraudScore = response.getFraudScore(); -System.out.println(fraudScore); -``` -### SIM Swap - -```java -var response = client.getNumberInsight2Client().fraudCheck(INSIGHT_NUMBER, Insight.SIM_SWAP); -var simSwap = response.getSimSwap(); -System.out.println(simSwap); -``` ## Numbers ### Cancel Number @@ -2035,13 +1928,13 @@ client.getNumbersClient().updateNumber( ### List Numbers ```java -ListNumbersResponse response = client.getNumbersClient().listNumbers( +List response = client.getNumbersClient().listNumbers( ListNumbersFilter.builder() .pattern(NUMBER_SEARCH_PATTERN, NUMBER_SEARCH_CRITERIA) .build() ); -for (OwnedNumber number : response.getNumbers()) { +for (OwnedNumber number : response) { System.out.println("Tel: " + number.getMsisdn()); System.out.println("Type: " + number.getType()); System.out.println("Country: " + number.getCountry()); @@ -2051,7 +1944,7 @@ for (OwnedNumber number : response.getNumbers()) { ### RedactA Transaction ```java -client.getRedactClient().redactTransaction(VONAGE_REDACT_ID, RedactRequest.Product.SMS); +client.getRedactClient().redactTransaction(VONAGE_REDACT_ID, Product.SMS); ``` ## SIM Swap ### Retrieve SIM Swap Date @@ -2233,6 +2126,7 @@ right 2025 Vonage package com.vonage.quickstart.sms; import com.vonage.client.VonageClient; +import com.vonage.client.auth.hashutils.HashType; import com.vonage.client.sms.MessageStatus; import com.vonage.client.sms.SmsSubmissionResponse; import com.vonage.client.sms.messages.TextMessage; @@ -2245,7 +2139,7 @@ public class SendSignedSms { VonageClient client = VonageClient.builder() .apiKey(VONAGE_API_KEY) .signatureSecret(VONAGE_SIGNATURE_SECRET) - .hashType(HashUtil.HashType.MD5).build(); + .hashType(HashType.MD5).build(); TextMessage message = new TextMessage( SMS_SENDER_ID, SMS_TO_NUMBER, @@ -2515,7 +2409,6 @@ System.out.println("Verification sent: " + response.getRequestId()); var request = VerificationRequest.builder() .workflows(List.of( new SilentAuthWorkflow(VERIFY_NUMBER), - new WhatsappCodelessWorkflow(VERIFY_NUMBER, VERIFY_WHATSAPP_NUMBER), new EmailWorkflow(VERIFY_TO_EMAIL, VERIFY_FROM_EMAIL), new WhatsappWorkflow(VERIFY_NUMBER, VERIFY_WHATSAPP_NUMBER), new SmsWorkflow(VERIFY_NUMBER), @@ -2667,16 +2560,6 @@ System.out.println(fragment); ```java client.getVerify2Client().deleteTemplateFragment(VERIFY_TEMPLATE_ID, VERIFY_TEMPLATE_FRAGMENT_ID); ``` -### Send Request WhatsApp Interactive - -```java -VerificationResponse response = client.getVerify2Client().sendVerification( - VerificationRequest.builder() - .addWorkflow(new WhatsappCodelessWorkflow(VERIFY_NUMBER, VERIFY_WHATSAPP_NUMBER)) - .brand(VERIFY_BRAND_NAME).build() -); -System.out.println("Verification sent: " + response.getRequestId()); -``` ### Cancel Request ```java @@ -2757,7 +2640,8 @@ get("/webhooks/answer", (req, res) -> { Map payload = new HashMap<>(); payload.put("foo", "bar"); - NotifyAction notify = NotifyAction.builder(payload) + NotifyAction notify = NotifyAction.builder() + .payload(payload) .eventUrl(notifyUrl) .build(); @@ -2975,16 +2859,15 @@ Spark.post("/webhooks/events", eventRoute); ### Retrieve Info For All Calls ```java -Date yesterday = new Date(Instant.now().minus(Duration.ofDays(1)).toEpochMilli()); -Date now = new Date(); +Instant now = Instant.now(), yesterday = now.minus(Duration.ofDays(1)); CallsFilter filter = CallsFilter.builder() - .dateStart(yesterday) - .dateEnd(now) + .startDate(yesterday) + .endDate(now) .build(); CallInfoPage calls = client.getVoiceClient().listCalls(filter); -System.out.println(calls.toJson()); +calls.forEach(System.out::println); ``` ### Record Call Split Audio @@ -2998,6 +2881,160 @@ Route answerRoute = (req, res) -> { RecordAction record = RecordAction.builder() .eventUrl(recordingUrl) .channels(2) + .build(); + + ConnectAction connect = ConnectAction.builder(PhoneEndpoint.builder(VOICE_TO_NUMBER).build()) + .from(VONAGE_VIRTUAL_NUMBER).build(); + + res.type("application/json"); + + return new Ncco(record, connect); +}; + +/* + * Route which prints out the recording URL it is given to stdout. + */ +Route recordingRoute = (req, res) -> { + System.out.println(EventWebhook.fromJson(req.body()).getRecordingUrl()); + + res.status(204); + return ""; +}; + +Spark.port(3000); +Spark.get("/webhooks/answer", answerRoute); +Spark.post("/webhooks/recordings", recordingRoute); +``` +### DTMF Input + +```java +/* + * Route to answer incoming calls. + */ +Route answerRoute = (req, res) -> { + TalkAction intro = TalkAction + .builder("Hello. Please press any key to continue.") + .build(); + + InputAction input = InputAction.builder() + .eventUrl(String.format("%s://%s/webhooks/dtmf", req.scheme(), req.host())) + .dtmf(DtmfSettings.builder().maxDigits(1).build()) + .build(); + + + res.type("application/json"); + + return new Ncco(intro, input).toJson(); +}; + +/* + * Route which returns NCCO saying which DTMF code was received. + */ +Route inputRoute = (req, res) -> { + EventWebhook event = EventWebhook.fromJson(req.body()); + + TalkAction response = TalkAction.builder(String.format("You pressed %s, Goodbye.", + event.getDtmf().getDigits() + )).build(); + + res.type("application/json"); + + return new Ncco(response).toJson(); +}; + +Spark.port(3000); +Spark.get("/webhooks/answer", answerRoute); +Spark.post("/webhooks/dtmf", inputRoute); +``` +### Send DTMF To Call + +```java +var response = client.getVoiceClient().sendDtmf(VOICE_CALL_ID, VOICE_DTMF_DIGITS); +System.out.println(response); +``` +### Connect Inbound Call + +```java +/* + * Route to answer incoming calls with an NCCO response. + */ +Route answerRoute = (req, res) -> { + ConnectAction connect = ConnectAction.builder() + .endpoint(PhoneEndpoint.builder(VOICE_TO_NUMBER).build()) + .from(VONAGE_VIRTUAL_NUMBER) + .build(); + + res.type("application/json"); + + return new Ncco(connect).toJson(); +}; + +Spark.port(3000); +Spark.get("/webhooks/answer", answerRoute); +Spark.post("/webhooks/answer", answerRoute); +``` +### Send Talk To Call + +```java +var payload = TalkPayload.builder(VOICE_TEXT).language(VOICE_LANGUAGE).build(); +client.getVoiceClient().startTalk(VOICE_CALL_ID, payload); +``` +### Outbound Text To Speech + +```java +client.getVoiceClient().createCall(new Call(VOICE_TO_NUMBER, VONAGE_VIRTUAL_NUMBER, VOICE_ANSWER_URL)); +``` +### ASR Input + +```java +/* + * Route to answer incoming calls. + */ +Route answerCallRoute = (req, res) -> { + TalkAction intro = TalkAction + .builder("Please say something") + .build(); + + SpeechSettings speechSettings = SpeechSettings.builder() + .language(Language.ENGLISH_UNITED_STATES).build(); + + InputAction input = InputAction.builder() + .eventUrl(String.format("%s://%s/webhooks/asr", req.scheme(), req.host())) + .speech(speechSettings) + .build(); + + + res.type("application/json"); + + return new Ncco(intro, input).toJson(); +}; + +/* + * Route which returns NCCO saying which word was recognized. + */ +Route speechInputRoute = (req, res) -> { + EventWebhook event = EventWebhook.fromJson(req.body()); + + TalkAction response = TalkAction.builder(String.format("You said %s, Goodbye.", + event.getSpeech().getResults().get(0).getText() + )).build(); + res.type("application/json"); + + return new Ncco(response).toJson(); +}; + +Spark.port(3000); +Spark.get("/webhooks/answer", answerCallRoute); +Spark.post("/webhooks/asr", speechInputRoute); +``` +### Outbound Text To Speech With NCCO + +```java +Ncco ncco = new Ncco(TalkAction.builder("This is a text to speech call from Vonage").build()); + +client.getVoiceClient().createCall(new Call(VOICE_TO_NUMBER, VONAGE_VIRTUAL_NUMBER, ncco.getActions())); +``` + .channels(2) .split(SplitRecording.CONVERSATION) .build(); diff --git a/build.gradle b/build.gradle index e0afc7c..8758296 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ java { dependencies { implementation 'io.github.cdimascio:dotenv-java:3.+' - implementation 'com.vonage:server-sdk:8.+' + implementation 'com.vonage:server-sdk:9.+' implementation 'com.vonage:jwt:2.+' implementation 'com.sparkjava:spark-core:2.+' implementation 'com.fasterxml.jackson.core:jackson-databind:2.+' diff --git a/src/main/java/AggregateSnippets.java b/src/main/java/AggregateSnippets.java index 560aa1d..e3efb33 100644 --- a/src/main/java/AggregateSnippets.java +++ b/src/main/java/AggregateSnippets.java @@ -148,7 +148,6 @@ private static String toHeadingTitle(String title) { .replace("NCCO", "ncco") // To avoid adding spaces in the next regex .replaceAll("(? response = client.getAccountClient().listSecrets(ACCOUNT_ID); - for (SecretResponse secret : response.getSecrets()) { + for (SecretResponse secret : response) { System.out.println(secret.getId() + " created at " + secret.getCreated()); } } diff --git a/src/main/java/com/vonage/quickstart/application/CreateApplication.java b/src/main/java/com/vonage/quickstart/application/CreateApplication.java index 68a1ff4..08cb6b0 100644 --- a/src/main/java/com/vonage/quickstart/application/CreateApplication.java +++ b/src/main/java/com/vonage/quickstart/application/CreateApplication.java @@ -24,8 +24,8 @@ import com.vonage.client.VonageClient; import com.vonage.client.application.Application; import com.vonage.client.application.capabilities.Messages; +import com.vonage.client.application.capabilities.Webhook; import com.vonage.client.common.HttpMethod; -import com.vonage.client.common.Webhook; import static com.vonage.quickstart.EnvironmentVariables.*; @@ -40,10 +40,16 @@ public static void main(String... args) { Application.builder() .name(APPLICATION_NAME) .addCapability(Messages.builder() - .addWebhook(Webhook.Type.INBOUND, - new Webhook("https://example.com/webhooks/inbound", HttpMethod.POST)) - .addWebhook(Webhook.Type.STATUS, - new Webhook("https://example.com/webhooks/status", HttpMethod.POST)) + .inbound(Webhook.builder() + .address("https://example.com/webhooks/inbound") + .method(HttpMethod.POST) + .build() + ) + .status(Webhook.builder() + .address("https://example.com/webhooks/status") + .method(HttpMethod.POST) + .build() + ) .build() ) .build() diff --git a/src/main/java/com/vonage/quickstart/application/UpdateApplication.java b/src/main/java/com/vonage/quickstart/application/UpdateApplication.java index 84ab1c6..7c43714 100644 --- a/src/main/java/com/vonage/quickstart/application/UpdateApplication.java +++ b/src/main/java/com/vonage/quickstart/application/UpdateApplication.java @@ -26,7 +26,6 @@ import com.vonage.client.application.ApplicationClient; import com.vonage.client.application.capabilities.*; import com.vonage.client.common.HttpMethod; -import com.vonage.client.common.Webhook; import static com.vonage.quickstart.EnvironmentVariables.*; @@ -41,22 +40,37 @@ public static void main(String... args) { Application existingApplication = applicationClient.getApplication(VONAGE_APPLICATION_ID); Capability messages = Messages.builder() - .addWebhook(Webhook.Type.INBOUND, - new Webhook("https://example.com/webhooks/inbound", HttpMethod.POST)) - .addWebhook(Webhook.Type.STATUS, - new Webhook("https://example.com/webhooks/status", HttpMethod.POST)) + .inbound(Webhook.builder() + .address("https://example.com/webhooks/inbound") + .method(HttpMethod.POST) + .build() + ) + .status(Webhook.builder() + .address("https://example.com/webhooks/status") + .method(HttpMethod.POST) + .build() + ) .build(); Capability voice = Voice.builder() - .addWebhook(Webhook.Type.ANSWER, - new Webhook("https://example.com/webhooks/answer", HttpMethod.POST)) - .addWebhook(Webhook.Type.EVENT, - new Webhook("https://example.com/webhooks/event", HttpMethod.POST)) + .answer(Webhook.builder() + .address("https://example.com/webhooks/answer") + .method(HttpMethod.POST) + .build() + ) + .event(Webhook.builder() + .address("https://example.com/webhooks/event") + .method(HttpMethod.POST) + .build() + ) .build(); Capability rtc = Rtc.builder() - .addWebhook(Webhook.Type.EVENT, - new Webhook("https://example.com/webhooks/event", HttpMethod.POST)) + .event(Webhook.builder() + .address("https://example.com/webhooks/event") + .method(HttpMethod.POST) + .build() + ) .build(); Capability vbc = Vbc.builder().build(); diff --git a/src/main/java/com/vonage/quickstart/conversation/CreateCustomEvent.java b/src/main/java/com/vonage/quickstart/conversation/CreateCustomEvent.java index 80dfe1c..d0a57fc 100644 --- a/src/main/java/com/vonage/quickstart/conversation/CreateCustomEvent.java +++ b/src/main/java/com/vonage/quickstart/conversation/CreateCustomEvent.java @@ -34,7 +34,7 @@ public static void main(String[] args) throws Exception { .build(); var event = client.getConversationsClient().createEvent( - CONV_ID, CustomEvent.builder() + CONV_ID, CustomEvent.builder("my_custom_event_name") .from(CONV_MEMBER_ID) .body(Map.of("your", "data")) .build() diff --git a/src/main/java/com/vonage/quickstart/insight/AdvancedInsight.java b/src/main/java/com/vonage/quickstart/insight/AdvancedInsight.java index 8c2be10..7bcf91e 100644 --- a/src/main/java/com/vonage/quickstart/insight/AdvancedInsight.java +++ b/src/main/java/com/vonage/quickstart/insight/AdvancedInsight.java @@ -24,6 +24,7 @@ import com.vonage.client.VonageClient; import com.vonage.client.insight.AdvancedInsightResponse; import com.vonage.client.insight.RoamingDetails; +import com.vonage.client.insight.RoamingStatus; import static com.vonage.quickstart.EnvironmentVariables.*; public class AdvancedInsight { @@ -59,7 +60,7 @@ public static void main(String[] args) throws Exception { } else { System.out.println("Roaming status: " + roaming.getStatus()); - if (response.getRoaming().getStatus() == RoamingDetails.RoamingStatus.ROAMING) { + if (response.getRoaming().getStatus() == RoamingStatus.ROAMING) { System.out.print(" Currently roaming in: " + roaming.getRoamingCountryCode()); System.out.println(" on the network " + roaming.getRoamingNetworkName()); } diff --git a/src/main/java/com/vonage/quickstart/insight/AdvancedInsightAsync.java b/src/main/java/com/vonage/quickstart/insight/AdvancedInsightAsync.java index 317c8f9..5063127 100644 --- a/src/main/java/com/vonage/quickstart/insight/AdvancedInsightAsync.java +++ b/src/main/java/com/vonage/quickstart/insight/AdvancedInsightAsync.java @@ -22,6 +22,7 @@ package com.vonage.quickstart.insight; import com.vonage.client.VonageClient; +import com.vonage.client.insight.AdvancedInsightAsyncRequest; import com.vonage.client.insight.AdvancedInsightRequest; import static com.vonage.quickstart.EnvironmentVariables.*; @@ -32,9 +33,11 @@ public static void main(String... args) { .apiSecret(VONAGE_API_SECRET) .build(); - client.getInsightClient().getAdvancedNumberInsight( - AdvancedInsightRequest.builder(INSIGHT_NUMBER) - .async(true).callback(INSIGHT_CALLBACK_URL).build() + var response = client.getInsightClient().getAdvancedAsyncNumberInsight( + AdvancedInsightAsyncRequest.builder() + .number(INSIGHT_NUMBER) + .callback(INSIGHT_CALLBACK_URL) + .build() ); } } diff --git a/src/main/java/com/vonage/quickstart/insight/AdvancedInsightWithCnam.java b/src/main/java/com/vonage/quickstart/insight/AdvancedInsightWithCnam.java index ba17c8f..3b3d93f 100644 --- a/src/main/java/com/vonage/quickstart/insight/AdvancedInsightWithCnam.java +++ b/src/main/java/com/vonage/quickstart/insight/AdvancedInsightWithCnam.java @@ -26,6 +26,7 @@ import com.vonage.client.insight.AdvancedInsightResponse; import com.vonage.client.insight.RoamingDetails; +import com.vonage.client.insight.RoamingStatus; import static com.vonage.quickstart.EnvironmentVariables.*; public class AdvancedInsightWithCnam { @@ -61,7 +62,7 @@ public static void main(String[] args) throws Exception { } else { System.out.println("Roaming status: " + roaming.getStatus()); - if (response.getRoaming().getStatus() == RoamingDetails.RoamingStatus.ROAMING) { + if (response.getRoaming().getStatus() == RoamingStatus.ROAMING) { System.out.print(" Currently roaming in: " + roaming.getRoamingCountryCode()); System.out.println(" on the network " + roaming.getRoamingNetworkName()); } diff --git a/src/main/java/com/vonage/quickstart/insight/AsyncInsightTrigger.java b/src/main/java/com/vonage/quickstart/insight/AsyncInsightTrigger.java index be46eda..64a07e3 100644 --- a/src/main/java/com/vonage/quickstart/insight/AsyncInsightTrigger.java +++ b/src/main/java/com/vonage/quickstart/insight/AsyncInsightTrigger.java @@ -21,6 +21,7 @@ */ package com.vonage.quickstart.insight; +import com.vonage.client.Jsonable; import com.vonage.client.insight.AdvancedInsightResponse; import spark.Spark; @@ -30,7 +31,7 @@ public class AsyncInsightTrigger { public static void main(String... args) { port(3000); Spark.post("/webhooks/insight", (req, res) -> { - AdvancedInsightResponse response = AdvancedInsightResponse.fromJson(req.body()); + AdvancedInsightResponse response = Jsonable.fromJson(req.body()); System.out.println("Country: " + response.getCountryName()); res.status(204); diff --git a/src/main/java/com/vonage/quickstart/meetings/CreateInstantRoom.java b/src/main/java/com/vonage/quickstart/meetings/CreateInstantRoom.java deleted file mode 100644 index 3c61324..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/CreateInstantRoom.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.MeetingRoom; -import com.vonage.client.meetings.RoomType; -import static com.vonage.quickstart.EnvironmentVariables.*; - -public class CreateInstantRoom { - public static void main(String[] args) throws Exception { - String DISPLAY_NAME = envVar("DISPLAY_NAME"); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - MeetingRoom room = MeetingRoom.builder(DISPLAY_NAME).type(RoomType.INSTANT).build(); - client.getMeetingsClient().createRoom(room); - System.out.println("Created room "+room.getId()); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/CreateLongTermRoom.java b/src/main/java/com/vonage/quickstart/meetings/CreateLongTermRoom.java deleted file mode 100644 index 0069872..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/CreateLongTermRoom.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.MeetingRoom; -import com.vonage.client.meetings.RoomType; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.time.Instant; - -public class CreateLongTermRoom { - public static void main(String[] args) throws Exception { - String DISPLAY_NAME = envVar("DISPLAY_NAME"); - Instant EXPIRATION_DATE = Instant.parse(envVar("EXPIRATION_DATE")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - MeetingRoom room = MeetingRoom.builder(DISPLAY_NAME) - .type(RoomType.LONG_TERM) - .expiresAt(EXPIRATION_DATE) - .build(); - client.getMeetingsClient().createRoom(room); - System.out.println("Created room "+room.getId()); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/CreateTheme.java b/src/main/java/com/vonage/quickstart/meetings/CreateTheme.java deleted file mode 100644 index dbe6774..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/CreateTheme.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.Theme; -import static com.vonage.quickstart.EnvironmentVariables.*; - -public class CreateTheme { - public static void main(String[] args) throws Exception { - String MAIN_COLOR = envVar("MAIN_COLOR"); - String BRAND_TEXT = envVar("BRAND_TEXT"); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - Theme theme = Theme.builder().mainColor(MAIN_COLOR).brandText(BRAND_TEXT).build(); - client.getMeetingsClient().createTheme(theme); - System.out.println("Updated theme '"+theme.getThemeName()+"' ("+theme.getThemeId()+")"); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/DeleteRecording.java b/src/main/java/com/vonage/quickstart/meetings/DeleteRecording.java deleted file mode 100644 index 9372a69..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/DeleteRecording.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.UUID; - -public class DeleteRecording { - public static void main(String[] args) throws Exception { - UUID RECORDING_ID = UUID.fromString(envVar("RECORDING_ID")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - client.getMeetingsClient().deleteRecording(RECORDING_ID); - System.out.println("Deleted recording "+RECORDING_ID); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/DeleteTheme.java b/src/main/java/com/vonage/quickstart/meetings/DeleteTheme.java deleted file mode 100644 index 9a36948..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/DeleteTheme.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.UUID; - -public class DeleteTheme { - public static void main(String[] args) throws Exception { - UUID THEME_ID = UUID.fromString(envVar("THEME_ID")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - client.getMeetingsClient().deleteTheme(THEME_ID, true); - System.out.println("Deleted theme "+THEME_ID); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/GetRecording.java b/src/main/java/com/vonage/quickstart/meetings/GetRecording.java deleted file mode 100644 index b74d140..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/GetRecording.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.Recording; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.UUID; - -public class GetRecording { - public static void main(String[] args) throws Exception { - UUID RECORDING_ID = UUID.fromString(envVar("RECORDING_ID")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - Recording recording = client.getMeetingsClient().getRecording(RECORDING_ID); - System.out.println(recording.getId()); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/GetRoom.java b/src/main/java/com/vonage/quickstart/meetings/GetRoom.java deleted file mode 100644 index 23d56f1..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/GetRoom.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.MeetingRoom; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.UUID; - -public class GetRoom { - public static void main(String[] args) throws Exception { - UUID ROOM_ID = UUID.fromString(envVar("ROOM_ID")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - MeetingRoom room = client.getMeetingsClient().getRoom(ROOM_ID); - System.out.println(room.getDisplayName() + " ("+room.getId()+")"); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/GetTheme.java b/src/main/java/com/vonage/quickstart/meetings/GetTheme.java deleted file mode 100644 index fe9d4b8..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/GetTheme.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.Theme; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.UUID; - -public class GetTheme { - public static void main(String[] args) throws Exception { - UUID THEME_ID = UUID.fromString(envVar("THEME_ID")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - Theme theme = client.getMeetingsClient().getTheme(THEME_ID); - System.out.println(theme.getThemeName()); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/ListDialInNumbers.java b/src/main/java/com/vonage/quickstart/meetings/ListDialInNumbers.java deleted file mode 100644 index e763e27..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/ListDialInNumbers.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.DialInNumber; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.List; - -public class ListDialInNumbers { - public static void main(String[] args) throws Exception { - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - List dialInNumbers = client.getMeetingsClient().listDialNumbers(); - dialInNumbers.forEach(din -> System.out.println(din.getDisplayName()+": "+din.getNumber())); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/ListRecordings.java b/src/main/java/com/vonage/quickstart/meetings/ListRecordings.java deleted file mode 100644 index 8d7e2f6..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/ListRecordings.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.Recording; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.List; - -public class ListRecordings { - public static void main(String[] args) throws Exception { - String SESSION_ID = envVar("SESSION_ID"); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - List recordings = client.getMeetingsClient().listRecordings(SESSION_ID); - recordings.forEach(recording -> System.out.println(recording.getId())); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/ListRooms.java b/src/main/java/com/vonage/quickstart/meetings/ListRooms.java deleted file mode 100644 index 98923d2..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/ListRooms.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.MeetingRoom; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.List; - -public class ListRooms { - public static void main(String[] args) throws Exception { - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - List rooms = client.getMeetingsClient().listRooms(); - rooms.forEach(room -> System.out.println(room.getDisplayName() + " ("+room.getId()+")")); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/ListRoomsByTheme.java b/src/main/java/com/vonage/quickstart/meetings/ListRoomsByTheme.java deleted file mode 100644 index 3d3aab9..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/ListRoomsByTheme.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.MeetingRoom; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.List; -import java.util.UUID; - -public class ListRoomsByTheme { - public static void main(String[] args) throws Exception { - UUID THEME_ID = UUID.fromString(envVar("THEME_ID")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - List rooms = client.getMeetingsClient().searchRoomsByTheme(THEME_ID); - rooms.forEach(room -> System.out.println(room.getDisplayName() + " ("+room.getId()+")")); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/ListThemes.java b/src/main/java/com/vonage/quickstart/meetings/ListThemes.java deleted file mode 100644 index 06265a5..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/ListThemes.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.Theme; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.List; - -public class ListThemes { - public static void main(String[] args) throws Exception { - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - List themes = client.getMeetingsClient().listThemes(); - themes.forEach(theme -> System.out.println(theme.getThemeName() + " ("+theme.getThemeId()+")")); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/UpdateApplication.java b/src/main/java/com/vonage/quickstart/meetings/UpdateApplication.java deleted file mode 100644 index c71ae2d..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/UpdateApplication.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.Application; -import com.vonage.client.meetings.UpdateApplicationRequest; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.UUID; - -public class UpdateApplication { - public static void main(String[] args) throws Exception { - UUID THEME_ID = UUID.fromString(envVar("THEME_ID")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - UpdateApplicationRequest request = UpdateApplicationRequest.builder() - .defaultThemeId(THEME_ID).build(); - Application application = client.getMeetingsClient().updateApplication(request); - System.out.println("Updated application "+application.getApplicationId()); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/UpdateRoom.java b/src/main/java/com/vonage/quickstart/meetings/UpdateRoom.java deleted file mode 100644 index 6162cb6..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/UpdateRoom.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.MeetingRoom; -import com.vonage.client.meetings.UpdateRoomRequest; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.UUID; - -public class UpdateRoom { - public static void main(String[] args) throws Exception { - UUID ROOM_ID = UUID.fromString(envVar("ROOM_ID")); - UUID THEME_ID = UUID.fromString(envVar("THEME_ID")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - UpdateRoomRequest request = UpdateRoomRequest.builder().themeId(THEME_ID).build(); - MeetingRoom room = client.getMeetingsClient().updateRoom(ROOM_ID, request); - System.out.println("Updated room '"+room.getDisplayName()+"' ("+room.getId()+")"); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/UpdateTheme.java b/src/main/java/com/vonage/quickstart/meetings/UpdateTheme.java deleted file mode 100644 index 0d621d3..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/UpdateTheme.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.Theme; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.util.UUID; - -public class UpdateTheme { - public static void main(String[] args) throws Exception { - UUID THEME_ID = UUID.fromString(envVar("THEME_ID")); - String MAIN_COLOR = envVar("MAIN_COLOR"); - String BRAND_TEXT = envVar("BRAND_TEXT"); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - Theme theme = Theme.builder().mainColor(MAIN_COLOR).brandText(BRAND_TEXT).build(); - client.getMeetingsClient().updateTheme(THEME_ID, theme); - System.out.println("Updated theme '"+theme.getThemeName()+"' ("+theme.getThemeId()+")"); - } -} diff --git a/src/main/java/com/vonage/quickstart/meetings/UploadLogo.java b/src/main/java/com/vonage/quickstart/meetings/UploadLogo.java deleted file mode 100644 index 5c93e76..0000000 --- a/src/main/java/com/vonage/quickstart/meetings/UploadLogo.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.meetings; - -import com.vonage.client.VonageClient; -import com.vonage.client.meetings.LogoType; -import static com.vonage.quickstart.EnvironmentVariables.*; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.UUID; - -public class UploadLogo { - public static void main(String[] args) throws Exception { - UUID THEME_ID = UUID.fromString(envVar("THEME_ID")); - LogoType LOGO_TYPE = LogoType.fromString(envVar("LOGO_TYPE")); - Path LOGO_FILEPATH = Paths.get(envVar("LOGO_FILEPATH")); - - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - client.getMeetingsClient().updateThemeLogo(THEME_ID, LOGO_TYPE, LOGO_FILEPATH); - System.out.println("Updated '"+LOGO_TYPE+"' logo for theme "+THEME_ID); - } -} diff --git a/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappAuthenticationTemplate.java b/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappAuthenticationTemplate.java index 9d2853d..1c08e5b 100644 --- a/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappAuthenticationTemplate.java +++ b/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappAuthenticationTemplate.java @@ -22,7 +22,7 @@ package com.vonage.quickstart.messages.whatsapp; import com.vonage.client.VonageClient; -import com.vonage.client.messages.MessageType; +import com.vonage.client.common.MessageType; import com.vonage.client.messages.whatsapp.*; import static com.vonage.quickstart.EnvironmentVariables.*; import java.util.List; diff --git a/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappMediaTemplate.java b/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappMediaTemplate.java index 0f5514f..3a2cdd9 100644 --- a/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappMediaTemplate.java +++ b/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappMediaTemplate.java @@ -22,7 +22,7 @@ package com.vonage.quickstart.messages.whatsapp; import com.vonage.client.VonageClient; -import com.vonage.client.messages.MessageType; +import com.vonage.client.common.MessageType; import com.vonage.client.messages.whatsapp.Locale; import com.vonage.client.messages.whatsapp.Policy; import com.vonage.client.messages.whatsapp.WhatsappCustomRequest; diff --git a/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappQuickReplyButton.java b/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappQuickReplyButton.java index cab1036..1412eec 100644 --- a/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappQuickReplyButton.java +++ b/src/main/java/com/vonage/quickstart/messages/whatsapp/SendWhatsappQuickReplyButton.java @@ -22,7 +22,7 @@ package com.vonage.quickstart.messages.whatsapp; import com.vonage.client.VonageClient; -import com.vonage.client.messages.MessageType; +import com.vonage.client.common.MessageType; import com.vonage.client.messages.whatsapp.Locale; import com.vonage.client.messages.whatsapp.Policy; import com.vonage.client.messages.whatsapp.WhatsappCustomRequest; diff --git a/src/main/java/com/vonage/quickstart/numberinsight2/FraudScore.java b/src/main/java/com/vonage/quickstart/numberinsight2/FraudScore.java deleted file mode 100644 index 6ca0429..0000000 --- a/src/main/java/com/vonage/quickstart/numberinsight2/FraudScore.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.numberinsight2; - -import com.vonage.client.VonageClient; -import com.vonage.client.numberinsight2.Insight; -import static com.vonage.quickstart.EnvironmentVariables.*; - -public class FraudScore { - public static void main(String[] args) throws Exception { - VonageClient client = VonageClient.builder().apiKey(VONAGE_API_KEY).apiSecret(VONAGE_API_SECRET).build(); - - var response = client.getNumberInsight2Client().fraudCheck(INSIGHT_NUMBER, Insight.FRAUD_SCORE); - var fraudScore = response.getFraudScore(); - System.out.println(fraudScore); - } -} diff --git a/src/main/java/com/vonage/quickstart/numberinsight2/SimSwap.java b/src/main/java/com/vonage/quickstart/numberinsight2/SimSwap.java deleted file mode 100644 index ead87ac..0000000 --- a/src/main/java/com/vonage/quickstart/numberinsight2/SimSwap.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.numberinsight2; - -import com.vonage.client.VonageClient; -import com.vonage.client.numberinsight2.Insight; -import static com.vonage.quickstart.EnvironmentVariables.*; - -public class SimSwap { - public static void main(String[] args) throws Exception { - VonageClient client = VonageClient.builder().apiKey(VONAGE_API_KEY).apiSecret(VONAGE_API_SECRET).build(); - - var response = client.getNumberInsight2Client().fraudCheck(INSIGHT_NUMBER, Insight.SIM_SWAP); - var simSwap = response.getSimSwap(); - System.out.println(simSwap); - } -} diff --git a/src/main/java/com/vonage/quickstart/numbers/ListNumbers.java b/src/main/java/com/vonage/quickstart/numbers/ListNumbers.java index 2d9814f..0cd3944 100644 --- a/src/main/java/com/vonage/quickstart/numbers/ListNumbers.java +++ b/src/main/java/com/vonage/quickstart/numbers/ListNumbers.java @@ -24,6 +24,7 @@ import com.vonage.client.VonageClient; import com.vonage.client.numbers.*; import static com.vonage.quickstart.EnvironmentVariables.*; +import java.util.List; public class ListNumbers { public static void main(String[] args) { @@ -32,13 +33,13 @@ public static void main(String[] args) { .apiSecret(VONAGE_API_SECRET) .build(); - ListNumbersResponse response = client.getNumbersClient().listNumbers( + List response = client.getNumbersClient().listNumbers( ListNumbersFilter.builder() .pattern(NUMBER_SEARCH_PATTERN, NUMBER_SEARCH_CRITERIA) .build() ); - for (OwnedNumber number : response.getNumbers()) { + for (OwnedNumber number : response) { System.out.println("Tel: " + number.getMsisdn()); System.out.println("Type: " + number.getType()); System.out.println("Country: " + number.getCountry()); diff --git a/src/main/java/com/vonage/quickstart/redact/RedactATransaction.java b/src/main/java/com/vonage/quickstart/redact/RedactATransaction.java index 032d9b3..d8bdb17 100644 --- a/src/main/java/com/vonage/quickstart/redact/RedactATransaction.java +++ b/src/main/java/com/vonage/quickstart/redact/RedactATransaction.java @@ -22,7 +22,7 @@ package com.vonage.quickstart.redact; import com.vonage.client.VonageClient; -import com.vonage.client.redact.RedactRequest; +import com.vonage.client.redact.Product; import static com.vonage.quickstart.EnvironmentVariables.*; public class RedactATransaction { @@ -32,6 +32,6 @@ public static void main(String... args) { .apiSecret(VONAGE_API_SECRET) .build(); - client.getRedactClient().redactTransaction(VONAGE_REDACT_ID, RedactRequest.Product.SMS); + client.getRedactClient().redactTransaction(VONAGE_REDACT_ID, Product.SMS); } } diff --git a/src/main/java/com/vonage/quickstart/sms/ReceiveSms.java b/src/main/java/com/vonage/quickstart/sms/ReceiveSms.java index 68a2701..ce67ec4 100644 --- a/src/main/java/com/vonage/quickstart/sms/ReceiveSms.java +++ b/src/main/java/com/vonage/quickstart/sms/ReceiveSms.java @@ -21,7 +21,7 @@ */ package com.vonage.quickstart.sms; -import com.vonage.client.incoming.MessageEvent; +import com.vonage.client.sms.MessageEvent; import spark.Route; import spark.Spark; diff --git a/src/main/java/com/vonage/quickstart/sms/SendSignedSms.java b/src/main/java/com/vonage/quickstart/sms/SendSignedSms.java index 5c934f6..2771dba 100644 --- a/src/main/java/com/vonage/quickstart/sms/SendSignedSms.java +++ b/src/main/java/com/vonage/quickstart/sms/SendSignedSms.java @@ -22,6 +22,7 @@ package com.vonage.quickstart.sms; import com.vonage.client.VonageClient; +import com.vonage.client.auth.hashutils.HashType; import com.vonage.client.sms.MessageStatus; import com.vonage.client.sms.SmsSubmissionResponse; import com.vonage.client.sms.messages.TextMessage; @@ -34,7 +35,7 @@ public static void main(String[] args) throws Exception { VonageClient client = VonageClient.builder() .apiKey(VONAGE_API_KEY) .signatureSecret(VONAGE_SIGNATURE_SECRET) - .hashType(HashUtil.HashType.MD5).build(); + .hashType(HashType.MD5).build(); TextMessage message = new TextMessage( SMS_SENDER_ID, SMS_TO_NUMBER, diff --git a/src/main/java/com/vonage/quickstart/verify2/SendRequestAllChannels.java b/src/main/java/com/vonage/quickstart/verify2/SendRequestAllChannels.java index f684c37..dea4cbc 100644 --- a/src/main/java/com/vonage/quickstart/verify2/SendRequestAllChannels.java +++ b/src/main/java/com/vonage/quickstart/verify2/SendRequestAllChannels.java @@ -36,7 +36,6 @@ public static void main(String[] args) throws Exception { var request = VerificationRequest.builder() .workflows(List.of( new SilentAuthWorkflow(VERIFY_NUMBER), - new WhatsappCodelessWorkflow(VERIFY_NUMBER, VERIFY_WHATSAPP_NUMBER), new EmailWorkflow(VERIFY_TO_EMAIL, VERIFY_FROM_EMAIL), new WhatsappWorkflow(VERIFY_NUMBER, VERIFY_WHATSAPP_NUMBER), new SmsWorkflow(VERIFY_NUMBER), diff --git a/src/main/java/com/vonage/quickstart/verify2/SendRequestWhatsappInteractive.java b/src/main/java/com/vonage/quickstart/verify2/SendRequestWhatsappInteractive.java deleted file mode 100644 index 9ee729c..0000000 --- a/src/main/java/com/vonage/quickstart/verify2/SendRequestWhatsappInteractive.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2025 Vonage - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - */ -package com.vonage.quickstart.verify2; - -import com.vonage.client.VonageClient; -import com.vonage.client.verify2.*; -import static com.vonage.quickstart.EnvironmentVariables.*; - -public class SendRequestWhatsappInteractive { - public static void main(String[] args) throws Exception { - VonageClient client = VonageClient.builder() - .applicationId(VONAGE_APPLICATION_ID) - .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) - .build(); - - VerificationResponse response = client.getVerify2Client().sendVerification( - VerificationRequest.builder() - .addWorkflow(new WhatsappCodelessWorkflow(VERIFY_NUMBER, VERIFY_WHATSAPP_NUMBER)) - .brand(VERIFY_BRAND_NAME).build() - ); - System.out.println("Verification sent: " + response.getRequestId()); - } -} diff --git a/src/main/java/com/vonage/quickstart/voice/AsrInput.java b/src/main/java/com/vonage/quickstart/voice/AsrInput.java index 94f31d4..b40933e 100644 --- a/src/main/java/com/vonage/quickstart/voice/AsrInput.java +++ b/src/main/java/com/vonage/quickstart/voice/AsrInput.java @@ -22,10 +22,7 @@ package com.vonage.quickstart.voice; import com.vonage.client.voice.EventWebhook; -import com.vonage.client.voice.ncco.InputAction; -import com.vonage.client.voice.ncco.Ncco; -import com.vonage.client.voice.ncco.SpeechSettings; -import com.vonage.client.voice.ncco.TalkAction; +import com.vonage.client.voice.ncco.*; import spark.Route; import spark.Spark; @@ -42,7 +39,7 @@ public static void main(String[] args) { .build(); SpeechSettings speechSettings = SpeechSettings.builder() - .language(SpeechSettings.Language.ENGLISH_UNITED_STATES).build(); + .language(Language.ENGLISH_UNITED_STATES).build(); InputAction input = InputAction.builder() .eventUrl(String.format("%s://%s/webhooks/asr", req.scheme(), req.host())) diff --git a/src/main/java/com/vonage/quickstart/voice/RecordCallSplitAudio.java b/src/main/java/com/vonage/quickstart/voice/RecordCallSplitAudio.java index 40ab5b7..272fb90 100644 --- a/src/main/java/com/vonage/quickstart/voice/RecordCallSplitAudio.java +++ b/src/main/java/com/vonage/quickstart/voice/RecordCallSplitAudio.java @@ -38,7 +38,6 @@ public static void main(String[] args) { RecordAction record = RecordAction.builder() .eventUrl(recordingUrl) .channels(2) - .split(SplitRecording.CONVERSATION) .build(); ConnectAction connect = ConnectAction.builder(PhoneEndpoint.builder(VOICE_TO_NUMBER).build()) diff --git a/src/main/java/com/vonage/quickstart/voice/RetrieveInfoForAllCalls.java b/src/main/java/com/vonage/quickstart/voice/RetrieveInfoForAllCalls.java index c4c32fd..5988337 100644 --- a/src/main/java/com/vonage/quickstart/voice/RetrieveInfoForAllCalls.java +++ b/src/main/java/com/vonage/quickstart/voice/RetrieveInfoForAllCalls.java @@ -36,15 +36,14 @@ public static void main(String... args) throws Exception { .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) .build(); - Date yesterday = new Date(Instant.now().minus(Duration.ofDays(1)).toEpochMilli()); - Date now = new Date(); + Instant now = Instant.now(), yesterday = now.minus(Duration.ofDays(1)); CallsFilter filter = CallsFilter.builder() - .dateStart(yesterday) - .dateEnd(now) + .startDate(yesterday) + .endDate(now) .build(); CallInfoPage calls = client.getVoiceClient().listCalls(filter); - System.out.println(calls.toJson()); + calls.forEach(System.out::println); } } diff --git a/src/main/java/com/vonage/quickstart/voice/TrackNccoProgress.java b/src/main/java/com/vonage/quickstart/voice/TrackNccoProgress.java index 4e1ff4b..9d6b7cb 100644 --- a/src/main/java/com/vonage/quickstart/voice/TrackNccoProgress.java +++ b/src/main/java/com/vonage/quickstart/voice/TrackNccoProgress.java @@ -44,7 +44,8 @@ public static void main(String... args) { Map payload = new HashMap<>(); payload.put("foo", "bar"); - NotifyAction notify = NotifyAction.builder(payload) + NotifyAction notify = NotifyAction.builder() + .payload(payload) .eventUrl(notifyUrl) .build();