Use references for request types

pull/1/head
Dominik Nakamura 3 years ago
parent 3ae17ba3fe
commit 9972d8def1
No known key found for this signature in database
GPG Key ID: E4C6A749B2491910

@ -18,10 +18,7 @@ async fn main() -> Result<()> {
let scene_list = client.scenes().get_scene_list().await?;
for scene in scene_list.scenes.iter().cycle() {
client
.scenes()
.set_current_scene(scene.name.clone())
.await?;
client.scenes().set_current_scene(&scene.name).await?;
tokio::time::sleep(Duration::from_secs(1)).await;
}

@ -19,8 +19,8 @@ async fn main() -> Result<()> {
let screenshot = client
.sources()
.take_source_screenshot(SourceScreenshot {
source_name: Some("Start".to_owned()),
embed_picture_format: Some("png".to_owned()),
source_name: Some("Start"),
embed_picture_format: Some("png"),
save_to_file_path: None,
file_format: None,
compress_quality: None,

@ -25,7 +25,7 @@ impl<'a> General<'a> {
/// Attempt to authenticate the client to the server.
///
/// - `auth`: Response to the auth challenge.
pub async fn authenticate(&self, auth: String) -> Result<()> {
pub async fn authenticate(&self, auth: &str) -> Result<()> {
self.client
.send_message(RequestType::Authenticate { auth })
.await
@ -34,7 +34,7 @@ impl<'a> General<'a> {
/// Set the filename formatting string.
///
/// - `filename_formatting`: Filename formatting string to set.
pub async fn set_filename_formatting(&self, filename_formatting: String) -> Result<()> {
pub async fn set_filename_formatting(&self, filename_formatting: &str) -> Result<()> {
self.client
.send_message(RequestType::SetFilenameFormatting {
filename_formatting,
@ -62,14 +62,14 @@ impl<'a> General<'a> {
///
/// - `realm`: Identifier to be choosen by the client.
/// - `data`: User-defined data.
pub async fn broadcast_custom_message<T>(&self, realm: String, data: T) -> Result<()>
pub async fn broadcast_custom_message<T>(&self, realm: &str, data: &T) -> Result<()>
where
T: Serialize,
{
self.client
.send_message(RequestType::BroadcastCustomMessage {
realm,
data: serde_json::to_value(&data).map_err(Error::SerializeCustomData)?,
data: &serde_json::to_value(data).map_err(Error::SerializeCustomData)?,
})
.await
}
@ -80,7 +80,7 @@ impl<'a> General<'a> {
}
/// Open a projector window or create a projector on a monitor. Requires OBS v24.0.4 or newer.
pub async fn open_projector(&self, projector: Projector) -> Result<()> {
pub async fn open_projector(&self, projector: Projector<'_>) -> Result<()> {
self.client
.send_message(RequestType::OpenProjector(projector))
.await

@ -129,13 +129,13 @@ impl Client {
})
}
async fn send_message<T>(&self, req: RequestType) -> Result<T>
async fn send_message<T>(&self, req: RequestType<'_>) -> Result<T>
where
T: DeserializeOwned,
{
let id = self.id_counter.fetch_add(1, Ordering::SeqCst).to_string();
let req = Request {
message_id: id.clone(),
message_id: &id,
ty: req,
};
let json = serde_json::to_string(&req).map_err(Error::SerializeMessage)?;
@ -175,7 +175,7 @@ impl Client {
match password {
Some(password) => {
let auth = Self::create_auth_response(&challenge, &salt, password.as_ref());
self.general().authenticate(auth).await?;
self.general().authenticate(&auth).await?;
}
None => return Err(Error::NoPassword),
}

@ -20,7 +20,7 @@ impl<'a> Outputs<'a> {
/// Get information about a single output.
///
/// - `output_name`: Output name.
pub async fn get_output_info(&self, output_name: String) -> Result<responses::Output> {
pub async fn get_output_info(&self, output_name: &str) -> Result<responses::Output> {
self.client
.send_message::<responses::OutputInfo>(RequestType::GetOutputInfo { output_name })
.await
@ -31,7 +31,7 @@ impl<'a> Outputs<'a> {
/// add outputs to OBS may not function properly when they are controlled in this way.
///
/// - `output_name`: Output name.
pub async fn start_output(&self, output_name: String) -> Result<()> {
pub async fn start_output(&self, output_name: &str) -> Result<()> {
self.client
.send_message(RequestType::StartOutput { output_name })
.await
@ -42,7 +42,7 @@ impl<'a> Outputs<'a> {
///
/// - `output_name`: Output name.
/// - `force`: Force stop (default: false).
pub async fn stop_output(&self, output_name: String, force: Option<bool>) -> Result<()> {
pub async fn stop_output(&self, output_name: &str, force: Option<bool>) -> Result<()> {
self.client
.send_message(RequestType::StopOutput { output_name, force })
.await

@ -12,7 +12,7 @@ impl<'a> Profiles<'a> {
/// Set the currently active profile.
///
/// - `profile_name`: Name of the desired profile.
pub async fn set_current_profile(&self, profile_name: String) -> Result<()> {
pub async fn set_current_profile(&self, profile_name: &str) -> Result<()> {
self.client
.send_message(RequestType::SetCurrentProfile { profile_name })
.await

@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use super::Client;
use crate::requests::RequestType;
@ -44,7 +44,7 @@ impl<'a> Recording<'a> {
/// immediately and will be effective on the next recording.
///
/// - `rec_folder`: Path of the recording folder.
pub async fn set_recording_folder(&self, rec_folder: PathBuf) -> Result<()> {
pub async fn set_recording_folder(&self, rec_folder: &Path) -> Result<()> {
self.client
.send_message(RequestType::SetRecordingFolder { rec_folder })
.await

@ -12,7 +12,7 @@ impl<'a> SceneCollections<'a> {
/// Change the active scene collection.
///
/// - `sc_name`: Name of the desired scene collection.
pub async fn set_current_scene_collection(&self, sc_name: String) -> Result<()> {
pub async fn set_current_scene_collection(&self, sc_name: &str) -> Result<()> {
self.client
.send_message(RequestType::SetCurrentSceneCollection { sc_name })
.await

@ -21,8 +21,8 @@ impl<'a> SceneItems<'a> {
/// - `item`: Scene Item name (if this field is a string) or specification (if it is an object).
pub async fn get_scene_item_properties(
&self,
scene_name: Option<String>,
item: Either<String, SceneItemSpecification>,
scene_name: Option<&str>,
item: Either<&str, SceneItemSpecification<'_>>,
) -> Result<Vec<responses::SceneItemProperties>> {
self.client
.send_message(RequestType::GetSceneItemProperties { scene_name, item })
@ -31,7 +31,10 @@ impl<'a> SceneItems<'a> {
/// Sets the scene specific properties of a source. Unspecified properties will remain
/// unchanged. Coordinates are relative to the item's parent (the scene or group it belongs to).
pub async fn set_scene_item_properties(&self, properties: SceneItemProperties) -> Result<()> {
pub async fn set_scene_item_properties(
&self,
properties: SceneItemProperties<'_>,
) -> Result<()> {
self.client
.send_message(RequestType::SetSceneItemProperties(properties))
.await
@ -43,8 +46,8 @@ impl<'a> SceneItems<'a> {
/// - `item`: Scene Item name (if this field is a string) or specification (if it is an object).
pub async fn reset_scene_item(
&self,
scene_name: Option<String>,
item: Either<String, SceneItemSpecification>,
scene_name: Option<&str>,
item: Either<&str, SceneItemSpecification<'_>>,
) -> Result<()> {
self.client
.send_message(RequestType::ResetSceneItem { scene_name, item })
@ -52,7 +55,10 @@ impl<'a> SceneItems<'a> {
}
/// Show or hide a specified source item in a specified scene.
pub async fn set_scene_item_render(&self, scene_item_render: SceneItemRender) -> Result<()> {
pub async fn set_scene_item_render(
&self,
scene_item_render: SceneItemRender<'_>,
) -> Result<()> {
self.client
.send_message(RequestType::SetSceneItemRender(scene_item_render))
.await
@ -64,8 +70,8 @@ impl<'a> SceneItems<'a> {
/// - `item`: Scene item to delete.
pub async fn delete_scene_item(
&self,
scene: Option<String>,
item: SceneItemSpecification,
scene: Option<&str>,
item: SceneItemSpecification<'_>,
) -> Result<()> {
self.client
.send_message(RequestType::DeleteSceneItem { scene, item })
@ -73,7 +79,7 @@ impl<'a> SceneItems<'a> {
}
/// Creates a scene item in a scene. In other words, this is how you add a source into a scene.
pub async fn add_scene_item(&self, scene_item: AddSceneItem) -> Result<i64> {
pub async fn add_scene_item(&self, scene_item: AddSceneItem<'_>) -> Result<i64> {
self.client
.send_message::<responses::AddSceneItem>(RequestType::AddSceneItem(scene_item))
.await
@ -83,7 +89,7 @@ impl<'a> SceneItems<'a> {
/// Duplicates a scene item.
pub async fn duplicate_scene_item(
&self,
scene_item: DuplicateSceneItem,
scene_item: DuplicateSceneItem<'_>,
) -> Result<responses::DuplicateSceneItem> {
self.client
.send_message(RequestType::DuplicateSceneItem(scene_item))

@ -12,7 +12,7 @@ impl<'a> Scenes<'a> {
/// Switch to the specified scene.
///
/// - `scene_name`: Name of the scene to switch to.
pub async fn set_current_scene(&self, scene_name: String) -> Result<()> {
pub async fn set_current_scene(&self, scene_name: &str) -> Result<()> {
self.client
.send_message(RequestType::SetCurrentScene { scene_name })
.await
@ -31,7 +31,7 @@ impl<'a> Scenes<'a> {
/// Create a new scene scene.
///
/// - `scene_name`: Name of the scene to create.
pub async fn create_scene(&self, scene_name: String) -> Result<()> {
pub async fn create_scene(&self, scene_name: &str) -> Result<()> {
self.client
.send_message(RequestType::CreateScene { scene_name })
.await
@ -44,8 +44,8 @@ impl<'a> Scenes<'a> {
/// uniqueness per scene
pub async fn reorder_scene_items(
&self,
scene: Option<String>,
items: Vec<Scene>,
scene: Option<&str>,
items: &[Scene<'_>],
) -> Result<()> {
self.client
.send_message(RequestType::ReorderSceneItems { scene, items })
@ -55,7 +55,7 @@ impl<'a> Scenes<'a> {
/// Set a scene to use a specific transition override.
pub async fn set_scene_transition_override(
&self,
scene_transition: SceneTransitionOverride,
scene_transition: SceneTransitionOverride<'_>,
) -> Result<()> {
self.client
.send_message(RequestType::SetSceneTransitionOverride(scene_transition))
@ -65,7 +65,7 @@ impl<'a> Scenes<'a> {
/// Remove any transition override on a scene.
///
/// - `scene_name`: Name of the scene to remove the override from.
pub async fn remove_scene_transition_override(&self, scene_name: String) -> Result<()> {
pub async fn remove_scene_transition_override(&self, scene_name: &str) -> Result<()> {
self.client
.send_message(RequestType::RemoveSceneTransitionOverride { scene_name })
.await
@ -76,7 +76,7 @@ impl<'a> Scenes<'a> {
/// - `scene_name`: Name of the scene to get the override for.
pub async fn get_scene_transition_override(
&self,
scene_name: String,
scene_name: &str,
) -> Result<responses::SceneTransitionOverride> {
self.client
.send_message(RequestType::GetSceneTransitionOverride { scene_name })

@ -40,7 +40,7 @@ impl<'a> Sources<'a> {
/// - `use_decibel`: Output volume in decibels of attenuation instead of amplitude/mul.
pub async fn get_volume(
&self,
source: String,
source: &str,
use_decibel: Option<bool>,
) -> Result<responses::Volume> {
self.client
@ -53,7 +53,7 @@ impl<'a> Sources<'a> {
/// Set the volume of the specified source. Default request format uses mul, NOT SLIDER
/// PERCENTAGE.
pub async fn set_volume(&self, volume: Volume) -> Result<()> {
pub async fn set_volume(&self, volume: Volume<'_>) -> Result<()> {
self.client
.send_message(RequestType::SetVolume(volume))
.await
@ -62,7 +62,7 @@ impl<'a> Sources<'a> {
/// Get the mute status of a specified source.
///
/// - `source`: Source name.
pub async fn get_mute(&self, source: String) -> Result<responses::Mute> {
pub async fn get_mute(&self, source: &str) -> Result<responses::Mute> {
self.client
.send_message(RequestType::GetMute { source })
.await
@ -72,7 +72,7 @@ impl<'a> Sources<'a> {
///
/// - `source`: Source name.
/// - `mute`: Desired mute status.
pub async fn set_mute(&self, source: String, mute: bool) -> Result<()> {
pub async fn set_mute(&self, source: &str, mute: bool) -> Result<()> {
self.client
.send_message(RequestType::SetMute { source, mute })
.await
@ -81,7 +81,7 @@ impl<'a> Sources<'a> {
/// Inverts the mute status of a specified source.
///
/// - `source`: Source name.
pub async fn toggle_mute(&self, source: String) -> Result<()> {
pub async fn toggle_mute(&self, source: &str) -> Result<()> {
self.client
.send_message(RequestType::ToggleMute { source })
.await
@ -90,7 +90,7 @@ impl<'a> Sources<'a> {
/// Get the audio's active status of a specified source.
///
/// - `source_name`: Source name.
pub async fn get_audio_active(&self, source_name: String) -> Result<bool> {
pub async fn get_audio_active(&self, source_name: &str) -> Result<bool> {
self.client
.send_message::<responses::AudioActive>(RequestType::GetAudioActive { source_name })
.await
@ -101,7 +101,7 @@ impl<'a> Sources<'a> {
///
/// - `source_name`: Source name.
/// - `new_name`: New source name.
pub async fn set_source_name(&self, source_name: String, new_name: String) -> Result<()> {
pub async fn set_source_name(&self, source_name: &str, new_name: &str) -> Result<()> {
self.client
.send_message(RequestType::SetSourceName {
source_name,
@ -114,7 +114,7 @@ impl<'a> Sources<'a> {
///
/// - `source`: Source name.
/// - `offset`: The desired audio sync offset (in nanoseconds).
pub async fn set_sync_offset(&self, source: String, offset: Duration) -> Result<()> {
pub async fn set_sync_offset(&self, source: &str, offset: Duration) -> Result<()> {
self.client
.send_message(RequestType::SetSyncOffset { source, offset })
.await
@ -123,7 +123,7 @@ impl<'a> Sources<'a> {
/// Get the audio sync offset of a specified source.
///
/// - `source`: Source name.
pub async fn get_sync_offset(&self, source: String) -> Result<responses::SyncOffset> {
pub async fn get_sync_offset(&self, source: &str) -> Result<responses::SyncOffset> {
self.client
.send_message(RequestType::GetSyncOffset { source })
.await
@ -136,8 +136,8 @@ impl<'a> Sources<'a> {
/// specific settings schema.
pub async fn get_source_settings<T>(
&self,
source_name: String,
source_type: Option<String>,
source_name: &str,
source_type: Option<&str>,
) -> Result<responses::SourceSettings<T>>
where
T: DeserializeOwned,
@ -153,7 +153,7 @@ impl<'a> Sources<'a> {
/// Set settings of the specified source.
pub async fn set_source_settings<T>(
&self,
source_settings: SourceSettings,
source_settings: SourceSettings<'_>,
) -> Result<responses::SourceSettings<T>>
where
T: DeserializeOwned,
@ -168,7 +168,7 @@ impl<'a> Sources<'a> {
/// - `source`: Source name.
pub async fn get_text_gdi_plus_properties(
&self,
source: String,
source: &str,
) -> Result<responses::TextGdiPlusProperties> {
self.client
.send_message(RequestType::GetTextGDIPlusProperties { source })
@ -178,7 +178,7 @@ impl<'a> Sources<'a> {
/// Set the current properties of a Text GDI Plus source.
pub async fn set_text_gdi_plus_properties(
&self,
properties: TextGdiPlusProperties,
properties: TextGdiPlusProperties<'_>,
) -> Result<()> {
self.client
.send_message(RequestType::SetTextGDIPlusProperties(Box::new(properties)))
@ -190,7 +190,7 @@ impl<'a> Sources<'a> {
/// - `source`: Source name.
pub async fn get_text_freetype2_properties(
&self,
source: String,
source: &str,
) -> Result<responses::TextFreetype2Properties> {
self.client
.send_message(RequestType::GetTextFreetype2Properties { source })
@ -200,7 +200,7 @@ impl<'a> Sources<'a> {
/// Set the current properties of a Text Freetype 2 source.
pub async fn set_text_freetype2_properties(
&self,
properties: TextFreetype2Properties,
properties: TextFreetype2Properties<'_>,
) -> Result<()> {
self.client
.send_message(RequestType::SetTextFreetype2Properties(properties))
@ -219,7 +219,7 @@ impl<'a> Sources<'a> {
/// - `source_name`: Source name.
pub async fn get_source_filters(
&self,
source_name: String,
source_name: &str,
) -> Result<Vec<responses::SourceFilter>> {
self.client
.send_message::<responses::SourceFilters>(RequestType::GetSourceFilters { source_name })
@ -233,8 +233,8 @@ impl<'a> Sources<'a> {
/// - `filter_name`: Source filter name.
pub async fn get_source_filter_info<T>(
&self,
source_name: String,
filter_name: String,
source_name: &str,
filter_name: &str,
) -> Result<responses::SourceFilterInfo<T>>
where
T: DeserializeOwned,
@ -249,7 +249,7 @@ impl<'a> Sources<'a> {
/// Add a new filter to a source. Available source types along with their settings properties
/// are available from [`get_sources_types_list`](Self::get_sources_types_list).
pub async fn add_filter_to_source(&self, add_filter: AddFilter) -> Result<()> {
pub async fn add_filter_to_source(&self, add_filter: AddFilter<'_>) -> Result<()> {
self.client
.send_message(RequestType::AddFilterToSource(add_filter))
.await
@ -261,8 +261,8 @@ impl<'a> Sources<'a> {
/// - `filter_name`: Name of the filter to remove.
pub async fn remove_filter_from_source(
&self,
source_name: String,
filter_name: String,
source_name: &str,
filter_name: &str,
) -> Result<()> {
self.client
.send_message(RequestType::RemoveFilterFromSource {
@ -273,21 +273,24 @@ impl<'a> Sources<'a> {
}
/// Move a filter in the chain (absolute index positioning).
pub async fn reorder_source_filter(&self, reorder_filter: ReorderFilter) -> Result<()> {
pub async fn reorder_source_filter(&self, reorder_filter: ReorderFilter<'_>) -> Result<()> {
self.client
.send_message(RequestType::ReorderSourceFilter(reorder_filter))
.await
}
/// Move a filter in the chain (relative positioning).
pub async fn move_source_filter(&self, move_filter: MoveFilter) -> Result<()> {
pub async fn move_source_filter(&self, move_filter: MoveFilter<'_>) -> Result<()> {
self.client
.send_message(RequestType::MoveSourceFilter(move_filter))
.await
}
/// Update settings of a filter.
pub async fn set_source_filter_settings(&self, settings: SourceFilterSettings) -> Result<()> {
pub async fn set_source_filter_settings(
&self,
settings: SourceFilterSettings<'_>,
) -> Result<()> {
self.client
.send_message(RequestType::SetSourceFilterSettings(settings))
.await
@ -296,7 +299,7 @@ impl<'a> Sources<'a> {
/// Change the visibility/enabled state of a filter.
pub async fn set_source_filter_visibility(
&self,
visibility: SourceFilterVisibility,
visibility: SourceFilterVisibility<'_>,
) -> Result<()> {
self.client
.send_message(RequestType::SetSourceFilterVisibility(visibility))
@ -306,7 +309,7 @@ impl<'a> Sources<'a> {
/// Get the audio monitoring type of the specified source.
///
/// - `source_name`: Source name.
pub async fn get_audio_monitor_type(&self, source_name: String) -> Result<MonitorType> {
pub async fn get_audio_monitor_type(&self, source_name: &str) -> Result<MonitorType> {
self.client
.send_message::<responses::AudioMonitorType>(RequestType::GetAudioMonitorType {
source_name,
@ -322,7 +325,7 @@ impl<'a> Sources<'a> {
/// `monitorAndOutput`.
pub async fn set_audio_monitor_type(
&self,
source_name: String,
source_name: &str,
monitor_type: MonitorType,
) -> Result<()> {
self.client
@ -341,7 +344,7 @@ impl<'a> Sources<'a> {
/// preserved if only one of these two parameters is specified.
pub async fn take_source_screenshot(
&self,
source_screenshot: SourceScreenshot,
source_screenshot: SourceScreenshot<'_>,
) -> Result<responses::SourceScreenshot> {
self.client
.send_message(RequestType::TakeSourceScreenshot(source_screenshot))

@ -27,7 +27,7 @@ impl<'a> Streaming<'a> {
///
/// - `stream`: Special stream configuration. Please note: these won't be saved to OBS'
/// configuration.
pub async fn start_streaming(&self, stream: Option<Stream>) -> Result<()> {
pub async fn start_streaming(&self, stream: Option<Stream<'_>>) -> Result<()> {
self.client
.send_message(RequestType::StartStreaming { stream })
.await
@ -42,7 +42,7 @@ impl<'a> Streaming<'a> {
/// will remain unchanged. Returns the updated settings in response. If 'type' is different than
/// the current streaming service type, all settings are required. Returns the full settings of
/// the stream (the same as GetStreamSettings).
pub async fn set_stream_settings(&self, settings: SetStreamSettings) -> Result<()> {
pub async fn set_stream_settings(&self, settings: SetStreamSettings<'_>) -> Result<()> {
self.client
.send_message(RequestType::SetStreamSettings(settings))
.await
@ -65,7 +65,7 @@ impl<'a> Streaming<'a> {
/// Send the provided text as embedded CEA-608 caption data.
///
/// - `text`: Captions text.
pub async fn send_captions(&self, text: String) -> Result<()> {
pub async fn send_captions(&self, text: &str) -> Result<()> {
self.client
.send_message(RequestType::SendCaptions { text })
.await

@ -26,7 +26,7 @@ impl<'a> StudioMode<'a> {
/// Set the active preview scene. Will return an `error` if Studio Mode is not enabled.
///
/// - `scene_name`: The name of the scene to preview.
pub async fn set_preview_scene(&self, scene_name: String) -> Result<()> {
pub async fn set_preview_scene(&self, scene_name: &str) -> Result<()> {
self.client
.send_message(RequestType::SetPreviewScene { scene_name })
.await
@ -37,7 +37,10 @@ impl<'a> StudioMode<'a> {
///
/// - `with_transition`: Change the active transition before switching scenes. Defaults to the
/// active transition.
pub async fn transition_to_program(&self, with_transition: Option<Transition>) -> Result<()> {
pub async fn transition_to_program(
&self,
with_transition: Option<Transition<'_>>,
) -> Result<()> {
self.client
.send_message(RequestType::TransitionToProgram { with_transition })
.await

@ -28,7 +28,7 @@ impl<'a> Transitions<'a> {
/// Set the active transition.
///
/// - `transition_name`: The name of the transition.
pub async fn set_current_transition(&self, transition_name: String) -> Result<()> {
pub async fn set_current_transition(&self, transition_name: &str) -> Result<()> {
self.client
.send_message(RequestType::SetCurrentTransition { transition_name })
.await

@ -1,6 +1,6 @@
//! All requests that can be send to the API.
use std::path::PathBuf;
use std::path::Path;
use chrono::Duration;
use either::Either;
@ -13,15 +13,15 @@ mod ser;
#[derive(Serialize)]
#[serde(rename_all = "kebab-case")]
pub(crate) struct Request {
pub message_id: String,
pub(crate) struct Request<'a> {
pub message_id: &'a str,
#[serde(flatten)]
pub ty: RequestType,
pub ty: RequestType<'a>,
}
#[derive(Serialize)]
#[serde(tag = "request-type")]
pub(crate) enum RequestType {
pub(crate) enum RequestType<'a> {
// --------------------------------
// General
// --------------------------------
@ -29,23 +29,23 @@ pub(crate) enum RequestType {
GetAuthRequired,
Authenticate {
/// Response to the auth challenge.
auth: String,
auth: &'a str,
},
#[serde(rename_all = "kebab-case")]
SetFilenameFormatting {
/// Filename formatting string to set.
filename_formatting: String,
filename_formatting: &'a str,
},
GetFilenameFormatting,
GetStats,
BroadcastCustomMessage {
/// Identifier to be choosen by the client.
realm: String,
realm: &'a str,
/// User-defined data.
data: serde_json::Value,
data: &'a serde_json::Value,
},
GetVideoInfo,
OpenProjector(Projector),
OpenProjector(Projector<'a>),
// --------------------------------
// Sources
// --------------------------------
@ -54,105 +54,105 @@ pub(crate) enum RequestType {
#[serde(rename_all = "camelCase")]
GetVolume {
/// Source name.
source: String,
source: &'a str,
/// Output volume in decibels of attenuation instead of amplitude/mul.
use_decibel: Option<bool>,
},
SetVolume(Volume),
SetVolume(Volume<'a>),
GetMute {
/// Source name.
source: String,
source: &'a str,
},
SetMute {
/// Source name.
source: String,
source: &'a str,
/// Desired mute status.
mute: bool,
},
ToggleMute {
/// Source name.
source: String,
source: &'a str,
},
#[serde(rename_all = "camelCase")]
GetAudioActive {
/// Source name.
source_name: String,
source_name: &'a str,
},
#[serde(rename_all = "camelCase")]
SetSourceName {
/// Source name.
source_name: String,
source_name: &'a str,
/// New source name.
new_name: String,
new_name: &'a str,
},
SetSyncOffset {
/// Source name.
source: String,
source: &'a str,
/// The desired audio sync offset (in nanoseconds).
#[serde(serialize_with = "ser::duration_nanos")]
offset: Duration,
},
GetSyncOffset {
/// Source name.
source: String,
source: &'a str,
},
#[serde(rename_all = "camelCase")]
GetSourceSettings {
/// Source name.
source_name: String,
source_name: &'a str,
/// Type of the specified source. Useful for type-checking if you expect a specific settings
/// schema.
source_type: Option<String>,
source_type: Option<&'a str>,
},
SetSourceSettings(SourceSettings),
SetSourceSettings(SourceSettings<'a>),
GetTextGDIPlusProperties {
/// Source name.
source: String,
source: &'a str,
},
SetTextGDIPlusProperties(Box<TextGdiPlusProperties>),
SetTextGDIPlusProperties(Box<TextGdiPlusProperties<'a>>),
GetTextFreetype2Properties {
/// Source name.
source: String,
source: &'a str,
},
SetTextFreetype2Properties(TextFreetype2Properties),
SetTextFreetype2Properties(TextFreetype2Properties<'a>),
GetSpecialSources,
#[serde(rename_all = "camelCase")]
GetSourceFilters {
/// Source name.
source_name: String,
source_name: &'a str,
},
#[serde(rename_all = "camelCase")]
GetSourceFilterInfo {
/// Source name.
source_name: String,
source_name: &'a str,
/// Source filter name.
filter_name: String,
filter_name: &'a str,
},
AddFilterToSource(AddFilter),
AddFilterToSource(AddFilter<'a>),
#[serde(rename_all = "camelCase")]
RemoveFilterFromSource {
/// Name of the source from which the specified filter is removed.
source_name: String,
source_name: &'a str,
/// Name of the filter to remove.
filter_name: String,
filter_name: &'a str,
},
ReorderSourceFilter(ReorderFilter),
MoveSourceFilter(MoveFilter),
SetSourceFilterSettings(SourceFilterSettings),
SetSourceFilterVisibility(SourceFilterVisibility),
ReorderSourceFilter(ReorderFilter<'a>),
MoveSourceFilter(MoveFilter<'a>),
SetSourceFilterSettings(SourceFilterSettings<'a>),
SetSourceFilterVisibility(SourceFilterVisibility<'a>),
#[serde(rename_all = "camelCase")]
GetAudioMonitorType {
/// Source name.
source_name: String,
source_name: &'a str,
},
#[serde(rename_all = "camelCase")]
SetAudioMonitorType {
/// Source name.
source_name: String,
source_name: &'a str,
/// The monitor type to use. Options: `none`, `monitorOnly`, `monitorAndOutput`.
monitor_type: MonitorType,
},
TakeSourceScreenshot(SourceScreenshot),
TakeSourceScreenshot(SourceScreenshot<'a>),
// --------------------------------
// Outputs
// --------------------------------
@ -160,17 +160,17 @@ pub(crate) enum RequestType {
#[serde(rename_all = "camelCase")]
GetOutputInfo {
/// Output name.
output_name: String,
output_name: &'a str,
},
#[serde(rename_all = "camelCase")]
StartOutput {
/// Output name.
output_name: String,
output_name: &'a str,
},
#[serde(rename_all = "camelCase")]
StopOutput {
/// Output name.
output_name: String,
output_name: &'a str,
/// Force stop (default: false).
force: Option<bool>,
},
@ -180,7 +180,7 @@ pub(crate) enum RequestType {
#[serde(rename_all = "kebab-case")]
SetCurrentProfile {
/// Name of the desired profile.
profile_name: String,
profile_name: &'a str,
},
GetCurrentProfile,
ListProfiles,
@ -195,7 +195,7 @@ pub(crate) enum RequestType {
#[serde(rename_all = "kebab-case")]
SetRecordingFolder {
/// Path of the recording folder.
rec_folder: PathBuf,
rec_folder: &'a Path,
},
GetRecordingFolder,
// --------------------------------
@ -211,7 +211,7 @@ pub(crate) enum RequestType {
#[serde(rename_all = "kebab-case")]
SetCurrentSceneCollection {
/// Name of the desired scene collection.
sc_name: String,
sc_name: &'a str,
},
GetCurrentSceneCollection,
ListSceneCollections,
@ -221,61 +221,61 @@ pub(crate) enum RequestType {
#[serde(rename_all = "kebab-case")]
GetSceneItemProperties {
/// Name of the scene the scene item belongs to. Defaults to the current scene.
scene_name: Option<String>,
scene_name: Option<&'a str>,
/// Scene Item name (if this field is a string) or specification (if it is an object).
#[serde(with = "either::serde_untagged")]
item: Either<String, SceneItemSpecification>,
item: Either<&'a str, SceneItemSpecification<'a>>,
},
SetSceneItemProperties(SceneItemProperties),
SetSceneItemProperties(SceneItemProperties<'a>),
#[serde(rename_all = "kebab-case")]
ResetSceneItem {
/// Name of the scene the scene item belongs to. Defaults to the current scene.
scene_name: Option<String>,
scene_name: Option<&'a str>,
/// Scene Item name (if this field is a string) or specification (if it is an object).
#[serde(with = "either::serde_untagged")]
item: Either<String, SceneItemSpecification>,
item: Either<&'a str, SceneItemSpecification<'a>>,
},
SetSceneItemRender(SceneItemRender),
SetSceneItemRender(SceneItemRender<'a>),
DeleteSceneItem {
/// Name of the scene the scene item belongs to. Defaults to the current scene.
scene: Option<String>,
scene: Option<&'a str>,
/// Scene item to delete.
item: SceneItemSpecification, // TODO: fields are actually not optional
item: SceneItemSpecification<'a>, // TODO: fields are actually not optional
},
AddSceneItem(AddSceneItem),
DuplicateSceneItem(DuplicateSceneItem),
AddSceneItem(AddSceneItem<'a>),
DuplicateSceneItem(DuplicateSceneItem<'a>),
// --------------------------------
// Scenes
// --------------------------------
#[serde(rename_all = "kebab-case")]
SetCurrentScene {
/// Name of the scene to switch to.
scene_name: String,
scene_name: &'a str,
},
GetCurrentScene,
GetSceneList,
#[serde(rename_all = "camelCase")]
CreateScene {
/// Name of the scene to create.
scene_name: String,
scene_name: &'a str,
},
ReorderSceneItems {
/// Name of the scene to reorder (defaults to current).
scene: Option<String>,
scene: Option<&'a str>,
/// Ordered list of objects with name and/or id specified. Id preferred due to uniqueness
/// per scene.
items: Vec<Scene>,
items: &'a [Scene<'a>],
},
SetSceneTransitionOverride(SceneTransitionOverride),
SetSceneTransitionOverride(SceneTransitionOverride<'a>),
#[serde(rename_all = "camelCase")]
RemoveSceneTransitionOverride {
/// Name of the scene to remove the override from.
scene_name: String,
scene_name: &'a str,
},
#[serde(rename_all = "camelCase")]
GetSceneTransitionOverride {
/// Name of the scene to get the override for.
scene_name: String,
scene_name: &'a str,
},
// --------------------------------
// Streaming
@ -284,15 +284,15 @@ pub(crate) enum RequestType {
StartStopStreaming,
StartStreaming {
/// Special stream configuration. Please note: these won't be saved to OBS' configuration.
stream: Option<Stream>,
stream: Option<Stream<'a>>,
},
StopStreaming,
SetStreamSettings(SetStreamSettings),
SetStreamSettings(SetStreamSettings<'a>),
GetStreamSettings,
SaveStreamSettings,
SendCaptions {
/// Captions text.
text: String,
text: &'a str,
},
// --------------------------------
// Studio Mode
@ -302,11 +302,11 @@ pub(crate) enum RequestType {
#[serde(rename_all = "kebab-case")]
SetPreviewScene {
/// The name of the scene to preview.
scene_name: String,
scene_name: &'a str,
},
TransitionToProgram {
/// Change the active transition before switching scenes. Defaults to the active transition.
with_transition: Option<Transition>,
with_transition: Option<Transition<'a>>,
},
EnableStudioMode,
DisableStudioMode,
@ -319,7 +319,7 @@ pub(crate) enum RequestType {
#[serde(rename_all = "kebab-case")]
SetCurrentTransition {
/// The name of the transition.
transition_name: String,
transition_name: &'a str,
},
SetTransitionDuration {
/// Desired duration of the transition (in milliseconds).
@ -332,7 +332,7 @@ pub(crate) enum RequestType {
/// Request information for [`open_projector`](crate::client::General::open_projector).
#[skip_serializing_none]
#[derive(Debug, Serialize)]
pub struct Projector {
pub struct Projector<'a> {
/// Type of projector: `Preview` (default), `Source`, `Scene`, `StudioProgram`, or `Multiview`
/// (case insensitive).
#[serde(rename = "type")]
@ -342,9 +342,9 @@ pub struct Projector {
/// Size and position of the projector window (only if monitor is -1). Encoded in Base64 using
/// [Qt's geometry encoding](https://doc.qt.io/qt-5/qwidget.html#saveGeometry). Corresponds to
/// OBS's saved projectors.
pub geometry: Option<String>,
pub geometry: Option<&'a str>,
/// Name of the source or scene to be displayed (ignored for other projector types).
pub name: Option<String>,
pub name: Option<&'a str>,
}
/// Request information for [`open_projector`](crate::client::General::open_projector) as part of
@ -367,9 +367,9 @@ pub enum ProjectorType {
#[skip_serializing_none]
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct Volume {
pub struct Volume<'a> {
/// Source name.
pub source: String,
pub source: &'a str,
/// Desired volume. Must be between `0.0` and `20.0` for mul, and under 26.0 for dB. OBS will
/// interpret dB values under -100.0 as Inf. Note: The OBS volume sliders only reach a maximum
/// of 1.0mul/0.0dB, however OBS actually supports larger values.
@ -382,23 +382,23 @@ pub struct Volume {
#[skip_serializing_none]
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceSettings {
pub struct SourceSettings<'a> {
/// Source name.
pub source_name: String,
pub source_name: &'a str,
/// Type of the specified source. Useful for type-checking to avoid settings a set of settings
/// incompatible with the actual source's type.
pub source_type: Option<String>,
pub source_type: Option<&'a str>,
/// Source settings (varies between source types, may require some probing around).
pub source_settings: serde_json::Value,
pub source_settings: &'a serde_json::Value,
}
/// Request information for
/// [`set_text_gdi_plus_properties`](crate::client::Sources::set_text_gdi_plus_properties).
#[skip_serializing_none]
#[derive(Debug, Serialize)]
pub struct TextGdiPlusProperties {
pub struct TextGdiPlusProperties<'a> {
/// Name of the source.
pub source: String,
pub source: &'a str,
/// Text Alignment ("left", "center", "right").
pub align: Option<Align>,
/// Background color.
@ -418,12 +418,12 @@ pub struct TextGdiPlusProperties {
/// Extents cy.
pub extents_cy: Option<i64>,
/// File path name.
pub file: Option<PathBuf>,
pub file: Option<&'a Path>,
/// Read text from the specified file.
pub read_from_file: Option<bool>,
/// Holds data for the font. Ex:
/// `"font": { "face": "Arial", "flags": 0, "size": 150, "style": "" }`.
pub font: Option<Font>,
pub font: Option<Font<'a>>,
/// Gradient enabled.
pub gradient: Option<bool>,
/// Gradient color.
@ -441,7 +441,7 @@ pub struct TextGdiPlusProperties {
/// Outline opacity (0-100).
pub outline_opacity: Option<u8>,
/// Text content to be displayed.
pub text: Option<String>,
pub text: Option<&'a str>,
/// Text vertical alignment ("top", "center", "bottom").
pub valign: Option<Valign>,
/// Vertical text enabled.
@ -454,9 +454,9 @@ pub struct TextGdiPlusProperties {
/// [`set_text_freetype2_properties`](crate::client::Sources::set_text_freetype2_properties).
#[skip_serializing_none]
#[derive(Debug, Serialize)]
pub struct TextFreetype2Properties {
pub struct TextFreetype2Properties<'a> {
/// Source name.
pub source: String,
pub source: &'a str,
/// Gradient top color.
pub color1: Option<u32>,
/// Gradient bottom color.
@ -467,7 +467,7 @@ pub struct TextFreetype2Properties {
pub drop_shadow: Option<bool>,
/// Holds data for the font. Ex:
/// `"font": { "face": "Arial", "flags": 0, "size": 150, "style": "" }`.
pub font: Option<Font>,
pub font: Option<Font<'a>>,
/// Read text from the specified file.
pub from_file: Option<bool>,
/// Chat log.
@ -475,9 +475,9 @@ pub struct TextFreetype2Properties {
/// Outline.
pub outline: Option<bool>,
/// Text content to be displayed.
pub text: Option<String>,
pub text: Option<&'a str>,
/// File path.
pub text_file: Option<PathBuf>,
pub text_file: Option<&'a Path>,
/// Word wrap.
pub word_wrap: Option<bool>,
}
@ -485,26 +485,26 @@ pub struct TextFreetype2Properties {
/// Request information for [`add_filter_to_source`](crate::client::Sources::add_filter_to_source).
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AddFilter {
pub struct AddFilter<'a> {
/// Name of the source on which the filter is added.
pub source_name: String,
pub source_name: &'a str,
/// Name of the new filter.
pub filter_name: String,
pub filter_name: &'a str,
/// Filter type.
pub filter_type: String,
pub filter_type: &'a str,
/// Filter settings.
pub filter_settings: serde_json::Value,
pub filter_settings: &'a serde_json::Value,
}
/// Request information for
/// [`reorder_source_filter`](crate::client::Sources::reorder_source_filter).
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct ReorderFilter {
pub struct ReorderFilter<'a> {
/// Name of the source to which the filter belongs.
pub source_name: String,
pub source_name: &'a str,
/// Name of the filter to reorder.
pub filter_name: String,
pub filter_name: &'a str,
/// Desired position of the filter in the chain.
pub new_index: u32,
}
@ -512,11 +512,11 @@ pub struct ReorderFilter {
/// Request information for [`move_source_filter`](crate::client::Sources::move_source_filter).
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct MoveFilter {
pub struct MoveFilter<'a> {
/// Name of the source to which the filter belongs.
pub source_name: String,
pub source_name: &'a str,
/// Name of the filter to reorder.
pub filter_name: String,
pub filter_name: &'a str,
/// How to move the filter around in the source's filter chain. Either "up", "down", "top" or
/// "bottom".
pub movement_type: MovementType,
@ -541,24 +541,24 @@ pub enum MovementType {
/// [`set_source_filter_settings`](crate::client::Sources::set_source_filter_settings).
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceFilterSettings {
pub struct SourceFilterSettings<'a> {
/// Name of the source to which the filter belongs.
pub source_name: String,
pub source_name: &'a str,
/// Name of the filter to reconfigure.
pub filter_name: String,
pub filter_name: &'a str,
/// New settings. These will be merged to the current filter settings.
pub filter_settings: serde_json::Value,
pub filter_settings: &'a serde_json::Value,
}
/// Request information for
/// [`set_source_filter_visibility`](crate::client::Sources::set_source_filter_visibility).
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceFilterVisibility {
pub struct SourceFilterVisibility<'a> {
/// Source name.
pub source_name: String,
pub source_name: &'a str,
/// Source filter name.
pub filter_name: String,
pub filter_name: &'a str,
/// New filter state.
pub filter_enabled: bool,
}
@ -568,22 +568,22 @@ pub struct SourceFilterVisibility {
#[skip_serializing_none]
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceScreenshot {
pub struct SourceScreenshot<'a> {
/// Source name. Note that, since scenes are also sources, you can also provide a scene name. If
/// not provided, the currently active scene is used.
pub source_name: Option<String>,
pub source_name: Option<&'a str>,
/// Format of the Data URI encoded picture. Can be "png", "jpg", "jpeg" or "bmp" (or any other
/// value supported by Qt's Image module).
pub embed_picture_format: Option<String>,
pub embed_picture_format: Option<&'a str>,
/// Full file path (file extension included) where the captured image is to be saved. Can be in
/// a format different from [`embed_picture_format`](SourceScreenshot::embed_picture_format).
/// Can be a relative path.
pub save_to_file_path: Option<PathBuf>,
pub save_to_file_path: Option<&'a Path>,
/// Format to save the image file as (one of the values provided in the
/// [`supported_image_export_formats`](crate::responses::Version::supported_image_export_formats)
/// response field of [`get_version`](crate::client::General::get_version)). If not specified,
/// tries to guess based on file extension.
pub file_format: Option<String>,
pub file_format: Option<&'a str>,
/// Compression ratio between -1 and 100 to write the image with. -1 is automatic, 1 is smallest
/// file/most compression, 100 is largest file/least compression. Varies with image type.
pub compress_quality: Option<i8>,
@ -598,12 +598,12 @@ pub struct SourceScreenshot {
#[skip_serializing_none]
#[derive(Debug, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct SceneItemProperties {
pub struct SceneItemProperties<'a> {
/// Name of the scene the source item belongs to. Defaults to the current scene.
pub scene_name: Option<String>,
pub scene_name: Option<&'a str>,
/// Scene Item name (if this field is a string) or specification (if it is an object).
#[serde(with = "either::serde_untagged")]
pub item: Either<String, SceneItemSpecification>,
pub item: Either<&'a str, SceneItemSpecification<'a>>,
/// Position of the scene item.
pub position: Option<Position>,
/// The new clockwise rotation of the item in degrees.
@ -626,11 +626,11 @@ pub struct SceneItemProperties {
#[skip_serializing_none]
#[derive(Debug, Serialize)]
#[serde(rename_all = "kebab-case")]
pub struct SceneItemRender {
pub struct SceneItemRender<'a> {
/// Name of the scene the scene item belongs to. Defaults to the currently active scene.
pub scene_name: Option<String>,
pub scene_name: Option<&'a str>,
/// Scene Item name.
pub source: String,
pub source: &'a str,
/// true = shown ; false = hidden.
pub render: bool,
}
@ -638,11 +638,11 @@ pub struct SceneItemRender {
/// Request information for [`add_scene_item`](crate::client::SceneItems::add_scene_item).
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct AddSceneItem {
pub struct AddSceneItem<'a> {
/// Name of the scene to create the scene item in.
pub scene_name: String,
pub scene_name: &'a str,
/// Name of the source to be added.
pub source_name: String,
pub source_name: &'a str,
/// Whether to make the sceneitem visible on creation or not. Default `true`.
pub set_visible: bool,
}
@ -652,13 +652,13 @@ pub struct AddSceneItem {
#[skip_serializing_none]
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct DuplicateSceneItem {
pub struct DuplicateSceneItem<'a> {
/// Name of the scene to copy the item from. Defaults to the current scene.
pub from_scene: Option<String>,
pub from_scene: Option<&'a str>,
/// Name of the scene to create the item in. Defaults to the current scene.
pub to_scene: Option<String>,
pub to_scene: Option<&'a str>,
/// Scene Item to duplicate from the source scene.
pub item: SceneItemSpecification, // TODO: fields are actually not optional
pub item: SceneItemSpecification<'a>, // TODO: fields are actually not optional
}
/// Request information for
@ -666,11 +666,11 @@ pub struct DuplicateSceneItem {
#[skip_serializing_none]
#[derive(Debug, Serialize)]
#[serde(rename_all = "camelCase")]
pub struct SceneTransitionOverride {
pub struct SceneTransitionOverride<'a> {
/// Name of the scene to switch to.
pub scene_name: String,
pub scene_name: &'a str,
/// Name of the transition to use.
pub transition_name: String,
pub transition_name: &'a str,
/// Duration in milliseconds of the transition if transition is not fixed. Defaults to the
/// current duration specified in the UI if there is no current override and this value is not
/// given.
@ -680,12 +680,12 @@ pub struct SceneTransitionOverride {
/// Request information for [`set_stream_settings`](crate::client::Streaming::set_stream_settings).
#[derive(Debug, Serialize)]
pub struct SetStreamSettings {
pub struct SetStreamSettings<'a> {
/// The type of streaming service configuration, usually `rtmp_custom` or `rtmp_common`.
#[serde(rename = "type")]
pub ty: StreamType,
/// The actual settings of the stream.
pub settings: StreamSettings,
pub settings: StreamSettings<'a>,
/// Persist the settings to disk.
pub save: bool,
}
@ -697,16 +697,16 @@ pub struct SetStreamSettings {
/// of [`TextFreetype2Properties`].
#[skip_serializing_none]
#[derive(Debug, Serialize)]
pub struct Font {
pub struct Font<'a> {
/// Font face.
pub face: Option<String>,
pub face: Option<&'a str>,
/// Font text styling flag. `Bold=1, Italic=2, Bold Italic=3, Underline=5, Strikeout=8`.
#[serde(serialize_with = "ser::bitflags_u8_opt")]
pub flags: Option<FontFlags>,
/// Font text size.
pub size: Option<u32>,
/// Font Style (unknown function).
pub style: Option<String>,
pub style: Option<&'a str>,
}
/// Request information for
@ -718,9 +718,9 @@ pub struct Font {
/// [`DuplicateSceneItem`].
#[skip_serializing_none]
#[derive(Debug, Serialize)]
pub struct SceneItemSpecification {
pub struct SceneItemSpecification<'a> {
/// Scene Item name.
pub name: Option<String>,
pub name: Option<&'a str>,
/// Scene Item ID.
pub id: Option<i64>,
}
@ -793,17 +793,17 @@ pub struct Bounds {
/// [`ReorderLineItems`](RequestType::ReorderSceneItems).
#[skip_serializing_none]
#[derive(Debug, Serialize)]
pub struct Scene {
pub struct Scene<'a> {
/// Id of a specific scene item. Unique on a scene by scene basis.
id: Option<i64>,
/// Name of a scene item. Sufficiently unique if no scene items share sources within the scene.
name: Option<String>,
name: Option<&'a str>,
}
/// Request information for [`start_streaming`](crate::client::Streaming::start_streaming).
#[skip_serializing_none]
#[derive(Debug, Serialize)]
pub struct Stream {
pub struct Stream<'a> {
/// If specified ensures the type of stream matches the given type (usually 'rtmp_custom' or
/// 'rtmp_common'). If the currently configured stream type does not match the given stream
/// type, all settings must be specified in the `settings` object or an error will occur when
@ -813,9 +813,9 @@ pub struct Stream {
/// Adds the given object parameters as encoded query string parameters to the 'key' of the RTMP
/// stream. Used to pass data to the RTMP service about the streaming. May be any String,
/// Numeric, or Boolean field.
metadata: Option<serde_json::Value>,
metadata: Option<&'a serde_json::Value>,
/// Settings for the stream.
settings: Option<StreamSettings>,
settings: Option<StreamSettings<'a>>,
}
/// Request information for [`start_streaming`](crate::client::Streaming::start_streaming) as part
@ -823,28 +823,28 @@ pub struct Stream {
/// of [`SetStreamSettings`].
#[skip_serializing_none]
#[derive(Debug, Serialize)]
pub struct StreamSettings {
pub struct StreamSettings<'a> {
/// The publish URL.
server: Option<String>,
server: Option<&'a str>,
/// The publish key of the stream.
key: Option<String>,
key: Option<&'a str>,
/// Indicates whether authentication should be used when connecting to the streaming server.
use_auth: Option<bool>,
/// If authentication is enabled, the username for the streaming server. Ignored if
/// [`use_auth`](Self::use_auth) is not set to `true`.
username: Option<String>,
username: Option<&'a str>,
/// If authentication is enabled, the password for the streaming server. Ignored if
/// [`use_auth`](Self::use_auth) is not set to `true`.
password: Option<String>,
password: Option<&'a str>,
}
/// Request information for
/// [`transition_to_program`](crate::client::StudioMode::transition_to_program).
#[skip_serializing_none]
#[derive(Debug, Serialize)]
pub struct Transition {
pub struct Transition<'a> {
/// Name of the transition.
name: String,
name: &'a str,
/// Transition duration (in milliseconds).
#[serde(serialize_with = "ser::duration_millis_opt")]
duration: Option<Duration>,

Loading…
Cancel
Save