From 46498910ba443afbef3c4ed0167f8b7b004bd46e Mon Sep 17 00:00:00 2001 From: Dominik Nakamura Date: Mon, 22 May 2023 18:02:31 +0900 Subject: [PATCH] Add doc aliases for all client methods --- CHANGELOG.md | 10 ++++++++-- src/client/config.rs | 7 +++++++ src/client/filters.rs | 9 +++++++++ src/client/general.rs | 4 ++++ src/client/hotkeys.rs | 3 +++ src/client/inputs.rs | 24 ++++++++++++++++++++++++ src/client/media_inputs.rs | 4 ++++ src/client/outputs.rs | 7 +++++++ src/client/profiles.rs | 7 +++++++ src/client/recording.rs | 7 +++++++ src/client/replay_buffer.rs | 6 ++++++ src/client/scene_collections.rs | 4 ++++ src/client/scene_items.rs | 18 ++++++++++++++++++ src/client/scenes.rs | 11 +++++++++++ src/client/sources.rs | 3 +++ src/client/streaming.rs | 5 +++++ src/client/transitions.rs | 9 +++++++++ src/client/ui.rs | 8 ++++++++ src/client/virtual_cam.rs | 4 ++++ src/docs/mapping.md | 1 - 20 files changed, 148 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2606e0f..4a1ab43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,15 +10,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - ReleaseDate +### Added + +- All client methods now have a doc alias with the original name from the [`obs-websocket` spec](https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.md). + - The search will point to the right function when putting the original name in the search bar on docs.rs (or in locally generated docs). + - [Latest `rust-analyzer`](https://rust-analyzer.github.io/thisweek/2023/05/22/changelog-182.html) can use this information in the method completion menu. + ## [0.11.0] - 2023-05-18 -## Added +### Added - New features from obs-websocket v5.1.0 - New `ScreenshotSaved` event, that is triggered by hotkeys in the OBS UI. - New variants for the `OutputState` enum, that signal reconnecting and reconnected states. -## Changed +### Changed - **BREAKING CHANGE:** Due to the update of `bitflags` the list of derived traits changed. - Update all dependencies to their lates version, most notably `base64`, `bitflags` and diff --git a/src/client/config.rs b/src/client/config.rs index d453b65..f1a3dbd 100644 --- a/src/client/config.rs +++ b/src/client/config.rs @@ -14,6 +14,7 @@ pub struct Config<'a> { impl<'a> Config<'a> { /// Gets the value of a "slot" from the selected persistent data realm. + #[doc(alias = "GetPersistentData")] pub async fn get_persistent_data( &self, realm: Realm, @@ -25,6 +26,7 @@ impl<'a> Config<'a> { } /// Sets the value of a "slot" from the selected persistent data realm. + #[doc(alias = "SetPersistentData")] pub async fn set_persistent_data(&self, data: SetPersistentData<'_>) -> Result<()> { self.client .send_message(Request::SetPersistentData(data)) @@ -35,6 +37,7 @@ impl<'a> Config<'a> { /// /// **Note:** To get the true FPS value, divide the FPS numerator by the FPS denominator. /// Example: `60000/1001`. + #[doc(alias = "GetVideoSettings")] pub async fn video_settings(&self) -> Result { self.client.send_message(Request::VideoSettings).await } @@ -44,6 +47,7 @@ impl<'a> Config<'a> { /// **Note:** Fields must be specified in pairs. For example, you cannot set only /// [`SetVideoSettings::base_width`] without needing to specify /// [`SetVideoSettings::base_height`]. + #[doc(alias = "SetVideoSettings")] pub async fn set_video_settings(&self, settings: SetVideoSettings) -> Result<()> { self.client .send_message(Request::SetVideoSettings(settings)) @@ -51,6 +55,7 @@ impl<'a> Config<'a> { } /// Gets the current stream service settings (stream destination). + #[doc(alias = "GetStreamServiceSettings")] pub async fn stream_service_settings(&self) -> Result> where T: DeserializeOwned, @@ -64,6 +69,7 @@ impl<'a> Config<'a> { /// /// **Note:** Simple RTMP settings can be set with type `rtmp_custom` and the settings fields /// `server` and `key`. + #[doc(alias = "SetStreamServiceSettings")] pub async fn set_stream_service_settings(&self, r#type: &'a str, settings: &T) -> Result<()> where T: Serialize, @@ -77,6 +83,7 @@ impl<'a> Config<'a> { } /// Gets the current directory that the record output is set to. + #[doc(alias = "GetRecordDirectory")] pub async fn record_directory(&self) -> Result { self.client .send_message::<_, responses::RecordDirectory>(Request::RecordDirectory) diff --git a/src/client/filters.rs b/src/client/filters.rs index dacd50c..0a3a3fb 100644 --- a/src/client/filters.rs +++ b/src/client/filters.rs @@ -17,6 +17,7 @@ pub struct Filters<'a> { impl<'a> Filters<'a> { /// Gets an array of all of a source's filters. + #[doc(alias = "GetSourceFilterList")] pub async fn list(&self, source: &str) -> Result> { self.client .send_message::<_, responses::Filters>(Request::List { source }) @@ -25,6 +26,7 @@ impl<'a> Filters<'a> { } /// Gets the default settings for a filter kind. + #[doc(alias = "GetSourceFilterDefaultSettings")] pub async fn default_settings(&self, kind: &str) -> Result where T: DeserializeOwned, @@ -38,6 +40,7 @@ impl<'a> Filters<'a> { } /// Creates a new filter, adding it to the specified source. + #[doc(alias = "CreateSourceFilter")] pub async fn create(&self, filter: Create<'_, T>) -> Result<()> where T: Serialize, @@ -57,6 +60,7 @@ impl<'a> Filters<'a> { } /// Removes a filter from a source. + #[doc(alias = "RemoveSourceFilter")] pub async fn remove(&self, source: &str, filter: &str) -> Result<()> { self.client .send_message(Request::Remove { source, filter }) @@ -64,11 +68,13 @@ impl<'a> Filters<'a> { } /// Sets the name of a source filter (rename). + #[doc(alias = "SetSourceFilterName")] pub async fn set_name(&self, name: SetName<'_>) -> Result<()> { self.client.send_message(Request::SetName(name)).await } /// Gets the info for a specific source filter. + #[doc(alias = "GetSourceFilter")] pub async fn get(&self, source: &str, filter: &str) -> Result { self.client .send_message(Request::Get { source, filter }) @@ -76,11 +82,13 @@ impl<'a> Filters<'a> { } /// Sets the index position of a filter on a source. + #[doc(alias = "SetSourceFilterIndex")] pub async fn set_index(&self, index: SetIndex<'_>) -> Result<()> { self.client.send_message(Request::SetIndex(index)).await } /// Sets the settings of a source filter. + #[doc(alias = "SetSourceFilterSettings")] pub async fn set_settings(&self, settings: SetSettings<'_, T>) -> Result<()> where T: Serialize, @@ -97,6 +105,7 @@ impl<'a> Filters<'a> { } /// Sets the enable state of a source filter. + #[doc(alias = "SetSourceFilterEnabled")] pub async fn set_enabled(&self, enabled: SetEnabled<'_>) -> Result<()> { self.client.send_message(Request::SetEnabled(enabled)).await } diff --git a/src/client/general.rs b/src/client/general.rs index c960482..c3ff84c 100644 --- a/src/client/general.rs +++ b/src/client/general.rs @@ -14,17 +14,20 @@ pub struct General<'a> { impl<'a> General<'a> { /// Gets data about the current plugin and RPC version. + #[doc(alias = "GetVersion")] pub async fn version(&self) -> Result { self.client.send_message(Request::Version).await } /// Gets statistics about OBS, obs-websocket, and the current session. + #[doc(alias = "GetStats")] pub async fn stats(&self) -> Result { self.client.send_message(Request::Stats).await } /// Broadcasts a custom event to all web-socket clients. Receivers are clients which are /// identified and subscribed. + #[doc(alias = "BroadcastCustomEvent")] pub async fn broadcast_custom_event(&self, event_data: &T) -> Result<()> where T: Serialize, @@ -44,6 +47,7 @@ impl<'a> General<'a> { /// 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. + #[doc(alias = "CallVendorRequest")] pub async fn call_vendor_request( &self, request: CallVendorRequest<'_, T>, diff --git a/src/client/hotkeys.rs b/src/client/hotkeys.rs index a7cc2e4..328c32d 100644 --- a/src/client/hotkeys.rs +++ b/src/client/hotkeys.rs @@ -12,6 +12,7 @@ pub struct Hotkeys<'a> { impl<'a> Hotkeys<'a> { /// Gets an array of all hotkey names in OBS. + #[doc(alias = "GetHotkeyList")] pub async fn list(&self) -> Result> { self.client .send_message::<_, responses::Hotkeys>(Request::List) @@ -20,6 +21,7 @@ impl<'a> Hotkeys<'a> { } /// Triggers a hotkey using its name. See [`Self::list`]. + #[doc(alias = "TriggerHotkeyByName")] pub async fn trigger_by_name(&self, name: &str) -> Result<()> { self.client .send_message(Request::TriggerByName { name }) @@ -27,6 +29,7 @@ impl<'a> Hotkeys<'a> { } /// Triggers a hotkey using a sequence of keys. + #[doc(alias = "TriggerHotkeyByKeySequence")] pub async fn trigger_by_sequence(&self, id: &str, modifiers: KeyModifiers) -> Result<()> { self.client .send_message(Request::TriggerBySequence { id, modifiers }) diff --git a/src/client/inputs.rs b/src/client/inputs.rs index 0e58835..370c823 100644 --- a/src/client/inputs.rs +++ b/src/client/inputs.rs @@ -18,6 +18,7 @@ pub struct Inputs<'a> { impl<'a> Inputs<'a> { /// Gets an array of all inputs in OBS. + #[doc(alias = "GetInputList")] pub async fn list(&self, kind: Option<&str>) -> Result> { self.client .send_message::<_, responses::Inputs>(Request::List { kind }) @@ -26,6 +27,7 @@ impl<'a> Inputs<'a> { } /// Gets an array of all available input kinds in OBS. + #[doc(alias = "GetInputKindList")] pub async fn list_kinds(&self, unversioned: bool) -> Result> { self.client .send_message::<_, responses::InputKinds>(Request::ListKinds { unversioned }) @@ -34,11 +36,13 @@ impl<'a> Inputs<'a> { } /// Gets the names of all special inputs. + #[doc(alias = "GetSpecialInputs")] pub async fn specials(&self) -> Result { self.client.send_message(Request::Specials).await } /// Gets the default settings for an input kind. + #[doc(alias = "GetInputDefaultSettings")] pub async fn default_settings(&self, kind: &str) -> Result where T: DeserializeOwned, @@ -55,6 +59,7 @@ impl<'a> Inputs<'a> { /// /// **Note:** Does not include defaults. To create the entire settings object, overlay input /// settings over the default input settings provided by [`Inputs::default_settings`]. + #[doc(alias = "GetInputSettings")] pub async fn settings(&self, name: &str) -> Result> where T: DeserializeOwned, @@ -63,6 +68,7 @@ impl<'a> Inputs<'a> { } /// Sets the settings of an input. + #[doc(alias = "SetInputSettings")] pub async fn set_settings(&self, settings: SetSettings<'_, T>) -> Result<()> where T: Serialize, @@ -78,6 +84,7 @@ impl<'a> Inputs<'a> { } /// Gets the audio mute state of an input. + #[doc(alias = "GetInputMute")] pub async fn muted(&self, name: &str) -> Result { self.client .send_message::<_, responses::InputMuted>(Request::Muted { name }) @@ -86,6 +93,7 @@ impl<'a> Inputs<'a> { } /// Sets the audio mute state of an input. + #[doc(alias = "SetInputMute")] pub async fn set_muted(&self, name: &str, muted: bool) -> Result<()> { self.client .send_message(Request::SetMuted { name, muted }) @@ -93,6 +101,7 @@ impl<'a> Inputs<'a> { } /// Toggles the audio mute state of an input. + #[doc(alias = "ToggleInputMute")] pub async fn toggle_mute(&self, name: &str) -> Result { self.client .send_message::<_, responses::InputMuted>(Request::ToggleMute { name }) @@ -101,11 +110,13 @@ impl<'a> Inputs<'a> { } /// Gets the current volume setting of an input. + #[doc(alias = "GetInputVolume")] pub async fn volume(&self, name: &str) -> Result { self.client.send_message(Request::Volume { name }).await } /// Sets the volume setting of an input. + #[doc(alias = "SetInputVolume")] pub async fn set_volume(&self, name: &str, volume: Volume) -> Result<()> { self.client .send_message(Request::SetVolume { name, volume }) @@ -113,6 +124,7 @@ impl<'a> Inputs<'a> { } /// Sets the name of an input (rename). + #[doc(alias = "SetInputName")] pub async fn set_name(&self, name: &str, new: &str) -> Result<()> { self.client .send_message(Request::SetName { name, new }) @@ -120,6 +132,7 @@ impl<'a> Inputs<'a> { } /// Creates a new input, adding it as a scene item to the specified scene. + #[doc(alias = "CreateInput")] pub async fn create(&self, input: Create<'_, T>) -> Result where T: Serialize, @@ -144,11 +157,13 @@ impl<'a> Inputs<'a> { /// Removes an existing input. /// /// **Note:** Will immediately remove all associated scene items. + #[doc(alias = "RemoveInput")] pub async fn remove(&self, name: &str) -> Result<()> { self.client.send_message(Request::Remove { name }).await } /// Gets the audio balance of an input. + #[doc(alias = "GetInputAudioBalance")] pub async fn audio_balance(&self, name: &str) -> Result { self.client .send_message::<_, responses::AudioBalance>(Request::AudioBalance { name }) @@ -157,6 +172,7 @@ impl<'a> Inputs<'a> { } /// Sets the audio balance of an input. + #[doc(alias = "SetInputAudioBalance")] pub async fn set_audio_balance(&self, name: &str, balance: f32) -> Result<()> { self.client .send_message(Request::SetAudioBalance { name, balance }) @@ -166,6 +182,7 @@ impl<'a> Inputs<'a> { /// Gets the audio sync offset of an input. /// /// **Note:** The audio sync offset can be negative too! + #[doc(alias = "GetInputAudioSyncOffset")] pub async fn audio_sync_offset(&self, name: &str) -> Result { self.client .send_message::<_, responses::AudioSyncOffset>(Request::AudioSyncOffset { name }) @@ -174,6 +191,7 @@ impl<'a> Inputs<'a> { } /// Sets the audio sync offset of an input. + #[doc(alias = "SetInputAudioSyncOffset")] pub async fn set_audio_sync_offset(&self, name: &str, offset: Duration) -> Result<()> { self.client .send_message(Request::SetAudioSyncOffset { name, offset }) @@ -181,6 +199,7 @@ impl<'a> Inputs<'a> { } /// Gets the audio monitor type of input. + #[doc(alias = "GetInputAudioMonitorType")] pub async fn audio_monitor_type(&self, name: &str) -> Result { self.client .send_message::<_, responses::AudioMonitorType>(Request::AudioMonitorType { name }) @@ -189,6 +208,7 @@ impl<'a> Inputs<'a> { } /// Sets the audio monitor type of input. + #[doc(alias = "SetInputAudioMonitorType")] pub async fn set_audio_monitor_type( &self, name: &str, @@ -200,6 +220,7 @@ impl<'a> Inputs<'a> { } /// Gets the enable state of all audio tracks of an input. + #[doc(alias = "GetInputAudioTracks")] pub async fn audio_tracks(&self, name: &str) -> Result<[bool; 6]> { self.client .send_message::<_, responses::AudioTracks>(Request::AudioTracks { name }) @@ -208,6 +229,7 @@ impl<'a> Inputs<'a> { } /// Sets the enable state of audio tracks of an input. + #[doc(alias = "SetInputAudioTracks")] pub async fn set_audio_tracks(&self, name: &str, tracks: [Option; 6]) -> Result<()> { self.client .send_message(Request::SetAudioTracks { name, tracks }) @@ -218,6 +240,7 @@ impl<'a> Inputs<'a> { /// /// **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. + #[doc(alias = "GetInputPropertiesListPropertyItems")] pub async fn properties_list_property_items( &self, input: &str, @@ -237,6 +260,7 @@ impl<'a> Inputs<'a> { /// **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. + #[doc(alias = "PressInputPropertiesButton")] pub async fn press_properties_button(&self, input: &str, property: &str) -> Result<()> { self.client .send_message(Request::PressPropertiesButton { input, property }) diff --git a/src/client/media_inputs.rs b/src/client/media_inputs.rs index bfadee9..4ae1261 100644 --- a/src/client/media_inputs.rs +++ b/src/client/media_inputs.rs @@ -13,6 +13,7 @@ pub struct MediaInputs<'a> { impl<'a> MediaInputs<'a> { /// Gets the status of a media input. + #[doc(alias = "GetMediaInputStatus")] pub async fn status(&self, input: &str) -> Result { self.client.send_message(Request::Status { input }).await } @@ -20,6 +21,7 @@ impl<'a> MediaInputs<'a> { /// Sets the cursor position of a media input. /// /// This request does not perform bounds checking of the cursor position. + #[doc(alias = "SetMediaInputCursor")] pub async fn set_cursor(&self, input: &str, cursor: Duration) -> Result<()> { self.client .send_message(Request::SetCursor { input, cursor }) @@ -29,6 +31,7 @@ impl<'a> MediaInputs<'a> { /// Offsets the current cursor position of a media input by the specified value. /// /// This request does not perform bounds checking of the cursor position. + #[doc(alias = "OffsetMediaInputCursor")] pub async fn offset_cursor(&self, input: &str, offset: Duration) -> Result<()> { self.client .send_message(Request::OffsetCursor { input, offset }) @@ -36,6 +39,7 @@ impl<'a> MediaInputs<'a> { } /// Triggers an action on a media input. + #[doc(alias = "TriggerMediaInputAction")] pub async fn trigger_action(&self, input: &str, action: MediaAction) -> Result<()> { self.client .send_message(Request::TriggerAction { input, action }) diff --git a/src/client/outputs.rs b/src/client/outputs.rs index 28fdb30..0f9d58f 100644 --- a/src/client/outputs.rs +++ b/src/client/outputs.rs @@ -10,6 +10,7 @@ pub struct Outputs<'a> { impl<'a> Outputs<'a> { /// Gets the list of available outputs. + #[doc(alias = "GetOutputList")] pub async fn list(&self) -> Result> { self.client .send_message::<_, responses::OutputList>(Request::List) @@ -18,11 +19,13 @@ impl<'a> Outputs<'a> { } /// Gets the status of an output. + #[doc(alias = "GetOutputStatus")] pub async fn status(&self, name: &str) -> Result { self.client.send_message(Request::Status { name }).await } /// Toggles the status of an output. + #[doc(alias = "ToggleOutput")] pub async fn toggle(&self, name: &str) -> Result { self.client .send_message::<_, responses::OutputActive>(Request::Toggle { name }) @@ -31,16 +34,19 @@ impl<'a> Outputs<'a> { } /// Starts an output. + #[doc(alias = "StartOutput")] pub async fn start(&self, name: &str) -> Result<()> { self.client.send_message(Request::Start { name }).await } /// Stops an output. + #[doc(alias = "StopOutput")] pub async fn stop(&self, name: &str) -> Result<()> { self.client.send_message(Request::Stop { name }).await } /// Gets the settings of an output. + #[doc(alias = "GetOutputSettings")] pub async fn settings(&self, name: &str) -> Result where T: DeserializeOwned, @@ -52,6 +58,7 @@ impl<'a> Outputs<'a> { } /// Sets the settings of an output. + #[doc(alias = "SetOutputSettings")] pub async fn set_settings(&self, name: &str, settings: T) -> Result<()> where T: Serialize, diff --git a/src/client/profiles.rs b/src/client/profiles.rs index cdb9f99..456d2e3 100644 --- a/src/client/profiles.rs +++ b/src/client/profiles.rs @@ -12,11 +12,13 @@ pub struct Profiles<'a> { impl<'a> Profiles<'a> { /// Gets an array of all profiles. + #[doc(alias = "GetProfileList")] pub async fn list(&self) -> Result { self.client.send_message(Request::List).await } /// Get the currently active profile name. + #[doc(alias = "GetProfileList")] pub async fn current(&self) -> Result { self.client .send_message::<_, responses::Profiles>(Request::List) @@ -25,22 +27,26 @@ impl<'a> Profiles<'a> { } /// Switches to a profile. + #[doc(alias = "SetCurrentProfile")] pub async fn set_current(&self, name: &str) -> Result<()> { self.client.send_message(Request::SetCurrent { name }).await } /// Creates a new profile, switching to it in the process. + #[doc(alias = "CreateProfile")] pub async fn create(&self, name: &str) -> Result<()> { self.client.send_message(Request::Create { name }).await } /// Removes a profile. If the current profile is chosen, it will change to a different profile /// first. + #[doc(alias = "RemoveProfile")] pub async fn remove(&self, name: &str) -> Result<()> { self.client.send_message(Request::Remove { name }).await } /// Gets a parameter from the current profile's configuration. + #[doc(alias = "GetProfileParameter")] pub async fn parameter( &self, category: &str, @@ -52,6 +58,7 @@ impl<'a> Profiles<'a> { } /// Sets the value of a parameter in the current profile's configuration. + #[doc(alias = "SetProfileParameter")] pub async fn set_parameter(&self, parameter: SetParameter<'_>) -> Result<()> { self.client .send_message(Request::SetParameter(parameter)) diff --git a/src/client/recording.rs b/src/client/recording.rs index 5e69aa4..d9e4635 100644 --- a/src/client/recording.rs +++ b/src/client/recording.rs @@ -8,11 +8,13 @@ pub struct Recording<'a> { impl<'a> Recording<'a> { /// Gets the status of the record output. + #[doc(alias = "GetRecordStatus")] pub async fn status(&self) -> Result { self.client.send_message(Request::Status).await } /// Toggles the status of the record output. + #[doc(alias = "ToggleRecord")] pub async fn toggle(&self) -> Result { self.client .send_message::<_, responses::OutputActive>(Request::Toggle) @@ -21,11 +23,13 @@ impl<'a> Recording<'a> { } /// Starts the record output. + #[doc(alias = "StartRecord")] pub async fn start(&self) -> Result<()> { self.client.send_message(Request::Start).await } /// Stops the record output. + #[doc(alias = "StopRecord")] pub async fn stop(&self) -> Result { self.client .send_message::<_, responses::OutputStopped>(Request::Stop) @@ -34,6 +38,7 @@ impl<'a> Recording<'a> { } /// Toggles pause on the record output. + #[doc(alias = "ToggleRecordPause")] pub async fn toggle_pause(&self) -> Result { self.client .send_message::<_, responses::OutputPaused>(Request::TogglePause) @@ -42,11 +47,13 @@ impl<'a> Recording<'a> { } /// Pauses the record output. + #[doc(alias = "PauseRecord")] pub async fn pause(&self) -> Result<()> { self.client.send_message(Request::Pause).await } /// Resumes the record output. + #[doc(alias = "ResumeRecord")] pub async fn resume(&self) -> Result<()> { self.client.send_message(Request::Resume).await } diff --git a/src/client/replay_buffer.rs b/src/client/replay_buffer.rs index 072a135..e17c9d8 100644 --- a/src/client/replay_buffer.rs +++ b/src/client/replay_buffer.rs @@ -8,6 +8,7 @@ pub struct ReplayBuffer<'a> { impl<'a> ReplayBuffer<'a> { /// Gets the status of the replay buffer output. + #[doc(alias = "GetReplayBufferStatus")] pub async fn status(&self) -> Result { self.client .send_message::<_, responses::OutputActive>(Request::Status) @@ -16,6 +17,7 @@ impl<'a> ReplayBuffer<'a> { } /// Toggles the state of the replay buffer output. + #[doc(alias = "ToggleReplayBuffer")] pub async fn toggle(&self) -> Result { self.client .send_message::<_, responses::OutputActive>(Request::Toggle) @@ -24,21 +26,25 @@ impl<'a> ReplayBuffer<'a> { } /// Starts the replay buffer output. + #[doc(alias = "StartReplayBuffer")] pub async fn start(&self) -> Result<()> { self.client.send_message(Request::Start).await } /// Stops the replay buffer output. + #[doc(alias = "StopReplayBuffer")] pub async fn stop(&self) -> Result<()> { self.client.send_message(Request::Stop).await } /// Saves the contents of the replay buffer output. + #[doc(alias = "SaveReplayBuffer")] pub async fn save(&self) -> Result<()> { self.client.send_message(Request::Save).await } /// Gets the file name of the last replay buffer save file. + #[doc(alias = "GetLastReplayBufferReplay")] pub async fn last_replay(&self) -> Result { self.client .send_message::<_, responses::SavedReplayPath>(Request::LastReplay) diff --git a/src/client/scene_collections.rs b/src/client/scene_collections.rs index 8a291e9..b7a8924 100644 --- a/src/client/scene_collections.rs +++ b/src/client/scene_collections.rs @@ -10,11 +10,13 @@ pub struct SceneCollections<'a> { impl<'a> SceneCollections<'a> { /// Gets an array of all scene collections. + #[doc(alias = "GetSceneCollectionList")] pub async fn list(&self) -> Result { self.client.send_message(Request::List).await } /// Get the currently active scene collection name. + #[doc(alias = "GetSceneCollectionList")] pub async fn current(&self) -> Result { self.client .send_message::<_, responses::SceneCollections>(Request::List) @@ -25,6 +27,7 @@ impl<'a> SceneCollections<'a> { /// Switches to a scene collection. /// /// **Note:** This will block until the collection has finished changing. + #[doc(alias = "SetCurrentSceneCollection")] pub async fn set_current(&self, name: &str) -> Result<()> { self.client.send_message(Request::SetCurrent { name }).await } @@ -32,6 +35,7 @@ impl<'a> SceneCollections<'a> { /// Creates a new scene collection, switching to it in the process. /// /// **Note:** This will block until the collection has finished changing. + #[doc(alias = "CreateSceneCollection")] pub async fn create(&self, name: &str) -> Result<()> { self.client.send_message(Request::Create { name }).await } diff --git a/src/client/scene_items.rs b/src/client/scene_items.rs index b19d525..1cc2947 100644 --- a/src/client/scene_items.rs +++ b/src/client/scene_items.rs @@ -18,6 +18,7 @@ pub struct SceneItems<'a> { impl<'a> SceneItems<'a> { /// Gets a list of all scene items in a scene. + #[doc(alias = "GetSceneItemList")] pub async fn list(&self, scene: &str) -> Result> { self.client .send_message::<_, responses::SceneItemList>(Request::List { scene }) @@ -28,6 +29,7 @@ impl<'a> SceneItems<'a> { /// Basically [`Self::list`], but for groups. /// /// Using groups at all in OBS is discouraged, as they are very broken under the hood. + #[doc(alias = "GetGroupSceneItemList")] pub async fn list_group(&self, scene: &str) -> Result> { self.client .send_message::<_, responses::SceneItemList>(Request::ListGroup { scene }) @@ -36,6 +38,7 @@ impl<'a> SceneItems<'a> { } /// Searches a scene for a source, and returns its id. + #[doc(alias = "GetSceneItemId")] pub async fn id(&self, get: Id<'_>) -> Result { self.client .send_message::<_, responses::SceneItemId>(Request::Id(get)) @@ -44,6 +47,7 @@ impl<'a> SceneItems<'a> { } /// Creates a new scene item using a source. + #[doc(alias = "CreateSceneItem")] pub async fn create(&self, create: CreateSceneItem<'_>) -> Result { self.client .send_message::<_, responses::SceneItemId>(Request::Create(create)) @@ -52,6 +56,7 @@ impl<'a> SceneItems<'a> { } /// Removes a scene item from a scene. + #[doc(alias = "RemoveSceneItem")] pub async fn remove(&self, scene: &str, item_id: i64) -> Result<()> { self.client .send_message(Request::Remove { scene, item_id }) @@ -59,6 +64,7 @@ impl<'a> SceneItems<'a> { } /// Duplicates a scene item, copying all transform and crop info. + #[doc(alias = "DuplicateSceneItem")] pub async fn duplicate(&self, duplicate: Duplicate<'_>) -> Result { self.client .send_message::<_, responses::SceneItemId>(Request::Duplicate(duplicate)) @@ -67,6 +73,7 @@ impl<'a> SceneItems<'a> { } /// Gets the transform and crop info of a scene item. + #[doc(alias = "GetSceneItemTransform")] pub async fn transform( &self, scene: &str, @@ -82,6 +89,7 @@ impl<'a> SceneItems<'a> { } /// Sets the transform and crop info of a scene item. + #[doc(alias = "SetSceneItemTransform")] pub async fn set_transform(&self, transform: SetTransform<'_>) -> Result<()> { self.client .send_message(Request::SetTransform(transform)) @@ -89,6 +97,7 @@ impl<'a> SceneItems<'a> { } /// Gets the enable state of a scene item. + #[doc(alias = "GetSceneItemEnabled")] pub async fn enabled(&self, scene: &str, item_id: i64) -> Result { self.client .send_message::<_, responses::SceneItemEnabled>(Request::Enabled { scene, item_id }) @@ -97,11 +106,13 @@ impl<'a> SceneItems<'a> { } /// Sets the enable state of a scene item. + #[doc(alias = "SetSceneItemEnabled")] pub async fn set_enabled(&self, enabled: SetEnabled<'a>) -> Result<()> { self.client.send_message(Request::SetEnabled(enabled)).await } /// Gets the lock state of a scene item. + #[doc(alias = "GetSceneItemLocked")] pub async fn locked(&self, scene: &str, item_id: i64) -> Result { self.client .send_message::<_, responses::SceneItemLocked>(Request::Locked { scene, item_id }) @@ -110,6 +121,7 @@ impl<'a> SceneItems<'a> { } /// Sets the lock state of a scene item. + #[doc(alias = "SetSceneItemLocked")] pub async fn set_locked(&self, locked: SetLocked<'_>) -> Result<()> { self.client.send_message(Request::SetLocked(locked)).await } @@ -117,6 +129,7 @@ impl<'a> SceneItems<'a> { /// 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. + #[doc(alias = "GetSceneItemIndex")] pub async fn index(&self, scene: &str, item_id: i64) -> Result { self.client .send_message::<_, responses::SceneItemIndex>(Request::Index { scene, item_id }) @@ -125,11 +138,13 @@ impl<'a> SceneItems<'a> { } /// Sets the index position of a scene item in a scene. + #[doc(alias = "SetSceneItemIndex")] pub async fn set_index(&self, index: SetIndex<'_>) -> Result<()> { self.client.send_message(Request::SetIndex(index)).await } /// Gets the blend mode of a scene item. + #[doc(alias = "GetSceneItemBlendMode")] pub async fn blend_mode(&self, scene: &str, item_id: i64) -> Result { self.client .send_message::<_, responses::SceneItemBlendMode>(Request::BlendMode { scene, item_id }) @@ -138,11 +153,13 @@ impl<'a> SceneItems<'a> { } /// Sets the blend mode of a scene item. + #[doc(alias = "SetSceneItemBlendMode")] pub async fn set_blend_mode(&self, mode: SetBlendMode<'a>) -> Result<()> { self.client.send_message(Request::SetBlendMode(mode)).await } /// Gets private scene item settings. + #[doc(alias = "GetSceneItemPrivateSettings")] pub async fn private_settings(&self, scene: &str, item_id: i64) -> Result where T: DeserializeOwned, @@ -157,6 +174,7 @@ impl<'a> SceneItems<'a> { } /// Sets private scene item settings. + #[doc(alias = "SetSceneItemPrivateSettings")] pub async fn set_private_settings(&self, settings: SetPrivateSettings<'_, T>) -> Result<()> where T: Serialize, diff --git a/src/client/scenes.rs b/src/client/scenes.rs index a4825ba..31699ff 100644 --- a/src/client/scenes.rs +++ b/src/client/scenes.rs @@ -12,6 +12,7 @@ pub struct Scenes<'a> { impl<'a> Scenes<'a> { /// Gets an array of all scenes in OBS. + #[doc(alias = "GetSceneList")] pub async fn list(&self) -> Result { self.client.send_message(Request::List).await } @@ -20,6 +21,7 @@ impl<'a> Scenes<'a> { /// /// Groups in OBS are actually scenes, but renamed and modified. In obs-websocket, we treat them /// as scenes where we can. + #[doc(alias = "GetGroupList")] pub async fn list_groups(&self) -> Result> { self.client .send_message::<_, responses::Groups>(Request::ListGroups) @@ -28,6 +30,7 @@ impl<'a> Scenes<'a> { } /// Gets the current program scene. + #[doc(alias = "GetCurrentProgramScene")] pub async fn current_program_scene(&self) -> Result { self.client .send_message::<_, responses::CurrentProgramScene>(Request::CurrentProgramScene) @@ -36,6 +39,7 @@ impl<'a> Scenes<'a> { } /// Sets the current program scene. + #[doc(alias = "SetCurrentProgramScene")] pub async fn set_current_program_scene(&self, scene: &str) -> Result<()> { self.client .send_message(Request::SetCurrentProgramScene { scene }) @@ -45,6 +49,7 @@ impl<'a> Scenes<'a> { /// Gets the current preview scene. /// /// Only available when studio mode is enabled. + #[doc(alias = "GetCurrentPreviewScene")] pub async fn current_preview_scene(&self) -> Result { self.client .send_message::<_, responses::CurrentPreviewScene>(Request::CurrentPreviewScene) @@ -55,6 +60,7 @@ impl<'a> Scenes<'a> { /// Sets the current preview scene. /// /// Only available when studio mode is enabled. + #[doc(alias = "SetCurrentPreviewScene")] pub async fn set_current_preview_scene(&self, scene: &str) -> Result<()> { self.client .send_message(Request::SetCurrentPreviewScene { scene }) @@ -62,6 +68,7 @@ impl<'a> Scenes<'a> { } /// Sets the name of a scene (rename). + #[doc(alias = "SetSceneName")] pub async fn set_name(&self, scene: &str, new_name: &str) -> Result<()> { self.client .send_message(Request::SetName { scene, new_name }) @@ -69,16 +76,19 @@ impl<'a> Scenes<'a> { } /// Creates a new scene in OBS. + #[doc(alias = "CreateScene")] pub async fn create(&self, name: &str) -> Result<()> { self.client.send_message(Request::Create { name }).await } /// Removes a scene from OBS. + #[doc(alias = "RemoveScene")] pub async fn remove(&self, scene: &str) -> Result<()> { self.client.send_message(Request::Remove { scene }).await } /// Gets the scene transition overridden for a scene. + #[doc(alias = "GetSceneSceneTransitionOverride")] pub async fn transition_override( &self, scene: &str, @@ -89,6 +99,7 @@ impl<'a> Scenes<'a> { } /// Sets the scene transition overridden for a scene. + #[doc(alias = "SetSceneSceneTransitionOverride")] pub async fn set_transition_override( &self, transition_override: SetTransitionOverride<'_>, diff --git a/src/client/sources.rs b/src/client/sources.rs index 82749a5..ac47c01 100644 --- a/src/client/sources.rs +++ b/src/client/sources.rs @@ -12,6 +12,7 @@ pub struct Sources<'a> { impl<'a> Sources<'a> { /// Gets the active and show state of a source. + #[doc(alias = "GetSourceActive")] pub async fn active(&self, name: &str) -> Result { self.client.send_message(Request::Active { name }).await } @@ -22,6 +23,7 @@ impl<'a> Sources<'a> { /// "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the /// original resolution is kept. If [`TakeScreenshot::width`] and [`TakeScreenshot::height`] are /// not specified, the compressed image will use the full resolution of the source. + #[doc(alias = "GetSourceScreenshot")] pub async fn take_screenshot(&self, settings: TakeScreenshot<'_>) -> Result { self.client .send_message::<_, responses::ImageData>(Request::TakeScreenshot(settings)) @@ -35,6 +37,7 @@ impl<'a> Sources<'a> { /// "scale to inner", meaning the smallest ratio will be used and the aspect ratio of the /// original resolution is kept. If [`SaveScreenshot::width`] and [`SaveScreenshot::height`] are /// not specified, the compressed image will use the full resolution of the source. + #[doc(alias = "SaveSourceScreenshot")] pub async fn save_screenshot(&self, settings: SaveScreenshot<'_>) -> Result<()> { self.client .send_message(Request::SaveScreenshot(settings)) diff --git a/src/client/streaming.rs b/src/client/streaming.rs index b5518c3..a4080ca 100644 --- a/src/client/streaming.rs +++ b/src/client/streaming.rs @@ -8,11 +8,13 @@ pub struct Streaming<'a> { impl<'a> Streaming<'a> { /// Gets the status of the stream output. + #[doc(alias = "GetStreamStatus")] pub async fn status(&self) -> Result { self.client.send_message(Request::GetStreamStatus).await } /// Toggles the status of the stream output. + #[doc(alias = "ToggleStream")] pub async fn toggle(&self) -> Result { self.client .send_message::<_, responses::OutputActive>(Request::ToggleStream) @@ -21,16 +23,19 @@ impl<'a> Streaming<'a> { } /// Starts the stream output. + #[doc(alias = "StartStream")] pub async fn start(&self) -> Result<()> { self.client.send_message(Request::StartStream).await } /// Stops the stream output. + #[doc(alias = "StopStream")] pub async fn stop(&self) -> Result<()> { self.client.send_message(Request::StopStream).await } /// Sends CEA-608 caption text over the stream output. + #[doc(alias = "SendStreamCaption")] pub async fn send_caption(&self, caption_text: &str) -> Result<()> { self.client .send_message(Request::SendStreamCaption { caption_text }) diff --git a/src/client/transitions.rs b/src/client/transitions.rs index f8bff53..c569339 100644 --- a/src/client/transitions.rs +++ b/src/client/transitions.rs @@ -11,6 +11,7 @@ pub struct Transitions<'a> { impl<'a> Transitions<'a> { /// Gets an array of all available transition kinds. + #[doc(alias = "GetTransitionKindList")] pub async fn list_kinds(&self) -> Result> { self.client .send_message::<_, responses::TransitionKinds>(Request::GetTransitionKindList) @@ -19,6 +20,7 @@ impl<'a> Transitions<'a> { } /// Gets an array of all scene transitions in OBS. + #[doc(alias = "GetSceneTransitionList")] pub async fn list(&self) -> Result { self.client .send_message(Request::GetSceneTransitionList) @@ -26,6 +28,7 @@ impl<'a> Transitions<'a> { } /// Gets information about the current scene transition. + #[doc(alias = "GetCurrentSceneTransition")] pub async fn current(&self) -> Result { self.client .send_message(Request::GetCurrentSceneTransition) @@ -36,6 +39,7 @@ impl<'a> Transitions<'a> { /// /// **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. + #[doc(alias = "SetCurrentSceneTransition")] pub async fn set_current(&self, name: &str) -> Result<()> { self.client .send_message(Request::SetCurrentSceneTransition { name }) @@ -43,6 +47,7 @@ impl<'a> Transitions<'a> { } /// Sets the duration of the current scene transition, if it is not fixed. + #[doc(alias = "SetCurrentSceneTransitionDuration")] pub async fn set_current_duration(&self, duration: Duration) -> Result<()> { self.client .send_message(Request::SetCurrentSceneTransitionDuration { duration }) @@ -50,6 +55,7 @@ impl<'a> Transitions<'a> { } /// Sets the settings of the current scene transition. + #[doc(alias = "SetCurrentSceneTransitionSettings")] pub async fn set_current_settings(&self, settings: T, overlay: Option) -> Result<()> where T: Serialize, @@ -65,6 +71,7 @@ impl<'a> Transitions<'a> { /// Gets the cursor position of the current scene transition. /// /// **Note:** `transitionCursor` will return `1.0` when the transition is inactive. + #[doc(alias = "GetCurrentSceneTransitionCursor")] pub async fn current_cursor(&self) -> Result { self.client .send_message::<_, responses::TransitionCursor>( @@ -76,6 +83,7 @@ impl<'a> Transitions<'a> { /// Triggers the current scene transition. Same functionality as the `Transition` button in /// studio mode. + #[doc(alias = "TriggerStudioModeTransition")] pub async fn trigger(&self) -> Result<()> { self.client .send_message(Request::TriggerStudioModeTransition) @@ -86,6 +94,7 @@ impl<'a> Transitions<'a> { /// /// **Very important note:** This will be deprecated and replaced in a future version of /// `obs-websocket`. + #[doc(alias = "SetTBarPosition")] pub async fn set_tbar_position(&self, position: f32, release: Option) -> Result<()> { self.client .send_message(Request::SetTbarPosition { position, release }) diff --git a/src/client/ui.rs b/src/client/ui.rs index 5539f90..5cb8b4f 100644 --- a/src/client/ui.rs +++ b/src/client/ui.rs @@ -15,6 +15,7 @@ pub struct Ui<'a> { impl<'a> Ui<'a> { /// Gets whether studio is enabled. + #[doc(alias = "GetStudioModeEnabled")] pub async fn studio_mode_enabled(&self) -> Result { self.client .send_message::<_, responses::StudioModeEnabled>(Request::GetStudioModeEnabled) @@ -25,6 +26,7 @@ impl<'a> Ui<'a> { /// Enables or disables studio mode. /// /// - `enabled`: Enable or disable the studio mode. + #[doc(alias = "SetStudioModeEnabled")] pub async fn set_studio_mode_enabled(&self, enabled: bool) -> Result<()> { self.client .send_message(Request::SetStudioModeEnabled { enabled }) @@ -32,6 +34,7 @@ impl<'a> Ui<'a> { } /// Opens the properties dialog of an input. + #[doc(alias = "OpenInputPropertiesDialog")] pub async fn open_properties_dialog(&self, input: &str) -> Result<()> { self.client .send_message(Request::OpenInputPropertiesDialog { input }) @@ -39,6 +42,7 @@ impl<'a> Ui<'a> { } /// Opens the filters dialog of an input. + #[doc(alias = "OpenInputFiltersDialog")] pub async fn open_filters_dialog(&self, input: &str) -> Result<()> { self.client .send_message(Request::OpenInputFiltersDialog { input }) @@ -46,6 +50,7 @@ impl<'a> Ui<'a> { } /// Opens the interact dialog of an input. + #[doc(alias = "OpenInputInteractDialog")] pub async fn open_interact_dialog(&self, input: &str) -> Result<()> { self.client .send_message(Request::OpenInputInteractDialog { input }) @@ -53,6 +58,7 @@ impl<'a> Ui<'a> { } /// Gets a list of connected monitors and information about them. + #[doc(alias = "GetMonitorList")] pub async fn list_monitors(&self) -> Result> { self.client .send_message::<_, responses::MonitorList>(Request::GetMonitorList) @@ -61,6 +67,7 @@ impl<'a> Ui<'a> { } /// Open a projector for a specific output video mix. + #[doc(alias = "OpenVideoMixProjector")] pub async fn open_video_mix_projector(&self, open: OpenVideoMixProjector) -> Result<()> { self.client .send_message(Request::OpenVideoMixProjector( @@ -73,6 +80,7 @@ impl<'a> Ui<'a> { } /// Opens a projector for a source. + #[doc(alias = "OpenSourceProjector")] pub async fn open_source_projector(&self, open: OpenSourceProjector<'a>) -> Result<()> { self.client .send_message(Request::OpenSourceProjector(OpenSourceProjectorInternal { diff --git a/src/client/virtual_cam.rs b/src/client/virtual_cam.rs index 94a4fea..a59d3fc 100644 --- a/src/client/virtual_cam.rs +++ b/src/client/virtual_cam.rs @@ -8,6 +8,7 @@ pub struct VirtualCam<'a> { impl<'a> VirtualCam<'a> { /// Gets the status of the virtual cam output. + #[doc(alias = "GetVirtualCamStatus")] pub async fn status(&self) -> Result { self.client .send_message::<_, responses::OutputActive>(Request::Status) @@ -16,6 +17,7 @@ impl<'a> VirtualCam<'a> { } /// Toggles the state of the virtual cam output. + #[doc(alias = "ToggleVirtualCam")] pub async fn toggle(&self) -> Result { self.client .send_message::<_, responses::OutputActive>(Request::Toggle) @@ -24,11 +26,13 @@ impl<'a> VirtualCam<'a> { } /// Starts the virtual cam output. + #[doc(alias = "StartVirtualCam")] pub async fn start(&self) -> Result<()> { self.client.send_message(Request::Start).await } /// Stops the virtual cam output. + #[doc(alias = "StopVirtualCam")] pub async fn stop(&self) -> Result<()> { self.client.send_message(Request::Stop).await } diff --git a/src/docs/mapping.md b/src/docs/mapping.md index 450974d..d363da3 100644 --- a/src/docs/mapping.md +++ b/src/docs/mapping.md @@ -217,6 +217,5 @@ the equivalent function calls. | OpenInputFiltersDialog | [`Ui::open_filters_dialog`](crate::client::Ui::open_filters_dialog) | | OpenInputInteractDialog | [`Ui::open_interact_dialog`](crate::client::Ui::open_interact_dialog) | | GetMonitorList | [`Ui::list_monitors`](crate::client::Ui::list_monitors) | -| GetMonitorList | [`Ui::list_monitors`](crate::client::Ui::list_monitors) | | OpenVideoMixProjector | [`Ui::open_video_mix_projector`](crate::client::Ui::open_video_mix_projector) | | OpenSourceProjector | [`Ui::open_source_projector`](crate::client::Ui::open_source_projector) |