diff --git a/.gitattributes b/.gitattributes index 6313b56c..b8afbf65 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -* text=auto eol=lf +* text=auto eol=lf encoding=utf-8 diff --git a/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/AbstractObsE2ETest.java b/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/AbstractObsE2ETest.java index 5e3e8631..959d005d 100644 --- a/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/AbstractObsE2ETest.java +++ b/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/AbstractObsE2ETest.java @@ -1,16 +1,13 @@ package io.obswebsocket.community.client.test; -import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.fail; import io.obswebsocket.community.client.OBSRemoteController; -import java.util.concurrent.BlockingQueue; -import java.util.concurrent.LinkedBlockingQueue; import java.util.function.Consumer; public abstract class AbstractObsE2ETest { protected static OBSRemoteController remote; - protected BlockingQueue resultQueue = new LinkedBlockingQueue(); // Scenes protected final static String SCENE1 = "scene1"; @@ -32,8 +29,6 @@ public abstract class AbstractObsE2ETest { protected final static String TRANSITION_SLIDE = "Slide"; protected final static String TRANSITION_CUT = "Cut"; protected final static String TRANSITION_FADE = "Fade"; - protected final static String SOURCE_OBS_MIC = "Mic/Aux"; - protected final static String SOURCE_OBS_AUDIO = "Desktop Audio"; // Test Helpers protected void obsShould(String expected) { @@ -59,19 +54,10 @@ protected void countDownFrom(int seconds) { protected static void connectToObs() { remote = OBSRemoteController.builder() .lifecycle() - .onControllerError(((reasonThrowable) -> { - System.out.println("An error occurred: " + reasonThrowable.getReason()); - reasonThrowable.getThrowable().printStackTrace(); - })) + .onControllerError(((reasonThrowable) -> fail("An error occurred: " + reasonThrowable.getReason(), reasonThrowable))) + .onCommunicatorError(e -> fail("Unable to connect", e)) .and() .build(); -// remote = new OBSRemoteController("ws://localhost:4455", false); -// remote.registerConnectionFailedCallback(message -> { -// fail("Failed to connect to OBS: " + message); -// }); -// remote.registerOnError((message, throwable) -> { -// fail("Failed to connect to OBS due to error: " + message); -// }); remote.connect(); try { @@ -87,55 +73,34 @@ protected void setupObs() { cleanupScenes(); // Change back to base scene -// remote.changeSceneWithTransition("scene1", "Cut", result -> { -// if(result.getError() != null && !result.getError().isEmpty()) { -// fail("Failed to switch to base scene"); -// } -// }); + remote.setCurrentProgramScene("scene1", result -> { + if (!result.isSuccessful()) { + fail("Failed to switch to base scene"); + } + }); } protected void cleanupScenes() { -// // Hide all visible elements in all scenes -// remote.getSceneList(sceneListResponse -> { -// sceneListResponse.getScenes().forEach(scene -> { -// scene.getSources().forEach(source -> { -// if(!source.getName().startsWith("scenename")) { -// remote.setSourceVisibility(scene.getName(), source.getName(), false, result -> { -// if(result.getError() != null && !result.getError().isEmpty()) { -// fail(String.format("Failed to hide source '%s' on scene '%s'", source.getName(), scene.getName())); -// } -// }); -// } -// }); -// }); -// }); - } - - protected Consumer loggingCallback = (obj) -> { - System.out.println("Received response: " + obj); - }; - - protected void waitReasonably() { - waitReasonably(500); - } - - protected void waitReasonably(long ms) { - try { - Thread.sleep(ms); - } catch (InterruptedException e) { - e.printStackTrace(); - } + // Hide all visible elements in all scenes + remote.getSceneList(sceneListResponse -> { + sceneListResponse.getScenes().forEach(scene -> { + remote.getSceneItemList(scene.getSceneName(), getSceneItemListResponse -> { + getSceneItemListResponse.getSceneItems().forEach(sceneItem -> { + if (!sceneItem.getSourceName().startsWith("scenename")) { + remote.setSceneItemEnabled(scene.getSceneName(), sceneItem.getSceneItemId(), false, result -> { + if (!result.isSuccessful()) { + fail(String.format("Failed to hide sceneItem '%s' on scene '%s'", sceneItem.getSourceName(), + scene.getSceneName())); + } + }); + } + }); + }); + }); + }); } - protected Consumer capturingCallback = (obj) -> { - System.out.println("Received response: " + obj + "(" + obj.getClass().getSimpleName() + ")"); - resultQueue.add(obj); - }; - - protected T getPreviousResponseAs(Class clazz) { - Object previousResponse = resultQueue.remove(); - assertThat(previousResponse).isInstanceOf(clazz); - return clazz.cast(previousResponse); + protected Consumer loggingCallback() { + return obj -> System.out.println("Received response: " + obj); } - } diff --git a/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/ObsRemoteE2eIT.java b/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/ObsRemoteE2eIT.java index c0377af0..0a79d996 100644 --- a/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/ObsRemoteE2eIT.java +++ b/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/ObsRemoteE2eIT.java @@ -27,7 +27,6 @@ static void beforeAll() { @BeforeEach public void beforeEach() { setupObs(); - resultQueue.clear(); } @AfterAll @@ -49,14 +48,9 @@ void getScenes() { .currentProgramSceneName(SCENE1).scenes(expectedScenes).build(); // When retrieved - remote.getSceneList(capturingCallback); - waitReasonably(); - - // Then scenes match as expected - GetSceneListResponse res = getPreviousResponseAs(GetSceneListResponse.class); + GetSceneListResponse res = remote.getSceneList(1000); assertThat(res.getMessageData().getResponseData()) .usingRecursiveComparison().ignoringCollectionOrder().isEqualTo(expectedResponseData); - } @Disabled @@ -80,7 +74,6 @@ void getSourcesList() { // When retrieved // remote.getSourcesList(capturingCallback); fail("getSourcesList not implemented"); - waitReasonably(); // Then it matches as expected // GetSourcesListResponse res = getPreviousResponseAs(GetSourcesListResponse.class); diff --git a/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/ObsRemoteE2eObservationIT.java b/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/ObsRemoteE2eObservationIT.java index ddda4e7f..c24240b1 100644 --- a/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/ObsRemoteE2eObservationIT.java +++ b/client/src/endToEndManualTest/java/io/obswebsocket/community/client/test/ObsRemoteE2eObservationIT.java @@ -1,223 +1,248 @@ package io.obswebsocket.community.client.test; -import org.junit.jupiter.api.Disabled; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +import com.google.gson.JsonObject; +import io.obswebsocket.community.client.message.response.inputs.GetInputMuteResponse; +import java.io.File; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; /** * This test should be run manually, following the prompts in the command-line and observing OBS for * the desired behavior. Authentication should be disabled. See the README in the obs-resources * directory for more information. */ -@Disabled public class ObsRemoteE2eObservationIT extends AbstractObsE2ETest { -// @BeforeAll -// static void beforeAll() { -// connectToObs(); -// } -// -// @BeforeEach -// public void beforeEach() { -// System.out.println("==============================="); -// System.out.println(">> Resetting..."); -// setupObs(); -// System.out.println(">> ...Ready"); -// } -// -// @AfterAll -// static void afterAll() { -// remote.disconnect(); + @BeforeAll + static void beforeAll() { + connectToObs(); + } + + @BeforeEach + public void beforeEach() { + System.out.println("==============================="); + System.out.println(">> Resetting..."); + setupObs(); + System.out.println(">> ...Ready"); + } + + @AfterAll + static void afterAll() { + remote.disconnect(); // System.setProperty(org.slf4j.impl.SimpleLogger.DEFAULT_LOG_LEVEL_KEY, "Debug"); -// } -// -// @AfterEach -// public void afterEach() { -// try { -// Thread.sleep(1000); -// } catch (InterruptedException e) { -// e.printStackTrace(); -// } -// System.out.println("<< Test Complete"); -// -// } -// -// @Test -// void switchScene() { -// obsShould("Switch to scene2"); -// remote.changeSceneWithTransition(SCENE2, TRANSITION_CUT, loggingCallback); -// obsShould("Switch back to scene1"); -// remote.setCurrentScene(SCENE1, loggingCallback); -// } -// -// @Test -// void showHideSceneItem() { -// obsShould("Show the red square"); -// remote.setSourceVisibility(null, SOURCE_RED_SQUARE, true, loggingCallback); -// obsShould("Hide the red square"); -// remote.setSourceVisibility(null, SOURCE_RED_SQUARE, false, loggingCallback); -// } -// -// @Test -// void setTransition() { -// obsShould("Set current transition to Slide, with transition 2000ms"); -// remote.setCurrentTransition(TRANSITION_SLIDE, loggingCallback); -// remote.setTransitionDuration(2000, loggingCallback); -// obsShould("Set current transition back to 300ms"); -// remote.setTransitionDuration(300, loggingCallback); -// obsShould("Set current transition back to Cut"); -// remote.setCurrentTransition(TRANSITION_CUT, loggingCallback); -// } -// -// @Test -// void changeScenesWithTransition() { -// obsShould("Change to scene2, with the Slide transition"); -// remote.changeSceneWithTransition(SCENE2, TRANSITION_SLIDE, loggingCallback); -// } -// -// @Test -// void setSourceFilterVisibility() { -// -// obsShould("Show a blue square (red square colored blue by a filter)"); -// remote.setSourceVisibility(null, SOURCE_RED_SQUARE, true, loggingCallback); -// remote.setSourceFilterVisibility(SOURCE_RED_SQUARE, SOURCE_RED_SQUARE_FILTER, true, -// loggingCallback); -// obsShould("Return the red square to normal"); -// remote.setSourceFilterVisibility(SOURCE_RED_SQUARE, SOURCE_RED_SQUARE_FILTER, false, -// loggingCallback); -// -// } -// -// @Test -// void exerciseStudioMode() { -// obsShould("Enable studio mode"); -// remote.setStudioModeEnabled(true, loggingCallback); -// obsShould("Set preview scene to scene2"); -// remote.setPreviewScene(SCENE2, loggingCallback); -// obsShould("Fade to scene2"); -// remote.transitionToProgram(TRANSITION_FADE, 1500, loggingCallback); -// obsShould("Disable studio mode"); -// remote.setStudioModeEnabled(false, loggingCallback); -// -// } -// -// @Test -// void setSourceSettings() { -// obsShould("Curse the 'scene1' text"); -// Map settings = new HashMap<>(); -// settings.put("text", "S̼͚̞̼̩̱̽̓̍̽͊́ͨ̍̀ċͭ̚҉̪̖̤̥ͅȩ͉̣̜̖̖͙͇́̀̒ͥ̓̚͠͞n̦͍͆͑ͤ̕e̶̖̝̗̻͂̑̽̔ͩ̅́͜ͅ ̢͉̬͔͙̺̖͂͂ͣ͢1̮̥͇̏̇͋̈́ͨͥ͝ͅ"); -// remote.setSourceSettings(SOURCE_TEXT_SCENE1, settings, loggingCallback); -// obsShould("Change the 'scene1' text back to normal"); -// settings.put("text", "Scene 1"); -// remote.setSourceSettings(SOURCE_TEXT_SCENE1, settings, loggingCallback); -// } -// -// @Test -// void takeSourceScreenshot() throws Exception { -// String path = System.getProperty("user.home"); -// assertThat(path).isNotNull(); -// File file = new File(path, "test.png"); -// String screenshotPath = file.getAbsolutePath(); -// obsShould("Take a screenshot of the current scene, and save it to " + screenshotPath, 1); -// remote.takeSourceScreenshot( -// SCENE1, "png", -// screenshotPath, -// null, 1, -// 1080, 720, -// loggingCallback -// ); -// } -// -// @Test -// void startStopStreaming() { -// obsShould("Start Streaming"); -// remote.startStreaming(loggingCallback); -// obsShould("Stop Streaming"); -// remote.stopStreaming(loggingCallback); -// } -// -// @Test -// void startStopRecordingAndReplayBuffer() { -// obsShould("Start Recording"); -// remote.startRecording(loggingCallback); -// -// obsShould("Start the replay buffer"); -// remote.startReplayBuffer(loggingCallback); -// -// obsShould("Save the replay buffer"); -// remote.saveReplayBuffer(loggingCallback); -// -// obsShould("Stop the replay buffer"); -// remote.stopReplayBuffer(loggingCallback); -// -// obsShould("Stop Recording"); -// remote.stopRecording(loggingCallback); -// } -// -// @Test -// void setVolumeAndMute() { -// -// obsShould("Set the volume to 50% (note, appears 67% due to log scaling; check % in advanced audio properties)"); -// remote.setSourceVisibility(null, "media", true, loggingCallback); -// remote.setVolume(SOURCE_MEDIA, 0.50, loggingCallback); -// obsShould("Mute the volume"); -// remote.setMute(SOURCE_MEDIA, true, loggingCallback); -// remote.getMute(SOURCE_MEDIA, capturingCallback); -// waitReasonably(); -// assertThat(getPreviousResponseAs(GetMuteResponse.class).isMuted()).isTrue(); -// -// obsShould("Unmute the volume"); -// remote.setMute(SOURCE_MEDIA, false, loggingCallback); -// remote.getMute(SOURCE_MEDIA, capturingCallback); -// waitReasonably(); -// assertThat(getPreviousResponseAs(GetMuteResponse.class).isMuted()).isFalse(); -// -// obsShould("Set the volume to 100%"); -// remote.setVolume(SOURCE_MEDIA, 1.00, loggingCallback); -// -// } -// -// @Test -// void playPauseVlcMedia() { -// obsShould("Play video 1, by showing it (Note, VLC must be installed!)"); -// remote.setSourceVisibility(null, SOURCE_VLC_MEDIA, true, loggingCallback); -// -// obsShould("Pause video 1"); -// remote.pauseMedia(SOURCE_VLC_MEDIA, loggingCallback); -// -// // BUG: Toggle Play/Pause does not work in Palakis OBS plugin! -// // see https://github.com/obsproject/obs-websocket/issues/725 -// // I've noted we can also replicate the problem -// obsShould("Toggle Play Video 1"); -// remote.toggleMedia(SOURCE_VLC_MEDIA, loggingCallback); -// obsShould("Toggle Pause Video 1"); -// remote.toggleMedia(SOURCE_VLC_MEDIA, loggingCallback); -// -// obsShould("Switch to video 2"); -// remote.nextMedia(SOURCE_VLC_MEDIA, loggingCallback); -// -// obsShould("Restart, back at video 1 (should auto play)"); -// remote.restartMedia(SOURCE_VLC_MEDIA, loggingCallback); -// -// obsShould("Stop video 1 (going back to beginning)"); -// remote.stopMedia(SOURCE_VLC_MEDIA, loggingCallback); -// -// } -// -// @Test -// void triggerHotkey() { -// obsShould("Show the red square via hotkey name"); -// remote.triggerHotkeyByName("libobs.show_scene_item.red_square", loggingCallback); -// } -// -// @Test -// void refreshBrowserSource() { -// -// obsShould("Show the browser source", 1); -// remote.setSourceVisibility(null, SOURCE_BROWSER, true, loggingCallback); -// -// obsShould("Refresh the browser source (new random color and number)"); -// remote.refreshBrowserSource(SOURCE_BROWSER, loggingCallback); -// waitReasonably(1000); -// -// } + } + + @AfterEach + public void afterEach() { + try { + Thread.sleep(1000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + System.out.println("<< Test Complete"); + + } + + @Test + void switchScene() { + obsShould("Switch to scene2"); + remote.setCurrentProgramScene(SCENE2, loggingCallback()); + obsShould("Switch back to scene1"); + remote.setCurrentProgramScene(SCENE1, loggingCallback()); + } + + @Test + void showHideSceneItem() { + Number squareId = remote.getSceneItemId(SCENE1, SOURCE_RED_SQUARE, 0, 1000) + .getSceneItemId(); + + obsShould("Show the red square"); + remote.setSceneItemEnabled(SCENE1, squareId, true, loggingCallback()); + obsShould("Hide the red square"); + remote.setSceneItemEnabled(SCENE1, squareId, false, loggingCallback()); + } + + @Test + void setTransition() { + obsShould("Set current transition to Slide, with transition 2000ms"); + + remote.setCurrentSceneTransition(TRANSITION_SLIDE, loggingCallback()); + remote.setCurrentSceneTransitionDuration(2000, loggingCallback()); + obsShould("Set current transition back to 300ms"); + remote.setCurrentSceneTransitionDuration(300, loggingCallback()); + obsShould("Set current transition back to Cut"); + remote.setCurrentSceneTransition(TRANSITION_CUT, loggingCallback()); + } + + @Test + void changeScenesWithTransition() { + obsShould("Change to scene2, with the Slide transition"); + remote.setCurrentSceneTransition(TRANSITION_SLIDE, 1000); + remote.setCurrentProgramScene(SCENE2, loggingCallback()); + } + + @Test + void setSourceFilterVisibility() { + Number squareId = remote.getSceneItemId(SCENE1, SOURCE_RED_SQUARE, 0, 1000) + .getSceneItemId(); + + obsShould("Show a blue square (red square colored blue by a filter)"); + remote.setSceneItemEnabled(SCENE1, squareId, true, loggingCallback()); + remote.setSourceFilterEnabled(SOURCE_RED_SQUARE, SOURCE_RED_SQUARE_FILTER, true, + loggingCallback()); + obsShould("Return the red square to normal"); + remote.setSceneItemEnabled(SCENE1, squareId, false, loggingCallback()); + } + + @Test + void exerciseStudioMode() { + obsShould("Enable studio mode"); + remote.setStudioModeEnabled(true, loggingCallback()); + obsShould("Set preview scene to scene2"); + remote.setCurrentPreviewScene(SCENE2, loggingCallback()); + remote.setCurrentSceneTransition(TRANSITION_FADE, loggingCallback()); + + obsShould("Fade to scene2"); + remote.triggerStudioModeTransition(loggingCallback()); + + obsShould("Disable studio mode"); + remote.setStudioModeEnabled(false, loggingCallback()); + } + + @Test + void setSourceSettings() { + obsShould("Curse the 'scene1' text"); + + JsonObject setting = new JsonObject(); + setting.addProperty("text", "S̼͚̞̼̩̱̽̓̍̽͊́ͨ̍̀ċͭ̚҉̪̖̤̥ͅȩ͉̣̜̖̖͙͇́̀̒ͥ̓̚͠͞n̦͍͆͑ͤ̕e̶̖̝̗̻͂̑̽̔ͩ̅́͜ͅ ̢͉̬͔͙̺̖͂͂ͣ͢1̮̥͇̏̇͋̈́ͨͥ͝ͅ"); + remote.setInputSettings(SOURCE_TEXT_SCENE1, setting, false, loggingCallback()); + + obsShould("Change the 'scene1' text back to normal"); + setting.addProperty("text", "Scene 1"); + remote.setInputSettings(SOURCE_TEXT_SCENE1, setting, false, loggingCallback()); + } + + @Test + void takeSourceScreenshot() { + String path = System.getProperty("user.home"); + assertNotNull(path); + File file = new File(path, "test.png"); + String screenshotPath = file.getAbsolutePath(); + obsShould("Take a screenshot of the current scene, and save it to " + screenshotPath, 1); + remote.saveSourceScreenshot( + SCENE1, "png", + screenshotPath, + 1080, 720, + 1, + loggingCallback() + ); + } + + @Test + void startStopStreaming() { + obsShould("Start Streaming"); + remote.startStream(loggingCallback()); + obsShould("Stop Streaming"); + remote.stopStream(loggingCallback()); + } + + @Test + void startStopRecordingAndReplayBuffer() { + obsShould("Start Recording"); + remote.startRecord(loggingCallback()); + + obsShould("Start the replay buffer"); + remote.startReplayBuffer(loggingCallback()); + + obsShould("Save the replay buffer"); + remote.saveReplayBuffer(loggingCallback()); + + obsShould("Stop the replay buffer"); + remote.stopReplayBuffer(loggingCallback()); + + obsShould("Stop Recording"); + remote.stopRecord(loggingCallback()); + } + + @Test + void setVolumeAndMute() { + Number mediaId = remote.getSceneItemId(SCENE1, "media", 0, 1000).getSceneItemId(); + + obsShould( + "Set the volume to 50% (note, appears 67% due to log scaling; check % in advanced audio properties)"); + remote.setSceneItemEnabled(SCENE1, mediaId, true, loggingCallback()); + remote.setInputVolume(SOURCE_MEDIA, 0.50, null, loggingCallback()); + + obsShould("Mute the volume"); + remote.setInputMute(SOURCE_MEDIA, true, loggingCallback()); + GetInputMuteResponse muteResponse = remote.getInputMute(SOURCE_MEDIA, 1000); + assertTrue(muteResponse.getInputMuted()); + + obsShould("Unmute the volume"); + remote.setInputMute(SOURCE_MEDIA, false, loggingCallback()); + GetInputMuteResponse unmuteResponse = remote.getInputMute(SOURCE_MEDIA, 1000); + assertFalse(unmuteResponse.getInputMuted()); + + obsShould("Set the volume to 100%"); + remote.setInputVolume(SOURCE_MEDIA, 1.00, null, loggingCallback()); + } + + @Test + void playPauseVlcMedia() { + Number vlcId = remote.getSceneItemId(SCENE1, SOURCE_VLC_MEDIA, 0, 1000).getSceneItemId(); + obsShould("Play video 1, by showing it (Note, VLC must be installed!)"); + remote.setSceneItemEnabled(SCENE1, vlcId, true, loggingCallback()); + + obsShould("Pause video 1"); + remote.triggerMediaInputAction(SOURCE_VLC_MEDIA, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE", loggingCallback()); + + // BUG: Toggle Play/Pause does not work in Palakis OBS plugin! + // see https://github.com/obsproject/obs-websocket/issues/725 + // I've noted we can also replicate the problem + obsShould("Toggle Play Video 1"); + remote.triggerMediaInputAction(SOURCE_VLC_MEDIA, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PLAY", loggingCallback()); + obsShould("Toggle Pause Video 1"); + remote.triggerMediaInputAction(SOURCE_VLC_MEDIA, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_PAUSE", loggingCallback()); + + obsShould("Switch to video 2"); + remote.triggerMediaInputAction(SOURCE_VLC_MEDIA, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_NEXT", loggingCallback()); + + obsShould("Restart, back at video 1 (should auto play)"); + remote.triggerMediaInputAction(SOURCE_VLC_MEDIA, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_RESTART", loggingCallback()); + + obsShould("Stop video 1 (going back to beginning)"); + remote.triggerMediaInputAction(SOURCE_VLC_MEDIA, "OBS_WEBSOCKET_MEDIA_INPUT_ACTION_STOP", loggingCallback()); + } + + @Test + void triggerHotkey() { + Number squareId = remote.getSceneItemId(SCENE1, SOURCE_RED_SQUARE, 0, 1000).getSceneItemId(); + + obsShould("Show the red square via hotkey name"); + remote.triggerHotkeyByName("libobs.show_scene_item.red_square", loggingCallback()); + + obsShould("Hide the square again"); + remote.setSceneItemEnabled(SCENE1, squareId, false, loggingCallback()); + } + + @Test + void refreshBrowserSource() { + Number browserId = remote.getSceneItemId(SCENE1, SOURCE_BROWSER, 0, 1000).getSceneItemId(); + + obsShould("Show the browser source", 1); + remote.setSceneItemEnabled(SCENE1, browserId, true, loggingCallback()); + + obsShould("Refresh the browser source (new random color and number)"); + remote.pressInputPropertiesButton(SOURCE_BROWSER, "refreshnocache", loggingCallback()); + obsShould("Hide the browser again"); + remote.setSceneItemEnabled(SCENE1, browserId, false, loggingCallback()); + } } diff --git a/client/src/integrationTest/java/io/obswebsocket/community/client/test/ObsCommunicatorEventIT.java b/client/src/integrationTest/java/io/obswebsocket/community/client/test/ObsCommunicatorEventIT.java index 5e22b769..651e0a9e 100644 --- a/client/src/integrationTest/java/io/obswebsocket/community/client/test/ObsCommunicatorEventIT.java +++ b/client/src/integrationTest/java/io/obswebsocket/community/client/test/ObsCommunicatorEventIT.java @@ -1194,7 +1194,7 @@ void sceneListChangedEventTriggered() { + "\t\t\t'scenes': [\n" + "\t\t\t\t{\n" + "\t\t\t\t'sceneName': 'sceneName',\n" - + "\t\t\t\t'sceneItemIndex': 5\n" + + "\t\t\t\t'sceneIndex': 5\n" + "\t\t\t\t}\n" + "\t\t\t]\n" + "\t\t}\n" @@ -1210,7 +1210,9 @@ void sceneListChangedEventTriggered() { assertEquals( actualTestResult.get().getMessageData().getEventData().getScenes().get(0).getSceneName(), "sceneName"); - assertEquals(actualTestResult.get().getMessageData().getEventData().getScenes().get(0).getSceneItemIndex(), 5); + assertEquals( + actualTestResult.get().getMessageData().getEventData().getScenes().get(0).getSceneIndex(), + 5); } @Test diff --git a/client/src/main/java/io/obswebsocket/community/client/BlockingConsumer.java b/client/src/main/java/io/obswebsocket/community/client/BlockingConsumer.java new file mode 100644 index 00000000..ae91583e --- /dev/null +++ b/client/src/main/java/io/obswebsocket/community/client/BlockingConsumer.java @@ -0,0 +1,26 @@ +package io.obswebsocket.community.client; + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.function.Consumer; +import lombok.extern.slf4j.Slf4j; + +@Slf4j +class BlockingConsumer implements Consumer { + + private final CountDownLatch latch = new CountDownLatch(1); + private T result; + + @Override + public void accept(T t) { + this.result = t; + latch.countDown(); + } + + public T get(long timeout) throws InterruptedException { + if (!latch.await(timeout, TimeUnit.MILLISECONDS)) { + log.warn("Timeout waiting for result"); + } + return result; + } +} diff --git a/client/src/main/java/io/obswebsocket/community/client/OBSRemoteControllerBase.java b/client/src/main/java/io/obswebsocket/community/client/OBSRemoteControllerBase.java index fc5090a5..a5b05254 100644 --- a/client/src/main/java/io/obswebsocket/community/client/OBSRemoteControllerBase.java +++ b/client/src/main/java/io/obswebsocket/community/client/OBSRemoteControllerBase.java @@ -303,6 +303,20 @@ public void getPersistentData(Realm realm, String slotName, sendRequest(GetPersistentDataRequest.builder().realm(realm).slotName(slotName).build(), callback); } + /** + * Gets the value of a "slot" from the selected persistent data realm. + * + * @param realm The data realm to select. `OBS_WEBSOCKET_DATA_REALM_GLOBAL` or `OBS_WEBSOCKET_DATA_REALM_PROFILE` + * @param slotName The name of the slot to retrieve data from + * @param timeout long timeout in ms + * @return the GetPersistentDataResponse, null if the request timed out + */ + public GetPersistentDataResponse getPersistentData(Realm realm, String slotName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetPersistentDataRequest.builder().realm(realm).slotName(slotName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the value of a "slot" from the selected persistent data realm. * @@ -316,6 +330,22 @@ public void setPersistentData(Realm realm, String slotName, JsonElement slotValu sendRequest(SetPersistentDataRequest.builder().realm(realm).slotName(slotName).slotValue(slotValue).build(), callback); } + /** + * Sets the value of a "slot" from the selected persistent data realm. + * + * @param realm The data realm to select. `OBS_WEBSOCKET_DATA_REALM_GLOBAL` or `OBS_WEBSOCKET_DATA_REALM_PROFILE` + * @param slotName The name of the slot to retrieve data from + * @param slotValue The value to apply to the slot + * @param timeout long timeout in ms + * @return the SetPersistentDataResponse, null if the request timed out + */ + public SetPersistentDataResponse setPersistentData(Realm realm, String slotName, + JsonElement slotValue, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetPersistentDataRequest.builder().realm(realm).slotName(slotName).slotValue(slotValue).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets an array of all scene collections * @@ -325,6 +355,18 @@ public void getSceneCollectionList(Consumer call sendRequest(GetSceneCollectionListRequest.builder().build(), callback); } + /** + * Gets an array of all scene collections + * + * @param timeout long timeout in ms + * @return the GetSceneCollectionListResponse, null if the request timed out + */ + public GetSceneCollectionListResponse getSceneCollectionList(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneCollectionListRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Switches to a scene collection. * @@ -338,6 +380,22 @@ public void setCurrentSceneCollection(String sceneCollectionName, sendRequest(SetCurrentSceneCollectionRequest.builder().sceneCollectionName(sceneCollectionName).build(), callback); } + /** + * Switches to a scene collection. + * + * Note: This will block until the collection has finished changing. + * + * @param sceneCollectionName Name of the scene collection to switch to + * @param timeout long timeout in ms + * @return the SetCurrentSceneCollectionResponse, null if the request timed out + */ + public SetCurrentSceneCollectionResponse setCurrentSceneCollection(String sceneCollectionName, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetCurrentSceneCollectionRequest.builder().sceneCollectionName(sceneCollectionName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Creates a new scene collection, switching to it in the process. * @@ -351,6 +409,22 @@ public void createSceneCollection(String sceneCollectionName, sendRequest(CreateSceneCollectionRequest.builder().sceneCollectionName(sceneCollectionName).build(), callback); } + /** + * Creates a new scene collection, switching to it in the process. + * + * Note: This will block until the collection has finished changing. + * + * @param sceneCollectionName Name for the new scene collection + * @param timeout long timeout in ms + * @return the CreateSceneCollectionResponse, null if the request timed out + */ + public CreateSceneCollectionResponse createSceneCollection(String sceneCollectionName, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(CreateSceneCollectionRequest.builder().sceneCollectionName(sceneCollectionName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets an array of all profiles * @@ -360,6 +434,18 @@ public void getProfileList(Consumer callback) { sendRequest(GetProfileListRequest.builder().build(), callback); } + /** + * Gets an array of all profiles + * + * @param timeout long timeout in ms + * @return the GetProfileListResponse, null if the request timed out + */ + public GetProfileListResponse getProfileList(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetProfileListRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Switches to a profile. * @@ -370,6 +456,19 @@ public void setCurrentProfile(String profileName, Consumer callback = new BlockingConsumer(); + sendRequest(SetCurrentProfileRequest.builder().profileName(profileName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Creates a new profile, switching to it in the process * @@ -380,6 +479,19 @@ public void createProfile(String profileName, Consumer ca sendRequest(CreateProfileRequest.builder().profileName(profileName).build(), callback); } + /** + * Creates a new profile, switching to it in the process + * + * @param profileName Name for the new profile + * @param timeout long timeout in ms + * @return the CreateProfileResponse, null if the request timed out + */ + public CreateProfileResponse createProfile(String profileName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(CreateProfileRequest.builder().profileName(profileName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Removes a profile. If the current profile is chosen, it will change to a different profile first. * @@ -390,6 +502,19 @@ public void removeProfile(String profileName, Consumer ca sendRequest(RemoveProfileRequest.builder().profileName(profileName).build(), callback); } + /** + * Removes a profile. If the current profile is chosen, it will change to a different profile first. + * + * @param profileName Name of the profile to remove + * @param timeout long timeout in ms + * @return the RemoveProfileResponse, null if the request timed out + */ + public RemoveProfileResponse removeProfile(String profileName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(RemoveProfileRequest.builder().profileName(profileName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets a parameter from the current profile's configuration. * @@ -402,6 +527,21 @@ public void getProfileParameter(String parameterCategory, String parameterName, sendRequest(GetProfileParameterRequest.builder().parameterCategory(parameterCategory).parameterName(parameterName).build(), callback); } + /** + * Gets a parameter from the current profile's configuration. + * + * @param parameterCategory Category of the parameter to get + * @param parameterName Name of the parameter to get + * @param timeout long timeout in ms + * @return the GetProfileParameterResponse, null if the request timed out + */ + public GetProfileParameterResponse getProfileParameter(String parameterCategory, + String parameterName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetProfileParameterRequest.builder().parameterCategory(parameterCategory).parameterName(parameterName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the value of a parameter in the current profile's configuration. * @@ -415,6 +555,22 @@ public void setProfileParameter(String parameterCategory, String parameterName, sendRequest(SetProfileParameterRequest.builder().parameterCategory(parameterCategory).parameterName(parameterName).parameterValue(parameterValue).build(), callback); } + /** + * Sets the value of a parameter in the current profile's configuration. + * + * @param parameterCategory Category of the parameter to set + * @param parameterName Name of the parameter to set + * @param parameterValue Value of the parameter to set. Use `null` to delete + * @param timeout long timeout in ms + * @return the SetProfileParameterResponse, null if the request timed out + */ + public SetProfileParameterResponse setProfileParameter(String parameterCategory, + String parameterName, String parameterValue, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetProfileParameterRequest.builder().parameterCategory(parameterCategory).parameterName(parameterName).parameterValue(parameterValue).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the current video settings. * @@ -426,6 +582,20 @@ public void getVideoSettings(Consumer callback) { sendRequest(GetVideoSettingsRequest.builder().build(), callback); } + /** + * Gets the current video settings. + * + * Note: To get the true FPS value, divide the FPS numerator by the FPS denominator. Example: `60000/1001` + * + * @param timeout long timeout in ms + * @return the GetVideoSettingsResponse, null if the request timed out + */ + public GetVideoSettingsResponse getVideoSettings(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetVideoSettingsRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the current video settings. * @@ -445,6 +615,27 @@ public void setVideoSettings(Number fpsNumerator, Number fpsDenominator, Number sendRequest(SetVideoSettingsRequest.builder().fpsNumerator(fpsNumerator).fpsDenominator(fpsDenominator).baseWidth(baseWidth).baseHeight(baseHeight).outputWidth(outputWidth).outputHeight(outputHeight).build(), callback); } + /** + * Sets the current video settings. + * + * Note: Fields must be specified in pairs. For example, you cannot set only `baseWidth` without needing to specify `baseHeight`. + * + * @param fpsNumerator Numerator of the fractional FPS value + * @param fpsDenominator Denominator of the fractional FPS value + * @param baseWidth Width of the base (canvas) resolution in pixels + * @param baseHeight Height of the base (canvas) resolution in pixels + * @param outputWidth Width of the output resolution in pixels + * @param outputHeight Height of the output resolution in pixels + * @param timeout long timeout in ms + * @return the SetVideoSettingsResponse, null if the request timed out + */ + public SetVideoSettingsResponse setVideoSettings(Number fpsNumerator, Number fpsDenominator, + Number baseWidth, Number baseHeight, Number outputWidth, Number outputHeight, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetVideoSettingsRequest.builder().fpsNumerator(fpsNumerator).fpsDenominator(fpsDenominator).baseWidth(baseWidth).baseHeight(baseHeight).outputWidth(outputWidth).outputHeight(outputHeight).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the current stream service settings (stream destination). * @@ -454,6 +645,18 @@ public void getStreamServiceSettings(Consumer sendRequest(GetStreamServiceSettingsRequest.builder().build(), callback); } + /** + * Gets the current stream service settings (stream destination). + * + * @param timeout long timeout in ms + * @return the GetStreamServiceSettingsResponse, null if the request timed out + */ + public GetStreamServiceSettingsResponse getStreamServiceSettings(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetStreamServiceSettingsRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the current stream service settings (stream destination). * @@ -468,6 +671,23 @@ public void setStreamServiceSettings(String streamServiceType, JsonObject stream sendRequest(SetStreamServiceSettingsRequest.builder().streamServiceType(streamServiceType).streamServiceSettings(streamServiceSettings).build(), callback); } + /** + * Sets the current stream service settings (stream destination). + * + * Note: Simple RTMP settings can be set with type `rtmp_custom` and the settings fields `server` and `key`. + * + * @param streamServiceType Type of stream service to apply. Example: `rtmp_common` or `rtmp_custom` + * @param streamServiceSettings Settings to apply to the service + * @param timeout long timeout in ms + * @return the SetStreamServiceSettingsResponse, null if the request timed out + */ + public SetStreamServiceSettingsResponse setStreamServiceSettings(String streamServiceType, + JsonObject streamServiceSettings, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetStreamServiceSettingsRequest.builder().streamServiceType(streamServiceType).streamServiceSettings(streamServiceSettings).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the current directory that the record output is set to. * @@ -477,6 +697,18 @@ public void getRecordDirectory(Consumer callback) { sendRequest(GetRecordDirectoryRequest.builder().build(), callback); } + /** + * Gets the current directory that the record output is set to. + * + * @param timeout long timeout in ms + * @return the GetRecordDirectoryResponse, null if the request timed out + */ + public GetRecordDirectoryResponse getRecordDirectory(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetRecordDirectoryRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets an array of all of a source's filters. * @@ -488,6 +720,19 @@ public void getSourceFilterList(String sourceName, sendRequest(GetSourceFilterListRequest.builder().sourceName(sourceName).build(), callback); } + /** + * Gets an array of all of a source's filters. + * + * @param sourceName Name of the source + * @param timeout long timeout in ms + * @return the GetSourceFilterListResponse, null if the request timed out + */ + public GetSourceFilterListResponse getSourceFilterList(String sourceName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSourceFilterListRequest.builder().sourceName(sourceName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the default settings for a filter kind. * @@ -499,6 +744,20 @@ public void getSourceFilterDefaultSettings(String filterKind, sendRequest(GetSourceFilterDefaultSettingsRequest.builder().filterKind(filterKind).build(), callback); } + /** + * Gets the default settings for a filter kind. + * + * @param filterKind Filter kind to get the default settings for + * @param timeout long timeout in ms + * @return the GetSourceFilterDefaultSettingsResponse, null if the request timed out + */ + public GetSourceFilterDefaultSettingsResponse getSourceFilterDefaultSettings(String filterKind, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSourceFilterDefaultSettingsRequest.builder().filterKind(filterKind).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Creates a new filter, adding it to the specified source. * @@ -513,6 +772,23 @@ public void createSourceFilter(String sourceName, String filterName, String filt sendRequest(CreateSourceFilterRequest.builder().sourceName(sourceName).filterName(filterName).filterKind(filterKind).filterSettings(filterSettings).build(), callback); } + /** + * Creates a new filter, adding it to the specified source. + * + * @param sourceName Name of the source to add the filter to + * @param filterName Name of the new filter to be created + * @param filterKind The kind of filter to be created + * @param filterSettings Settings object to initialize the filter with + * @param timeout long timeout in ms + * @return the CreateSourceFilterResponse, null if the request timed out + */ + public CreateSourceFilterResponse createSourceFilter(String sourceName, String filterName, + String filterKind, JsonObject filterSettings, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(CreateSourceFilterRequest.builder().sourceName(sourceName).filterName(filterName).filterKind(filterKind).filterSettings(filterSettings).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Removes a filter from a source. * @@ -525,6 +801,21 @@ public void removeSourceFilter(String sourceName, String filterName, sendRequest(RemoveSourceFilterRequest.builder().sourceName(sourceName).filterName(filterName).build(), callback); } + /** + * Removes a filter from a source. + * + * @param sourceName Name of the source the filter is on + * @param filterName Name of the filter to remove + * @param timeout long timeout in ms + * @return the RemoveSourceFilterResponse, null if the request timed out + */ + public RemoveSourceFilterResponse removeSourceFilter(String sourceName, String filterName, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(RemoveSourceFilterRequest.builder().sourceName(sourceName).filterName(filterName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the name of a source filter (rename). * @@ -538,6 +829,22 @@ public void setSourceFilterName(String sourceName, String filterName, String new sendRequest(SetSourceFilterNameRequest.builder().sourceName(sourceName).filterName(filterName).newFilterName(newFilterName).build(), callback); } + /** + * Sets the name of a source filter (rename). + * + * @param sourceName Name of the source the filter is on + * @param filterName Current name of the filter + * @param newFilterName New name for the filter + * @param timeout long timeout in ms + * @return the SetSourceFilterNameResponse, null if the request timed out + */ + public SetSourceFilterNameResponse setSourceFilterName(String sourceName, String filterName, + String newFilterName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSourceFilterNameRequest.builder().sourceName(sourceName).filterName(filterName).newFilterName(newFilterName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the info for a specific source filter. * @@ -550,6 +857,21 @@ public void getSourceFilter(String sourceName, String filterName, sendRequest(GetSourceFilterRequest.builder().sourceName(sourceName).filterName(filterName).build(), callback); } + /** + * Gets the info for a specific source filter. + * + * @param sourceName Name of the source + * @param filterName Name of the filter + * @param timeout long timeout in ms + * @return the GetSourceFilterResponse, null if the request timed out + */ + public GetSourceFilterResponse getSourceFilter(String sourceName, String filterName, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSourceFilterRequest.builder().sourceName(sourceName).filterName(filterName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the index position of a filter on a source. * @@ -563,6 +885,22 @@ public void setSourceFilterIndex(String sourceName, String filterName, Number fi sendRequest(SetSourceFilterIndexRequest.builder().sourceName(sourceName).filterName(filterName).filterIndex(filterIndex).build(), callback); } + /** + * Sets the index position of a filter on a source. + * + * @param sourceName Name of the source the filter is on + * @param filterName Name of the filter + * @param filterIndex New index position of the filter + * @param timeout long timeout in ms + * @return the SetSourceFilterIndexResponse, null if the request timed out + */ + public SetSourceFilterIndexResponse setSourceFilterIndex(String sourceName, String filterName, + Number filterIndex, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSourceFilterIndexRequest.builder().sourceName(sourceName).filterName(filterName).filterIndex(filterIndex).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the settings of a source filter. * @@ -578,6 +916,23 @@ public void setSourceFilterSettings(String sourceName, String filterName, sendRequest(SetSourceFilterSettingsRequest.builder().sourceName(sourceName).filterName(filterName).filterSettings(filterSettings).overlay(overlay).build(), callback); } + /** + * Sets the settings of a source filter. + * + * @param sourceName Name of the source the filter is on + * @param filterName Name of the filter to set the settings of + * @param filterSettings Object of settings to apply + * @param overlay True == apply the settings on top of existing ones, False == reset the input to its defaults, then apply settings. + * @param timeout long timeout in ms + * @return the SetSourceFilterSettingsResponse, null if the request timed out + */ + public SetSourceFilterSettingsResponse setSourceFilterSettings(String sourceName, + String filterName, JsonObject filterSettings, Boolean overlay, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSourceFilterSettingsRequest.builder().sourceName(sourceName).filterName(filterName).filterSettings(filterSettings).overlay(overlay).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the enable state of a source filter. * @@ -591,6 +946,22 @@ public void setSourceFilterEnabled(String sourceName, String filterName, Boolean sendRequest(SetSourceFilterEnabledRequest.builder().sourceName(sourceName).filterName(filterName).filterEnabled(filterEnabled).build(), callback); } + /** + * Sets the enable state of a source filter. + * + * @param sourceName Name of the source the filter is on + * @param filterName Name of the filter + * @param filterEnabled New enable state of the filter + * @param timeout long timeout in ms + * @return the SetSourceFilterEnabledResponse, null if the request timed out + */ + public SetSourceFilterEnabledResponse setSourceFilterEnabled(String sourceName, String filterName, + Boolean filterEnabled, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSourceFilterEnabledRequest.builder().sourceName(sourceName).filterName(filterName).filterEnabled(filterEnabled).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets data about the current plugin and RPC version. * @@ -600,6 +971,18 @@ public void getVersion(Consumer callback) { sendRequest(GetVersionRequest.builder().build(), callback); } + /** + * Gets data about the current plugin and RPC version. + * + * @param timeout long timeout in ms + * @return the GetVersionResponse, null if the request timed out + */ + public GetVersionResponse getVersion(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetVersionRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets statistics about OBS, obs-websocket, and the current session. * @@ -609,6 +992,18 @@ public void getStats(Consumer callback) { sendRequest(GetStatsRequest.builder().build(), callback); } + /** + * Gets statistics about OBS, obs-websocket, and the current session. + * + * @param timeout long timeout in ms + * @return the GetStatsResponse, null if the request timed out + */ + public GetStatsResponse getStats(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetStatsRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Broadcasts a `CustomEvent` to all WebSocket clients. Receivers are clients which are identified and subscribed. * @@ -620,6 +1015,19 @@ public void broadcastCustomEvent(JsonObject eventData, sendRequest(BroadcastCustomEventRequest.builder().eventData(eventData).build(), callback); } + /** + * Broadcasts a `CustomEvent` to all WebSocket clients. Receivers are clients which are identified and subscribed. + * + * @param eventData Data payload to emit to all receivers + * @param timeout long timeout in ms + * @return the BroadcastCustomEventResponse, null if the request timed out + */ + public BroadcastCustomEventResponse broadcastCustomEvent(JsonObject eventData, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(BroadcastCustomEventRequest.builder().eventData(eventData).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Call a request registered to a vendor. * @@ -637,14 +1045,45 @@ public void callVendorRequest(String vendorName, String requestType, JsonObject } /** - * Gets an array of all hotkey names in OBS + * Call a request registered to a vendor. * - * @param callback Consumer<GetHotkeyListResponse> + * A vendor is a unique name registered by a third-party plugin or script, which allows for custom requests and events to be added to obs-websocket. + * If a plugin or script implements vendor requests or events, documentation is expected to be provided with them. + * + * @param vendorName Name of the vendor to use + * @param requestType The request type to call + * @param requestData Object containing appropriate request data + * @param timeout long timeout in ms + * @return the CallVendorRequestResponse, null if the request timed out + */ + public CallVendorRequestResponse callVendorRequest(String vendorName, String requestType, + JsonObject requestData, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(CallVendorRequestRequest.builder().vendorName(vendorName).requestType(requestType).requestData(requestData).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + + /** + * Gets an array of all hotkey names in OBS + * + * @param callback Consumer<GetHotkeyListResponse> */ public void getHotkeyList(Consumer callback) { sendRequest(GetHotkeyListRequest.builder().build(), callback); } + /** + * Gets an array of all hotkey names in OBS + * + * @param timeout long timeout in ms + * @return the GetHotkeyListResponse, null if the request timed out + */ + public GetHotkeyListResponse getHotkeyList(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetHotkeyListRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Triggers a hotkey using its name. See `GetHotkeyList` * @@ -656,6 +1095,19 @@ public void triggerHotkeyByName(String hotkeyName, sendRequest(TriggerHotkeyByNameRequest.builder().hotkeyName(hotkeyName).build(), callback); } + /** + * Triggers a hotkey using its name. See `GetHotkeyList` + * + * @param hotkeyName Name of the hotkey to trigger + * @param timeout long timeout in ms + * @return the TriggerHotkeyByNameResponse, null if the request timed out + */ + public TriggerHotkeyByNameResponse triggerHotkeyByName(String hotkeyName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(TriggerHotkeyByNameRequest.builder().hotkeyName(hotkeyName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Triggers a hotkey using a sequence of keys. * @@ -668,6 +1120,21 @@ public void triggerHotkeyByKeySequence(String keyId, KeyModifiers keyModifiers, sendRequest(TriggerHotkeyByKeySequenceRequest.builder().keyId(keyId).keyModifiers(keyModifiers).build(), callback); } + /** + * Triggers a hotkey using a sequence of keys. + * + * @param keyId The OBS key ID to use. See https://github.com/obsproject/obs-studio/blob/master/libobs/obs-hotkeys.h + * @param keyModifiers Object containing key modifiers to apply + * @param timeout long timeout in ms + * @return the TriggerHotkeyByKeySequenceResponse, null if the request timed out + */ + public TriggerHotkeyByKeySequenceResponse triggerHotkeyByKeySequence(String keyId, + KeyModifiers keyModifiers, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(TriggerHotkeyByKeySequenceRequest.builder().keyId(keyId).keyModifiers(keyModifiers).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sleeps for a time duration or number of frames. Only available in request batches with types `SERIAL_REALTIME` or `SERIAL_FRAME`. * @@ -679,6 +1146,20 @@ public void sleep(Number sleepMillis, Number sleepFrames, Consumer callback = new BlockingConsumer(); + sendRequest(SleepRequest.builder().sleepMillis(sleepMillis).sleepFrames(sleepFrames).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets an array of all inputs in OBS. * @@ -689,6 +1170,19 @@ public void getInputList(String inputKind, Consumer callba sendRequest(GetInputListRequest.builder().inputKind(inputKind).build(), callback); } + /** + * Gets an array of all inputs in OBS. + * + * @param inputKind Restrict the array to only inputs of the specified kind + * @param timeout long timeout in ms + * @return the GetInputListResponse, null if the request timed out + */ + public GetInputListResponse getInputList(String inputKind, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetInputListRequest.builder().inputKind(inputKind).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets an array of all available input kinds in OBS. * @@ -699,6 +1193,19 @@ public void getInputKindList(Boolean unversioned, Consumer callback = new BlockingConsumer(); + sendRequest(GetInputKindListRequest.builder().unversioned(unversioned).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the names of all special inputs. * @@ -708,6 +1215,18 @@ public void getSpecialInputs(Consumer callback) { sendRequest(GetSpecialInputsRequest.builder().build(), callback); } + /** + * Gets the names of all special inputs. + * + * @param timeout long timeout in ms + * @return the GetSpecialInputsResponse, null if the request timed out + */ + public GetSpecialInputsResponse getSpecialInputs(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSpecialInputsRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Creates a new input, adding it as a scene item to the specified scene. * @@ -723,6 +1242,24 @@ public void createInput(String sceneName, String inputName, String inputKind, sendRequest(CreateInputRequest.builder().sceneName(sceneName).inputName(inputName).inputKind(inputKind).inputSettings(inputSettings).sceneItemEnabled(sceneItemEnabled).build(), callback); } + /** + * Creates a new input, adding it as a scene item to the specified scene. + * + * @param sceneName Name of the scene to add the input to as a scene item + * @param inputName Name of the new input to created + * @param inputKind The kind of input to be created + * @param inputSettings Settings object to initialize the input with + * @param sceneItemEnabled Whether to set the created scene item to enabled or disabled + * @param timeout long timeout in ms + * @return the CreateInputResponse, null if the request timed out + */ + public CreateInputResponse createInput(String sceneName, String inputName, String inputKind, + JsonObject inputSettings, Boolean sceneItemEnabled, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(CreateInputRequest.builder().sceneName(sceneName).inputName(inputName).inputKind(inputKind).inputSettings(inputSettings).sceneItemEnabled(sceneItemEnabled).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Removes an existing input. * @@ -735,6 +1272,21 @@ public void removeInput(String inputName, Consumer callback sendRequest(RemoveInputRequest.builder().inputName(inputName).build(), callback); } + /** + * Removes an existing input. + * + * Note: Will immediately remove all associated scene items. + * + * @param inputName Name of the input to remove + * @param timeout long timeout in ms + * @return the RemoveInputResponse, null if the request timed out + */ + public RemoveInputResponse removeInput(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(RemoveInputRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the name of an input (rename). * @@ -747,6 +1299,20 @@ public void setInputName(String inputName, String newInputName, sendRequest(SetInputNameRequest.builder().inputName(inputName).newInputName(newInputName).build(), callback); } + /** + * Sets the name of an input (rename). + * + * @param inputName Current input name + * @param newInputName New name for the input + * @param timeout long timeout in ms + * @return the SetInputNameResponse, null if the request timed out + */ + public SetInputNameResponse setInputName(String inputName, String newInputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetInputNameRequest.builder().inputName(inputName).newInputName(newInputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the default settings for an input kind. * @@ -758,6 +1324,19 @@ public void getInputDefaultSettings(String inputKind, sendRequest(GetInputDefaultSettingsRequest.builder().inputKind(inputKind).build(), callback); } + /** + * Gets the default settings for an input kind. + * + * @param inputKind Input kind to get the default settings for + * @param timeout long timeout in ms + * @return the GetInputDefaultSettingsResponse, null if the request timed out + */ + public GetInputDefaultSettingsResponse getInputDefaultSettings(String inputKind, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetInputDefaultSettingsRequest.builder().inputKind(inputKind).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the settings of an input. * @@ -770,6 +1349,21 @@ public void getInputSettings(String inputName, Consumer callback = new BlockingConsumer(); + sendRequest(GetInputSettingsRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the settings of an input. * @@ -783,6 +1377,22 @@ public void setInputSettings(String inputName, JsonObject inputSettings, Boolean sendRequest(SetInputSettingsRequest.builder().inputName(inputName).inputSettings(inputSettings).overlay(overlay).build(), callback); } + /** + * Sets the settings of an input. + * + * @param inputName Name of the input to set the settings of + * @param inputSettings Object of settings to apply + * @param overlay True == apply the settings on top of existing ones, False == reset the input to its defaults, then apply settings. + * @param timeout long timeout in ms + * @return the SetInputSettingsResponse, null if the request timed out + */ + public SetInputSettingsResponse setInputSettings(String inputName, JsonObject inputSettings, + Boolean overlay, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetInputSettingsRequest.builder().inputName(inputName).inputSettings(inputSettings).overlay(overlay).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the audio mute state of an input. * @@ -793,6 +1403,19 @@ public void getInputMute(String inputName, Consumer callba sendRequest(GetInputMuteRequest.builder().inputName(inputName).build(), callback); } + /** + * Gets the audio mute state of an input. + * + * @param inputName Name of input to get the mute state of + * @param timeout long timeout in ms + * @return the GetInputMuteResponse, null if the request timed out + */ + public GetInputMuteResponse getInputMute(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetInputMuteRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the audio mute state of an input. * @@ -805,6 +1428,20 @@ public void setInputMute(String inputName, Boolean inputMuted, sendRequest(SetInputMuteRequest.builder().inputName(inputName).inputMuted(inputMuted).build(), callback); } + /** + * Sets the audio mute state of an input. + * + * @param inputName Name of the input to set the mute state of + * @param inputMuted Whether to mute the input or not + * @param timeout long timeout in ms + * @return the SetInputMuteResponse, null if the request timed out + */ + public SetInputMuteResponse setInputMute(String inputName, Boolean inputMuted, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetInputMuteRequest.builder().inputName(inputName).inputMuted(inputMuted).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Toggles the audio mute state of an input. * @@ -815,6 +1452,19 @@ public void toggleInputMute(String inputName, Consumer sendRequest(ToggleInputMuteRequest.builder().inputName(inputName).build(), callback); } + /** + * Toggles the audio mute state of an input. + * + * @param inputName Name of the input to toggle the mute state of + * @param timeout long timeout in ms + * @return the ToggleInputMuteResponse, null if the request timed out + */ + public ToggleInputMuteResponse toggleInputMute(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(ToggleInputMuteRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the current volume setting of an input. * @@ -825,6 +1475,19 @@ public void getInputVolume(String inputName, Consumer ca sendRequest(GetInputVolumeRequest.builder().inputName(inputName).build(), callback); } + /** + * Gets the current volume setting of an input. + * + * @param inputName Name of the input to get the volume of + * @param timeout long timeout in ms + * @return the GetInputVolumeResponse, null if the request timed out + */ + public GetInputVolumeResponse getInputVolume(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetInputVolumeRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the volume setting of an input. * @@ -838,6 +1501,22 @@ public void setInputVolume(String inputName, Number inputVolumeMul, Number input sendRequest(SetInputVolumeRequest.builder().inputName(inputName).inputVolumeMul(inputVolumeMul).inputVolumeDb(inputVolumeDb).build(), callback); } + /** + * Sets the volume setting of an input. + * + * @param inputName Name of the input to set the volume of + * @param inputVolumeMul Volume setting in mul + * @param inputVolumeDb Volume setting in dB + * @param timeout long timeout in ms + * @return the SetInputVolumeResponse, null if the request timed out + */ + public SetInputVolumeResponse setInputVolume(String inputName, Number inputVolumeMul, + Number inputVolumeDb, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetInputVolumeRequest.builder().inputName(inputName).inputVolumeMul(inputVolumeMul).inputVolumeDb(inputVolumeDb).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the audio balance of an input. * @@ -849,6 +1528,19 @@ public void getInputAudioBalance(String inputName, sendRequest(GetInputAudioBalanceRequest.builder().inputName(inputName).build(), callback); } + /** + * Gets the audio balance of an input. + * + * @param inputName Name of the input to get the audio balance of + * @param timeout long timeout in ms + * @return the GetInputAudioBalanceResponse, null if the request timed out + */ + public GetInputAudioBalanceResponse getInputAudioBalance(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetInputAudioBalanceRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the audio balance of an input. * @@ -861,6 +1553,21 @@ public void setInputAudioBalance(String inputName, Number inputAudioBalance, sendRequest(SetInputAudioBalanceRequest.builder().inputName(inputName).inputAudioBalance(inputAudioBalance).build(), callback); } + /** + * Sets the audio balance of an input. + * + * @param inputName Name of the input to set the audio balance of + * @param inputAudioBalance New audio balance value + * @param timeout long timeout in ms + * @return the SetInputAudioBalanceResponse, null if the request timed out + */ + public SetInputAudioBalanceResponse setInputAudioBalance(String inputName, + Number inputAudioBalance, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetInputAudioBalanceRequest.builder().inputName(inputName).inputAudioBalance(inputAudioBalance).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the audio sync offset of an input. * @@ -874,6 +1581,21 @@ public void getInputAudioSyncOffset(String inputName, sendRequest(GetInputAudioSyncOffsetRequest.builder().inputName(inputName).build(), callback); } + /** + * Gets the audio sync offset of an input. + * + * Note: The audio sync offset can be negative too! + * + * @param inputName Name of the input to get the audio sync offset of + * @param timeout long timeout in ms + * @return the GetInputAudioSyncOffsetResponse, null if the request timed out + */ + public GetInputAudioSyncOffsetResponse getInputAudioSyncOffset(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetInputAudioSyncOffsetRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the audio sync offset of an input. * @@ -886,6 +1608,21 @@ public void setInputAudioSyncOffset(String inputName, Number inputAudioSyncOffse sendRequest(SetInputAudioSyncOffsetRequest.builder().inputName(inputName).inputAudioSyncOffset(inputAudioSyncOffset).build(), callback); } + /** + * Sets the audio sync offset of an input. + * + * @param inputName Name of the input to set the audio sync offset of + * @param inputAudioSyncOffset New audio sync offset in milliseconds + * @param timeout long timeout in ms + * @return the SetInputAudioSyncOffsetResponse, null if the request timed out + */ + public SetInputAudioSyncOffsetResponse setInputAudioSyncOffset(String inputName, + Number inputAudioSyncOffset, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetInputAudioSyncOffsetRequest.builder().inputName(inputName).inputAudioSyncOffset(inputAudioSyncOffset).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the audio monitor type of an input. * @@ -903,6 +1640,25 @@ public void getInputAudioMonitorType(String inputName, sendRequest(GetInputAudioMonitorTypeRequest.builder().inputName(inputName).build(), callback); } + /** + * Gets the audio monitor type of an input. + * + * The available audio monitor types are: + * + * - `OBS_MONITORING_TYPE_NONE` + * - `OBS_MONITORING_TYPE_MONITOR_ONLY` + * - `OBS_MONITORING_TYPE_MONITOR_AND_OUTPUT` + * + * @param inputName Name of the input to get the audio monitor type of + * @param timeout long timeout in ms + * @return the GetInputAudioMonitorTypeResponse, null if the request timed out + */ + public GetInputAudioMonitorTypeResponse getInputAudioMonitorType(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetInputAudioMonitorTypeRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the audio monitor type of an input. * @@ -915,6 +1671,21 @@ public void setInputAudioMonitorType(String inputName, Input.MonitorType monitor sendRequest(SetInputAudioMonitorTypeRequest.builder().inputName(inputName).monitorType(monitorType).build(), callback); } + /** + * Sets the audio monitor type of an input. + * + * @param inputName Name of the input to set the audio monitor type of + * @param monitorType Audio monitor type + * @param timeout long timeout in ms + * @return the SetInputAudioMonitorTypeResponse, null if the request timed out + */ + public SetInputAudioMonitorTypeResponse setInputAudioMonitorType(String inputName, + Input.MonitorType monitorType, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetInputAudioMonitorTypeRequest.builder().inputName(inputName).monitorType(monitorType).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the enable state of all audio tracks of an input. * @@ -926,6 +1697,19 @@ public void getInputAudioTracks(String inputName, sendRequest(GetInputAudioTracksRequest.builder().inputName(inputName).build(), callback); } + /** + * Gets the enable state of all audio tracks of an input. + * + * @param inputName Name of the input + * @param timeout long timeout in ms + * @return the GetInputAudioTracksResponse, null if the request timed out + */ + public GetInputAudioTracksResponse getInputAudioTracks(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetInputAudioTracksRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the enable state of audio tracks of an input. * @@ -938,6 +1722,21 @@ public void setInputAudioTracks(String inputName, Input.AudioTracks inputAudioTr sendRequest(SetInputAudioTracksRequest.builder().inputName(inputName).inputAudioTracks(inputAudioTracks).build(), callback); } + /** + * Sets the enable state of audio tracks of an input. + * + * @param inputName Name of the input + * @param inputAudioTracks Track settings to apply + * @param timeout long timeout in ms + * @return the SetInputAudioTracksResponse, null if the request timed out + */ + public SetInputAudioTracksResponse setInputAudioTracks(String inputName, + Input.AudioTracks inputAudioTracks, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetInputAudioTracksRequest.builder().inputName(inputName).inputAudioTracks(inputAudioTracks).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the items of a list property from an input's properties. * @@ -953,13 +1752,30 @@ public void getInputPropertiesListPropertyItems(String inputName, String propert } /** - * Presses a button in the properties of an input. - * - * Some known `propertyName` values are: - * - * - `refreshnocache` - Browser source reload button + * Gets the items of a list property from an input's properties. * - * Note: Use this in cases where there is a button in the properties of an input that cannot be accessed in any other way. For example, browser sources, where there is a refresh button. + * Note: Use this in cases where an input provides a dynamic, selectable list of items. For example, display capture, where it provides a list of available displays. + * + * @param inputName Name of the input + * @param propertyName Name of the list property to get the items of + * @param timeout long timeout in ms + * @return the GetInputPropertiesListPropertyItemsResponse, null if the request timed out + */ + public GetInputPropertiesListPropertyItemsResponse getInputPropertiesListPropertyItems( + String inputName, String propertyName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetInputPropertiesListPropertyItemsRequest.builder().inputName(inputName).propertyName(propertyName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + + /** + * Presses a button in the properties of an input. + * + * Some known `propertyName` values are: + * + * - `refreshnocache` - Browser source reload button + * + * Note: Use this in cases where there is a button in the properties of an input that cannot be accessed in any other way. For example, browser sources, where there is a refresh button. * * @param inputName Name of the input * @param propertyName Name of the button property to press @@ -970,6 +1786,27 @@ public void pressInputPropertiesButton(String inputName, String propertyName, sendRequest(PressInputPropertiesButtonRequest.builder().inputName(inputName).propertyName(propertyName).build(), callback); } + /** + * Presses a button in the properties of an input. + * + * Some known `propertyName` values are: + * + * - `refreshnocache` - Browser source reload button + * + * Note: Use this in cases where there is a button in the properties of an input that cannot be accessed in any other way. For example, browser sources, where there is a refresh button. + * + * @param inputName Name of the input + * @param propertyName Name of the button property to press + * @param timeout long timeout in ms + * @return the PressInputPropertiesButtonResponse, null if the request timed out + */ + public PressInputPropertiesButtonResponse pressInputPropertiesButton(String inputName, + String propertyName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(PressInputPropertiesButtonRequest.builder().inputName(inputName).propertyName(propertyName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the status of a media input. * @@ -992,6 +1829,30 @@ public void getMediaInputStatus(String inputName, sendRequest(GetMediaInputStatusRequest.builder().inputName(inputName).build(), callback); } + /** + * Gets the status of a media input. + * + * Media States: + * + * - `OBS_MEDIA_STATE_NONE` + * - `OBS_MEDIA_STATE_PLAYING` + * - `OBS_MEDIA_STATE_OPENING` + * - `OBS_MEDIA_STATE_BUFFERING` + * - `OBS_MEDIA_STATE_PAUSED` + * - `OBS_MEDIA_STATE_STOPPED` + * - `OBS_MEDIA_STATE_ENDED` + * - `OBS_MEDIA_STATE_ERROR` + * + * @param inputName Name of the media input + * @param timeout long timeout in ms + * @return the GetMediaInputStatusResponse, null if the request timed out + */ + public GetMediaInputStatusResponse getMediaInputStatus(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetMediaInputStatusRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the cursor position of a media input. * @@ -1006,6 +1867,23 @@ public void setMediaInputCursor(String inputName, Number mediaCursor, sendRequest(SetMediaInputCursorRequest.builder().inputName(inputName).mediaCursor(mediaCursor).build(), callback); } + /** + * Sets the cursor position of a media input. + * + * This request does not perform bounds checking of the cursor position. + * + * @param inputName Name of the media input + * @param mediaCursor New cursor position to set + * @param timeout long timeout in ms + * @return the SetMediaInputCursorResponse, null if the request timed out + */ + public SetMediaInputCursorResponse setMediaInputCursor(String inputName, Number mediaCursor, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetMediaInputCursorRequest.builder().inputName(inputName).mediaCursor(mediaCursor).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Offsets the current cursor position of a media input by the specified value. * @@ -1020,6 +1898,23 @@ public void offsetMediaInputCursor(String inputName, Number mediaCursorOffset, sendRequest(OffsetMediaInputCursorRequest.builder().inputName(inputName).mediaCursorOffset(mediaCursorOffset).build(), callback); } + /** + * Offsets the current cursor position of a media input by the specified value. + * + * This request does not perform bounds checking of the cursor position. + * + * @param inputName Name of the media input + * @param mediaCursorOffset Value to offset the current cursor position by + * @param timeout long timeout in ms + * @return the OffsetMediaInputCursorResponse, null if the request timed out + */ + public OffsetMediaInputCursorResponse offsetMediaInputCursor(String inputName, + Number mediaCursorOffset, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(OffsetMediaInputCursorRequest.builder().inputName(inputName).mediaCursorOffset(mediaCursorOffset).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Triggers an action on a media input. * @@ -1032,6 +1927,21 @@ public void triggerMediaInputAction(String inputName, String mediaAction, sendRequest(TriggerMediaInputActionRequest.builder().inputName(inputName).mediaAction(mediaAction).build(), callback); } + /** + * Triggers an action on a media input. + * + * @param inputName Name of the media input + * @param mediaAction Identifier of the `ObsMediaInputAction` enum + * @param timeout long timeout in ms + * @return the TriggerMediaInputActionResponse, null if the request timed out + */ + public TriggerMediaInputActionResponse triggerMediaInputAction(String inputName, + String mediaAction, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(TriggerMediaInputActionRequest.builder().inputName(inputName).mediaAction(mediaAction).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the status of the virtualcam output. * @@ -1041,6 +1951,18 @@ public void getVirtualCamStatus(Consumer callback) sendRequest(GetVirtualCamStatusRequest.builder().build(), callback); } + /** + * Gets the status of the virtualcam output. + * + * @param timeout long timeout in ms + * @return the GetVirtualCamStatusResponse, null if the request timed out + */ + public GetVirtualCamStatusResponse getVirtualCamStatus(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetVirtualCamStatusRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Toggles the state of the virtualcam output. * @@ -1050,6 +1972,18 @@ public void toggleVirtualCam(Consumer callback) { sendRequest(ToggleVirtualCamRequest.builder().build(), callback); } + /** + * Toggles the state of the virtualcam output. + * + * @param timeout long timeout in ms + * @return the ToggleVirtualCamResponse, null if the request timed out + */ + public ToggleVirtualCamResponse toggleVirtualCam(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(ToggleVirtualCamRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Starts the virtualcam output. * @@ -1059,6 +1993,18 @@ public void startVirtualCam(Consumer callback) { sendRequest(StartVirtualCamRequest.builder().build(), callback); } + /** + * Starts the virtualcam output. + * + * @param timeout long timeout in ms + * @return the StartVirtualCamResponse, null if the request timed out + */ + public StartVirtualCamResponse startVirtualCam(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StartVirtualCamRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Stops the virtualcam output. * @@ -1068,6 +2014,18 @@ public void stopVirtualCam(Consumer callback) { sendRequest(StopVirtualCamRequest.builder().build(), callback); } + /** + * Stops the virtualcam output. + * + * @param timeout long timeout in ms + * @return the StopVirtualCamResponse, null if the request timed out + */ + public StopVirtualCamResponse stopVirtualCam(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StopVirtualCamRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the status of the replay buffer output. * @@ -1077,6 +2035,18 @@ public void getReplayBufferStatus(Consumer callba sendRequest(GetReplayBufferStatusRequest.builder().build(), callback); } + /** + * Gets the status of the replay buffer output. + * + * @param timeout long timeout in ms + * @return the GetReplayBufferStatusResponse, null if the request timed out + */ + public GetReplayBufferStatusResponse getReplayBufferStatus(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetReplayBufferStatusRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Toggles the state of the replay buffer output. * @@ -1086,6 +2056,18 @@ public void toggleReplayBuffer(Consumer callback) { sendRequest(ToggleReplayBufferRequest.builder().build(), callback); } + /** + * Toggles the state of the replay buffer output. + * + * @param timeout long timeout in ms + * @return the ToggleReplayBufferResponse, null if the request timed out + */ + public ToggleReplayBufferResponse toggleReplayBuffer(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(ToggleReplayBufferRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Starts the replay buffer output. * @@ -1095,6 +2077,18 @@ public void startReplayBuffer(Consumer callback) { sendRequest(StartReplayBufferRequest.builder().build(), callback); } + /** + * Starts the replay buffer output. + * + * @param timeout long timeout in ms + * @return the StartReplayBufferResponse, null if the request timed out + */ + public StartReplayBufferResponse startReplayBuffer(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StartReplayBufferRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Stops the replay buffer output. * @@ -1104,6 +2098,18 @@ public void stopReplayBuffer(Consumer callback) { sendRequest(StopReplayBufferRequest.builder().build(), callback); } + /** + * Stops the replay buffer output. + * + * @param timeout long timeout in ms + * @return the StopReplayBufferResponse, null if the request timed out + */ + public StopReplayBufferResponse stopReplayBuffer(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StopReplayBufferRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Saves the contents of the replay buffer output. * @@ -1113,6 +2119,18 @@ public void saveReplayBuffer(Consumer callback) { sendRequest(SaveReplayBufferRequest.builder().build(), callback); } + /** + * Saves the contents of the replay buffer output. + * + * @param timeout long timeout in ms + * @return the SaveReplayBufferResponse, null if the request timed out + */ + public SaveReplayBufferResponse saveReplayBuffer(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SaveReplayBufferRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the filename of the last replay buffer save file. * @@ -1122,6 +2140,18 @@ public void getLastReplayBufferReplay(Consumer callback = new BlockingConsumer(); + sendRequest(GetLastReplayBufferReplayRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the list of available outputs. * @@ -1131,6 +2161,18 @@ public void getOutputList(Consumer callback) { sendRequest(GetOutputListRequest.builder().build(), callback); } + /** + * Gets the list of available outputs. + * + * @param timeout long timeout in ms + * @return the GetOutputListResponse, null if the request timed out + */ + public GetOutputListResponse getOutputList(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetOutputListRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the status of an output. * @@ -1141,6 +2183,19 @@ public void getOutputStatus(String outputName, Consumer sendRequest(GetOutputStatusRequest.builder().outputName(outputName).build(), callback); } + /** + * Gets the status of an output. + * + * @param outputName Output name + * @param timeout long timeout in ms + * @return the GetOutputStatusResponse, null if the request timed out + */ + public GetOutputStatusResponse getOutputStatus(String outputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetOutputStatusRequest.builder().outputName(outputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Toggles the status of an output. * @@ -1151,6 +2206,19 @@ public void toggleOutput(String outputName, Consumer callb sendRequest(ToggleOutputRequest.builder().outputName(outputName).build(), callback); } + /** + * Toggles the status of an output. + * + * @param outputName Output name + * @param timeout long timeout in ms + * @return the ToggleOutputResponse, null if the request timed out + */ + public ToggleOutputResponse toggleOutput(String outputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(ToggleOutputRequest.builder().outputName(outputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Starts an output. * @@ -1161,6 +2229,19 @@ public void startOutput(String outputName, Consumer callbac sendRequest(StartOutputRequest.builder().outputName(outputName).build(), callback); } + /** + * Starts an output. + * + * @param outputName Output name + * @param timeout long timeout in ms + * @return the StartOutputResponse, null if the request timed out + */ + public StartOutputResponse startOutput(String outputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StartOutputRequest.builder().outputName(outputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Stops an output. * @@ -1171,6 +2252,19 @@ public void stopOutput(String outputName, Consumer callback) sendRequest(StopOutputRequest.builder().outputName(outputName).build(), callback); } + /** + * Stops an output. + * + * @param outputName Output name + * @param timeout long timeout in ms + * @return the StopOutputResponse, null if the request timed out + */ + public StopOutputResponse stopOutput(String outputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StopOutputRequest.builder().outputName(outputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the settings of an output. * @@ -1181,6 +2275,19 @@ public void getOutputSettings(String outputName, Consumer callback = new BlockingConsumer(); + sendRequest(GetOutputSettingsRequest.builder().outputName(outputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the settings of an output. * @@ -1193,6 +2300,21 @@ public void setOutputSettings(String outputName, JsonObject outputSettings, sendRequest(SetOutputSettingsRequest.builder().outputName(outputName).outputSettings(outputSettings).build(), callback); } + /** + * Sets the settings of an output. + * + * @param outputName Output name + * @param outputSettings Output settings + * @param timeout long timeout in ms + * @return the SetOutputSettingsResponse, null if the request timed out + */ + public SetOutputSettingsResponse setOutputSettings(String outputName, JsonObject outputSettings, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetOutputSettingsRequest.builder().outputName(outputName).outputSettings(outputSettings).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the status of the record output. * @@ -1202,6 +2324,18 @@ public void getRecordStatus(Consumer callback) { sendRequest(GetRecordStatusRequest.builder().build(), callback); } + /** + * Gets the status of the record output. + * + * @param timeout long timeout in ms + * @return the GetRecordStatusResponse, null if the request timed out + */ + public GetRecordStatusResponse getRecordStatus(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetRecordStatusRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Toggles the status of the record output. * @@ -1211,6 +2345,18 @@ public void toggleRecord(Consumer callback) { sendRequest(ToggleRecordRequest.builder().build(), callback); } + /** + * Toggles the status of the record output. + * + * @param timeout long timeout in ms + * @return the ToggleRecordResponse, null if the request timed out + */ + public ToggleRecordResponse toggleRecord(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(ToggleRecordRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Starts the record output. * @@ -1220,6 +2366,18 @@ public void startRecord(Consumer callback) { sendRequest(StartRecordRequest.builder().build(), callback); } + /** + * Starts the record output. + * + * @param timeout long timeout in ms + * @return the StartRecordResponse, null if the request timed out + */ + public StartRecordResponse startRecord(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StartRecordRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Stops the record output. * @@ -1229,6 +2387,18 @@ public void stopRecord(Consumer callback) { sendRequest(StopRecordRequest.builder().build(), callback); } + /** + * Stops the record output. + * + * @param timeout long timeout in ms + * @return the StopRecordResponse, null if the request timed out + */ + public StopRecordResponse stopRecord(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StopRecordRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Toggles pause on the record output. * @@ -1238,6 +2408,18 @@ public void toggleRecordPause(Consumer callback) { sendRequest(ToggleRecordPauseRequest.builder().build(), callback); } + /** + * Toggles pause on the record output. + * + * @param timeout long timeout in ms + * @return the ToggleRecordPauseResponse, null if the request timed out + */ + public ToggleRecordPauseResponse toggleRecordPause(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(ToggleRecordPauseRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Pauses the record output. * @@ -1247,6 +2429,18 @@ public void pauseRecord(Consumer callback) { sendRequest(PauseRecordRequest.builder().build(), callback); } + /** + * Pauses the record output. + * + * @param timeout long timeout in ms + * @return the PauseRecordResponse, null if the request timed out + */ + public PauseRecordResponse pauseRecord(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(PauseRecordRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Resumes the record output. * @@ -1256,6 +2450,18 @@ public void resumeRecord(Consumer callback) { sendRequest(ResumeRecordRequest.builder().build(), callback); } + /** + * Resumes the record output. + * + * @param timeout long timeout in ms + * @return the ResumeRecordResponse, null if the request timed out + */ + public ResumeRecordResponse resumeRecord(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(ResumeRecordRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets a list of all scene items in a scene. * @@ -1268,6 +2474,36 @@ public void getSceneItemList(String sceneName, Consumer callback = new BlockingConsumer(); + sendRequest(GetSceneItemListRequest.builder().sceneName(sceneName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + + /** + * Basically GetSceneItemList, but for groups. + * + * Using groups at all in OBS is discouraged, as they are very broken under the hood. Please use nested scenes instead. + * + * Groups only + * + * @param sceneName Name of the group to get the items of + * @param callback Consumer<GetGroupSceneItemListResponse> + */ + public void getGroupSceneItemList(String sceneName, + Consumer callback) { + sendRequest(GetGroupSceneItemListRequest.builder().sceneName(sceneName).build(), callback); + } + /** * Basically GetSceneItemList, but for groups. * @@ -1276,11 +2512,13 @@ public void getSceneItemList(String sceneName, Consumer callback) { + public GetGroupSceneItemListResponse getGroupSceneItemList(String sceneName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); sendRequest(GetGroupSceneItemListRequest.builder().sceneName(sceneName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } } /** @@ -1298,6 +2536,24 @@ public void getSceneItemId(String sceneName, String sourceName, Number searchOff sendRequest(GetSceneItemIdRequest.builder().sceneName(sceneName).sourceName(sourceName).searchOffset(searchOffset).build(), callback); } + /** + * Searches a scene for a source, and returns its id. + * + * Scenes and Groups + * + * @param sceneName Name of the scene or group to search in + * @param sourceName Name of the source to find + * @param searchOffset Number of matches to skip during search. >= 0 means first forward. -1 means last (top) item + * @param timeout long timeout in ms + * @return the GetSceneItemIdResponse, null if the request timed out + */ + public GetSceneItemIdResponse getSceneItemId(String sceneName, String sourceName, + Number searchOffset, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneItemIdRequest.builder().sceneName(sceneName).sourceName(sourceName).searchOffset(searchOffset).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Creates a new scene item using a source. * @@ -1313,6 +2569,24 @@ public void createSceneItem(String sceneName, String sourceName, Boolean sceneIt sendRequest(CreateSceneItemRequest.builder().sceneName(sceneName).sourceName(sourceName).sceneItemEnabled(sceneItemEnabled).build(), callback); } + /** + * Creates a new scene item using a source. + * + * Scenes only + * + * @param sceneName Name of the scene to create the new item in + * @param sourceName Name of the source to add to the scene + * @param sceneItemEnabled Enable state to apply to the scene item on creation + * @param timeout long timeout in ms + * @return the CreateSceneItemResponse, null if the request timed out + */ + public CreateSceneItemResponse createSceneItem(String sceneName, String sourceName, + Boolean sceneItemEnabled, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(CreateSceneItemRequest.builder().sceneName(sceneName).sourceName(sourceName).sceneItemEnabled(sceneItemEnabled).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Removes a scene item from a scene. * @@ -1327,6 +2601,23 @@ public void removeSceneItem(String sceneName, Number sceneItemId, sendRequest(RemoveSceneItemRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); } + /** + * Removes a scene item from a scene. + * + * Scenes only + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param timeout long timeout in ms + * @return the RemoveSceneItemResponse, null if the request timed out + */ + public RemoveSceneItemResponse removeSceneItem(String sceneName, Number sceneItemId, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(RemoveSceneItemRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Duplicates a scene item, copying all transform and crop info. * @@ -1342,6 +2633,24 @@ public void duplicateSceneItem(String sceneName, Number sceneItemId, String dest sendRequest(DuplicateSceneItemRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).destinationSceneName(destinationSceneName).build(), callback); } + /** + * Duplicates a scene item, copying all transform and crop info. + * + * Scenes only + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param destinationSceneName Name of the scene to create the duplicated item in + * @param timeout long timeout in ms + * @return the DuplicateSceneItemResponse, null if the request timed out + */ + public DuplicateSceneItemResponse duplicateSceneItem(String sceneName, Number sceneItemId, + String destinationSceneName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(DuplicateSceneItemRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).destinationSceneName(destinationSceneName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the transform and crop info of a scene item. * @@ -1356,6 +2665,23 @@ public void getSceneItemTransform(String sceneName, Number sceneItemId, sendRequest(GetSceneItemTransformRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); } + /** + * Gets the transform and crop info of a scene item. + * + * Scenes and Groups + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param timeout long timeout in ms + * @return the GetSceneItemTransformResponse, null if the request timed out + */ + public GetSceneItemTransformResponse getSceneItemTransform(String sceneName, Number sceneItemId, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneItemTransformRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the transform and crop info of a scene item. * @@ -1369,6 +2695,22 @@ public void setSceneItemTransform(String sceneName, Number sceneItemId, sendRequest(SetSceneItemTransformRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemTransform(sceneItemTransform).build(), callback); } + /** + * Sets the transform and crop info of a scene item. + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param sceneItemTransform Object containing scene item transform info to update + * @param timeout long timeout in ms + * @return the SetSceneItemTransformResponse, null if the request timed out + */ + public SetSceneItemTransformResponse setSceneItemTransform(String sceneName, Number sceneItemId, + SceneItem.Transform sceneItemTransform, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSceneItemTransformRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemTransform(sceneItemTransform).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the enable state of a scene item. * @@ -1383,6 +2725,23 @@ public void getSceneItemEnabled(String sceneName, Number sceneItemId, sendRequest(GetSceneItemEnabledRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); } + /** + * Gets the enable state of a scene item. + * + * Scenes and Groups + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param timeout long timeout in ms + * @return the GetSceneItemEnabledResponse, null if the request timed out + */ + public GetSceneItemEnabledResponse getSceneItemEnabled(String sceneName, Number sceneItemId, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneItemEnabledRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the enable state of a scene item. * @@ -1398,6 +2757,24 @@ public void setSceneItemEnabled(String sceneName, Number sceneItemId, Boolean sc sendRequest(SetSceneItemEnabledRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemEnabled(sceneItemEnabled).build(), callback); } + /** + * Sets the enable state of a scene item. + * + * Scenes and Groups + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param sceneItemEnabled New enable state of the scene item + * @param timeout long timeout in ms + * @return the SetSceneItemEnabledResponse, null if the request timed out + */ + public SetSceneItemEnabledResponse setSceneItemEnabled(String sceneName, Number sceneItemId, + Boolean sceneItemEnabled, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSceneItemEnabledRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemEnabled(sceneItemEnabled).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the lock state of a scene item. * @@ -1412,6 +2789,23 @@ public void getSceneItemLocked(String sceneName, Number sceneItemId, sendRequest(GetSceneItemLockedRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); } + /** + * Gets the lock state of a scene item. + * + * Scenes and Groups + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param timeout long timeout in ms + * @return the GetSceneItemLockedResponse, null if the request timed out + */ + public GetSceneItemLockedResponse getSceneItemLocked(String sceneName, Number sceneItemId, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneItemLockedRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the lock state of a scene item. * @@ -1427,6 +2821,24 @@ public void setSceneItemLocked(String sceneName, Number sceneItemId, Boolean sce sendRequest(SetSceneItemLockedRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemLocked(sceneItemLocked).build(), callback); } + /** + * Sets the lock state of a scene item. + * + * Scenes and Group + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param sceneItemLocked New lock state of the scene item + * @param timeout long timeout in ms + * @return the SetSceneItemLockedResponse, null if the request timed out + */ + public SetSceneItemLockedResponse setSceneItemLocked(String sceneName, Number sceneItemId, + Boolean sceneItemLocked, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSceneItemLockedRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemLocked(sceneItemLocked).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the index position of a scene item in a scene. * @@ -1443,6 +2855,25 @@ public void getSceneItemIndex(String sceneName, Number sceneItemId, sendRequest(GetSceneItemIndexRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); } + /** + * Gets the index position of a scene item in a scene. + * + * An index of 0 is at the bottom of the source list in the UI. + * + * Scenes and Groups + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param timeout long timeout in ms + * @return the GetSceneItemIndexResponse, null if the request timed out + */ + public GetSceneItemIndexResponse getSceneItemIndex(String sceneName, Number sceneItemId, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneItemIndexRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the index position of a scene item in a scene. * @@ -1458,6 +2889,24 @@ public void setSceneItemIndex(String sceneName, Number sceneItemId, Number scene sendRequest(SetSceneItemIndexRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemIndex(sceneItemIndex).build(), callback); } + /** + * Sets the index position of a scene item in a scene. + * + * Scenes and Groups + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param sceneItemIndex New index position of the scene item + * @param timeout long timeout in ms + * @return the SetSceneItemIndexResponse, null if the request timed out + */ + public SetSceneItemIndexResponse setSceneItemIndex(String sceneName, Number sceneItemId, + Number sceneItemIndex, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSceneItemIndexRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemIndex(sceneItemIndex).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the blend mode of a scene item. * @@ -1482,6 +2931,33 @@ public void getSceneItemBlendMode(String sceneName, Number sceneItemId, sendRequest(GetSceneItemBlendModeRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); } + /** + * Gets the blend mode of a scene item. + * + * Blend modes: + * + * - `OBS_BLEND_NORMAL` + * - `OBS_BLEND_ADDITIVE` + * - `OBS_BLEND_SUBTRACT` + * - `OBS_BLEND_SCREEN` + * - `OBS_BLEND_MULTIPLY` + * - `OBS_BLEND_LIGHTEN` + * - `OBS_BLEND_DARKEN` + * + * Scenes and Groups + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param timeout long timeout in ms + * @return the GetSceneItemBlendModeResponse, null if the request timed out + */ + public GetSceneItemBlendModeResponse getSceneItemBlendMode(String sceneName, Number sceneItemId, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneItemBlendModeRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the blend mode of a scene item. * @@ -1497,6 +2973,24 @@ public void setSceneItemBlendMode(String sceneName, Number sceneItemId, sendRequest(SetSceneItemBlendModeRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemBlendMode(sceneItemBlendMode).build(), callback); } + /** + * Sets the blend mode of a scene item. + * + * Scenes and Groups + * + * @param sceneName Name of the scene the item is in + * @param sceneItemId Numeric ID of the scene item + * @param sceneItemBlendMode New blend mode + * @param timeout long timeout in ms + * @return the SetSceneItemBlendModeResponse, null if the request timed out + */ + public SetSceneItemBlendModeResponse setSceneItemBlendMode(String sceneName, Number sceneItemId, + SceneItem.BlendMode sceneItemBlendMode, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSceneItemBlendModeRequest.builder().sceneName(sceneName).sceneItemId(sceneItemId).sceneItemBlendMode(sceneItemBlendMode).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets an array of all scenes in OBS. * @@ -1506,6 +3000,18 @@ public void getSceneList(Consumer callback) { sendRequest(GetSceneListRequest.builder().build(), callback); } + /** + * Gets an array of all scenes in OBS. + * + * @param timeout long timeout in ms + * @return the GetSceneListResponse, null if the request timed out + */ + public GetSceneListResponse getSceneList(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneListRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets an array of all groups in OBS. * @@ -1517,6 +3023,20 @@ public void getGroupList(Consumer callback) { sendRequest(GetGroupListRequest.builder().build(), callback); } + /** + * Gets an array of all groups in OBS. + * + * Groups in OBS are actually scenes, but renamed and modified. In obs-websocket, we treat them as scenes where we can. + * + * @param timeout long timeout in ms + * @return the GetGroupListResponse, null if the request timed out + */ + public GetGroupListResponse getGroupList(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetGroupListRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the current program scene. * @@ -1526,6 +3046,18 @@ public void getCurrentProgramScene(Consumer call sendRequest(GetCurrentProgramSceneRequest.builder().build(), callback); } + /** + * Gets the current program scene. + * + * @param timeout long timeout in ms + * @return the GetCurrentProgramSceneResponse, null if the request timed out + */ + public GetCurrentProgramSceneResponse getCurrentProgramScene(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetCurrentProgramSceneRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the current program scene. * @@ -1537,6 +3069,19 @@ public void setCurrentProgramScene(String sceneName, sendRequest(SetCurrentProgramSceneRequest.builder().sceneName(sceneName).build(), callback); } + /** + * Sets the current program scene. + * + * @param sceneName Scene to set as the current program scene + * @param timeout long timeout in ms + * @return the SetCurrentProgramSceneResponse, null if the request timed out + */ + public SetCurrentProgramSceneResponse setCurrentProgramScene(String sceneName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetCurrentProgramSceneRequest.builder().sceneName(sceneName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the current preview scene. * @@ -1548,6 +3093,20 @@ public void getCurrentPreviewScene(Consumer call sendRequest(GetCurrentPreviewSceneRequest.builder().build(), callback); } + /** + * Gets the current preview scene. + * + * Only available when studio mode is enabled. + * + * @param timeout long timeout in ms + * @return the GetCurrentPreviewSceneResponse, null if the request timed out + */ + public GetCurrentPreviewSceneResponse getCurrentPreviewScene(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetCurrentPreviewSceneRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the current preview scene. * @@ -1561,6 +3120,21 @@ public void setCurrentPreviewScene(String sceneName, sendRequest(SetCurrentPreviewSceneRequest.builder().sceneName(sceneName).build(), callback); } + /** + * Sets the current preview scene. + * + * Only available when studio mode is enabled. + * + * @param sceneName Scene to set as the current preview scene + * @param timeout long timeout in ms + * @return the SetCurrentPreviewSceneResponse, null if the request timed out + */ + public SetCurrentPreviewSceneResponse setCurrentPreviewScene(String sceneName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetCurrentPreviewSceneRequest.builder().sceneName(sceneName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Creates a new scene in OBS. * @@ -1571,6 +3145,19 @@ public void createScene(String sceneName, Consumer callback sendRequest(CreateSceneRequest.builder().sceneName(sceneName).build(), callback); } + /** + * Creates a new scene in OBS. + * + * @param sceneName Name for the new scene + * @param timeout long timeout in ms + * @return the CreateSceneResponse, null if the request timed out + */ + public CreateSceneResponse createScene(String sceneName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(CreateSceneRequest.builder().sceneName(sceneName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Removes a scene from OBS. * @@ -1581,16 +3168,43 @@ public void removeScene(String sceneName, Consumer callback sendRequest(RemoveSceneRequest.builder().sceneName(sceneName).build(), callback); } + /** + * Removes a scene from OBS. + * + * @param sceneName Name of the scene to remove + * @param timeout long timeout in ms + * @return the RemoveSceneResponse, null if the request timed out + */ + public RemoveSceneResponse removeScene(String sceneName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(RemoveSceneRequest.builder().sceneName(sceneName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + + /** + * Sets the name of a scene (rename). + * + * @param sceneName Name of the scene to be renamed + * @param newSceneName New name for the scene + * @param callback Consumer<SetSceneNameResponse> + */ + public void setSceneName(String sceneName, String newSceneName, + Consumer callback) { + sendRequest(SetSceneNameRequest.builder().sceneName(sceneName).newSceneName(newSceneName).build(), callback); + } + /** * Sets the name of a scene (rename). * * @param sceneName Name of the scene to be renamed * @param newSceneName New name for the scene - * @param callback Consumer<SetSceneNameResponse> + * @param timeout long timeout in ms + * @return the SetSceneNameResponse, null if the request timed out */ - public void setSceneName(String sceneName, String newSceneName, - Consumer callback) { + public SetSceneNameResponse setSceneName(String sceneName, String newSceneName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); sendRequest(SetSceneNameRequest.builder().sceneName(sceneName).newSceneName(newSceneName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } } /** @@ -1604,6 +3218,20 @@ public void getSceneSceneTransitionOverride(String sceneName, sendRequest(GetSceneSceneTransitionOverrideRequest.builder().sceneName(sceneName).build(), callback); } + /** + * Gets the scene transition overridden for a scene. + * + * @param sceneName Name of the scene + * @param timeout long timeout in ms + * @return the GetSceneSceneTransitionOverrideResponse, null if the request timed out + */ + public GetSceneSceneTransitionOverrideResponse getSceneSceneTransitionOverride(String sceneName, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneSceneTransitionOverrideRequest.builder().sceneName(sceneName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the scene transition overridden for a scene. * @@ -1617,6 +3245,22 @@ public void setSceneSceneTransitionOverride(String sceneName, String transitionN sendRequest(SetSceneSceneTransitionOverrideRequest.builder().sceneName(sceneName).transitionName(transitionName).transitionDuration(transitionDuration).build(), callback); } + /** + * Gets the scene transition overridden for a scene. + * + * @param sceneName Name of the scene + * @param transitionName Name of the scene transition to use as override. Specify `null` to remove + * @param transitionDuration Duration to use for any overridden transition. Specify `null` to remove + * @param timeout long timeout in ms + * @return the SetSceneSceneTransitionOverrideResponse, null if the request timed out + */ + public SetSceneSceneTransitionOverrideResponse setSceneSceneTransitionOverride(String sceneName, + String transitionName, Number transitionDuration, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetSceneSceneTransitionOverrideRequest.builder().sceneName(sceneName).transitionName(transitionName).transitionDuration(transitionDuration).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the active and show state of a source. * @@ -1629,6 +3273,21 @@ public void getSourceActive(String sourceName, Consumer sendRequest(GetSourceActiveRequest.builder().sourceName(sourceName).build(), callback); } + /** + * Gets the active and show state of a source. + * + * **Compatible with inputs and scenes.** + * + * @param sourceName Name of the source to get the active state of + * @param timeout long timeout in ms + * @return the GetSourceActiveResponse, null if the request timed out + */ + public GetSourceActiveResponse getSourceActive(String sourceName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSourceActiveRequest.builder().sourceName(sourceName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets a Base64-encoded screenshot of a source. * @@ -1650,6 +3309,29 @@ public void getSourceScreenshot(String sourceName, String imageFormat, Number im sendRequest(GetSourceScreenshotRequest.builder().sourceName(sourceName).imageFormat(imageFormat).imageWidth(imageWidth).imageHeight(imageHeight).imageCompressionQuality(imageCompressionQuality).build(), callback); } + /** + * Gets a Base64-encoded screenshot of a source. + * + * The `imageWidth` and `imageHeight` parameters are treated as "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the original resolution is kept. + * If `imageWidth` and `imageHeight` are not specified, the compressed image will use the full resolution of the source. + * + * **Compatible with inputs and scenes.** + * + * @param sourceName Name of the source to take a screenshot of + * @param imageFormat Image compression format to use. Use `GetVersion` to get compatible image formats + * @param imageWidth Width to scale the screenshot to + * @param imageHeight Height to scale the screenshot to + * @param imageCompressionQuality Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use "default" (whatever that means, idk) + * @param timeout long timeout in ms + * @return the GetSourceScreenshotResponse, null if the request timed out + */ + public GetSourceScreenshotResponse getSourceScreenshot(String sourceName, String imageFormat, + Number imageWidth, Number imageHeight, Number imageCompressionQuality, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSourceScreenshotRequest.builder().sourceName(sourceName).imageFormat(imageFormat).imageWidth(imageWidth).imageHeight(imageHeight).imageCompressionQuality(imageCompressionQuality).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Saves a screenshot of a source to the filesystem. * @@ -1672,6 +3354,31 @@ public void saveSourceScreenshot(String sourceName, String imageFormat, String i sendRequest(SaveSourceScreenshotRequest.builder().sourceName(sourceName).imageFormat(imageFormat).imageFilePath(imageFilePath).imageWidth(imageWidth).imageHeight(imageHeight).imageCompressionQuality(imageCompressionQuality).build(), callback); } + /** + * Saves a screenshot of a source to the filesystem. + * + * The `imageWidth` and `imageHeight` parameters are treated as "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the original resolution is kept. + * If `imageWidth` and `imageHeight` are not specified, the compressed image will use the full resolution of the source. + * + * **Compatible with inputs and scenes.** + * + * @param sourceName Name of the source to take a screenshot of + * @param imageFormat Image compression format to use. Use `GetVersion` to get compatible image formats + * @param imageFilePath Path to save the screenshot file to. Eg. `C:\Users\\user\Desktop\screenshot.png` + * @param imageWidth Width to scale the screenshot to + * @param imageHeight Height to scale the screenshot to + * @param imageCompressionQuality Compression quality to use. 0 for high compression, 100 for uncompressed. -1 to use "default" (whatever that means, idk) + * @param timeout long timeout in ms + * @return the SaveSourceScreenshotResponse, null if the request timed out + */ + public SaveSourceScreenshotResponse saveSourceScreenshot(String sourceName, String imageFormat, + String imageFilePath, Number imageWidth, Number imageHeight, Number imageCompressionQuality, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SaveSourceScreenshotRequest.builder().sourceName(sourceName).imageFormat(imageFormat).imageFilePath(imageFilePath).imageWidth(imageWidth).imageHeight(imageHeight).imageCompressionQuality(imageCompressionQuality).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the status of the stream output. * @@ -1681,6 +3388,18 @@ public void getStreamStatus(Consumer callback) { sendRequest(GetStreamStatusRequest.builder().build(), callback); } + /** + * Gets the status of the stream output. + * + * @param timeout long timeout in ms + * @return the GetStreamStatusResponse, null if the request timed out + */ + public GetStreamStatusResponse getStreamStatus(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetStreamStatusRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Toggles the status of the stream output. * @@ -1690,6 +3409,18 @@ public void toggleStream(Consumer callback) { sendRequest(ToggleStreamRequest.builder().build(), callback); } + /** + * Toggles the status of the stream output. + * + * @param timeout long timeout in ms + * @return the ToggleStreamResponse, null if the request timed out + */ + public ToggleStreamResponse toggleStream(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(ToggleStreamRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Starts the stream output. * @@ -1699,6 +3430,18 @@ public void startStream(Consumer callback) { sendRequest(StartStreamRequest.builder().build(), callback); } + /** + * Starts the stream output. + * + * @param timeout long timeout in ms + * @return the StartStreamResponse, null if the request timed out + */ + public StartStreamResponse startStream(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StartStreamRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Stops the stream output. * @@ -1708,6 +3451,18 @@ public void stopStream(Consumer callback) { sendRequest(StopStreamRequest.builder().build(), callback); } + /** + * Stops the stream output. + * + * @param timeout long timeout in ms + * @return the StopStreamResponse, null if the request timed out + */ + public StopStreamResponse stopStream(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(StopStreamRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sends CEA-608 caption text over the stream output. * @@ -1718,6 +3473,19 @@ public void sendStreamCaption(String captionText, Consumer callback = new BlockingConsumer(); + sendRequest(SendStreamCaptionRequest.builder().captionText(captionText).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets an array of all available transition kinds. * @@ -1729,6 +3497,20 @@ public void getTransitionKindList(Consumer callba sendRequest(GetTransitionKindListRequest.builder().build(), callback); } + /** + * Gets an array of all available transition kinds. + * + * Similar to `GetInputKindList` + * + * @param timeout long timeout in ms + * @return the GetTransitionKindListResponse, null if the request timed out + */ + public GetTransitionKindListResponse getTransitionKindList(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetTransitionKindListRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets an array of all scene transitions in OBS. * @@ -1738,6 +3520,18 @@ public void getSceneTransitionList(Consumer call sendRequest(GetSceneTransitionListRequest.builder().build(), callback); } + /** + * Gets an array of all scene transitions in OBS. + * + * @param timeout long timeout in ms + * @return the GetSceneTransitionListResponse, null if the request timed out + */ + public GetSceneTransitionListResponse getSceneTransitionList(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetSceneTransitionListRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets information about the current scene transition. * @@ -1747,6 +3541,18 @@ public void getCurrentSceneTransition(Consumer callback = new BlockingConsumer(); + sendRequest(GetCurrentSceneTransitionRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the current scene transition. * @@ -1760,6 +3566,22 @@ public void setCurrentSceneTransition(String transitionName, sendRequest(SetCurrentSceneTransitionRequest.builder().transitionName(transitionName).build(), callback); } + /** + * Sets the current scene transition. + * + * Small note: While the namespace of scene transitions is generally unique, that uniqueness is not a guarantee as it is with other resources like inputs. + * + * @param transitionName Name of the transition to make active + * @param timeout long timeout in ms + * @return the SetCurrentSceneTransitionResponse, null if the request timed out + */ + public SetCurrentSceneTransitionResponse setCurrentSceneTransition(String transitionName, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetCurrentSceneTransitionRequest.builder().transitionName(transitionName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the duration of the current scene transition, if it is not fixed. * @@ -1771,6 +3593,20 @@ public void setCurrentSceneTransitionDuration(Number transitionDuration, sendRequest(SetCurrentSceneTransitionDurationRequest.builder().transitionDuration(transitionDuration).build(), callback); } + /** + * Sets the duration of the current scene transition, if it is not fixed. + * + * @param transitionDuration Duration in milliseconds + * @param timeout long timeout in ms + * @return the SetCurrentSceneTransitionDurationResponse, null if the request timed out + */ + public SetCurrentSceneTransitionDurationResponse setCurrentSceneTransitionDuration( + Number transitionDuration, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetCurrentSceneTransitionDurationRequest.builder().transitionDuration(transitionDuration).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the settings of the current scene transition. * @@ -1783,6 +3619,21 @@ public void setCurrentSceneTransitionSettings(JsonObject transitionSettings, Boo sendRequest(SetCurrentSceneTransitionSettingsRequest.builder().transitionSettings(transitionSettings).overlay(overlay).build(), callback); } + /** + * Sets the settings of the current scene transition. + * + * @param transitionSettings Settings object to apply to the transition. Can be `{}` + * @param overlay Whether to overlay over the current settings or replace them + * @param timeout long timeout in ms + * @return the SetCurrentSceneTransitionSettingsResponse, null if the request timed out + */ + public SetCurrentSceneTransitionSettingsResponse setCurrentSceneTransitionSettings( + JsonObject transitionSettings, Boolean overlay, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetCurrentSceneTransitionSettingsRequest.builder().transitionSettings(transitionSettings).overlay(overlay).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets the cursor position of the current scene transition. * @@ -1795,6 +3646,20 @@ public void getCurrentSceneTransitionCursor( sendRequest(GetCurrentSceneTransitionCursorRequest.builder().build(), callback); } + /** + * Gets the cursor position of the current scene transition. + * + * Note: `transitionCursor` will return 1.0 when the transition is inactive. + * + * @param timeout long timeout in ms + * @return the GetCurrentSceneTransitionCursorResponse, null if the request timed out + */ + public GetCurrentSceneTransitionCursorResponse getCurrentSceneTransitionCursor(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetCurrentSceneTransitionCursorRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Triggers the current scene transition. Same functionality as the `Transition` button in studio mode. * @@ -1804,6 +3669,18 @@ public void triggerStudioModeTransition(Consumer callback = new BlockingConsumer(); + sendRequest(TriggerStudioModeTransitionRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Sets the position of the TBar. * @@ -1818,6 +3695,22 @@ public void setTBarPosition(Number position, Boolean release, sendRequest(SetTBarPositionRequest.builder().position(position).release(release).build(), callback); } + /** + * Sets the position of the TBar. + * + * **Very important note**: This will be deprecated and replaced in a future version of obs-websocket. + * + * @param position New position + * @param release Whether to release the TBar. Only set `false` if you know that you will be sending another position update + * @param timeout long timeout in ms + * @return the SetTBarPositionResponse, null if the request timed out + */ + public SetTBarPositionResponse setTBarPosition(Number position, Boolean release, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetTBarPositionRequest.builder().position(position).release(release).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets whether studio is enabled. * @@ -1827,6 +3720,18 @@ public void getStudioModeEnabled(Consumer callback sendRequest(GetStudioModeEnabledRequest.builder().build(), callback); } + /** + * Gets whether studio is enabled. + * + * @param timeout long timeout in ms + * @return the GetStudioModeEnabledResponse, null if the request timed out + */ + public GetStudioModeEnabledResponse getStudioModeEnabled(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetStudioModeEnabledRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Enables or disables studio mode * @@ -1838,6 +3743,20 @@ public void setStudioModeEnabled(Boolean studioModeEnabled, sendRequest(SetStudioModeEnabledRequest.builder().studioModeEnabled(studioModeEnabled).build(), callback); } + /** + * Enables or disables studio mode + * + * @param studioModeEnabled True == Enabled, False == Disabled + * @param timeout long timeout in ms + * @return the SetStudioModeEnabledResponse, null if the request timed out + */ + public SetStudioModeEnabledResponse setStudioModeEnabled(Boolean studioModeEnabled, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SetStudioModeEnabledRequest.builder().studioModeEnabled(studioModeEnabled).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Opens the properties dialog of an input. * @@ -1849,6 +3768,20 @@ public void openInputPropertiesDialog(String inputName, sendRequest(OpenInputPropertiesDialogRequest.builder().inputName(inputName).build(), callback); } + /** + * Opens the properties dialog of an input. + * + * @param inputName Name of the input to open the dialog of + * @param timeout long timeout in ms + * @return the OpenInputPropertiesDialogResponse, null if the request timed out + */ + public OpenInputPropertiesDialogResponse openInputPropertiesDialog(String inputName, + long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(OpenInputPropertiesDialogRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Opens the filters dialog of an input. * @@ -1860,6 +3793,19 @@ public void openInputFiltersDialog(String inputName, sendRequest(OpenInputFiltersDialogRequest.builder().inputName(inputName).build(), callback); } + /** + * Opens the filters dialog of an input. + * + * @param inputName Name of the input to open the dialog of + * @param timeout long timeout in ms + * @return the OpenInputFiltersDialogResponse, null if the request timed out + */ + public OpenInputFiltersDialogResponse openInputFiltersDialog(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(OpenInputFiltersDialogRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Opens the interact dialog of an input. * @@ -1871,6 +3817,19 @@ public void openInputInteractDialog(String inputName, sendRequest(OpenInputInteractDialogRequest.builder().inputName(inputName).build(), callback); } + /** + * Opens the interact dialog of an input. + * + * @param inputName Name of the input to open the dialog of + * @param timeout long timeout in ms + * @return the OpenInputInteractDialogResponse, null if the request timed out + */ + public OpenInputInteractDialogResponse openInputInteractDialog(String inputName, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(OpenInputInteractDialogRequest.builder().inputName(inputName).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Gets a list of connected monitors and information about them. * @@ -1880,6 +3839,18 @@ public void getMonitorList(Consumer callback) { sendRequest(GetMonitorListRequest.builder().build(), callback); } + /** + * Gets a list of connected monitors and information about them. + * + * @param timeout long timeout in ms + * @return the GetMonitorListResponse, null if the request timed out + */ + public GetMonitorListResponse getMonitorList(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(GetMonitorListRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Opens a projector for a specific output video mix. * @@ -1901,6 +3872,30 @@ public void openVideoMixProjector(VideoMixType videoMixType, Number monitorIndex sendRequest(OpenVideoMixProjectorRequest.builder().videoMixType(videoMixType).monitorIndex(monitorIndex).projectorGeometry(projectorGeometry).build(), callback); } + /** + * Opens a projector for a specific output video mix. + * + * Mix types: + * + * - `OBS_WEBSOCKET_VIDEO_MIX_TYPE_PREVIEW` + * - `OBS_WEBSOCKET_VIDEO_MIX_TYPE_PROGRAM` + * - `OBS_WEBSOCKET_VIDEO_MIX_TYPE_MULTIVIEW` + * + * Note: This request serves to provide feature parity with 4.x. It is very likely to be changed/deprecated in a future release. + * + * @param videoMixType Type of mix to open + * @param monitorIndex Monitor index, use `GetMonitorList` to obtain index + * @param projectorGeometry Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex` + * @param timeout long timeout in ms + * @return the OpenVideoMixProjectorResponse, null if the request timed out + */ + public OpenVideoMixProjectorResponse openVideoMixProjector(VideoMixType videoMixType, + Number monitorIndex, String projectorGeometry, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(OpenVideoMixProjectorRequest.builder().videoMixType(videoMixType).monitorIndex(monitorIndex).projectorGeometry(projectorGeometry).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Opens a projector for a source. * @@ -1915,4 +3910,22 @@ public void openSourceProjector(String sourceName, Number monitorIndex, String p Consumer callback) { sendRequest(OpenSourceProjectorRequest.builder().sourceName(sourceName).monitorIndex(monitorIndex).projectorGeometry(projectorGeometry).build(), callback); } + + /** + * Opens a projector for a source. + * + * Note: This request serves to provide feature parity with 4.x. It is very likely to be changed/deprecated in a future release. + * + * @param sourceName Name of the source to open a projector for + * @param monitorIndex Monitor index, use `GetMonitorList` to obtain index + * @param projectorGeometry Size/Position data for a windowed projector, in Qt Base64 encoded format. Mutually exclusive with `monitorIndex` + * @param timeout long timeout in ms + * @return the OpenSourceProjectorResponse, null if the request timed out + */ + public OpenSourceProjectorResponse openSourceProjector(String sourceName, Number monitorIndex, + String projectorGeometry, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(OpenSourceProjectorRequest.builder().sourceName(sourceName).monitorIndex(monitorIndex).projectorGeometry(projectorGeometry).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentProfileChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentProfileChangedEvent.java index 6ddc701e..c612c553 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentProfileChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentProfileChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected CurrentProfileChangedEvent(CurrentProfileChangedEvent.SpecificData dat super(Intent.Config, data); } + /** + * Name of the new profile + * + * @return the profileName + */ + public String getProfileName() { + return getMessageData().getEventData().getProfileName(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * Name of the new profile */ - @NonNull private String profileName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentProfileChangingEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentProfileChangingEvent.java index faf44802..22bafdf0 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentProfileChangingEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentProfileChangingEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected CurrentProfileChangingEvent(CurrentProfileChangingEvent.SpecificData d super(Intent.Config, data); } + /** + * Name of the current profile + * + * @return the profileName + */ + public String getProfileName() { + return getMessageData().getEventData().getProfileName(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * Name of the current profile */ - @NonNull private String profileName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentSceneCollectionChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentSceneCollectionChangedEvent.java index aa5dbfb7..4393c5f6 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentSceneCollectionChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentSceneCollectionChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -27,6 +26,15 @@ protected CurrentSceneCollectionChangedEvent( super(Intent.Config, data); } + /** + * Name of the new scene collection + * + * @return the sceneCollectionName + */ + public String getSceneCollectionName() { + return getMessageData().getEventData().getSceneCollectionName(); + } + @Getter @ToString @Builder @@ -34,7 +42,6 @@ public static class SpecificData { /** * Name of the new scene collection */ - @NonNull private String sceneCollectionName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentSceneCollectionChangingEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentSceneCollectionChangingEvent.java index 5f4eaad1..4c990839 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentSceneCollectionChangingEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/config/CurrentSceneCollectionChangingEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -28,6 +27,15 @@ protected CurrentSceneCollectionChangingEvent( super(Intent.Config, data); } + /** + * Name of the current scene collection + * + * @return the sceneCollectionName + */ + public String getSceneCollectionName() { + return getMessageData().getEventData().getSceneCollectionName(); + } + @Getter @ToString @Builder @@ -35,7 +43,6 @@ public static class SpecificData { /** * Name of the current scene collection */ - @NonNull private String sceneCollectionName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/config/ProfileListChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/config/ProfileListChangedEvent.java index 03be98b3..96c2ebea 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/config/ProfileListChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/config/ProfileListChangedEvent.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -26,6 +25,15 @@ protected ProfileListChangedEvent(ProfileListChangedEvent.SpecificData data) { super(Intent.Config, data); } + /** + * Updated list of profiles + * + * @return the profiles + */ + public List getProfiles() { + return getMessageData().getEventData().getProfiles(); + } + @Getter @ToString @Builder @@ -33,7 +41,6 @@ public static class SpecificData { /** * Updated list of profiles */ - @NonNull @Singular private List profiles; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/config/SceneCollectionListChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/config/SceneCollectionListChangedEvent.java index d21348ad..b54e4962 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/config/SceneCollectionListChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/config/SceneCollectionListChangedEvent.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -26,6 +25,15 @@ protected SceneCollectionListChangedEvent(SceneCollectionListChangedEvent.Specif super(Intent.Config, data); } + /** + * Updated list of scene collections + * + * @return the sceneCollections + */ + public List getSceneCollections() { + return getMessageData().getEventData().getSceneCollections(); + } + @Getter @ToString @Builder @@ -33,7 +41,6 @@ public static class SpecificData { /** * Updated list of scene collections */ - @NonNull @Singular private List sceneCollections; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterCreatedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterCreatedEvent.java index 92f1087e..1a50e627 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterCreatedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterCreatedEvent.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -25,6 +24,60 @@ protected SourceFilterCreatedEvent(SourceFilterCreatedEvent.SpecificData data) { super(Intent.Filters, data); } + /** + * Name of the source the filter was added to + * + * @return the sourceName + */ + public String getSourceName() { + return getMessageData().getEventData().getSourceName(); + } + + /** + * Name of the filter + * + * @return the filterName + */ + public String getFilterName() { + return getMessageData().getEventData().getFilterName(); + } + + /** + * The kind of the filter + * + * @return the filterKind + */ + public String getFilterKind() { + return getMessageData().getEventData().getFilterKind(); + } + + /** + * Index position of the filter + * + * @return the filterIndex + */ + public Number getFilterIndex() { + return getMessageData().getEventData().getFilterIndex(); + } + + /** + * The settings configured to the filter when it was created + * + * @return the filterSettings + */ + public JsonObject getFilterSettings() { + return getMessageData().getEventData().getFilterSettings(); + } + + /** + * The default settings for the filter + * + * @return the defaultFilterSettings + */ + public JsonObject getDefaultFilterSettings() { + return getMessageData().getEventData().getDefaultFilterSettings(); + } + @Getter @ToString @Builder @@ -32,37 +85,31 @@ public static class SpecificData { /** * Name of the source the filter was added to */ - @NonNull private String sourceName; /** * Name of the filter */ - @NonNull private String filterName; /** * The kind of the filter */ - @NonNull private String filterKind; /** * Index position of the filter */ - @NonNull private Number filterIndex; /** * The settings configured to the filter when it was created */ - @NonNull private JsonObject filterSettings; /** * The default settings for the filter */ - @NonNull private JsonObject defaultFilterSettings; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterEnableStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterEnableStateChangedEvent.java index 35710824..c170ef2d 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterEnableStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterEnableStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -25,6 +24,33 @@ protected SourceFilterEnableStateChangedEvent( super(Intent.Filters, data); } + /** + * Name of the source the filter is on + * + * @return the sourceName + */ + public String getSourceName() { + return getMessageData().getEventData().getSourceName(); + } + + /** + * Name of the filter + * + * @return the filterName + */ + public String getFilterName() { + return getMessageData().getEventData().getFilterName(); + } + + /** + * Whether the filter is enabled + * + * @return the filterEnabled + */ + public Boolean getFilterEnabled() { + return getMessageData().getEventData().getFilterEnabled(); + } + @Getter @ToString @Builder @@ -32,19 +58,16 @@ public static class SpecificData { /** * Name of the source the filter is on */ - @NonNull private String sourceName; /** * Name of the filter */ - @NonNull private String filterName; /** * Whether the filter is enabled */ - @NonNull private Boolean filterEnabled; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterListReindexedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterListReindexedEvent.java index ad01cdc0..eebea5d0 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterListReindexedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterListReindexedEvent.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -27,6 +26,24 @@ protected SourceFilterListReindexedEvent(SourceFilterListReindexedEvent.Specific super(Intent.Filters, data); } + /** + * Name of the source + * + * @return the sourceName + */ + public String getSourceName() { + return getMessageData().getEventData().getSourceName(); + } + + /** + * Array of filter objects + * + * @return the filters + */ + public List getFilters() { + return getMessageData().getEventData().getFilters(); + } + @Getter @ToString @Builder @@ -34,13 +51,11 @@ public static class SpecificData { /** * Name of the source */ - @NonNull private String sourceName; /** * Array of filter objects */ - @NonNull @Singular private List filters; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterNameChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterNameChangedEvent.java index 37afb16a..36b0a43b 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterNameChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterNameChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,33 @@ protected SourceFilterNameChangedEvent(SourceFilterNameChangedEvent.SpecificData super(Intent.Filters, data); } + /** + * The source the filter is on + * + * @return the sourceName + */ + public String getSourceName() { + return getMessageData().getEventData().getSourceName(); + } + + /** + * Old name of the filter + * + * @return the oldFilterName + */ + public String getOldFilterName() { + return getMessageData().getEventData().getOldFilterName(); + } + + /** + * New name of the filter + * + * @return the filterName + */ + public String getFilterName() { + return getMessageData().getEventData().getFilterName(); + } + @Getter @ToString @Builder @@ -31,19 +57,16 @@ public static class SpecificData { /** * The source the filter is on */ - @NonNull private String sourceName; /** * Old name of the filter */ - @NonNull private String oldFilterName; /** * New name of the filter */ - @NonNull private String filterName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterRemovedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterRemovedEvent.java index 9248f32c..92d91065 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterRemovedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/filters/SourceFilterRemovedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected SourceFilterRemovedEvent(SourceFilterRemovedEvent.SpecificData data) { super(Intent.Filters, data); } + /** + * Name of the source the filter was on + * + * @return the sourceName + */ + public String getSourceName() { + return getMessageData().getEventData().getSourceName(); + } + + /** + * Name of the filter + * + * @return the filterName + */ + public String getFilterName() { + return getMessageData().getEventData().getFilterName(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Name of the source the filter was on */ - @NonNull private String sourceName; /** * Name of the filter */ - @NonNull private String filterName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/general/VendorEventEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/general/VendorEventEvent.java index 81ee9677..28fa5dce 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/general/VendorEventEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/general/VendorEventEvent.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -28,6 +27,33 @@ protected VendorEventEvent(VendorEventEvent.SpecificData data) { super(Intent.Vendors, data); } + /** + * Name of the vendor emitting the event + * + * @return the vendorName + */ + public String getVendorName() { + return getMessageData().getEventData().getVendorName(); + } + + /** + * Vendor-provided event typedef + * + * @return the eventType + */ + public String getEventType() { + return getMessageData().getEventData().getEventType(); + } + + /** + * Vendor-provided event data. {} if event does not provide any data + * + * @return the eventData + */ + public JsonObject getEventData() { + return getMessageData().getEventData().getEventData(); + } + @Getter @ToString @Builder @@ -35,19 +61,16 @@ public static class SpecificData { /** * Name of the vendor emitting the event */ - @NonNull private String vendorName; /** * Vendor-provided event typedef */ - @NonNull private String eventType; /** * Vendor-provided event data. {} if event does not provide any data */ - @NonNull private JsonObject eventData; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputActiveStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputActiveStateChangedEvent.java index 913eebcf..5fd0e2e1 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputActiveStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputActiveStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -26,6 +25,24 @@ protected InputActiveStateChangedEvent(InputActiveStateChangedEvent.SpecificData super(Intent.InputActiveStateChanged, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * Whether the input is active + * + * @return the videoActive + */ + public Boolean getVideoActive() { + return getMessageData().getEventData().getVideoActive(); + } + @Getter @ToString @Builder @@ -33,13 +50,11 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; /** * Whether the input is active */ - @NonNull private Boolean videoActive; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioBalanceChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioBalanceChangedEvent.java index 40a7ce2a..70bda807 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioBalanceChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioBalanceChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected InputAudioBalanceChangedEvent(InputAudioBalanceChangedEvent.SpecificDa super(Intent.Inputs, data); } + /** + * Name of the affected input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * New audio balance value of the input + * + * @return the inputAudioBalance + */ + public Number getInputAudioBalance() { + return getMessageData().getEventData().getInputAudioBalance(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Name of the affected input */ - @NonNull private String inputName; /** * New audio balance value of the input */ - @NonNull private Number inputAudioBalance; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioMonitorTypeChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioMonitorTypeChangedEvent.java index 537bc3cc..caaf86c3 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioMonitorTypeChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioMonitorTypeChangedEvent.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.model.Input; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -31,6 +30,24 @@ protected InputAudioMonitorTypeChangedEvent(InputAudioMonitorTypeChangedEvent.Sp super(Intent.Inputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * New monitor type of the input + * + * @return the monitorType + */ + public Input.MonitorType getMonitorType() { + return getMessageData().getEventData().getMonitorType(); + } + @Getter @ToString @Builder @@ -38,13 +55,11 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; /** * New monitor type of the input */ - @NonNull private Input.MonitorType monitorType; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioSyncOffsetChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioSyncOffsetChangedEvent.java index fe644efb..1c434411 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioSyncOffsetChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioSyncOffsetChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected InputAudioSyncOffsetChangedEvent(InputAudioSyncOffsetChangedEvent.Spec super(Intent.Inputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * New sync offset in milliseconds + * + * @return the inputAudioSyncOffset + */ + public Number getInputAudioSyncOffset() { + return getMessageData().getEventData().getInputAudioSyncOffset(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; /** * New sync offset in milliseconds */ - @NonNull private Number inputAudioSyncOffset; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioTracksChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioTracksChangedEvent.java index cc2f881f..fd08fc80 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioTracksChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputAudioTracksChangedEvent.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.model.Input; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -25,6 +24,24 @@ protected InputAudioTracksChangedEvent(InputAudioTracksChangedEvent.SpecificData super(Intent.Inputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * Object of audio tracks along with their associated enable states + * + * @return the inputAudioTracks + */ + public Input.AudioTracks getInputAudioTracks() { + return getMessageData().getEventData().getInputAudioTracks(); + } + @Getter @ToString @Builder @@ -32,13 +49,11 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; /** * Object of audio tracks along with their associated enable states */ - @NonNull private Input.AudioTracks inputAudioTracks; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputCreatedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputCreatedEvent.java index 4602c1f8..bf6a016a 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputCreatedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputCreatedEvent.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -25,6 +24,51 @@ protected InputCreatedEvent(InputCreatedEvent.SpecificData data) { super(Intent.Inputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * The kind of the input + * + * @return the inputKind + */ + public String getInputKind() { + return getMessageData().getEventData().getInputKind(); + } + + /** + * The unversioned kind of input (aka no `_v2` stuff) + * + * @return the unversionedInputKind + */ + public String getUnversionedInputKind() { + return getMessageData().getEventData().getUnversionedInputKind(); + } + + /** + * The settings configured to the input when it was created + * + * @return the inputSettings + */ + public JsonObject getInputSettings() { + return getMessageData().getEventData().getInputSettings(); + } + + /** + * The default settings for the input + * + * @return the defaultInputSettings + */ + public JsonObject getDefaultInputSettings() { + return getMessageData().getEventData().getDefaultInputSettings(); + } + @Getter @ToString @Builder @@ -32,31 +76,26 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; /** * The kind of the input */ - @NonNull private String inputKind; /** * The unversioned kind of input (aka no `_v2` stuff) */ - @NonNull private String unversionedInputKind; /** * The settings configured to the input when it was created */ - @NonNull private JsonObject inputSettings; /** * The default settings for the input */ - @NonNull private JsonObject defaultInputSettings; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputMuteStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputMuteStateChangedEvent.java index 7b5b1632..d0a1dfed 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputMuteStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputMuteStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected InputMuteStateChangedEvent(InputMuteStateChangedEvent.SpecificData dat super(Intent.Inputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * Whether the input is muted + * + * @return the inputMuted + */ + public Boolean getInputMuted() { + return getMessageData().getEventData().getInputMuted(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; /** * Whether the input is muted */ - @NonNull private Boolean inputMuted; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputNameChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputNameChangedEvent.java index 8d994f27..bea999d4 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputNameChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputNameChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected InputNameChangedEvent(InputNameChangedEvent.SpecificData data) { super(Intent.Inputs, data); } + /** + * Old name of the input + * + * @return the oldInputName + */ + public String getOldInputName() { + return getMessageData().getEventData().getOldInputName(); + } + + /** + * New name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Old name of the input */ - @NonNull private String oldInputName; /** * New name of the input */ - @NonNull private String inputName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputRemovedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputRemovedEvent.java index b275a997..35dcd751 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputRemovedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputRemovedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected InputRemovedEvent(InputRemovedEvent.SpecificData data) { super(Intent.Inputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputShowStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputShowStateChangedEvent.java index 1858e73c..e285834c 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputShowStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputShowStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -26,6 +25,24 @@ protected InputShowStateChangedEvent(InputShowStateChangedEvent.SpecificData dat super(Intent.InputShowStateChanged, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * Whether the input is showing + * + * @return the videoShowing + */ + public Boolean getVideoShowing() { + return getMessageData().getEventData().getVideoShowing(); + } + @Getter @ToString @Builder @@ -33,13 +50,11 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; /** * Whether the input is showing */ - @NonNull private Boolean videoShowing; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputVolumeChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputVolumeChangedEvent.java index b77ebfac..680a5afb 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputVolumeChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputVolumeChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,33 @@ protected InputVolumeChangedEvent(InputVolumeChangedEvent.SpecificData data) { super(Intent.Inputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * New volume level in multimap + * + * @return the inputVolumeMul + */ + public Number getInputVolumeMul() { + return getMessageData().getEventData().getInputVolumeMul(); + } + + /** + * New volume level in dB + * + * @return the inputVolumeDb + */ + public Number getInputVolumeDb() { + return getMessageData().getEventData().getInputVolumeDb(); + } + @Getter @ToString @Builder @@ -31,19 +57,16 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; /** * New volume level in multimap */ - @NonNull private Number inputVolumeMul; /** * New volume level in dB */ - @NonNull private Number inputVolumeDb; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputVolumeMetersEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputVolumeMetersEvent.java index 72291394..afa9eac8 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputVolumeMetersEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/inputs/InputVolumeMetersEvent.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -27,6 +26,15 @@ protected InputVolumeMetersEvent(InputVolumeMetersEvent.SpecificData data) { super(Intent.InputVolumeMeters, data); } + /** + * Array of active inputs with their associated volume levels + * + * @return the inputs + */ + public List getInputs() { + return getMessageData().getEventData().getInputs(); + } + @Getter @ToString @Builder @@ -34,7 +42,6 @@ public static class SpecificData { /** * Array of active inputs with their associated volume levels */ - @NonNull @Singular private List inputs; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputActionTriggeredEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputActionTriggeredEvent.java index 056aba83..eb44626e 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputActionTriggeredEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputActionTriggeredEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected MediaInputActionTriggeredEvent(MediaInputActionTriggeredEvent.Specific super(Intent.MediaInputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + + /** + * Action performed on the input. See `ObsMediaInputAction` enum + * + * @return the mediaAction + */ + public String getMediaAction() { + return getMessageData().getEventData().getMediaAction(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; /** * Action performed on the input. See `ObsMediaInputAction` enum */ - @NonNull private String mediaAction; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputPlaybackEndedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputPlaybackEndedEvent.java index 3fb9292c..fa95332c 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputPlaybackEndedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputPlaybackEndedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected MediaInputPlaybackEndedEvent(MediaInputPlaybackEndedEvent.SpecificData super(Intent.MediaInputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputPlaybackStartedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputPlaybackStartedEvent.java index 712d6dfa..208abcbb 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputPlaybackStartedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/mediainputs/MediaInputPlaybackStartedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected MediaInputPlaybackStartedEvent(MediaInputPlaybackStartedEvent.Specific super(Intent.MediaInputs, data); } + /** + * Name of the input + * + * @return the inputName + */ + public String getInputName() { + return getMessageData().getEventData().getInputName(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * Name of the input */ - @NonNull private String inputName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/RecordStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/RecordStateChangedEvent.java index de7a0864..8de05dc6 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/RecordStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/RecordStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,33 @@ protected RecordStateChangedEvent(RecordStateChangedEvent.SpecificData data) { super(Intent.Outputs, data); } + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getEventData().getOutputActive(); + } + + /** + * The specific state of the output + * + * @return the outputState + */ + public String getOutputState() { + return getMessageData().getEventData().getOutputState(); + } + + /** + * File name for the saved recording, if record stopped. `null` otherwise + * + * @return the outputPath + */ + public String getOutputPath() { + return getMessageData().getEventData().getOutputPath(); + } + @Getter @ToString @Builder @@ -31,19 +57,16 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; /** * The specific state of the output */ - @NonNull private String outputState; /** * File name for the saved recording, if record stopped. `null` otherwise */ - @NonNull private String outputPath; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/ReplayBufferSavedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/ReplayBufferSavedEvent.java index 10cc27c5..468d4b0e 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/ReplayBufferSavedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/ReplayBufferSavedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected ReplayBufferSavedEvent(ReplayBufferSavedEvent.SpecificData data) { super(Intent.Outputs, data); } + /** + * Path of the saved replay file + * + * @return the savedReplayPath + */ + public String getSavedReplayPath() { + return getMessageData().getEventData().getSavedReplayPath(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * Path of the saved replay file */ - @NonNull private String savedReplayPath; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/ReplayBufferStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/ReplayBufferStateChangedEvent.java index e535f76d..2eb77afa 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/ReplayBufferStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/ReplayBufferStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected ReplayBufferStateChangedEvent(ReplayBufferStateChangedEvent.SpecificDa super(Intent.Outputs, data); } + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getEventData().getOutputActive(); + } + + /** + * The specific state of the output + * + * @return the outputState + */ + public String getOutputState() { + return getMessageData().getEventData().getOutputState(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; /** * The specific state of the output */ - @NonNull private String outputState; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/StreamStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/StreamStateChangedEvent.java index 8bd556f1..a931e311 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/StreamStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/StreamStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected StreamStateChangedEvent(StreamStateChangedEvent.SpecificData data) { super(Intent.Outputs, data); } + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getEventData().getOutputActive(); + } + + /** + * The specific state of the output + * + * @return the outputState + */ + public String getOutputState() { + return getMessageData().getEventData().getOutputState(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; /** * The specific state of the output */ - @NonNull private String outputState; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/VirtualcamStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/VirtualcamStateChangedEvent.java index a33b084e..79e164cd 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/VirtualcamStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/outputs/VirtualcamStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected VirtualcamStateChangedEvent(VirtualcamStateChangedEvent.SpecificData d super(Intent.Outputs, data); } + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getEventData().getOutputActive(); + } + + /** + * The specific state of the output + * + * @return the outputState + */ + public String getOutputState() { + return getMessageData().getEventData().getOutputState(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; /** * The specific state of the output */ - @NonNull private String outputState; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemCreatedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemCreatedEvent.java index 4540af45..71bdec2a 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemCreatedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemCreatedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,42 @@ protected SceneItemCreatedEvent(SceneItemCreatedEvent.SpecificData data) { super(Intent.SceneItems, data); } + /** + * Name of the scene the item was added to + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + + /** + * Name of the underlying source (input/scene) + * + * @return the sourceName + */ + public String getSourceName() { + return getMessageData().getEventData().getSourceName(); + } + + /** + * Numeric ID of the scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getEventData().getSceneItemId(); + } + + /** + * Index position of the item + * + * @return the sceneItemIndex + */ + public Number getSceneItemIndex() { + return getMessageData().getEventData().getSceneItemIndex(); + } + @Getter @ToString @Builder @@ -31,25 +66,21 @@ public static class SpecificData { /** * Name of the scene the item was added to */ - @NonNull private String sceneName; /** * Name of the underlying source (input/scene) */ - @NonNull private String sourceName; /** * Numeric ID of the scene item */ - @NonNull private Number sceneItemId; /** * Index position of the item */ - @NonNull private Number sceneItemIndex; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemEnableStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemEnableStateChangedEvent.java index 844a43c1..c9d50cc4 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemEnableStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemEnableStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,33 @@ protected SceneItemEnableStateChangedEvent(SceneItemEnableStateChangedEvent.Spec super(Intent.SceneItems, data); } + /** + * Name of the scene the item is in + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + + /** + * Numeric ID of the scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getEventData().getSceneItemId(); + } + + /** + * Whether the scene item is enabled (visible) + * + * @return the sceneItemEnabled + */ + public Boolean getSceneItemEnabled() { + return getMessageData().getEventData().getSceneItemEnabled(); + } + @Getter @ToString @Builder @@ -31,19 +57,16 @@ public static class SpecificData { /** * Name of the scene the item is in */ - @NonNull private String sceneName; /** * Numeric ID of the scene item */ - @NonNull private Number sceneItemId; /** * Whether the scene item is enabled (visible) */ - @NonNull private Boolean sceneItemEnabled; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemListReindexedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemListReindexedEvent.java index d53a38cb..8ffa1a90 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemListReindexedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemListReindexedEvent.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -27,6 +26,24 @@ protected SceneItemListReindexedEvent(SceneItemListReindexedEvent.SpecificData d super(Intent.SceneItems, data); } + /** + * Name of the scene + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + + /** + * Array of scene item objects + * + * @return the sceneItems + */ + public List getSceneItems() { + return getMessageData().getEventData().getSceneItems(); + } + @Getter @ToString @Builder @@ -34,13 +51,11 @@ public static class SpecificData { /** * Name of the scene */ - @NonNull private String sceneName; /** * Array of scene item objects */ - @NonNull @Singular private List sceneItems; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemLockStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemLockStateChangedEvent.java index 6a80f533..99cc77c6 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemLockStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemLockStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,33 @@ protected SceneItemLockStateChangedEvent(SceneItemLockStateChangedEvent.Specific super(Intent.SceneItems, data); } + /** + * Name of the scene the item is in + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + + /** + * Numeric ID of the scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getEventData().getSceneItemId(); + } + + /** + * Whether the scene item is locked + * + * @return the sceneItemLocked + */ + public Boolean getSceneItemLocked() { + return getMessageData().getEventData().getSceneItemLocked(); + } + @Getter @ToString @Builder @@ -31,19 +57,16 @@ public static class SpecificData { /** * Name of the scene the item is in */ - @NonNull private String sceneName; /** * Numeric ID of the scene item */ - @NonNull private Number sceneItemId; /** * Whether the scene item is locked */ - @NonNull private Boolean sceneItemLocked; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemRemovedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemRemovedEvent.java index 309777e9..4b59c0f5 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemRemovedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemRemovedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -26,6 +25,33 @@ protected SceneItemRemovedEvent(SceneItemRemovedEvent.SpecificData data) { super(Intent.SceneItems, data); } + /** + * Name of the scene the item was removed from + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + + /** + * Name of the underlying source (input/scene) + * + * @return the sourceName + */ + public String getSourceName() { + return getMessageData().getEventData().getSourceName(); + } + + /** + * Numeric ID of the scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getEventData().getSceneItemId(); + } + @Getter @ToString @Builder @@ -33,19 +59,16 @@ public static class SpecificData { /** * Name of the scene the item was removed from */ - @NonNull private String sceneName; /** * Name of the underlying source (input/scene) */ - @NonNull private String sourceName; /** * Numeric ID of the scene item */ - @NonNull private Number sceneItemId; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemSelectedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemSelectedEvent.java index ca9286ed..5719068d 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemSelectedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemSelectedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected SceneItemSelectedEvent(SceneItemSelectedEvent.SpecificData data) { super(Intent.SceneItems, data); } + /** + * Name of the scene the item is in + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + + /** + * Numeric ID of the scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getEventData().getSceneItemId(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Name of the scene the item is in */ - @NonNull private String sceneName; /** * Numeric ID of the scene item */ - @NonNull private Number sceneItemId; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemTransformChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemTransformChangedEvent.java index 2a7a9079..360a745a 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemTransformChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/sceneitems/SceneItemTransformChangedEvent.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.model.SceneItem; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -25,6 +24,33 @@ protected SceneItemTransformChangedEvent(SceneItemTransformChangedEvent.Specific super(Intent.SceneItemTransformChanged, data); } + /** + * The name of the scene the item is in + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + + /** + * Numeric ID of the scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getEventData().getSceneItemId(); + } + + /** + * New transform/crop info of the scene item + * + * @return the sceneItemTransform + */ + public SceneItem.Transform getSceneItemTransform() { + return getMessageData().getEventData().getSceneItemTransform(); + } + @Getter @ToString @Builder @@ -32,19 +58,16 @@ public static class SpecificData { /** * The name of the scene the item is in */ - @NonNull private String sceneName; /** * Numeric ID of the scene item */ - @NonNull private Number sceneItemId; /** * New transform/crop info of the scene item */ - @NonNull private SceneItem.Transform sceneItemTransform; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/CurrentPreviewSceneChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/CurrentPreviewSceneChangedEvent.java index 035116ca..6cc8d9c9 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/CurrentPreviewSceneChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/CurrentPreviewSceneChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected CurrentPreviewSceneChangedEvent(CurrentPreviewSceneChangedEvent.Specif super(Intent.Scenes, data); } + /** + * Name of the scene that was switched to + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * Name of the scene that was switched to */ - @NonNull private String sceneName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/CurrentProgramSceneChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/CurrentProgramSceneChangedEvent.java index ed1ebad4..1a93d635 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/CurrentProgramSceneChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/CurrentProgramSceneChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected CurrentProgramSceneChangedEvent(CurrentProgramSceneChangedEvent.Specif super(Intent.Scenes, data); } + /** + * Name of the scene that was switched to + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * Name of the scene that was switched to */ - @NonNull private String sceneName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneCreatedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneCreatedEvent.java index 3475942f..b14cb33d 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneCreatedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneCreatedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected SceneCreatedEvent(SceneCreatedEvent.SpecificData data) { super(Intent.Scenes, data); } + /** + * Name of the new scene + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + + /** + * Whether the new scene is a group + * + * @return the isGroup + */ + public Boolean getIsGroup() { + return getMessageData().getEventData().getIsGroup(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Name of the new scene */ - @NonNull private String sceneName; /** * Whether the new scene is a group */ - @NonNull private Boolean isGroup; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneListChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneListChangedEvent.java index e1e1da27..1d1dd4c3 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneListChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneListChangedEvent.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -29,6 +28,15 @@ protected SceneListChangedEvent(SceneListChangedEvent.SpecificData data) { super(Intent.Scenes, data); } + /** + * Updated array of scenes + * + * @return the scenes + */ + public List getScenes() { + return getMessageData().getEventData().getScenes(); + } + @Getter @ToString @Builder @@ -36,7 +44,6 @@ public static class SpecificData { /** * Updated array of scenes */ - @NonNull @Singular private List scenes; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneNameChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneNameChangedEvent.java index c908d0de..000c7116 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneNameChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneNameChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected SceneNameChangedEvent(SceneNameChangedEvent.SpecificData data) { super(Intent.Scenes, data); } + /** + * Old name of the scene + * + * @return the oldSceneName + */ + public String getOldSceneName() { + return getMessageData().getEventData().getOldSceneName(); + } + + /** + * New name of the scene + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Old name of the scene */ - @NonNull private String oldSceneName; /** * New name of the scene */ - @NonNull private String sceneName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneRemovedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneRemovedEvent.java index e1a1c540..528bff23 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneRemovedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/scenes/SceneRemovedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,24 @@ protected SceneRemovedEvent(SceneRemovedEvent.SpecificData data) { super(Intent.Scenes, data); } + /** + * Name of the removed scene + * + * @return the sceneName + */ + public String getSceneName() { + return getMessageData().getEventData().getSceneName(); + } + + /** + * Whether the scene was a group + * + * @return the isGroup + */ + public Boolean getIsGroup() { + return getMessageData().getEventData().getIsGroup(); + } + @Getter @ToString @Builder @@ -31,13 +48,11 @@ public static class SpecificData { /** * Name of the removed scene */ - @NonNull private String sceneName; /** * Whether the scene was a group */ - @NonNull private Boolean isGroup; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/CurrentSceneTransitionChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/CurrentSceneTransitionChangedEvent.java index 3286df1b..e1ef52d8 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/CurrentSceneTransitionChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/CurrentSceneTransitionChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -25,6 +24,15 @@ protected CurrentSceneTransitionChangedEvent( super(Intent.Transitions, data); } + /** + * Name of the new transition + * + * @return the transitionName + */ + public String getTransitionName() { + return getMessageData().getEventData().getTransitionName(); + } + @Getter @ToString @Builder @@ -32,7 +40,6 @@ public static class SpecificData { /** * Name of the new transition */ - @NonNull private String transitionName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/CurrentSceneTransitionDurationChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/CurrentSceneTransitionDurationChangedEvent.java index 78ce783a..cff19661 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/CurrentSceneTransitionDurationChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/CurrentSceneTransitionDurationChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -25,6 +24,15 @@ protected CurrentSceneTransitionDurationChangedEvent( super(Intent.Transitions, data); } + /** + * Transition duration in milliseconds + * + * @return the transitionDuration + */ + public Number getTransitionDuration() { + return getMessageData().getEventData().getTransitionDuration(); + } + @Getter @ToString @Builder @@ -32,7 +40,6 @@ public static class SpecificData { /** * Transition duration in milliseconds */ - @NonNull private Number transitionDuration; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionEndedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionEndedEvent.java index 4e321545..d632a150 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionEndedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionEndedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -26,6 +25,15 @@ protected SceneTransitionEndedEvent(SceneTransitionEndedEvent.SpecificData data) super(Intent.Transitions, data); } + /** + * Scene transition name + * + * @return the transitionName + */ + public String getTransitionName() { + return getMessageData().getEventData().getTransitionName(); + } + @Getter @ToString @Builder @@ -33,7 +41,6 @@ public static class SpecificData { /** * Scene transition name */ - @NonNull private String transitionName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionStartedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionStartedEvent.java index c8f17d7f..7b1c1053 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionStartedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionStartedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected SceneTransitionStartedEvent(SceneTransitionStartedEvent.SpecificData d super(Intent.Transitions, data); } + /** + * Scene transition name + * + * @return the transitionName + */ + public String getTransitionName() { + return getMessageData().getEventData().getTransitionName(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * Scene transition name */ - @NonNull private String transitionName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionVideoEndedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionVideoEndedEvent.java index 304a99c3..58690f3b 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionVideoEndedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/transitions/SceneTransitionVideoEndedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -29,6 +28,15 @@ protected SceneTransitionVideoEndedEvent(SceneTransitionVideoEndedEvent.Specific super(Intent.Transitions, data); } + /** + * Scene transition name + * + * @return the transitionName + */ + public String getTransitionName() { + return getMessageData().getEventData().getTransitionName(); + } + @Getter @ToString @Builder @@ -36,7 +44,6 @@ public static class SpecificData { /** * Scene transition name */ - @NonNull private String transitionName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/event/ui/StudioModeStateChangedEvent.java b/client/src/main/java/io/obswebsocket/community/client/message/event/ui/StudioModeStateChangedEvent.java index 09f2f1a1..6469e8cf 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/event/ui/StudioModeStateChangedEvent.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/event/ui/StudioModeStateChangedEvent.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.event.Event; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -24,6 +23,15 @@ protected StudioModeStateChangedEvent(StudioModeStateChangedEvent.SpecificData d super(Intent.Ui, data); } + /** + * True == Enabled, False == Disabled + * + * @return the studioModeEnabled + */ + public Boolean getStudioModeEnabled() { + return getMessageData().getEventData().getStudioModeEnabled(); + } + @Getter @ToString @Builder @@ -31,7 +39,6 @@ public static class SpecificData { /** * True == Enabled, False == Disabled */ - @NonNull private Boolean studioModeEnabled; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/RequestResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/RequestResponse.java index 07af146a..81848b83 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/RequestResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/RequestResponse.java @@ -22,18 +22,21 @@ protected RequestResponse() { @ToString(callSuper = true) @Getter public static class Data extends Request.Data { + protected Status requestStatus; private T responseData; } public boolean isSuccessful() { - return this.messageData.requestStatus != null && this.messageData.requestStatus.result; + return this.messageData.requestStatus != null && + Boolean.TRUE.equals(this.messageData.requestStatus.result); } @Getter @ToString @Builder public static class Status { + protected Boolean result; protected Integer code; protected String comment; diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetPersistentDataResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetPersistentDataResponse.java index 4fc92646..219ca51f 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetPersistentDataResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetPersistentDataResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,15 @@ callSuper = true ) public class GetPersistentDataResponse extends RequestResponse { + /** + * Value associated with the slot. `null` if not set + * + * @return the slotValue + */ + public JsonObject getSlotValue() { + return getMessageData().getResponseData().getSlotValue(); + } + @Getter @ToString @Builder @@ -21,7 +29,6 @@ public static class SpecificData { /** * Value associated with the slot. `null` if not set */ - @NonNull private JsonObject slotValue; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetProfileListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetProfileListResponse.java index 91ce797a..e630057a 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetProfileListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetProfileListResponse.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -15,6 +14,24 @@ callSuper = true ) public class GetProfileListResponse extends RequestResponse { + /** + * The name of the current profile + * + * @return the currentProfileName + */ + public String getCurrentProfileName() { + return getMessageData().getResponseData().getCurrentProfileName(); + } + + /** + * Array of all available profiles + * + * @return the profiles + */ + public List getProfiles() { + return getMessageData().getResponseData().getProfiles(); + } + @Getter @ToString @Builder @@ -22,13 +39,11 @@ public static class SpecificData { /** * The name of the current profile */ - @NonNull private String currentProfileName; /** * Array of all available profiles */ - @NonNull @Singular private List profiles; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetProfileParameterResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetProfileParameterResponse.java index 6d1fed4a..75e3549e 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetProfileParameterResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetProfileParameterResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,24 @@ callSuper = true ) public class GetProfileParameterResponse extends RequestResponse { + /** + * Value associated with the parameter. `null` if not set and no default + * + * @return the parameterValue + */ + public String getParameterValue() { + return getMessageData().getResponseData().getParameterValue(); + } + + /** + * Default value associated with the parameter. `null` if no default + * + * @return the defaultParameterValue + */ + public String getDefaultParameterValue() { + return getMessageData().getResponseData().getDefaultParameterValue(); + } + @Getter @ToString @Builder @@ -20,13 +37,11 @@ public static class SpecificData { /** * Value associated with the parameter. `null` if not set and no default */ - @NonNull private String parameterValue; /** * Default value associated with the parameter. `null` if no default */ - @NonNull private String defaultParameterValue; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetRecordDirectoryResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetRecordDirectoryResponse.java index 2b6217ca..7d4b7516 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetRecordDirectoryResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetRecordDirectoryResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetRecordDirectoryResponse extends RequestResponse { + /** + * Output directory + * + * @return the recordDirectory + */ + public String getRecordDirectory() { + return getMessageData().getResponseData().getRecordDirectory(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Output directory */ - @NonNull private String recordDirectory; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetSceneCollectionListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetSceneCollectionListResponse.java index e398bd1a..30df90c5 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetSceneCollectionListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetSceneCollectionListResponse.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -15,6 +14,24 @@ callSuper = true ) public class GetSceneCollectionListResponse extends RequestResponse { + /** + * The name of the current scene collection + * + * @return the currentSceneCollectionName + */ + public String getCurrentSceneCollectionName() { + return getMessageData().getResponseData().getCurrentSceneCollectionName(); + } + + /** + * Array of all available scene collections + * + * @return the sceneCollections + */ + public List getSceneCollections() { + return getMessageData().getResponseData().getSceneCollections(); + } + @Getter @ToString @Builder @@ -22,13 +39,11 @@ public static class SpecificData { /** * The name of the current scene collection */ - @NonNull private String currentSceneCollectionName; /** * Array of all available scene collections */ - @NonNull @Singular private List sceneCollections; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetStreamServiceSettingsResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetStreamServiceSettingsResponse.java index 2f3b0f5a..a54195a6 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetStreamServiceSettingsResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetStreamServiceSettingsResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,24 @@ callSuper = true ) public class GetStreamServiceSettingsResponse extends RequestResponse { + /** + * Stream service type, like `rtmp_custom` or `rtmp_common` + * + * @return the streamServiceType + */ + public String getStreamServiceType() { + return getMessageData().getResponseData().getStreamServiceType(); + } + + /** + * Stream service settings + * + * @return the streamServiceSettings + */ + public JsonObject getStreamServiceSettings() { + return getMessageData().getResponseData().getStreamServiceSettings(); + } + @Getter @ToString @Builder @@ -21,13 +38,11 @@ public static class SpecificData { /** * Stream service type, like `rtmp_custom` or `rtmp_common` */ - @NonNull private String streamServiceType; /** * Stream service settings */ - @NonNull private JsonObject streamServiceSettings; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetVideoSettingsResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetVideoSettingsResponse.java index d781e389..c29f308e 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetVideoSettingsResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/config/GetVideoSettingsResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,60 @@ callSuper = true ) public class GetVideoSettingsResponse extends RequestResponse { + /** + * Numerator of the fractional FPS value + * + * @return the fpsNumerator + */ + public Number getFpsNumerator() { + return getMessageData().getResponseData().getFpsNumerator(); + } + + /** + * Denominator of the fractional FPS value + * + * @return the fpsDenominator + */ + public Number getFpsDenominator() { + return getMessageData().getResponseData().getFpsDenominator(); + } + + /** + * Width of the base (canvas) resolution in pixels + * + * @return the baseWidth + */ + public Number getBaseWidth() { + return getMessageData().getResponseData().getBaseWidth(); + } + + /** + * Height of the base (canvas) resolution in pixels + * + * @return the baseHeight + */ + public Number getBaseHeight() { + return getMessageData().getResponseData().getBaseHeight(); + } + + /** + * Width of the output resolution in pixels + * + * @return the outputWidth + */ + public Number getOutputWidth() { + return getMessageData().getResponseData().getOutputWidth(); + } + + /** + * Height of the output resolution in pixels + * + * @return the outputHeight + */ + public Number getOutputHeight() { + return getMessageData().getResponseData().getOutputHeight(); + } + @Getter @ToString @Builder @@ -20,37 +73,31 @@ public static class SpecificData { /** * Numerator of the fractional FPS value */ - @NonNull private Number fpsNumerator; /** * Denominator of the fractional FPS value */ - @NonNull private Number fpsDenominator; /** * Width of the base (canvas) resolution in pixels */ - @NonNull private Number baseWidth; /** * Height of the base (canvas) resolution in pixels */ - @NonNull private Number baseHeight; /** * Width of the output resolution in pixels */ - @NonNull private Number outputWidth; /** * Height of the output resolution in pixels */ - @NonNull private Number outputHeight; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterDefaultSettingsResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterDefaultSettingsResponse.java index a7ea9829..8ba49fbb 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterDefaultSettingsResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterDefaultSettingsResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,15 @@ callSuper = true ) public class GetSourceFilterDefaultSettingsResponse extends RequestResponse { + /** + * Object of default settings for the filter kind + * + * @return the defaultFilterSettings + */ + public JsonObject getDefaultFilterSettings() { + return getMessageData().getResponseData().getDefaultFilterSettings(); + } + @Getter @ToString @Builder @@ -21,7 +29,6 @@ public static class SpecificData { /** * Object of default settings for the filter kind */ - @NonNull private JsonObject defaultFilterSettings; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterListResponse.java index 848a2fd4..28fc9672 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterListResponse.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -16,6 +15,15 @@ callSuper = true ) public class GetSourceFilterListResponse extends RequestResponse { + /** + * Array of filters + * + * @return the filters + */ + public List getFilters() { + return getMessageData().getResponseData().getFilters(); + } + @Getter @ToString @Builder @@ -23,7 +31,6 @@ public static class SpecificData { /** * Array of filters */ - @NonNull @Singular private List filters; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterResponse.java index 72e229af..e1c8d106 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/filters/GetSourceFilterResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,42 @@ callSuper = true ) public class GetSourceFilterResponse extends RequestResponse { + /** + * Whether the filter is enabled + * + * @return the filterEnabled + */ + public Boolean getFilterEnabled() { + return getMessageData().getResponseData().getFilterEnabled(); + } + + /** + * Index of the filter in the list, beginning at 0 + * + * @return the filterIndex + */ + public Number getFilterIndex() { + return getMessageData().getResponseData().getFilterIndex(); + } + + /** + * The kind of filter + * + * @return the filterKind + */ + public String getFilterKind() { + return getMessageData().getResponseData().getFilterKind(); + } + + /** + * Settings object associated with the filter + * + * @return the filterSettings + */ + public JsonObject getFilterSettings() { + return getMessageData().getResponseData().getFilterSettings(); + } + @Getter @ToString @Builder @@ -21,25 +56,21 @@ public static class SpecificData { /** * Whether the filter is enabled */ - @NonNull private Boolean filterEnabled; /** * Index of the filter in the list, beginning at 0 */ - @NonNull private Number filterIndex; /** * The kind of filter */ - @NonNull private String filterKind; /** * Settings object associated with the filter */ - @NonNull private JsonObject filterSettings; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/general/CallVendorRequestResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/general/CallVendorRequestResponse.java index 2c3423aa..4cce9836 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/general/CallVendorRequestResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/general/CallVendorRequestResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,33 @@ callSuper = true ) public class CallVendorRequestResponse extends RequestResponse { + /** + * Echoed of `vendorName` + * + * @return the vendorName + */ + public String getVendorName() { + return getMessageData().getResponseData().getVendorName(); + } + + /** + * Echoed of `requestType` + * + * @return the requestType + */ + public String getRequestType() { + return getMessageData().getResponseData().getRequestType(); + } + + /** + * Object containing appropriate response data. {} if request does not provide any response data + * + * @return the responseData + */ + public JsonObject getResponseData() { + return getMessageData().getResponseData().getResponseData(); + } + @Getter @ToString @Builder @@ -21,19 +47,16 @@ public static class SpecificData { /** * Echoed of `vendorName` */ - @NonNull private String vendorName; /** * Echoed of `requestType` */ - @NonNull private String requestType; /** * Object containing appropriate response data. {} if request does not provide any response data */ - @NonNull private JsonObject responseData; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetHotkeyListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetHotkeyListResponse.java index 499f031c..65035f77 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetHotkeyListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetHotkeyListResponse.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -15,6 +14,15 @@ callSuper = true ) public class GetHotkeyListResponse extends RequestResponse { + /** + * Array of hotkey names + * + * @return the hotkeys + */ + public List getHotkeys() { + return getMessageData().getResponseData().getHotkeys(); + } + @Getter @ToString @Builder @@ -22,7 +30,6 @@ public static class SpecificData { /** * Array of hotkey names */ - @NonNull @Singular private List hotkeys; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetStatsResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetStatsResponse.java index 7f09602e..28f3d331 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetStatsResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetStatsResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,105 @@ callSuper = true ) public class GetStatsResponse extends RequestResponse { + /** + * Current CPU usage in percent + * + * @return the cpuUsage + */ + public Number getCpuUsage() { + return getMessageData().getResponseData().getCpuUsage(); + } + + /** + * Amount of memory in MB currently being used by OBS + * + * @return the memoryUsage + */ + public Number getMemoryUsage() { + return getMessageData().getResponseData().getMemoryUsage(); + } + + /** + * Available disk space on the device being used for recording storage + * + * @return the availableDiskSpace + */ + public Number getAvailableDiskSpace() { + return getMessageData().getResponseData().getAvailableDiskSpace(); + } + + /** + * Current FPS being rendered + * + * @return the activeFps + */ + public Number getActiveFps() { + return getMessageData().getResponseData().getActiveFps(); + } + + /** + * Average time in milliseconds that OBS is taking to render a frame + * + * @return the averageFrameRenderTime + */ + public Number getAverageFrameRenderTime() { + return getMessageData().getResponseData().getAverageFrameRenderTime(); + } + + /** + * Number of frames skipped by OBS in the render thread + * + * @return the renderSkippedFrames + */ + public Number getRenderSkippedFrames() { + return getMessageData().getResponseData().getRenderSkippedFrames(); + } + + /** + * Total number of frames outputted by the render thread + * + * @return the renderTotalFrames + */ + public Number getRenderTotalFrames() { + return getMessageData().getResponseData().getRenderTotalFrames(); + } + + /** + * Number of frames skipped by OBS in the output thread + * + * @return the outputSkippedFrames + */ + public Number getOutputSkippedFrames() { + return getMessageData().getResponseData().getOutputSkippedFrames(); + } + + /** + * Total number of frames outputted by the output thread + * + * @return the outputTotalFrames + */ + public Number getOutputTotalFrames() { + return getMessageData().getResponseData().getOutputTotalFrames(); + } + + /** + * Total number of messages received by obs-websocket from the client + * + * @return the webSocketSessionIncomingMessages + */ + public Number getWebSocketSessionIncomingMessages() { + return getMessageData().getResponseData().getWebSocketSessionIncomingMessages(); + } + + /** + * Total number of messages sent by obs-websocket to the client + * + * @return the webSocketSessionOutgoingMessages + */ + public Number getWebSocketSessionOutgoingMessages() { + return getMessageData().getResponseData().getWebSocketSessionOutgoingMessages(); + } + @Getter @ToString @Builder @@ -20,67 +118,56 @@ public static class SpecificData { /** * Current CPU usage in percent */ - @NonNull private Number cpuUsage; /** * Amount of memory in MB currently being used by OBS */ - @NonNull private Number memoryUsage; /** * Available disk space on the device being used for recording storage */ - @NonNull private Number availableDiskSpace; /** * Current FPS being rendered */ - @NonNull private Number activeFps; /** * Average time in milliseconds that OBS is taking to render a frame */ - @NonNull private Number averageFrameRenderTime; /** * Number of frames skipped by OBS in the render thread */ - @NonNull private Number renderSkippedFrames; /** * Total number of frames outputted by the render thread */ - @NonNull private Number renderTotalFrames; /** * Number of frames skipped by OBS in the output thread */ - @NonNull private Number outputSkippedFrames; /** * Total number of frames outputted by the output thread */ - @NonNull private Number outputTotalFrames; /** * Total number of messages received by obs-websocket from the client */ - @NonNull private Number webSocketSessionIncomingMessages; /** * Total number of messages sent by obs-websocket to the client */ - @NonNull private Number webSocketSessionOutgoingMessages; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetVersionResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetVersionResponse.java index 0b16da6e..9c93670b 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetVersionResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/general/GetVersionResponse.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -15,6 +14,69 @@ callSuper = true ) public class GetVersionResponse extends RequestResponse { + /** + * Current OBS Studio version + * + * @return the obsVersion + */ + public String getObsVersion() { + return getMessageData().getResponseData().getObsVersion(); + } + + /** + * Current obs-websocket version + * + * @return the obsWebSocketVersion + */ + public String getObsWebSocketVersion() { + return getMessageData().getResponseData().getObsWebSocketVersion(); + } + + /** + * Current latest obs-websocket RPC version + * + * @return the rpcVersion + */ + public Number getRpcVersion() { + return getMessageData().getResponseData().getRpcVersion(); + } + + /** + * Array of available RPC requests for the currently negotiated RPC version + * + * @return the availableRequests + */ + public List getAvailableRequests() { + return getMessageData().getResponseData().getAvailableRequests(); + } + + /** + * Image formats available in `GetSourceScreenshot` and `SaveSourceScreenshot` requests. + * + * @return the supportedImageFormats + */ + public List getSupportedImageFormats() { + return getMessageData().getResponseData().getSupportedImageFormats(); + } + + /** + * Name of the platform. Usually `windows`, `macos`, or `ubuntu` (linux flavor). Not guaranteed to be any of those + * + * @return the platform + */ + public String getPlatform() { + return getMessageData().getResponseData().getPlatform(); + } + + /** + * Description of the platform, like `Windows 10 (10.0)` + * + * @return the platformDescription + */ + public String getPlatformDescription() { + return getMessageData().getResponseData().getPlatformDescription(); + } + @Getter @ToString @Builder @@ -22,45 +84,38 @@ public static class SpecificData { /** * Current OBS Studio version */ - @NonNull private String obsVersion; /** * Current obs-websocket version */ - @NonNull private String obsWebSocketVersion; /** * Current latest obs-websocket RPC version */ - @NonNull private Number rpcVersion; /** * Array of available RPC requests for the currently negotiated RPC version */ - @NonNull @Singular private List availableRequests; /** * Image formats available in `GetSourceScreenshot` and `SaveSourceScreenshot` requests. */ - @NonNull @Singular private List supportedImageFormats; /** * Name of the platform. Usually `windows`, `macos`, or `ubuntu` (linux flavor). Not guaranteed to be any of those */ - @NonNull private String platform; /** * Description of the platform, like `Windows 10 (10.0)` */ - @NonNull private String platformDescription; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/CreateInputResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/CreateInputResponse.java index c685691f..4e1f20a3 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/CreateInputResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/CreateInputResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class CreateInputResponse extends RequestResponse { + /** + * ID of the newly created scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getResponseData().getSceneItemId(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * ID of the newly created scene item */ - @NonNull private Number sceneItemId; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioBalanceResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioBalanceResponse.java index 3a79b2ff..de8db36f 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioBalanceResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioBalanceResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetInputAudioBalanceResponse extends RequestResponse { + /** + * Audio balance value from 0.0-1.0 + * + * @return the inputAudioBalance + */ + public Number getInputAudioBalance() { + return getMessageData().getResponseData().getInputAudioBalance(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Audio balance value from 0.0-1.0 */ - @NonNull private Number inputAudioBalance; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioMonitorTypeResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioMonitorTypeResponse.java index e3bb10f7..e6655fa0 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioMonitorTypeResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioMonitorTypeResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.model.Input; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,15 @@ callSuper = true ) public class GetInputAudioMonitorTypeResponse extends RequestResponse { + /** + * Audio monitor type + * + * @return the monitorType + */ + public Input.MonitorType getMonitorType() { + return getMessageData().getResponseData().getMonitorType(); + } + @Getter @ToString @Builder @@ -21,7 +29,6 @@ public static class SpecificData { /** * Audio monitor type */ - @NonNull private Input.MonitorType monitorType; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioSyncOffsetResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioSyncOffsetResponse.java index 8cf2a324..b8d3bde2 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioSyncOffsetResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioSyncOffsetResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetInputAudioSyncOffsetResponse extends RequestResponse { + /** + * Audio sync offset in milliseconds + * + * @return the inputAudioSyncOffset + */ + public Number getInputAudioSyncOffset() { + return getMessageData().getResponseData().getInputAudioSyncOffset(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Audio sync offset in milliseconds */ - @NonNull private Number inputAudioSyncOffset; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioTracksResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioTracksResponse.java index 65e8c214..495be589 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioTracksResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputAudioTracksResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.model.Input; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,15 @@ callSuper = true ) public class GetInputAudioTracksResponse extends RequestResponse { + /** + * Object of audio tracks and associated enable states + * + * @return the inputAudioTracks + */ + public Input.AudioTracks getInputAudioTracks() { + return getMessageData().getResponseData().getInputAudioTracks(); + } + @Getter @ToString @Builder @@ -21,7 +29,6 @@ public static class SpecificData { /** * Object of audio tracks and associated enable states */ - @NonNull private Input.AudioTracks inputAudioTracks; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputDefaultSettingsResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputDefaultSettingsResponse.java index 0e0f934c..5c5236a1 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputDefaultSettingsResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputDefaultSettingsResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,15 @@ callSuper = true ) public class GetInputDefaultSettingsResponse extends RequestResponse { + /** + * Object of default settings for the input kind + * + * @return the defaultInputSettings + */ + public JsonObject getDefaultInputSettings() { + return getMessageData().getResponseData().getDefaultInputSettings(); + } + @Getter @ToString @Builder @@ -21,7 +29,6 @@ public static class SpecificData { /** * Object of default settings for the input kind */ - @NonNull private JsonObject defaultInputSettings; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputKindListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputKindListResponse.java index 5b918520..165cd767 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputKindListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputKindListResponse.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -15,6 +14,15 @@ callSuper = true ) public class GetInputKindListResponse extends RequestResponse { + /** + * Array of input kinds + * + * @return the inputKinds + */ + public List getInputKinds() { + return getMessageData().getResponseData().getInputKinds(); + } + @Getter @ToString @Builder @@ -22,7 +30,6 @@ public static class SpecificData { /** * Array of input kinds */ - @NonNull @Singular private List inputKinds; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputListResponse.java index 87dfe9c1..b0393b70 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputListResponse.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -16,6 +15,15 @@ callSuper = true ) public class GetInputListResponse extends RequestResponse { + /** + * Array of inputs + * + * @return the inputs + */ + public List getInputs() { + return getMessageData().getResponseData().getInputs(); + } + @Getter @ToString @Builder @@ -23,7 +31,6 @@ public static class SpecificData { /** * Array of inputs */ - @NonNull @Singular private List inputs; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputMuteResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputMuteResponse.java index 3791dfcf..7532a2ac 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputMuteResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputMuteResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetInputMuteResponse extends RequestResponse { + /** + * Whether the input is muted + * + * @return the inputMuted + */ + public Boolean getInputMuted() { + return getMessageData().getResponseData().getInputMuted(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether the input is muted */ - @NonNull private Boolean inputMuted; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputPropertiesListPropertyItemsResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputPropertiesListPropertyItemsResponse.java index ddd67b97..ead8041e 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputPropertiesListPropertyItemsResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputPropertiesListPropertyItemsResponse.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -16,6 +15,15 @@ callSuper = true ) public class GetInputPropertiesListPropertyItemsResponse extends RequestResponse { + /** + * Array of items in the list property + * + * @return the propertyItems + */ + public List getPropertyItems() { + return getMessageData().getResponseData().getPropertyItems(); + } + @Getter @ToString @Builder @@ -23,7 +31,6 @@ public static class SpecificData { /** * Array of items in the list property */ - @NonNull @Singular private List propertyItems; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputSettingsResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputSettingsResponse.java index 972161cb..3a7ea1e1 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputSettingsResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputSettingsResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,24 @@ callSuper = true ) public class GetInputSettingsResponse extends RequestResponse { + /** + * Object of settings for the input + * + * @return the inputSettings + */ + public JsonObject getInputSettings() { + return getMessageData().getResponseData().getInputSettings(); + } + + /** + * The kind of the input + * + * @return the inputKind + */ + public String getInputKind() { + return getMessageData().getResponseData().getInputKind(); + } + @Getter @ToString @Builder @@ -21,13 +38,11 @@ public static class SpecificData { /** * Object of settings for the input */ - @NonNull private JsonObject inputSettings; /** * The kind of the input */ - @NonNull private String inputKind; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputVolumeResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputVolumeResponse.java index 83cd852e..8baeee1a 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputVolumeResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetInputVolumeResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,24 @@ callSuper = true ) public class GetInputVolumeResponse extends RequestResponse { + /** + * Volume setting in mul + * + * @return the inputVolumeMul + */ + public Number getInputVolumeMul() { + return getMessageData().getResponseData().getInputVolumeMul(); + } + + /** + * Volume setting in dB + * + * @return the inputVolumeDb + */ + public Number getInputVolumeDb() { + return getMessageData().getResponseData().getInputVolumeDb(); + } + @Getter @ToString @Builder @@ -20,13 +37,11 @@ public static class SpecificData { /** * Volume setting in mul */ - @NonNull private Number inputVolumeMul; /** * Volume setting in dB */ - @NonNull private Number inputVolumeDb; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetSpecialInputsResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetSpecialInputsResponse.java index edf7b994..90b0b41d 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetSpecialInputsResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/GetSpecialInputsResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,60 @@ callSuper = true ) public class GetSpecialInputsResponse extends RequestResponse { + /** + * Name of the Desktop Audio input + * + * @return the desktop1 + */ + public String getDesktop1() { + return getMessageData().getResponseData().getDesktop1(); + } + + /** + * Name of the Desktop Audio 2 input + * + * @return the desktop2 + */ + public String getDesktop2() { + return getMessageData().getResponseData().getDesktop2(); + } + + /** + * Name of the Mic/Auxiliary Audio input + * + * @return the mic1 + */ + public String getMic1() { + return getMessageData().getResponseData().getMic1(); + } + + /** + * Name of the Mic/Auxiliary Audio 2 input + * + * @return the mic2 + */ + public String getMic2() { + return getMessageData().getResponseData().getMic2(); + } + + /** + * Name of the Mic/Auxiliary Audio 3 input + * + * @return the mic3 + */ + public String getMic3() { + return getMessageData().getResponseData().getMic3(); + } + + /** + * Name of the Mic/Auxiliary Audio 4 input + * + * @return the mic4 + */ + public String getMic4() { + return getMessageData().getResponseData().getMic4(); + } + @Getter @ToString @Builder @@ -20,37 +73,31 @@ public static class SpecificData { /** * Name of the Desktop Audio input */ - @NonNull private String desktop1; /** * Name of the Desktop Audio 2 input */ - @NonNull private String desktop2; /** * Name of the Mic/Auxiliary Audio input */ - @NonNull private String mic1; /** * Name of the Mic/Auxiliary Audio 2 input */ - @NonNull private String mic2; /** * Name of the Mic/Auxiliary Audio 3 input */ - @NonNull private String mic3; /** * Name of the Mic/Auxiliary Audio 4 input */ - @NonNull private String mic4; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/ToggleInputMuteResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/ToggleInputMuteResponse.java index 6adf75a7..e5654907 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/ToggleInputMuteResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/inputs/ToggleInputMuteResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class ToggleInputMuteResponse extends RequestResponse { + /** + * Whether the input has been muted or unmuted + * + * @return the inputMuted + */ + public Boolean getInputMuted() { + return getMessageData().getResponseData().getInputMuted(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether the input has been muted or unmuted */ - @NonNull private Boolean inputMuted; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/mediainputs/GetMediaInputStatusResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/mediainputs/GetMediaInputStatusResponse.java index ca89fb7d..85937cab 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/mediainputs/GetMediaInputStatusResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/mediainputs/GetMediaInputStatusResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.model.MediaState; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,33 @@ callSuper = true ) public class GetMediaInputStatusResponse extends RequestResponse { + /** + * State of the media input + * + * @return the mediaState + */ + public MediaState getMediaState() { + return getMessageData().getResponseData().getMediaState(); + } + + /** + * Total duration of the playing media in milliseconds. `null` if not playing + * + * @return the mediaDuration + */ + public Number getMediaDuration() { + return getMessageData().getResponseData().getMediaDuration(); + } + + /** + * Position of the cursor in milliseconds. `null` if not playing + * + * @return the mediaCursor + */ + public Number getMediaCursor() { + return getMessageData().getResponseData().getMediaCursor(); + } + @Getter @ToString @Builder @@ -21,19 +47,16 @@ public static class SpecificData { /** * State of the media input */ - @NonNull private MediaState mediaState; /** * Total duration of the playing media in milliseconds. `null` if not playing */ - @NonNull private Number mediaDuration; /** * Position of the cursor in milliseconds. `null` if not playing */ - @NonNull private Number mediaCursor; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetLastReplayBufferReplayResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetLastReplayBufferReplayResponse.java index 79e3d624..a25d1386 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetLastReplayBufferReplayResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetLastReplayBufferReplayResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetLastReplayBufferReplayResponse extends RequestResponse { + /** + * File path + * + * @return the savedReplayPath + */ + public String getSavedReplayPath() { + return getMessageData().getResponseData().getSavedReplayPath(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * File path */ - @NonNull private String savedReplayPath; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputListResponse.java index d212e38a..ab0432f4 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputListResponse.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -16,6 +15,15 @@ callSuper = true ) public class GetOutputListResponse extends RequestResponse { + /** + * The outputs + * + * @return the outputs + */ + public List getOutputs() { + return getMessageData().getResponseData().getOutputs(); + } + @Getter @ToString @Builder @@ -23,7 +31,6 @@ public static class SpecificData { /** * The outputs */ - @NonNull @Singular private List outputs; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputSettingsResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputSettingsResponse.java index 05c1e519..ebad2efc 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputSettingsResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputSettingsResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,15 @@ callSuper = true ) public class GetOutputSettingsResponse extends RequestResponse { + /** + * Output settings + * + * @return the outputSettings + */ + public JsonObject getOutputSettings() { + return getMessageData().getResponseData().getOutputSettings(); + } + @Getter @ToString @Builder @@ -21,7 +29,6 @@ public static class SpecificData { /** * Output settings */ - @NonNull private JsonObject outputSettings; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputStatusResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputStatusResponse.java index 6b0c39ec..27aa7e2b 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputStatusResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetOutputStatusResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,78 @@ callSuper = true ) public class GetOutputStatusResponse extends RequestResponse { + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getResponseData().getOutputActive(); + } + + /** + * Whether the output is reconnecting + * + * @return the outputReconnecting + */ + public Boolean getOutputReconnecting() { + return getMessageData().getResponseData().getOutputReconnecting(); + } + + /** + * Current formatted timecode string for the output + * + * @return the outputTimecode + */ + public String getOutputTimecode() { + return getMessageData().getResponseData().getOutputTimecode(); + } + + /** + * Current duration in milliseconds for the output + * + * @return the outputDuration + */ + public Number getOutputDuration() { + return getMessageData().getResponseData().getOutputDuration(); + } + + /** + * Congestion of the output + * + * @return the outputCongestion + */ + public Number getOutputCongestion() { + return getMessageData().getResponseData().getOutputCongestion(); + } + + /** + * Number of bytes sent by the output + * + * @return the outputBytes + */ + public Number getOutputBytes() { + return getMessageData().getResponseData().getOutputBytes(); + } + + /** + * Number of frames skipped by the output's process + * + * @return the outputSkippedFrames + */ + public Number getOutputSkippedFrames() { + return getMessageData().getResponseData().getOutputSkippedFrames(); + } + + /** + * Total number of frames delivered by the output's process + * + * @return the outputTotalFrames + */ + public Number getOutputTotalFrames() { + return getMessageData().getResponseData().getOutputTotalFrames(); + } + @Getter @ToString @Builder @@ -20,49 +91,41 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; /** * Whether the output is reconnecting */ - @NonNull private Boolean outputReconnecting; /** * Current formatted timecode string for the output */ - @NonNull private String outputTimecode; /** * Current duration in milliseconds for the output */ - @NonNull private Number outputDuration; /** * Congestion of the output */ - @NonNull private Number outputCongestion; /** * Number of bytes sent by the output */ - @NonNull private Number outputBytes; /** * Number of frames skipped by the output's process */ - @NonNull private Number outputSkippedFrames; /** * Total number of frames delivered by the output's process */ - @NonNull private Number outputTotalFrames; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetReplayBufferStatusResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetReplayBufferStatusResponse.java index 8c4387a0..462c9981 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetReplayBufferStatusResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetReplayBufferStatusResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetReplayBufferStatusResponse extends RequestResponse { + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getResponseData().getOutputActive(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetVirtualCamStatusResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetVirtualCamStatusResponse.java index da048854..906c6735 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetVirtualCamStatusResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/GetVirtualCamStatusResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetVirtualCamStatusResponse extends RequestResponse { + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getResponseData().getOutputActive(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleOutputResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleOutputResponse.java index 110ecd00..be1576a2 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleOutputResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleOutputResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class ToggleOutputResponse extends RequestResponse { + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getResponseData().getOutputActive(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleReplayBufferResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleReplayBufferResponse.java index 191f260d..6a482e74 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleReplayBufferResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleReplayBufferResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class ToggleReplayBufferResponse extends RequestResponse { + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getResponseData().getOutputActive(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleVirtualCamResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleVirtualCamResponse.java index 02a0c15f..321f8a6d 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleVirtualCamResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/outputs/ToggleVirtualCamResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class ToggleVirtualCamResponse extends RequestResponse { + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getResponseData().getOutputActive(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/record/GetRecordStatusResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/record/GetRecordStatusResponse.java index 800570ea..ee9bb563 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/record/GetRecordStatusResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/record/GetRecordStatusResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,51 @@ callSuper = true ) public class GetRecordStatusResponse extends RequestResponse { + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getResponseData().getOutputActive(); + } + + /** + * Whether the output is paused + * + * @return the outputPaused + */ + public Boolean getOutputPaused() { + return getMessageData().getResponseData().getOutputPaused(); + } + + /** + * Current formatted timecode string for the output + * + * @return the outputTimecode + */ + public String getOutputTimecode() { + return getMessageData().getResponseData().getOutputTimecode(); + } + + /** + * Current duration in milliseconds for the output + * + * @return the outputDuration + */ + public Number getOutputDuration() { + return getMessageData().getResponseData().getOutputDuration(); + } + + /** + * Number of bytes sent by the output + * + * @return the outputBytes + */ + public Number getOutputBytes() { + return getMessageData().getResponseData().getOutputBytes(); + } + @Getter @ToString @Builder @@ -20,31 +64,26 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; /** * Whether the output is paused */ - @NonNull private Boolean outputPaused; /** * Current formatted timecode string for the output */ - @NonNull private String outputTimecode; /** * Current duration in milliseconds for the output */ - @NonNull private Number outputDuration; /** * Number of bytes sent by the output */ - @NonNull private Number outputBytes; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/record/StopRecordResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/record/StopRecordResponse.java index faecef88..c8889ec5 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/record/StopRecordResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/record/StopRecordResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class StopRecordResponse extends RequestResponse { + /** + * File name for the saved recording + * + * @return the outputPath + */ + public String getOutputPath() { + return getMessageData().getResponseData().getOutputPath(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * File name for the saved recording */ - @NonNull private String outputPath; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/CreateSceneItemResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/CreateSceneItemResponse.java index 9fa06c03..75c50bd3 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/CreateSceneItemResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/CreateSceneItemResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class CreateSceneItemResponse extends RequestResponse { + /** + * Numeric ID of the scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getResponseData().getSceneItemId(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Numeric ID of the scene item */ - @NonNull private Number sceneItemId; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/DuplicateSceneItemResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/DuplicateSceneItemResponse.java index cfcd8f93..d010a90a 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/DuplicateSceneItemResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/DuplicateSceneItemResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class DuplicateSceneItemResponse extends RequestResponse { + /** + * Numeric ID of the duplicated scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getResponseData().getSceneItemId(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Numeric ID of the duplicated scene item */ - @NonNull private Number sceneItemId; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetGroupSceneItemListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetGroupSceneItemListResponse.java index 76538a53..717041cd 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetGroupSceneItemListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetGroupSceneItemListResponse.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -16,6 +15,15 @@ callSuper = true ) public class GetGroupSceneItemListResponse extends RequestResponse { + /** + * Array of scene items in the group + * + * @return the sceneItems + */ + public List getSceneItems() { + return getMessageData().getResponseData().getSceneItems(); + } + @Getter @ToString @Builder @@ -23,7 +31,6 @@ public static class SpecificData { /** * Array of scene items in the group */ - @NonNull @Singular private List sceneItems; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemBlendModeResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemBlendModeResponse.java index 7d67e5b8..9827d3a9 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemBlendModeResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemBlendModeResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetSceneItemBlendModeResponse extends RequestResponse { + /** + * Current blend mode + * + * @return the sceneItemBlendMode + */ + public String getSceneItemBlendMode() { + return getMessageData().getResponseData().getSceneItemBlendMode(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Current blend mode */ - @NonNull private String sceneItemBlendMode; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemEnabledResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemEnabledResponse.java index dc7ac50a..f3f83ada 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemEnabledResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemEnabledResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetSceneItemEnabledResponse extends RequestResponse { + /** + * Whether the scene item is enabled. `true` for enabled, `false` for disabled + * + * @return the sceneItemEnabled + */ + public Boolean getSceneItemEnabled() { + return getMessageData().getResponseData().getSceneItemEnabled(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether the scene item is enabled. `true` for enabled, `false` for disabled */ - @NonNull private Boolean sceneItemEnabled; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemIdResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemIdResponse.java index 1a05228c..36d55b47 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemIdResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemIdResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetSceneItemIdResponse extends RequestResponse { + /** + * Numeric ID of the scene item + * + * @return the sceneItemId + */ + public Number getSceneItemId() { + return getMessageData().getResponseData().getSceneItemId(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Numeric ID of the scene item */ - @NonNull private Number sceneItemId; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemIndexResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemIndexResponse.java index f5b1da0e..8e957a9b 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemIndexResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemIndexResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetSceneItemIndexResponse extends RequestResponse { + /** + * Index position of the scene item + * + * @return the sceneItemIndex + */ + public Number getSceneItemIndex() { + return getMessageData().getResponseData().getSceneItemIndex(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Index position of the scene item */ - @NonNull private Number sceneItemIndex; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemListResponse.java index 75f26002..71422341 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemListResponse.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -16,6 +15,15 @@ callSuper = true ) public class GetSceneItemListResponse extends RequestResponse { + /** + * Array of scene items in the scene + * + * @return the sceneItems + */ + public List getSceneItems() { + return getMessageData().getResponseData().getSceneItems(); + } + @Getter @ToString @Builder @@ -23,7 +31,6 @@ public static class SpecificData { /** * Array of scene items in the scene */ - @NonNull @Singular private List sceneItems; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemLockedResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemLockedResponse.java index c807caff..b4764d30 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemLockedResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemLockedResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetSceneItemLockedResponse extends RequestResponse { + /** + * Whether the scene item is locked. `true` for locked, `false` for unlocked + * + * @return the sceneItemLocked + */ + public Boolean getSceneItemLocked() { + return getMessageData().getResponseData().getSceneItemLocked(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether the scene item is locked. `true` for locked, `false` for unlocked */ - @NonNull private Boolean sceneItemLocked; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemTransformResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemTransformResponse.java index e002cf2c..0cde02de 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemTransformResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sceneitems/GetSceneItemTransformResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.model.SceneItem; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,15 @@ callSuper = true ) public class GetSceneItemTransformResponse extends RequestResponse { + /** + * Object containing scene item transform info + * + * @return the sceneItemTransform + */ + public SceneItem.Transform getSceneItemTransform() { + return getMessageData().getResponseData().getSceneItemTransform(); + } + @Getter @ToString @Builder @@ -21,7 +29,6 @@ public static class SpecificData { /** * Object containing scene item transform info */ - @NonNull private SceneItem.Transform sceneItemTransform; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetCurrentPreviewSceneResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetCurrentPreviewSceneResponse.java index c1ae66be..a758c8ec 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetCurrentPreviewSceneResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetCurrentPreviewSceneResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetCurrentPreviewSceneResponse extends RequestResponse { + /** + * Current preview scene + * + * @return the currentPreviewSceneName + */ + public String getCurrentPreviewSceneName() { + return getMessageData().getResponseData().getCurrentPreviewSceneName(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Current preview scene */ - @NonNull private String currentPreviewSceneName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetCurrentProgramSceneResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetCurrentProgramSceneResponse.java index f8282b27..83680f84 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetCurrentProgramSceneResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetCurrentProgramSceneResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetCurrentProgramSceneResponse extends RequestResponse { + /** + * Current program scene + * + * @return the currentProgramSceneName + */ + public String getCurrentProgramSceneName() { + return getMessageData().getResponseData().getCurrentProgramSceneName(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Current program scene */ - @NonNull private String currentProgramSceneName; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetGroupListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetGroupListResponse.java index 249e9244..4d1817cd 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetGroupListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetGroupListResponse.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -15,6 +14,15 @@ callSuper = true ) public class GetGroupListResponse extends RequestResponse { + /** + * Array of group names + * + * @return the groups + */ + public List getGroups() { + return getMessageData().getResponseData().getGroups(); + } + @Getter @ToString @Builder @@ -22,7 +30,6 @@ public static class SpecificData { /** * Array of group names */ - @NonNull @Singular private List groups; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetSceneListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetSceneListResponse.java index 482b497d..438cf284 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetSceneListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetSceneListResponse.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -16,6 +15,33 @@ callSuper = true ) public class GetSceneListResponse extends RequestResponse { + /** + * Current program scene + * + * @return the currentProgramSceneName + */ + public String getCurrentProgramSceneName() { + return getMessageData().getResponseData().getCurrentProgramSceneName(); + } + + /** + * Current preview scene. `null` if not in studio mode + * + * @return the currentPreviewSceneName + */ + public String getCurrentPreviewSceneName() { + return getMessageData().getResponseData().getCurrentPreviewSceneName(); + } + + /** + * Array of scenes + * + * @return the scenes + */ + public List getScenes() { + return getMessageData().getResponseData().getScenes(); + } + @Getter @ToString @Builder @@ -23,19 +49,16 @@ public static class SpecificData { /** * Current program scene */ - @NonNull private String currentProgramSceneName; /** * Current preview scene. `null` if not in studio mode */ - @NonNull private String currentPreviewSceneName; /** * Array of scenes */ - @NonNull @Singular private List scenes; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetSceneSceneTransitionOverrideResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetSceneSceneTransitionOverrideResponse.java index 1ad69892..15c0dc32 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetSceneSceneTransitionOverrideResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/scenes/GetSceneSceneTransitionOverrideResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,24 @@ callSuper = true ) public class GetSceneSceneTransitionOverrideResponse extends RequestResponse { + /** + * Name of the overridden scene transition, else `null` + * + * @return the transitionName + */ + public String getTransitionName() { + return getMessageData().getResponseData().getTransitionName(); + } + + /** + * Duration of the overridden scene transition, else `null` + * + * @return the transitionDuration + */ + public Number getTransitionDuration() { + return getMessageData().getResponseData().getTransitionDuration(); + } + @Getter @ToString @Builder @@ -20,13 +37,11 @@ public static class SpecificData { /** * Name of the overridden scene transition, else `null` */ - @NonNull private String transitionName; /** * Duration of the overridden scene transition, else `null` */ - @NonNull private Number transitionDuration; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sources/GetSourceActiveResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sources/GetSourceActiveResponse.java index 66a83096..646c2290 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sources/GetSourceActiveResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sources/GetSourceActiveResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,24 @@ callSuper = true ) public class GetSourceActiveResponse extends RequestResponse { + /** + * Whether the source is showing in Program + * + * @return the videoActive + */ + public Boolean getVideoActive() { + return getMessageData().getResponseData().getVideoActive(); + } + + /** + * Whether the source is showing in the UI (Preview, Projector, Properties) + * + * @return the videoShowing + */ + public Boolean getVideoShowing() { + return getMessageData().getResponseData().getVideoShowing(); + } + @Getter @ToString @Builder @@ -20,13 +37,11 @@ public static class SpecificData { /** * Whether the source is showing in Program */ - @NonNull private Boolean videoActive; /** * Whether the source is showing in the UI (Preview, Projector, Properties) */ - @NonNull private Boolean videoShowing; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sources/GetSourceScreenshotResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sources/GetSourceScreenshotResponse.java index 7013bcb4..6b45329c 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sources/GetSourceScreenshotResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sources/GetSourceScreenshotResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetSourceScreenshotResponse extends RequestResponse { + /** + * Base64-encoded screenshot + * + * @return the imageData + */ + public String getImageData() { + return getMessageData().getResponseData().getImageData(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Base64-encoded screenshot */ - @NonNull private String imageData; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/sources/SaveSourceScreenshotResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/sources/SaveSourceScreenshotResponse.java index e4b718c0..f972a88b 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/sources/SaveSourceScreenshotResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/sources/SaveSourceScreenshotResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class SaveSourceScreenshotResponse extends RequestResponse { + /** + * Base64-encoded screenshot + * + * @return the imageData + */ + public String getImageData() { + return getMessageData().getResponseData().getImageData(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Base64-encoded screenshot */ - @NonNull private String imageData; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/stream/GetStreamStatusResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/stream/GetStreamStatusResponse.java index 1394e9a1..34ed1891 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/stream/GetStreamStatusResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/stream/GetStreamStatusResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,78 @@ callSuper = true ) public class GetStreamStatusResponse extends RequestResponse { + /** + * Whether the output is active + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getResponseData().getOutputActive(); + } + + /** + * Whether the output is currently reconnecting + * + * @return the outputReconnecting + */ + public Boolean getOutputReconnecting() { + return getMessageData().getResponseData().getOutputReconnecting(); + } + + /** + * Current formatted timecode string for the output + * + * @return the outputTimecode + */ + public String getOutputTimecode() { + return getMessageData().getResponseData().getOutputTimecode(); + } + + /** + * Current duration in milliseconds for the output + * + * @return the outputDuration + */ + public Number getOutputDuration() { + return getMessageData().getResponseData().getOutputDuration(); + } + + /** + * Congestion of the output + * + * @return the outputCongestion + */ + public Number getOutputCongestion() { + return getMessageData().getResponseData().getOutputCongestion(); + } + + /** + * Number of bytes sent by the output + * + * @return the outputBytes + */ + public Number getOutputBytes() { + return getMessageData().getResponseData().getOutputBytes(); + } + + /** + * Number of frames skipped by the output's process + * + * @return the outputSkippedFrames + */ + public Number getOutputSkippedFrames() { + return getMessageData().getResponseData().getOutputSkippedFrames(); + } + + /** + * Total number of frames delivered by the output's process + * + * @return the outputTotalFrames + */ + public Number getOutputTotalFrames() { + return getMessageData().getResponseData().getOutputTotalFrames(); + } + @Getter @ToString @Builder @@ -20,49 +91,41 @@ public static class SpecificData { /** * Whether the output is active */ - @NonNull private Boolean outputActive; /** * Whether the output is currently reconnecting */ - @NonNull private Boolean outputReconnecting; /** * Current formatted timecode string for the output */ - @NonNull private String outputTimecode; /** * Current duration in milliseconds for the output */ - @NonNull private Number outputDuration; /** * Congestion of the output */ - @NonNull private Number outputCongestion; /** * Number of bytes sent by the output */ - @NonNull private Number outputBytes; /** * Number of frames skipped by the output's process */ - @NonNull private Number outputSkippedFrames; /** * Total number of frames delivered by the output's process */ - @NonNull private Number outputTotalFrames; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/stream/ToggleStreamResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/stream/ToggleStreamResponse.java index 21f75b83..34dd121a 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/stream/ToggleStreamResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/stream/ToggleStreamResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class ToggleStreamResponse extends RequestResponse { + /** + * New state of the stream output + * + * @return the outputActive + */ + public Boolean getOutputActive() { + return getMessageData().getResponseData().getOutputActive(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * New state of the stream output */ - @NonNull private Boolean outputActive; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetCurrentSceneTransitionCursorResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetCurrentSceneTransitionCursorResponse.java index 64ba5b58..ba0b6106 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetCurrentSceneTransitionCursorResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetCurrentSceneTransitionCursorResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetCurrentSceneTransitionCursorResponse extends RequestResponse { + /** + * Cursor position, between 0.0 and 1.0 + * + * @return the transitionCursor + */ + public Number getTransitionCursor() { + return getMessageData().getResponseData().getTransitionCursor(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Cursor position, between 0.0 and 1.0 */ - @NonNull private Number transitionCursor; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetCurrentSceneTransitionResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetCurrentSceneTransitionResponse.java index 8e819888..edb2ab7c 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetCurrentSceneTransitionResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetCurrentSceneTransitionResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,60 @@ callSuper = true ) public class GetCurrentSceneTransitionResponse extends RequestResponse { + /** + * Name of the transition + * + * @return the transitionName + */ + public String getTransitionName() { + return getMessageData().getResponseData().getTransitionName(); + } + + /** + * Kind of the transition + * + * @return the transitionKind + */ + public String getTransitionKind() { + return getMessageData().getResponseData().getTransitionKind(); + } + + /** + * Whether the transition uses a fixed (unconfigurable) duration + * + * @return the transitionFixed + */ + public Boolean getTransitionFixed() { + return getMessageData().getResponseData().getTransitionFixed(); + } + + /** + * Configured transition duration in milliseconds. `null` if transition is fixed + * + * @return the transitionDuration + */ + public Number getTransitionDuration() { + return getMessageData().getResponseData().getTransitionDuration(); + } + + /** + * Whether the transition supports being configured + * + * @return the transitionConfigurable + */ + public Boolean getTransitionConfigurable() { + return getMessageData().getResponseData().getTransitionConfigurable(); + } + + /** + * Object of settings for the transition. `null` if transition is not configurable + * + * @return the transitionSettings + */ + public JsonObject getTransitionSettings() { + return getMessageData().getResponseData().getTransitionSettings(); + } + @Getter @ToString @Builder @@ -21,37 +74,31 @@ public static class SpecificData { /** * Name of the transition */ - @NonNull private String transitionName; /** * Kind of the transition */ - @NonNull private String transitionKind; /** * Whether the transition uses a fixed (unconfigurable) duration */ - @NonNull private Boolean transitionFixed; /** * Configured transition duration in milliseconds. `null` if transition is fixed */ - @NonNull private Number transitionDuration; /** * Whether the transition supports being configured */ - @NonNull private Boolean transitionConfigurable; /** * Object of settings for the transition. `null` if transition is not configurable */ - @NonNull private JsonObject transitionSettings; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetSceneTransitionListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetSceneTransitionListResponse.java index b002ff71..a7eb3746 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetSceneTransitionListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetSceneTransitionListResponse.java @@ -6,7 +6,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -14,6 +13,33 @@ callSuper = true ) public class GetSceneTransitionListResponse extends RequestResponse { + /** + * Name of the current scene transition. Can be null + * + * @return the currentSceneTransitionName + */ + public String getCurrentSceneTransitionName() { + return getMessageData().getResponseData().getCurrentSceneTransitionName(); + } + + /** + * Kind of the current scene transition. Can be null + * + * @return the currentSceneTransitionKind + */ + public String getCurrentSceneTransitionKind() { + return getMessageData().getResponseData().getCurrentSceneTransitionKind(); + } + + /** + * Array of transitions + * + * @return the transitions + */ + public JsonObject getTransitions() { + return getMessageData().getResponseData().getTransitions(); + } + @Getter @ToString @Builder @@ -21,19 +47,16 @@ public static class SpecificData { /** * Name of the current scene transition. Can be null */ - @NonNull private String currentSceneTransitionName; /** * Kind of the current scene transition. Can be null */ - @NonNull private String currentSceneTransitionKind; /** * Array of transitions */ - @NonNull private JsonObject transitions; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetTransitionKindListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetTransitionKindListResponse.java index 1f299f38..14ff0818 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetTransitionKindListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/transitions/GetTransitionKindListResponse.java @@ -6,7 +6,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -15,6 +14,15 @@ callSuper = true ) public class GetTransitionKindListResponse extends RequestResponse { + /** + * Array of transition kinds + * + * @return the transitionKinds + */ + public List getTransitionKinds() { + return getMessageData().getResponseData().getTransitionKinds(); + } + @Getter @ToString @Builder @@ -22,7 +30,6 @@ public static class SpecificData { /** * Array of transition kinds */ - @NonNull @Singular private List transitionKinds; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/ui/GetMonitorListResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/ui/GetMonitorListResponse.java index 54e90c20..2e3fa9fc 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/ui/GetMonitorListResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/ui/GetMonitorListResponse.java @@ -7,7 +7,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.Singular; import lombok.ToString; @@ -16,6 +15,15 @@ callSuper = true ) public class GetMonitorListResponse extends RequestResponse { + /** + * a list of detected monitors with some information + * + * @return the monitors + */ + public List getMonitors() { + return getMessageData().getResponseData().getMonitors(); + } + @Getter @ToString @Builder @@ -23,7 +31,6 @@ public static class SpecificData { /** * a list of detected monitors with some information */ - @NonNull @Singular private List monitors; } diff --git a/client/src/main/java/io/obswebsocket/community/client/message/response/ui/GetStudioModeEnabledResponse.java b/client/src/main/java/io/obswebsocket/community/client/message/response/ui/GetStudioModeEnabledResponse.java index 83402f6a..fd0a9e36 100644 --- a/client/src/main/java/io/obswebsocket/community/client/message/response/ui/GetStudioModeEnabledResponse.java +++ b/client/src/main/java/io/obswebsocket/community/client/message/response/ui/GetStudioModeEnabledResponse.java @@ -5,7 +5,6 @@ import io.obswebsocket.community.client.message.response.RequestResponse; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -13,6 +12,15 @@ callSuper = true ) public class GetStudioModeEnabledResponse extends RequestResponse { + /** + * Whether studio mode is enabled + * + * @return the studioModeEnabled + */ + public Boolean getStudioModeEnabled() { + return getMessageData().getResponseData().getStudioModeEnabled(); + } + @Getter @ToString @Builder @@ -20,7 +28,6 @@ public static class SpecificData { /** * Whether studio mode is enabled */ - @NonNull private Boolean studioModeEnabled; } } diff --git a/client/src/main/java/io/obswebsocket/community/client/model/Scene.java b/client/src/main/java/io/obswebsocket/community/client/model/Scene.java index e7395225..b43fedfa 100644 --- a/client/src/main/java/io/obswebsocket/community/client/model/Scene.java +++ b/client/src/main/java/io/obswebsocket/community/client/model/Scene.java @@ -12,5 +12,5 @@ public class Scene { private String sceneName; - private Integer sceneItemIndex; + private Integer sceneIndex; } diff --git a/client/src/test/resources/events/scenes/SceneListChanged.json b/client/src/test/resources/events/scenes/SceneListChanged.json index 6920188c..01cf9b75 100644 --- a/client/src/test/resources/events/scenes/SceneListChanged.json +++ b/client/src/test/resources/events/scenes/SceneListChanged.json @@ -7,11 +7,11 @@ "scenes": [ { "sceneName": "Scene 1", - "sceneItemIndex": 0 + "sceneIndex": 0 }, { "sceneName": "Scene 2", - "sceneItemIndex": 1 + "sceneIndex": 1 } ] } diff --git a/client/src/test/resources/responses/scenes/GetSceneListResponse.json b/client/src/test/resources/responses/scenes/GetSceneListResponse.json index c8099d60..50dc3b2e 100644 --- a/client/src/test/resources/responses/scenes/GetSceneListResponse.json +++ b/client/src/test/resources/responses/scenes/GetSceneListResponse.json @@ -12,10 +12,10 @@ "scenes": [ { "sceneName": "Scene Name", - "sceneItemIndex": 1 + "sceneIndex": 1 } ] } }, "op": 7 -} \ No newline at end of file +} diff --git a/example/src/main/java/io/obswebsocket/community/client/example/Example.java b/example/src/main/java/io/obswebsocket/community/client/example/Example.java index 34c50ad3..959e05db 100644 --- a/example/src/main/java/io/obswebsocket/community/client/example/Example.java +++ b/example/src/main/java/io/obswebsocket/community/client/example/Example.java @@ -43,26 +43,27 @@ private void onReady() { } private void onFirstConnection() { + // Send a blocking call (last parameter is a timeout instead of a callback) + this.obsRemoteController.setStudioModeEnabled(true, 1000); + // Send a request through a convenience method this.obsRemoteController.getSceneList(getSceneListResponse -> { if (getSceneListResponse.isSuccessful()) { // Print each Scene - getSceneListResponse.getMessageData().getResponseData().getScenes() - .forEach(System.out::println); + getSceneListResponse.getScenes().forEach(System.out::println); } + this.obsRemoteController.setStudioModeEnabled(false, 1000); this.disconnectAndReconnect(); }); } private void onSecondConnection() { - // Send a Request through specific Request builder + // Send a Request through specific Request builder this.obsRemoteController.sendRequest(GetStudioModeEnabledRequest.builder().build(), - requestResponse -> { + (GetStudioModeEnabledResponse requestResponse) -> { if (requestResponse.isSuccessful()) { - GetStudioModeEnabledResponse getStudioModeEnabledResponse = (GetStudioModeEnabledResponse) requestResponse; - if (getStudioModeEnabledResponse.getMessageData().getResponseData() - .getStudioModeEnabled()) { + if (requestResponse.getStudioModeEnabled()) { System.out.println("Studio mode enabled"); } else { System.out.println("Studio mode not enabled"); @@ -88,6 +89,6 @@ private void disconnectAndReconnect() { private void onStudioModeStateChanged(StudioModeStateChangedEvent studioModeStateChangedEvent) { System.out.printf( "Studio Mode State Changed to: %B%n", - studioModeStateChangedEvent.getMessageData().getEventData().getStudioModeEnabled()); + studioModeStateChangedEvent.getStudioModeEnabled()); } } diff --git a/messagegenerator/src/main/java/io/obswebsocket/community/generator/EventGenerator.java b/messagegenerator/src/main/java/io/obswebsocket/community/generator/EventGenerator.java index f836aabb..fe6f2dd6 100644 --- a/messagegenerator/src/main/java/io/obswebsocket/community/generator/EventGenerator.java +++ b/messagegenerator/src/main/java/io/obswebsocket/community/generator/EventGenerator.java @@ -46,21 +46,21 @@ File determineTarget(Event req) { req.getCategory() + "/" + req.getEventType() + "Event.java"); } - void generateEvent(Event request, PrintStream out) throws IOException { - String pkg = BASE_PACKAGE + request.getCategory(); - String className = request.getEventType() + "Event"; + void generateEvent(Event event, PrintStream out) throws IOException { + String pkg = BASE_PACKAGE + event.getCategory(); + String className = event.getEventType() + "Event"; - TypeSpec specificData = buildSpecificData(request.getEventType(), - request.getDataFields(), true); + TypeSpec specificData = buildSpecificData(event.getEventType(), + event.getDataFields(), true); TypeSpec.Builder classTypeBuilder = TypeSpec.classBuilder(className).addModifiers(PUBLIC) .addAnnotation(Getter.class).addAnnotation( AnnotationSpec.builder(ToString.class).addMember("callSuper", "$L", true).build()) - .addJavadoc(request.getDescription()); + .addJavadoc(event.getDescription()); classTypeBuilder.addMethod(MethodSpec.constructorBuilder() .addModifiers(PROTECTED) - .addStatement("super(Intent.$L)", request.getEventSubscription()) + .addStatement("super(Intent.$L)", event.getEventSubscription()) .build()); if (specificData != null) { @@ -73,13 +73,14 @@ void generateEvent(Event request, PrintStream out) throws IOException { classTypeBuilder.addMethod(MethodSpec.constructorBuilder() .addModifiers(PROTECTED) .addParameter(specificDataClass, "data") - .addStatement("super(Intent.$L, data)", request.getEventSubscription()) + .addStatement("super(Intent.$L, data)", event.getEventSubscription()) .build()); } else { classTypeBuilder.superclass(ParameterizedTypeName.get( ClassName.get(io.obswebsocket.community.client.message.event.Event.class), ClassName.get("", "Void"))); } + addGetters(MessageClass.Event, event.getEventType(), event.getDataFields(), classTypeBuilder); TypeSpec classType = classTypeBuilder.build(); JavaFile javaFile = javaFileBuilder(pkg, classType).build(); diff --git a/messagegenerator/src/main/java/io/obswebsocket/community/generator/GeneratorBase.java b/messagegenerator/src/main/java/io/obswebsocket/community/generator/GeneratorBase.java index 2f34e9e1..2d484a97 100644 --- a/messagegenerator/src/main/java/io/obswebsocket/community/generator/GeneratorBase.java +++ b/messagegenerator/src/main/java/io/obswebsocket/community/generator/GeneratorBase.java @@ -9,6 +9,7 @@ import com.squareup.javapoet.ClassName; import com.squareup.javapoet.FieldSpec; import com.squareup.javapoet.JavaFile; +import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterizedTypeName; import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; @@ -74,7 +75,7 @@ protected TypeSpec buildSpecificData(String request, List fields, fields.forEach(field -> { FieldSpec.Builder fldBuilder = FieldSpec.builder(determineType(request, field), field.getValueName(), PRIVATE); - if (!Boolean.TRUE.equals(field.valueOptional)) { + if (!response && !Boolean.TRUE.equals(field.valueOptional)) { fldBuilder.addAnnotation(NonNull.class); } if (field.getValueType().startsWith("Array") && field.getValueName().endsWith("s")) { @@ -89,6 +90,26 @@ protected TypeSpec buildSpecificData(String request, List fields, return specificData.build(); } + protected enum MessageClass { + Event, Response + } + + protected void addGetters(MessageClass cls, String messageType, List fields, TypeSpec.Builder classTypeBuilder) { + fields.forEach(field -> { + String valueFirstUc = Character.toUpperCase(field.getValueName().charAt(0)) + + field.getValueName().substring(1); + + classTypeBuilder.addMethod(MethodSpec + .methodBuilder("get" + valueFirstUc) + .addModifiers(PUBLIC) + .returns(determineType(messageType, field)) + .addStatement("return getMessageData().get$LData().get$L()", cls.name(), valueFirstUc) + .addJavadoc(field.getValueDescription()) + .addJavadoc("\n\n@return the $L", field.getValueName()) + .build()); + }); + } + private static final Pattern ARRAY_PATTERN = Pattern.compile("Array<(.*)>"); protected TypeName determineType(String request, RequestField rf) { diff --git a/messagegenerator/src/main/java/io/obswebsocket/community/generator/OBSRemoteControllerBaseGenerator.java b/messagegenerator/src/main/java/io/obswebsocket/community/generator/OBSRemoteControllerBaseGenerator.java index 9e84be73..bfec43d2 100644 --- a/messagegenerator/src/main/java/io/obswebsocket/community/generator/OBSRemoteControllerBaseGenerator.java +++ b/messagegenerator/src/main/java/io/obswebsocket/community/generator/OBSRemoteControllerBaseGenerator.java @@ -8,6 +8,7 @@ import com.squareup.javapoet.JavaFile; import com.squareup.javapoet.MethodSpec; import com.squareup.javapoet.ParameterizedTypeName; +import com.squareup.javapoet.TypeName; import com.squareup.javapoet.TypeSpec; import com.squareup.javapoet.TypeSpec.Builder; import com.squareup.javapoet.TypeVariableName; @@ -46,7 +47,10 @@ void generate(PrintStream out) throws IOException { .addModifiers(PUBLIC, ABSTRACT) .addMethod(generateAbstractSendRequest()); - protocol.getRequests().forEach(req -> addMethodFor(classTypeBuilder, req)); + protocol.getRequests().forEach(req -> { + addMethodFor(classTypeBuilder, req, false); + addMethodFor(classTypeBuilder, req, true); + }); JavaFile javaFile = javaFileBuilder(OBSRemoteControllerBase.class.getPackage().getName(), classTypeBuilder.build()).build(); @@ -70,7 +74,8 @@ private MethodSpec generateAbstractSendRequest() { } private void addMethodFor(Builder classTypeBuilder, - io.obswebsocket.community.generator.model.generated.Request req) { + io.obswebsocket.community.generator.model.generated.Request req, + boolean blocking) { String type = req.getRequestType(); MethodSpec.Builder builder = MethodSpec.methodBuilder( @@ -81,28 +86,50 @@ private void addMethodFor(Builder classTypeBuilder, .forEach( rf -> builder.addParameter(determineType(req.getRequestType(), rf), rf.getValueName())); - builder.addParameter( - ParameterizedTypeName.get(ClassName.get(Consumer.class), - ClassName.get(ResponseGenerator.BASE_PACKAGE + req.getCategory(), type + "Response")), - "callback"); + ClassName responseType = ClassName.get(ResponseGenerator.BASE_PACKAGE + req.getCategory(), + type + "Response"); + if (!blocking) { + builder.addParameter( + ParameterizedTypeName.get(ClassName.get(Consumer.class), responseType), + "callback"); + } else { + builder.addParameter(TypeName.LONG, "timeout"); + builder.returns(responseType); + } // Body CodeBlock.Builder bodyBuilder = CodeBlock.builder(); + if (blocking) { + ParameterizedTypeName blockingConsumer = ParameterizedTypeName.get( + ClassName.get(OBSRemoteControllerBase.class.getPackage().getName(), "BlockingConsumer"), + responseType); + builder.addStatement("$T callback = new $T()", blockingConsumer, blockingConsumer); + } + bodyBuilder.add("sendRequest("); bodyBuilder.add("$T.builder()", ClassName.get(RequestGenerator.BASE_PACKAGE + req.getCategory(), req.getRequestType() + "Request")); req.getRequestFields() .forEach(rf -> bodyBuilder.add(".$L($L)", rf.getValueName(), rf.getValueName())); - bodyBuilder.add(".build()"); - bodyBuilder.add(", callback)"); + bodyBuilder.add(".build(), callback)"); builder.addStatement(bodyBuilder.build()); + if (blocking) { + builder.addCode("try { return callback.get(timeout); } catch ($T e) { throw new $T(e); }", + ClassName.get(InterruptedException.class), ClassName.get(RuntimeException.class)); + } builder.addJavadoc("$L\n", req.getDescription().replace("\\u", "\\\\u")); req.getRequestFields() .forEach(rf -> builder.addJavadoc("\n@param $L $L", rf.getValueName(), - rf.getValueDescription().replace("\\u", "\\\\u").replaceAll("<", "<").replaceAll(">", ">"))); - builder.addJavadoc("\n@param callback Consumer<$L>", type + "Response"); + rf.getValueDescription().replace("\\u", "\\\\u").replaceAll("<", "<") + .replaceAll(">", ">"))); + if (!blocking) { + builder.addJavadoc("\n@param callback Consumer<$L>", type + "Response"); + } else { + builder.addJavadoc("\n@param timeout long timeout in ms"); + builder.addJavadoc("\n@return the $T, null if the request timed out", responseType); + } classTypeBuilder.addMethod(builder.build()); } diff --git a/messagegenerator/src/main/java/io/obswebsocket/community/generator/ResponseGenerator.java b/messagegenerator/src/main/java/io/obswebsocket/community/generator/ResponseGenerator.java index 411d9880..4aff808c 100644 --- a/messagegenerator/src/main/java/io/obswebsocket/community/generator/ResponseGenerator.java +++ b/messagegenerator/src/main/java/io/obswebsocket/community/generator/ResponseGenerator.java @@ -65,6 +65,9 @@ void generateResponse(Request request, PrintStream out) throws IOException { ClassName.get(RequestResponse.class), ClassName.get("", "Void"))); } + + addGetters(MessageClass.Response, request.getRequestType(), request.getResponseFields(), classTypeBuilder); + TypeSpec classType = classTypeBuilder.build(); JavaFile javaFile = javaFileBuilder(pkg, classType).build(); diff --git a/messagegenerator/src/test/resources/EventWithParameters.java b/messagegenerator/src/test/resources/EventWithParameters.java index 9bf53ed3..a3445d61 100644 --- a/messagegenerator/src/test/resources/EventWithParameters.java +++ b/messagegenerator/src/test/resources/EventWithParameters.java @@ -9,7 +9,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; /** @@ -28,6 +27,69 @@ protected TypeEvent(TypeEvent.SpecificData data) { super(Intent.subscription, data); } + /** + * stringField description + * + * @return the stringField + */ + public String getStringField() { + return getMessageData().getEventData().getStringField(); + } + + /** + * booleanField description + * + * @return the booleanField + */ + public Boolean getBooleanField() { + return getMessageData().getEventData().getBooleanField(); + } + + /** + * booleanList description + * + * @return the booleanList + */ + public List getBooleanList() { + return getMessageData().getEventData().getBooleanList(); + } + + /** + * stringList description + * + * @return the stringList + */ + public List getStringList() { + return getMessageData().getEventData().getStringList(); + } + + /** + * audioTracks description + * + * @return the audioTracks + */ + public Input.AudioTracks getAudioTracks() { + return getMessageData().getEventData().getAudioTracks(); + } + + /** + * jsonObject description + * + * @return the jsonObject + */ + public JsonObject getJsonObject() { + return getMessageData().getEventData().getJsonObject(); + } + + /** + * sceneList description + * + * @return the sceneList + */ + public List getSceneList() { + return getMessageData().getEventData().getSceneList(); + } + @Getter @ToString @Builder @@ -35,43 +97,36 @@ public static class SpecificData { /** * stringField description */ - @NonNull private String stringField; /** * booleanField description */ - @NonNull private Boolean booleanField; /** * booleanList description */ - @NonNull private List booleanList; /** * stringList description */ - @NonNull private List stringList; /** * audioTracks description */ - @NonNull private Input.AudioTracks audioTracks; /** * jsonObject description */ - @NonNull private JsonObject jsonObject; /** * sceneList description */ - @NonNull private List sceneList; } } diff --git a/messagegenerator/src/test/resources/OBSRemoteControllerBaseGenerator.java b/messagegenerator/src/test/resources/OBSRemoteControllerBaseGenerator.java index e4dbc86e..c34eb491 100644 --- a/messagegenerator/src/test/resources/OBSRemoteControllerBaseGenerator.java +++ b/messagegenerator/src/test/resources/OBSRemoteControllerBaseGenerator.java @@ -27,6 +27,18 @@ public void someType(Consumer callback) { sendRequest(SomeTypeRequest.builder().build(), callback); } + /** + * Description + * + * @param timeout long timeout in ms + * @return the SomeTypeResponse, null if the request timed out + */ + public SomeTypeResponse someType(long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(SomeTypeRequest.builder().build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } + /** * Other description * @@ -44,4 +56,25 @@ public void otherType(String stringField, Boolean booleanField, List bo List sceneList, Consumer callback) { sendRequest(OtherTypeRequest.builder().stringField(stringField).booleanField(booleanField).booleanList(booleanList).stringList(stringList).audioTracks(audioTracks).jsonObject(jsonObject).sceneList(sceneList).build(), callback); } + + /** + * Other description + * + * @param stringField stringField description + * @param booleanField booleanField description + * @param booleanList booleanList description + * @param stringList stringList description + * @param audioTracks audioTracks description + * @param jsonObject jsonObject description + * @param sceneList sceneList description + * @param timeout long timeout in ms + * @return the OtherTypeResponse, null if the request timed out + */ + public OtherTypeResponse otherType(String stringField, Boolean booleanField, + List booleanList, List stringList, Input.AudioTracks audioTracks, + JsonObject jsonObject, List sceneList, long timeout) { + BlockingConsumer callback = new BlockingConsumer(); + sendRequest(OtherTypeRequest.builder().stringField(stringField).booleanField(booleanField).booleanList(booleanList).stringList(stringList).audioTracks(audioTracks).jsonObject(jsonObject).sceneList(sceneList).build(), callback); + try { return callback.get(timeout); } catch (InterruptedException e) { throw new RuntimeException(e); } + } } diff --git a/messagegenerator/src/test/resources/ResponseWithParameters.java b/messagegenerator/src/test/resources/ResponseWithParameters.java index bb68c199..7305d4ea 100644 --- a/messagegenerator/src/test/resources/ResponseWithParameters.java +++ b/messagegenerator/src/test/resources/ResponseWithParameters.java @@ -9,7 +9,6 @@ import java.util.List; import lombok.Builder; import lombok.Getter; -import lombok.NonNull; import lombok.ToString; @Getter @@ -17,6 +16,69 @@ callSuper = true ) public class TypeResponse extends RequestResponse { + /** + * stringField description + * + * @return the stringField + */ + public String getStringField() { + return getMessageData().getResponseData().getStringField(); + } + + /** + * booleanField description + * + * @return the booleanField + */ + public Boolean getBooleanField() { + return getMessageData().getResponseData().getBooleanField(); + } + + /** + * booleanList description + * + * @return the booleanList + */ + public List getBooleanList() { + return getMessageData().getResponseData().getBooleanList(); + } + + /** + * stringList description + * + * @return the stringList + */ + public List getStringList() { + return getMessageData().getResponseData().getStringList(); + } + + /** + * audioTracks description + * + * @return the audioTracks + */ + public Input.AudioTracks getAudioTracks() { + return getMessageData().getResponseData().getAudioTracks(); + } + + /** + * jsonObject description + * + * @return the jsonObject + */ + public JsonObject getJsonObject() { + return getMessageData().getResponseData().getJsonObject(); + } + + /** + * sceneList description + * + * @return the sceneList + */ + public List getSceneList() { + return getMessageData().getResponseData().getSceneList(); + } + @Getter @ToString @Builder @@ -24,43 +86,36 @@ public static class SpecificData { /** * stringField description */ - @NonNull private String stringField; /** * booleanField description */ - @NonNull private Boolean booleanField; /** * booleanList description */ - @NonNull private List booleanList; /** * stringList description */ - @NonNull private List stringList; /** * audioTracks description */ - @NonNull private Input.AudioTracks audioTracks; /** * jsonObject description */ - @NonNull private JsonObject jsonObject; /** * sceneList description */ - @NonNull private List sceneList; } }