diff --git a/livekit-api/src/services/mod.rs b/livekit-api/src/services/mod.rs index f5f6e01a1..a84f7d953 100644 --- a/livekit-api/src/services/mod.rs +++ b/livekit-api/src/services/mod.rs @@ -22,6 +22,7 @@ use crate::access_token::{AccessToken, AccessTokenError, VideoGrants}; pub mod egress; pub mod ingress; pub mod room; +pub mod sip; mod twirp_client; diff --git a/livekit-api/src/services/sip.rs b/livekit-api/src/services/sip.rs new file mode 100644 index 000000000..35bcf0db6 --- /dev/null +++ b/livekit-api/src/services/sip.rs @@ -0,0 +1,230 @@ +// Copyright 2024 LiveKit, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use livekit_protocol as proto; +use std::ptr::null; + +use crate::access_token::VideoGrants; +use crate::get_env_keys; +use crate::services::ingress::{CreateIngressOptions, IngressListFilter}; +use crate::services::twirp_client::TwirpClient; +use crate::services::{ServiceBase, ServiceResult, LIVEKIT_PACKAGE}; + +const SVC: &str = "SIP"; + +#[derive(Debug)] +pub struct SIPClient { + base: ServiceBase, + client: TwirpClient, +} + +#[derive(Default, Clone, Debug)] +pub struct CreateSIPTrunkOptions { + /// CIDR or IPs that traffic is accepted from + /// An empty list means all inbound traffic is accepted. + pub inbound_addresses: Vec, + /// Accepted `To` values. This Trunk will only accept a call made to + /// these numbers. This allows you to have distinct Trunks for different phone + /// numbers at the same provider. + pub inbound_numbers: Vec, + /// Username and password used to authenticate inbound SIP invites + /// May be empty to have no Authentication + pub inbound_username: String, + pub inbound_password: String, + + /// IP that SIP INVITE is sent too + pub outbound_address: String, + /// Username and password used to authenticate outbound SIP invites + /// May be empty to have no Authentication + pub outbound_username: String, + pub outbound_password: String, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ListSIPTrunkFilter { + All, +} + +#[derive(Default, Clone, Debug)] +pub struct CreateSIPDispatchRuleOptions { + /// What trunks are accepted for this dispatch rule + /// If empty all trunks will match this dispatch rule + pub trunk_ids: Vec, + pub hide_phone_number: bool, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum ListSIPDispatchRuleFilter { + All, +} + +#[derive(Default, Clone, Debug)] +pub struct CreateSIPParticipantOptions { + /// Optional identity of the participant in LiveKit room + pub participant_identity: String, + /// Optionally send following DTMF digits (extension codes) when making a call. + /// Character 'w' can be used to add a 0.5 sec delay. + pub dtmf: String, + /// Optionally play ringtone in the room as an audible indicator for existing participants + pub play_ringtone: bool, +} + +impl SIPClient { + pub fn with_api_key(host: &str, api_key: &str, api_secret: &str) -> Self { + Self { + base: ServiceBase::with_api_key(api_key, api_secret), + client: TwirpClient::new(host, LIVEKIT_PACKAGE, None), + } + } + + pub fn new(host: &str) -> ServiceResult { + let (api_key, api_secret) = get_env_keys()?; + Ok(Self::with_api_key(host, &api_key, &api_secret)) + } + + pub async fn create_sip_trunk( + &self, + number: String, + options: CreateSIPTrunkOptions, + ) -> ServiceResult { + self.client + .request( + SVC, + "CreateSIPTrunk", + proto::CreateSipTrunkRequest { + outbound_number: number.to_owned(), + outbound_address: options.outbound_address.to_owned(), + outbound_username: options.outbound_username.to_owned(), + outbound_password: options.outbound_password.to_owned(), + + inbound_numbers: options.inbound_numbers.to_owned(), + inbound_numbers_regex: Vec::new(), + inbound_addresses: options.inbound_addresses.to_owned(), + inbound_username: options.inbound_username.to_owned(), + inbound_password: options.inbound_password.to_owned(), + }, + self.base.auth_header(VideoGrants { ..Default::default() })?, + ) + .await + .map_err(Into::into) + } + + pub async fn list_sip_trunk( + &self, + filter: ListSIPTrunkFilter, + ) -> ServiceResult> { + let resp: proto::ListSipTrunkResponse = self + .client + .request( + SVC, + "ListSIPTrunk", + proto::ListSipTrunkRequest {}, + self.base.auth_header(VideoGrants { ..Default::default() })?, + ) + .await?; + + Ok(resp.items) + } + + pub async fn delete_sip_trunk(&self, sip_trunk_id: &str) -> ServiceResult { + self.client + .request( + SVC, + "DeleteSIPTrunk", + proto::DeleteSipTrunkRequest { sip_trunk_id: sip_trunk_id.to_owned() }, + self.base.auth_header(VideoGrants { ..Default::default() })?, + ) + .await + .map_err(Into::into) + } + + pub async fn create_sip_dispatch_rule( + &self, + rule: proto::sip_dispatch_rule::Rule, + options: CreateSIPDispatchRuleOptions, + ) -> ServiceResult { + self.client + .request( + SVC, + "CreateSIPDispatchRule", + proto::CreateSipDispatchRuleRequest { + trunk_ids: options.trunk_ids.to_owned(), + hide_phone_number: options.hide_phone_number, + rule: Some(proto::SipDispatchRule { rule: Some(rule.to_owned()) }), + }, + self.base.auth_header(VideoGrants { ..Default::default() })?, + ) + .await + .map_err(Into::into) + } + + pub async fn list_sip_dispatch_rule( + &self, + filter: ListSIPDispatchRuleFilter, + ) -> ServiceResult> { + let resp: proto::ListSipDispatchRuleResponse = self + .client + .request( + SVC, + "ListSIPDispatchRule", + proto::ListSipDispatchRuleRequest {}, + self.base.auth_header(VideoGrants { ..Default::default() })?, + ) + .await?; + + Ok(resp.items) + } + + pub async fn delete_sip_dispatch_rule( + &self, + sip_dispatch_rule_id: &str, + ) -> ServiceResult { + self.client + .request( + SVC, + "DeleteSIPDispatchRule", + proto::DeleteSipDispatchRuleRequest { + sip_dispatch_rule_id: sip_dispatch_rule_id.to_owned(), + }, + self.base.auth_header(VideoGrants { ..Default::default() })?, + ) + .await + .map_err(Into::into) + } + + pub async fn create_sip_participant( + &self, + sip_trunk_id: String, + call_to: String, + room_name: String, + options: CreateSIPParticipantOptions, + ) -> ServiceResult { + self.client + .request( + SVC, + "CreateSIPParticipant", + proto::CreateSipParticipantRequest { + sip_trunk_id: sip_trunk_id.to_owned(), + sip_call_to: call_to.to_owned(), + room_name: room_name.to_owned(), + participant_identity: options.participant_identity.to_owned(), + dtmf: options.dtmf.to_owned(), + play_ringtone: options.play_ringtone, + }, + self.base.auth_header(VideoGrants { ..Default::default() })?, + ) + .await + .map_err(Into::into) + } +} diff --git a/livekit-ffi/src/server/room.rs b/livekit-ffi/src/server/room.rs index 732cab2b7..67cf10df0 100644 --- a/livekit-ffi/src/server/room.rs +++ b/livekit-ffi/src/server/room.rs @@ -221,6 +221,7 @@ impl RoomInner { .into_iter() .map(|str| str.try_into().unwrap()) .collect(), + destination_identities: Vec::new(), // TODO }, async_id, }) { diff --git a/livekit-protocol/generate_proto.sh b/livekit-protocol/generate_proto.sh index 903cab1da..4ef8efaad 100755 --- a/livekit-protocol/generate_proto.sh +++ b/livekit-protocol/generate_proto.sh @@ -14,7 +14,7 @@ # limitations under the License. -PROTOCOL=protocol +PROTOCOL=protocol/protobufs OUT_RUST=src protoc \ @@ -28,4 +28,5 @@ protoc \ $PROTOCOL/livekit_rtc.proto \ $PROTOCOL/livekit_room.proto \ $PROTOCOL/livekit_webhook.proto \ - $PROTOCOL/livekit_models.proto + $PROTOCOL/livekit_sip.proto \ + $PROTOCOL/livekit_models.proto diff --git a/livekit-protocol/protocol b/livekit-protocol/protocol index 4f0d066ef..766ababa3 160000 --- a/livekit-protocol/protocol +++ b/livekit-protocol/protocol @@ -1 +1 @@ -Subproject commit 4f0d066ef6bb41e5954c90d86b60eda75a40543f +Subproject commit 766ababa37ae07121b4e6da25105b436f03c670c diff --git a/livekit-protocol/src/livekit.rs b/livekit-protocol/src/livekit.rs index 47a86ee62..760db090b 100644 --- a/livekit-protocol/src/livekit.rs +++ b/livekit-protocol/src/livekit.rs @@ -8,6 +8,8 @@ pub struct Room { pub name: ::prost::alloc::string::String, #[prost(uint32, tag="3")] pub empty_timeout: u32, + #[prost(uint32, tag="14")] + pub departure_timeout: u32, #[prost(uint32, tag="4")] pub max_participants: u32, #[prost(int64, tag="5")] @@ -300,9 +302,16 @@ pub struct VideoLayer { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct DataPacket { + #[deprecated] #[prost(enumeration="data_packet::Kind", tag="1")] pub kind: i32, - #[prost(oneof="data_packet::Value", tags="2, 3")] + /// participant identity of user that sent the message + #[prost(string, tag="4")] + pub participant_identity: ::prost::alloc::string::String, + /// identities of participants who will receive the message (sent to all by default) + #[prost(string, repeated, tag="5")] + pub destination_identities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(oneof="data_packet::Value", tags="2, 3, 6")] pub value: ::core::option::Option, } /// Nested message and enum types in `DataPacket`. @@ -340,6 +349,8 @@ pub mod data_packet { User(super::UserPacket), #[prost(message, tag="3")] Speaker(super::ActiveSpeakerUpdate), + #[prost(message, tag="6")] + SipDtmf(super::SipDtmf), } } #[allow(clippy::derive_partial_eq_without_eq)] @@ -364,17 +375,21 @@ pub struct SpeakerInfo { #[derive(Clone, PartialEq, ::prost::Message)] pub struct UserPacket { /// participant ID of user that sent the message + #[deprecated] #[prost(string, tag="1")] pub participant_sid: ::prost::alloc::string::String, + #[deprecated] #[prost(string, tag="5")] pub participant_identity: ::prost::alloc::string::String, /// user defined payload #[prost(bytes="vec", tag="2")] pub payload: ::prost::alloc::vec::Vec, /// the ID of the participants who will receive the message (sent to all by default) + #[deprecated] #[prost(string, repeated, tag="3")] pub destination_sids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// identities of participants who will receive the message (sent to all by default) + #[deprecated] #[prost(string, repeated, tag="6")] pub destination_identities: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, /// topic under which the message was published @@ -383,6 +398,14 @@ pub struct UserPacket { } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct SipDtmf { + #[prost(uint32, tag="3")] + pub code: u32, + #[prost(string, tag="4")] + pub digit: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct ParticipantTracks { /// participant ID of participant to whom the tracks belong #[prost(string, tag="1")] @@ -659,9 +682,11 @@ pub struct RtpStats { pub last_layer_lock_pli: ::core::option::Option<::pbjson_types::Timestamp>, #[prost(message, optional, tag="44")] pub packet_drift: ::core::option::Option, - /// NEXT_ID: 46 #[prost(message, optional, tag="45")] pub report_drift: ::core::option::Option, + /// NEXT_ID: 47 + #[prost(message, optional, tag="46")] + pub rebased_report_drift: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -1032,6 +1057,44 @@ impl SubscriptionError { } } } +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] +#[repr(i32)] +pub enum AudioTrackFeature { + TfStereo = 0, + TfNoDtx = 1, + TfAutoGainControl = 2, + TfEchoCancellation = 3, + TfNoiseSuppression = 4, + TfEnhancedNoiseCancellation = 5, +} +impl AudioTrackFeature { + /// String value of the enum field names used in the ProtoBuf definition. + /// + /// The values are not transformed in any way and thus are considered stable + /// (if the ProtoBuf definition does not change) and safe for programmatic use. + pub fn as_str_name(&self) -> &'static str { + match self { + AudioTrackFeature::TfStereo => "TF_STEREO", + AudioTrackFeature::TfNoDtx => "TF_NO_DTX", + AudioTrackFeature::TfAutoGainControl => "TF_AUTO_GAIN_CONTROL", + AudioTrackFeature::TfEchoCancellation => "TF_ECHO_CANCELLATION", + AudioTrackFeature::TfNoiseSuppression => "TF_NOISE_SUPPRESSION", + AudioTrackFeature::TfEnhancedNoiseCancellation => "TF_ENHANCED_NOISE_CANCELLATION", + } + } + /// Creates an enum from field names used in the ProtoBuf definition. + pub fn from_str_name(value: &str) -> ::core::option::Option { + match value { + "TF_STEREO" => Some(Self::TfStereo), + "TF_NO_DTX" => Some(Self::TfNoDtx), + "TF_AUTO_GAIN_CONTROL" => Some(Self::TfAutoGainControl), + "TF_ECHO_CANCELLATION" => Some(Self::TfEchoCancellation), + "TF_NOISE_SUPPRESSION" => Some(Self::TfNoiseSuppression), + "TF_ENHANCED_NOISE_CANCELLATION" => Some(Self::TfEnhancedNoiseCancellation), + _ => None, + } + } +} /// composite using a web browser #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -1419,6 +1482,8 @@ pub struct S3Upload { /// Content-Disposition header #[prost(string, tag="9")] pub content_disposition: ::prost::alloc::string::String, + #[prost(message, optional, tag="10")] + pub proxy: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -1428,6 +1493,8 @@ pub struct GcpUpload { pub credentials: ::prost::alloc::string::String, #[prost(string, tag="2")] pub bucket: ::prost::alloc::string::String, + #[prost(message, optional, tag="3")] + pub proxy: ::core::option::Option, } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] @@ -1455,6 +1522,16 @@ pub struct AliOssUpload { } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct ProxyConfig { + #[prost(string, tag="1")] + pub url: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub username: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub password: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct StreamOutput { /// required #[prost(enumeration="StreamProtocol", tag="1")] @@ -1563,6 +1640,8 @@ pub struct EgressInfo { pub ended_at: i64, #[prost(int64, tag="18")] pub updated_at: i64, + #[prost(string, tag="21")] + pub details: ::prost::alloc::string::String, #[prost(string, tag="9")] pub error: ::prost::alloc::string::String, #[prost(message, repeated, tag="15")] @@ -1988,7 +2067,7 @@ impl EgressStatus { #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct SignalRequest { - #[prost(oneof="signal_request::Message", tags="1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16")] + #[prost(oneof="signal_request::Message", tags="1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18")] pub message: ::core::option::Option, } /// Nested message and enum types in `SignalRequest`. @@ -2040,6 +2119,12 @@ pub mod signal_request { UpdateMetadata(super::UpdateParticipantMetadata), #[prost(message, tag="16")] PingReq(super::Ping), + /// Update local audio track settings + #[prost(message, tag="17")] + UpdateAudioTrack(super::UpdateLocalAudioTrack), + /// Update local video track settings + #[prost(message, tag="18")] + UpdateVideoTrack(super::UpdateLocalVideoTrack), } } #[allow(clippy::derive_partial_eq_without_eq)] @@ -2298,6 +2383,24 @@ pub struct UpdateTrackSettings { } #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateLocalAudioTrack { + #[prost(string, tag="1")] + pub track_sid: ::prost::alloc::string::String, + #[prost(enumeration="AudioTrackFeature", repeated, tag="2")] + pub features: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct UpdateLocalVideoTrack { + #[prost(string, tag="1")] + pub track_sid: ::prost::alloc::string::String, + #[prost(uint32, tag="2")] + pub width: u32, + #[prost(uint32, tag="3")] + pub height: u32, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] pub struct LeaveRequest { /// sent when server initiates the disconnect due to server-restart /// indicates clients should attempt full-reconnect sequence @@ -2673,6 +2776,9 @@ pub struct CreateRoomRequest { /// number of seconds to keep the room open if no one joins #[prost(uint32, tag="2")] pub empty_timeout: u32, + /// number of seconds to keep the room open after everyone leaves + #[prost(uint32, tag="10")] + pub departure_timeout: u32, /// limit number of participants that can be in a room #[prost(uint32, tag="3")] pub max_participants: u32, @@ -2690,7 +2796,7 @@ pub struct CreateRoomRequest { pub min_playout_delay: u32, #[prost(uint32, tag="8")] pub max_playout_delay: u32, - /// improves A/V sync when playout_delay set to a value larger than 200ms. It will disables transceiver re-use + /// improves A/V sync when playout_delay set to a value larger than 200ms. It will disables transceiver re-use /// so not recommended for rooms with frequent subscription changes #[prost(bool, tag="9")] pub sync_streams: bool, @@ -3267,5 +3373,205 @@ pub struct WebhookEvent { #[prost(int32, tag="11")] pub num_dropped: i32, } +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateSipTrunkRequest { + /// CIDR or IPs that traffic is accepted from + /// An empty list means all inbound traffic is accepted. + #[prost(string, repeated, tag="1")] + pub inbound_addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// IP that SIP INVITE is sent too + #[prost(string, tag="2")] + pub outbound_address: ::prost::alloc::string::String, + /// Number used to make outbound calls + #[prost(string, tag="3")] + pub outbound_number: ::prost::alloc::string::String, + #[deprecated] + #[prost(string, repeated, tag="4")] + pub inbound_numbers_regex: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Accepted `To` values. This Trunk will only accept a call made to + /// these numbers. This allows you to have distinct Trunks for different phone + /// numbers at the same provider. + #[prost(string, repeated, tag="9")] + pub inbound_numbers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Username and password used to authenticate inbound and outbound SIP invites + /// May be empty to have no Authentication + #[prost(string, tag="5")] + pub inbound_username: ::prost::alloc::string::String, + #[prost(string, tag="6")] + pub inbound_password: ::prost::alloc::string::String, + #[prost(string, tag="7")] + pub outbound_username: ::prost::alloc::string::String, + #[prost(string, tag="8")] + pub outbound_password: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SipTrunkInfo { + #[prost(string, tag="1")] + pub sip_trunk_id: ::prost::alloc::string::String, + /// CIDR or IPs that traffic is accepted from + /// An empty list means all inbound traffic is accepted. + #[prost(string, repeated, tag="2")] + pub inbound_addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// IP that SIP INVITE is sent too + #[prost(string, tag="3")] + pub outbound_address: ::prost::alloc::string::String, + /// Number used to make outbound calls + #[prost(string, tag="4")] + pub outbound_number: ::prost::alloc::string::String, + #[deprecated] + #[prost(string, repeated, tag="5")] + pub inbound_numbers_regex: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Accepted `To` values. This Trunk will only accept a call made to + /// these numbers. This allows you to have distinct Trunks for different phone + /// numbers at the same provider. + #[prost(string, repeated, tag="10")] + pub inbound_numbers: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// Username and password used to authenticate inbound and outbound SIP invites + /// May be empty to have no Authentication + #[prost(string, tag="6")] + pub inbound_username: ::prost::alloc::string::String, + #[prost(string, tag="7")] + pub inbound_password: ::prost::alloc::string::String, + #[prost(string, tag="8")] + pub outbound_username: ::prost::alloc::string::String, + #[prost(string, tag="9")] + pub outbound_password: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListSipTrunkRequest { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListSipTrunkResponse { + #[prost(message, repeated, tag="1")] + pub items: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteSipTrunkRequest { + #[prost(string, tag="1")] + pub sip_trunk_id: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SipDispatchRuleDirect { + /// What room should call be directed into + #[prost(string, tag="1")] + pub room_name: ::prost::alloc::string::String, + /// Optional pin required to enter room + #[prost(string, tag="2")] + pub pin: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SipDispatchRuleIndividual { + /// Prefix used on new room name + #[prost(string, tag="1")] + pub room_prefix: ::prost::alloc::string::String, + /// Optional pin required to enter room + #[prost(string, tag="2")] + pub pin: ::prost::alloc::string::String, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SipDispatchRule { + #[prost(oneof="sip_dispatch_rule::Rule", tags="1, 2")] + pub rule: ::core::option::Option, +} +/// Nested message and enum types in `SIPDispatchRule`. +pub mod sip_dispatch_rule { + #[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Oneof)] + pub enum Rule { + /// SIPDispatchRuleDirect is a `SIP Dispatch Rule` that puts a user directly into a room + /// This places users into an existing room. Optionally you can require a pin before a user can + /// enter the room + #[prost(message, tag="1")] + DispatchRuleDirect(super::SipDispatchRuleDirect), + /// SIPDispatchRuleIndividual is a `SIP Dispatch Rule` that creates a new room for each caller. + #[prost(message, tag="2")] + DispatchRuleIndividual(super::SipDispatchRuleIndividual), + } +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateSipDispatchRuleRequest { + #[prost(message, optional, tag="1")] + pub rule: ::core::option::Option, + /// What trunks are accepted for this dispatch rule + /// If empty all trunks will match this dispatch rule + #[prost(string, repeated, tag="2")] + pub trunk_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + /// By default the From value (Phone number) is used as the participant identity + /// If true a random value will be used instead + #[prost(bool, tag="3")] + pub hide_phone_number: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SipDispatchRuleInfo { + #[prost(string, tag="1")] + pub sip_dispatch_rule_id: ::prost::alloc::string::String, + #[prost(message, optional, tag="2")] + pub rule: ::core::option::Option, + #[prost(string, repeated, tag="3")] + pub trunk_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, + #[prost(bool, tag="4")] + pub hide_phone_number: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListSipDispatchRuleRequest { +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct ListSipDispatchRuleResponse { + #[prost(message, repeated, tag="1")] + pub items: ::prost::alloc::vec::Vec, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct DeleteSipDispatchRuleRequest { + #[prost(string, tag="1")] + pub sip_dispatch_rule_id: ::prost::alloc::string::String, +} +/// A SIP Participant is a singular SIP session connected to a LiveKit room via +/// a SIP Trunk into a SIP DispatchRule +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct CreateSipParticipantRequest { + /// What SIP Trunk should be used to dial the user + #[prost(string, tag="1")] + pub sip_trunk_id: ::prost::alloc::string::String, + /// What number should be dialed via SIP + #[prost(string, tag="2")] + pub sip_call_to: ::prost::alloc::string::String, + /// What LiveKit room should this participant be connected too + #[prost(string, tag="3")] + pub room_name: ::prost::alloc::string::String, + /// Optional identity of the participant in LiveKit room + #[prost(string, tag="4")] + pub participant_identity: ::prost::alloc::string::String, + /// Optionally send following DTMF digits (extension codes) when making a call. + /// Character 'w' can be used to add a 0.5 sec delay. + #[prost(string, tag="5")] + pub dtmf: ::prost::alloc::string::String, + /// Optionally play ringtone in the room as an audible indicator for existing participants + #[prost(bool, tag="6")] + pub play_ringtone: bool, +} +#[allow(clippy::derive_partial_eq_without_eq)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct SipParticipantInfo { + #[prost(string, tag="1")] + pub participant_id: ::prost::alloc::string::String, + #[prost(string, tag="2")] + pub participant_identity: ::prost::alloc::string::String, + #[prost(string, tag="3")] + pub room_name: ::prost::alloc::string::String, +} include!("livekit.serde.rs"); // @@protoc_insertion_point(module) diff --git a/livekit-protocol/src/livekit.serde.rs b/livekit-protocol/src/livekit.serde.rs index ecbec62e3..93b2e848d 100644 --- a/livekit-protocol/src/livekit.serde.rs +++ b/livekit-protocol/src/livekit.serde.rs @@ -678,6 +678,89 @@ impl<'de> serde::Deserialize<'de> for AudioCodec { deserializer.deserialize_any(GeneratedVisitor) } } +impl serde::Serialize for AudioTrackFeature { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::TfStereo => "TF_STEREO", + Self::TfNoDtx => "TF_NO_DTX", + Self::TfAutoGainControl => "TF_AUTO_GAIN_CONTROL", + Self::TfEchoCancellation => "TF_ECHO_CANCELLATION", + Self::TfNoiseSuppression => "TF_NOISE_SUPPRESSION", + Self::TfEnhancedNoiseCancellation => "TF_ENHANCED_NOISE_CANCELLATION", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for AudioTrackFeature { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "TF_STEREO", + "TF_NO_DTX", + "TF_AUTO_GAIN_CONTROL", + "TF_ECHO_CANCELLATION", + "TF_NOISE_SUPPRESSION", + "TF_ENHANCED_NOISE_CANCELLATION", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = AudioTrackFeature; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "TF_STEREO" => Ok(AudioTrackFeature::TfStereo), + "TF_NO_DTX" => Ok(AudioTrackFeature::TfNoDtx), + "TF_AUTO_GAIN_CONTROL" => Ok(AudioTrackFeature::TfAutoGainControl), + "TF_ECHO_CANCELLATION" => Ok(AudioTrackFeature::TfEchoCancellation), + "TF_NOISE_SUPPRESSION" => Ok(AudioTrackFeature::TfNoiseSuppression), + "TF_ENHANCED_NOISE_CANCELLATION" => Ok(AudioTrackFeature::TfEnhancedNoiseCancellation), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} impl serde::Serialize for AutoParticipantEgress { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result @@ -2481,6 +2564,9 @@ impl serde::Serialize for CreateRoomRequest { if self.empty_timeout != 0 { len += 1; } + if self.departure_timeout != 0 { + len += 1; + } if self.max_participants != 0 { len += 1; } @@ -2509,6 +2595,9 @@ impl serde::Serialize for CreateRoomRequest { if self.empty_timeout != 0 { struct_ser.serialize_field("emptyTimeout", &self.empty_timeout)?; } + if self.departure_timeout != 0 { + struct_ser.serialize_field("departureTimeout", &self.departure_timeout)?; + } if self.max_participants != 0 { struct_ser.serialize_field("maxParticipants", &self.max_participants)?; } @@ -2543,6 +2632,8 @@ impl<'de> serde::Deserialize<'de> for CreateRoomRequest { "name", "empty_timeout", "emptyTimeout", + "departure_timeout", + "departureTimeout", "max_participants", "maxParticipants", "node_id", @@ -2561,6 +2652,7 @@ impl<'de> serde::Deserialize<'de> for CreateRoomRequest { enum GeneratedField { Name, EmptyTimeout, + DepartureTimeout, MaxParticipants, NodeId, Metadata, @@ -2592,6 +2684,7 @@ impl<'de> serde::Deserialize<'de> for CreateRoomRequest { match value { "name" => Ok(GeneratedField::Name), "emptyTimeout" | "empty_timeout" => Ok(GeneratedField::EmptyTimeout), + "departureTimeout" | "departure_timeout" => Ok(GeneratedField::DepartureTimeout), "maxParticipants" | "max_participants" => Ok(GeneratedField::MaxParticipants), "nodeId" | "node_id" => Ok(GeneratedField::NodeId), "metadata" => Ok(GeneratedField::Metadata), @@ -2620,6 +2713,7 @@ impl<'de> serde::Deserialize<'de> for CreateRoomRequest { { let mut name__ = None; let mut empty_timeout__ = None; + let mut departure_timeout__ = None; let mut max_participants__ = None; let mut node_id__ = None; let mut metadata__ = None; @@ -2643,6 +2737,14 @@ impl<'de> serde::Deserialize<'de> for CreateRoomRequest { Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } + GeneratedField::DepartureTimeout => { + if departure_timeout__.is_some() { + return Err(serde::de::Error::duplicate_field("departureTimeout")); + } + departure_timeout__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } GeneratedField::MaxParticipants => { if max_participants__.is_some() { return Err(serde::de::Error::duplicate_field("maxParticipants")); @@ -2699,6 +2801,7 @@ impl<'de> serde::Deserialize<'de> for CreateRoomRequest { Ok(CreateRoomRequest { name: name__.unwrap_or_default(), empty_timeout: empty_timeout__.unwrap_or_default(), + departure_timeout: departure_timeout__.unwrap_or_default(), max_participants: max_participants__.unwrap_or_default(), node_id: node_id__.unwrap_or_default(), metadata: metadata__.unwrap_or_default(), @@ -2712,7 +2815,7 @@ impl<'de> serde::Deserialize<'de> for CreateRoomRequest { deserializer.deserialize_struct("livekit.CreateRoomRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for DataChannelInfo { +impl serde::Serialize for CreateSipDispatchRuleRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -2720,47 +2823,47 @@ impl serde::Serialize for DataChannelInfo { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.label.is_empty() { + if self.rule.is_some() { len += 1; } - if self.id != 0 { + if !self.trunk_ids.is_empty() { len += 1; } - if self.target != 0 { + if self.hide_phone_number { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.DataChannelInfo", len)?; - if !self.label.is_empty() { - struct_ser.serialize_field("label", &self.label)?; + let mut struct_ser = serializer.serialize_struct("livekit.CreateSIPDispatchRuleRequest", len)?; + if let Some(v) = self.rule.as_ref() { + struct_ser.serialize_field("rule", v)?; } - if self.id != 0 { - struct_ser.serialize_field("id", &self.id)?; + if !self.trunk_ids.is_empty() { + struct_ser.serialize_field("trunkIds", &self.trunk_ids)?; } - if self.target != 0 { - let v = SignalTarget::try_from(self.target) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.target)))?; - struct_ser.serialize_field("target", &v)?; + if self.hide_phone_number { + struct_ser.serialize_field("hidePhoneNumber", &self.hide_phone_number)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for DataChannelInfo { +impl<'de> serde::Deserialize<'de> for CreateSipDispatchRuleRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "label", - "id", - "target", + "rule", + "trunk_ids", + "trunkIds", + "hide_phone_number", + "hidePhoneNumber", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Label, - Id, - Target, + Rule, + TrunkIds, + HidePhoneNumber, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -2783,9 +2886,9 @@ impl<'de> serde::Deserialize<'de> for DataChannelInfo { E: serde::de::Error, { match value { - "label" => Ok(GeneratedField::Label), - "id" => Ok(GeneratedField::Id), - "target" => Ok(GeneratedField::Target), + "rule" => Ok(GeneratedField::Rule), + "trunkIds" | "trunk_ids" => Ok(GeneratedField::TrunkIds), + "hidePhoneNumber" | "hide_phone_number" => Ok(GeneratedField::HidePhoneNumber), _ => Ok(GeneratedField::__SkipField__), } } @@ -2795,57 +2898,55 @@ impl<'de> serde::Deserialize<'de> for DataChannelInfo { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DataChannelInfo; + type Value = CreateSipDispatchRuleRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.DataChannelInfo") + formatter.write_str("struct livekit.CreateSIPDispatchRuleRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut label__ = None; - let mut id__ = None; - let mut target__ = None; + let mut rule__ = None; + let mut trunk_ids__ = None; + let mut hide_phone_number__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Label => { - if label__.is_some() { - return Err(serde::de::Error::duplicate_field("label")); + GeneratedField::Rule => { + if rule__.is_some() { + return Err(serde::de::Error::duplicate_field("rule")); } - label__ = Some(map_.next_value()?); + rule__ = map_.next_value()?; } - GeneratedField::Id => { - if id__.is_some() { - return Err(serde::de::Error::duplicate_field("id")); + GeneratedField::TrunkIds => { + if trunk_ids__.is_some() { + return Err(serde::de::Error::duplicate_field("trunkIds")); } - id__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + trunk_ids__ = Some(map_.next_value()?); } - GeneratedField::Target => { - if target__.is_some() { - return Err(serde::de::Error::duplicate_field("target")); + GeneratedField::HidePhoneNumber => { + if hide_phone_number__.is_some() { + return Err(serde::de::Error::duplicate_field("hidePhoneNumber")); } - target__ = Some(map_.next_value::()? as i32); + hide_phone_number__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(DataChannelInfo { - label: label__.unwrap_or_default(), - id: id__.unwrap_or_default(), - target: target__.unwrap_or_default(), + Ok(CreateSipDispatchRuleRequest { + rule: rule__, + trunk_ids: trunk_ids__.unwrap_or_default(), + hide_phone_number: hide_phone_number__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.DataChannelInfo", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.CreateSIPDispatchRuleRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for DataPacket { +impl serde::Serialize for CreateSipParticipantRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -2853,48 +2954,74 @@ impl serde::Serialize for DataPacket { { use serde::ser::SerializeStruct; let mut len = 0; - if self.kind != 0 { + if !self.sip_trunk_id.is_empty() { len += 1; } - if self.value.is_some() { + if !self.sip_call_to.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.DataPacket", len)?; - if self.kind != 0 { - let v = data_packet::Kind::try_from(self.kind) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.kind)))?; - struct_ser.serialize_field("kind", &v)?; + if !self.room_name.is_empty() { + len += 1; } - if let Some(v) = self.value.as_ref() { - match v { - data_packet::Value::User(v) => { - struct_ser.serialize_field("user", v)?; - } - data_packet::Value::Speaker(v) => { - struct_ser.serialize_field("speaker", v)?; - } - } + if !self.participant_identity.is_empty() { + len += 1; + } + if !self.dtmf.is_empty() { + len += 1; + } + if self.play_ringtone { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.CreateSIPParticipantRequest", len)?; + if !self.sip_trunk_id.is_empty() { + struct_ser.serialize_field("sipTrunkId", &self.sip_trunk_id)?; + } + if !self.sip_call_to.is_empty() { + struct_ser.serialize_field("sipCallTo", &self.sip_call_to)?; + } + if !self.room_name.is_empty() { + struct_ser.serialize_field("roomName", &self.room_name)?; + } + if !self.participant_identity.is_empty() { + struct_ser.serialize_field("participantIdentity", &self.participant_identity)?; + } + if !self.dtmf.is_empty() { + struct_ser.serialize_field("dtmf", &self.dtmf)?; + } + if self.play_ringtone { + struct_ser.serialize_field("playRingtone", &self.play_ringtone)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for DataPacket { +impl<'de> serde::Deserialize<'de> for CreateSipParticipantRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "kind", - "user", - "speaker", + "sip_trunk_id", + "sipTrunkId", + "sip_call_to", + "sipCallTo", + "room_name", + "roomName", + "participant_identity", + "participantIdentity", + "dtmf", + "play_ringtone", + "playRingtone", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Kind, - User, - Speaker, + SipTrunkId, + SipCallTo, + RoomName, + ParticipantIdentity, + Dtmf, + PlayRingtone, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -2917,9 +3044,12 @@ impl<'de> serde::Deserialize<'de> for DataPacket { E: serde::de::Error, { match value { - "kind" => Ok(GeneratedField::Kind), - "user" => Ok(GeneratedField::User), - "speaker" => Ok(GeneratedField::Speaker), + "sipTrunkId" | "sip_trunk_id" => Ok(GeneratedField::SipTrunkId), + "sipCallTo" | "sip_call_to" => Ok(GeneratedField::SipCallTo), + "roomName" | "room_name" => Ok(GeneratedField::RoomName), + "participantIdentity" | "participant_identity" => Ok(GeneratedField::ParticipantIdentity), + "dtmf" => Ok(GeneratedField::Dtmf), + "playRingtone" | "play_ringtone" => Ok(GeneratedField::PlayRingtone), _ => Ok(GeneratedField::__SkipField__), } } @@ -2929,157 +3059,182 @@ impl<'de> serde::Deserialize<'de> for DataPacket { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DataPacket; + type Value = CreateSipParticipantRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.DataPacket") + formatter.write_str("struct livekit.CreateSIPParticipantRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut kind__ = None; - let mut value__ = None; + let mut sip_trunk_id__ = None; + let mut sip_call_to__ = None; + let mut room_name__ = None; + let mut participant_identity__ = None; + let mut dtmf__ = None; + let mut play_ringtone__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Kind => { - if kind__.is_some() { - return Err(serde::de::Error::duplicate_field("kind")); + GeneratedField::SipTrunkId => { + if sip_trunk_id__.is_some() { + return Err(serde::de::Error::duplicate_field("sipTrunkId")); } - kind__ = Some(map_.next_value::()? as i32); + sip_trunk_id__ = Some(map_.next_value()?); } - GeneratedField::User => { - if value__.is_some() { - return Err(serde::de::Error::duplicate_field("user")); + GeneratedField::SipCallTo => { + if sip_call_to__.is_some() { + return Err(serde::de::Error::duplicate_field("sipCallTo")); } - value__ = map_.next_value::<::std::option::Option<_>>()?.map(data_packet::Value::User) -; + sip_call_to__ = Some(map_.next_value()?); } - GeneratedField::Speaker => { - if value__.is_some() { - return Err(serde::de::Error::duplicate_field("speaker")); + GeneratedField::RoomName => { + if room_name__.is_some() { + return Err(serde::de::Error::duplicate_field("roomName")); } - value__ = map_.next_value::<::std::option::Option<_>>()?.map(data_packet::Value::Speaker) -; + room_name__ = Some(map_.next_value()?); + } + GeneratedField::ParticipantIdentity => { + if participant_identity__.is_some() { + return Err(serde::de::Error::duplicate_field("participantIdentity")); + } + participant_identity__ = Some(map_.next_value()?); + } + GeneratedField::Dtmf => { + if dtmf__.is_some() { + return Err(serde::de::Error::duplicate_field("dtmf")); + } + dtmf__ = Some(map_.next_value()?); + } + GeneratedField::PlayRingtone => { + if play_ringtone__.is_some() { + return Err(serde::de::Error::duplicate_field("playRingtone")); + } + play_ringtone__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(DataPacket { - kind: kind__.unwrap_or_default(), - value: value__, + Ok(CreateSipParticipantRequest { + sip_trunk_id: sip_trunk_id__.unwrap_or_default(), + sip_call_to: sip_call_to__.unwrap_or_default(), + room_name: room_name__.unwrap_or_default(), + participant_identity: participant_identity__.unwrap_or_default(), + dtmf: dtmf__.unwrap_or_default(), + play_ringtone: play_ringtone__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.DataPacket", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.CreateSIPParticipantRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for data_packet::Kind { +impl serde::Serialize for CreateSipTrunkRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { - let variant = match self { - Self::Reliable => "RELIABLE", - Self::Lossy => "LOSSY", - }; - serializer.serialize_str(variant) + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.inbound_addresses.is_empty() { + len += 1; + } + if !self.outbound_address.is_empty() { + len += 1; + } + if !self.outbound_number.is_empty() { + len += 1; + } + if !self.inbound_numbers_regex.is_empty() { + len += 1; + } + if !self.inbound_numbers.is_empty() { + len += 1; + } + if !self.inbound_username.is_empty() { + len += 1; + } + if !self.inbound_password.is_empty() { + len += 1; + } + if !self.outbound_username.is_empty() { + len += 1; + } + if !self.outbound_password.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.CreateSIPTrunkRequest", len)?; + if !self.inbound_addresses.is_empty() { + struct_ser.serialize_field("inboundAddresses", &self.inbound_addresses)?; + } + if !self.outbound_address.is_empty() { + struct_ser.serialize_field("outboundAddress", &self.outbound_address)?; + } + if !self.outbound_number.is_empty() { + struct_ser.serialize_field("outboundNumber", &self.outbound_number)?; + } + if !self.inbound_numbers_regex.is_empty() { + struct_ser.serialize_field("inboundNumbersRegex", &self.inbound_numbers_regex)?; + } + if !self.inbound_numbers.is_empty() { + struct_ser.serialize_field("inboundNumbers", &self.inbound_numbers)?; + } + if !self.inbound_username.is_empty() { + struct_ser.serialize_field("inboundUsername", &self.inbound_username)?; + } + if !self.inbound_password.is_empty() { + struct_ser.serialize_field("inboundPassword", &self.inbound_password)?; + } + if !self.outbound_username.is_empty() { + struct_ser.serialize_field("outboundUsername", &self.outbound_username)?; + } + if !self.outbound_password.is_empty() { + struct_ser.serialize_field("outboundPassword", &self.outbound_password)?; + } + struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for data_packet::Kind { +impl<'de> serde::Deserialize<'de> for CreateSipTrunkRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "RELIABLE", - "LOSSY", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = data_packet::Kind; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "RELIABLE" => Ok(data_packet::Kind::Reliable), - "LOSSY" => Ok(data_packet::Kind::Lossy), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for DeleteIngressRequest { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if !self.ingress_id.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("livekit.DeleteIngressRequest", len)?; - if !self.ingress_id.is_empty() { - struct_ser.serialize_field("ingressId", &self.ingress_id)?; - } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for DeleteIngressRequest { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "ingress_id", - "ingressId", + "inbound_addresses", + "inboundAddresses", + "outbound_address", + "outboundAddress", + "outbound_number", + "outboundNumber", + "inbound_numbers_regex", + "inboundNumbersRegex", + "inbound_numbers", + "inboundNumbers", + "inbound_username", + "inboundUsername", + "inbound_password", + "inboundPassword", + "outbound_username", + "outboundUsername", + "outbound_password", + "outboundPassword", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - IngressId, + InboundAddresses, + OutboundAddress, + OutboundNumber, + InboundNumbersRegex, + InboundNumbers, + InboundUsername, + InboundPassword, + OutboundUsername, + OutboundPassword, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -3102,7 +3257,15 @@ impl<'de> serde::Deserialize<'de> for DeleteIngressRequest { E: serde::de::Error, { match value { - "ingressId" | "ingress_id" => Ok(GeneratedField::IngressId), + "inboundAddresses" | "inbound_addresses" => Ok(GeneratedField::InboundAddresses), + "outboundAddress" | "outbound_address" => Ok(GeneratedField::OutboundAddress), + "outboundNumber" | "outbound_number" => Ok(GeneratedField::OutboundNumber), + "inboundNumbersRegex" | "inbound_numbers_regex" => Ok(GeneratedField::InboundNumbersRegex), + "inboundNumbers" | "inbound_numbers" => Ok(GeneratedField::InboundNumbers), + "inboundUsername" | "inbound_username" => Ok(GeneratedField::InboundUsername), + "inboundPassword" | "inbound_password" => Ok(GeneratedField::InboundPassword), + "outboundUsername" | "outbound_username" => Ok(GeneratedField::OutboundUsername), + "outboundPassword" | "outbound_password" => Ok(GeneratedField::OutboundPassword), _ => Ok(GeneratedField::__SkipField__), } } @@ -3112,39 +3275,103 @@ impl<'de> serde::Deserialize<'de> for DeleteIngressRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DeleteIngressRequest; + type Value = CreateSipTrunkRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.DeleteIngressRequest") + formatter.write_str("struct livekit.CreateSIPTrunkRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut ingress_id__ = None; + let mut inbound_addresses__ = None; + let mut outbound_address__ = None; + let mut outbound_number__ = None; + let mut inbound_numbers_regex__ = None; + let mut inbound_numbers__ = None; + let mut inbound_username__ = None; + let mut inbound_password__ = None; + let mut outbound_username__ = None; + let mut outbound_password__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::IngressId => { - if ingress_id__.is_some() { - return Err(serde::de::Error::duplicate_field("ingressId")); + GeneratedField::InboundAddresses => { + if inbound_addresses__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundAddresses")); } - ingress_id__ = Some(map_.next_value()?); + inbound_addresses__ = Some(map_.next_value()?); + } + GeneratedField::OutboundAddress => { + if outbound_address__.is_some() { + return Err(serde::de::Error::duplicate_field("outboundAddress")); + } + outbound_address__ = Some(map_.next_value()?); + } + GeneratedField::OutboundNumber => { + if outbound_number__.is_some() { + return Err(serde::de::Error::duplicate_field("outboundNumber")); + } + outbound_number__ = Some(map_.next_value()?); + } + GeneratedField::InboundNumbersRegex => { + if inbound_numbers_regex__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundNumbersRegex")); + } + inbound_numbers_regex__ = Some(map_.next_value()?); + } + GeneratedField::InboundNumbers => { + if inbound_numbers__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundNumbers")); + } + inbound_numbers__ = Some(map_.next_value()?); + } + GeneratedField::InboundUsername => { + if inbound_username__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundUsername")); + } + inbound_username__ = Some(map_.next_value()?); + } + GeneratedField::InboundPassword => { + if inbound_password__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundPassword")); + } + inbound_password__ = Some(map_.next_value()?); + } + GeneratedField::OutboundUsername => { + if outbound_username__.is_some() { + return Err(serde::de::Error::duplicate_field("outboundUsername")); + } + outbound_username__ = Some(map_.next_value()?); + } + GeneratedField::OutboundPassword => { + if outbound_password__.is_some() { + return Err(serde::de::Error::duplicate_field("outboundPassword")); + } + outbound_password__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(DeleteIngressRequest { - ingress_id: ingress_id__.unwrap_or_default(), + Ok(CreateSipTrunkRequest { + inbound_addresses: inbound_addresses__.unwrap_or_default(), + outbound_address: outbound_address__.unwrap_or_default(), + outbound_number: outbound_number__.unwrap_or_default(), + inbound_numbers_regex: inbound_numbers_regex__.unwrap_or_default(), + inbound_numbers: inbound_numbers__.unwrap_or_default(), + inbound_username: inbound_username__.unwrap_or_default(), + inbound_password: inbound_password__.unwrap_or_default(), + outbound_username: outbound_username__.unwrap_or_default(), + outbound_password: outbound_password__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.DeleteIngressRequest", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.CreateSIPTrunkRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for DeleteRoomRequest { +impl serde::Serialize for DataChannelInfo { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -3152,29 +3379,47 @@ impl serde::Serialize for DeleteRoomRequest { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.room.is_empty() { + if !self.label.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.DeleteRoomRequest", len)?; - if !self.room.is_empty() { - struct_ser.serialize_field("room", &self.room)?; + if self.id != 0 { + len += 1; + } + if self.target != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.DataChannelInfo", len)?; + if !self.label.is_empty() { + struct_ser.serialize_field("label", &self.label)?; + } + if self.id != 0 { + struct_ser.serialize_field("id", &self.id)?; + } + if self.target != 0 { + let v = SignalTarget::try_from(self.target) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.target)))?; + struct_ser.serialize_field("target", &v)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for DeleteRoomRequest { +impl<'de> serde::Deserialize<'de> for DataChannelInfo { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "room", + "label", + "id", + "target", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Room, + Label, + Id, + Target, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -3197,7 +3442,9 @@ impl<'de> serde::Deserialize<'de> for DeleteRoomRequest { E: serde::de::Error, { match value { - "room" => Ok(GeneratedField::Room), + "label" => Ok(GeneratedField::Label), + "id" => Ok(GeneratedField::Id), + "target" => Ok(GeneratedField::Target), _ => Ok(GeneratedField::__SkipField__), } } @@ -3207,61 +3454,130 @@ impl<'de> serde::Deserialize<'de> for DeleteRoomRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DeleteRoomRequest; + type Value = DataChannelInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.DeleteRoomRequest") + formatter.write_str("struct livekit.DataChannelInfo") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut room__ = None; + let mut label__ = None; + let mut id__ = None; + let mut target__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Room => { - if room__.is_some() { - return Err(serde::de::Error::duplicate_field("room")); + GeneratedField::Label => { + if label__.is_some() { + return Err(serde::de::Error::duplicate_field("label")); } - room__ = Some(map_.next_value()?); + label__ = Some(map_.next_value()?); + } + GeneratedField::Id => { + if id__.is_some() { + return Err(serde::de::Error::duplicate_field("id")); + } + id__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Target => { + if target__.is_some() { + return Err(serde::de::Error::duplicate_field("target")); + } + target__ = Some(map_.next_value::()? as i32); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(DeleteRoomRequest { - room: room__.unwrap_or_default(), + Ok(DataChannelInfo { + label: label__.unwrap_or_default(), + id: id__.unwrap_or_default(), + target: target__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.DeleteRoomRequest", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.DataChannelInfo", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for DeleteRoomResponse { +impl serde::Serialize for DataPacket { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; - let len = 0; - let struct_ser = serializer.serialize_struct("livekit.DeleteRoomResponse", len)?; + let mut len = 0; + if self.kind != 0 { + len += 1; + } + if !self.participant_identity.is_empty() { + len += 1; + } + if !self.destination_identities.is_empty() { + len += 1; + } + if self.value.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.DataPacket", len)?; + if self.kind != 0 { + let v = data_packet::Kind::try_from(self.kind) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.kind)))?; + struct_ser.serialize_field("kind", &v)?; + } + if !self.participant_identity.is_empty() { + struct_ser.serialize_field("participantIdentity", &self.participant_identity)?; + } + if !self.destination_identities.is_empty() { + struct_ser.serialize_field("destinationIdentities", &self.destination_identities)?; + } + if let Some(v) = self.value.as_ref() { + match v { + data_packet::Value::User(v) => { + struct_ser.serialize_field("user", v)?; + } + data_packet::Value::Speaker(v) => { + struct_ser.serialize_field("speaker", v)?; + } + data_packet::Value::SipDtmf(v) => { + struct_ser.serialize_field("sipDtmf", v)?; + } + } + } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for DeleteRoomResponse { +impl<'de> serde::Deserialize<'de> for DataPacket { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ + "kind", + "participant_identity", + "participantIdentity", + "destination_identities", + "destinationIdentities", + "user", + "speaker", + "sip_dtmf", + "sipDtmf", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { + Kind, + ParticipantIdentity, + DestinationIdentities, + User, + Speaker, + SipDtmf, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -3283,7 +3599,15 @@ impl<'de> serde::Deserialize<'de> for DeleteRoomResponse { where E: serde::de::Error, { - Ok(GeneratedField::__SkipField__) + match value { + "kind" => Ok(GeneratedField::Kind), + "participantIdentity" | "participant_identity" => Ok(GeneratedField::ParticipantIdentity), + "destinationIdentities" | "destination_identities" => Ok(GeneratedField::DestinationIdentities), + "user" => Ok(GeneratedField::User), + "speaker" => Ok(GeneratedField::Speaker), + "sipDtmf" | "sip_dtmf" => Ok(GeneratedField::SipDtmf), + _ => Ok(GeneratedField::__SkipField__), + } } } deserializer.deserialize_identifier(GeneratedVisitor) @@ -3291,27 +3615,149 @@ impl<'de> serde::Deserialize<'de> for DeleteRoomResponse { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DeleteRoomResponse; + type Value = DataPacket; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.DeleteRoomResponse") + formatter.write_str("struct livekit.DataPacket") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - while map_.next_key::()?.is_some() { - let _ = map_.next_value::()?; - } - Ok(DeleteRoomResponse { - }) - } - } - deserializer.deserialize_struct("livekit.DeleteRoomResponse", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for DirectFileOutput { + let mut kind__ = None; + let mut participant_identity__ = None; + let mut destination_identities__ = None; + let mut value__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Kind => { + if kind__.is_some() { + return Err(serde::de::Error::duplicate_field("kind")); + } + kind__ = Some(map_.next_value::()? as i32); + } + GeneratedField::ParticipantIdentity => { + if participant_identity__.is_some() { + return Err(serde::de::Error::duplicate_field("participantIdentity")); + } + participant_identity__ = Some(map_.next_value()?); + } + GeneratedField::DestinationIdentities => { + if destination_identities__.is_some() { + return Err(serde::de::Error::duplicate_field("destinationIdentities")); + } + destination_identities__ = Some(map_.next_value()?); + } + GeneratedField::User => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("user")); + } + value__ = map_.next_value::<::std::option::Option<_>>()?.map(data_packet::Value::User) +; + } + GeneratedField::Speaker => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("speaker")); + } + value__ = map_.next_value::<::std::option::Option<_>>()?.map(data_packet::Value::Speaker) +; + } + GeneratedField::SipDtmf => { + if value__.is_some() { + return Err(serde::de::Error::duplicate_field("sipDtmf")); + } + value__ = map_.next_value::<::std::option::Option<_>>()?.map(data_packet::Value::SipDtmf) +; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(DataPacket { + kind: kind__.unwrap_or_default(), + participant_identity: participant_identity__.unwrap_or_default(), + destination_identities: destination_identities__.unwrap_or_default(), + value: value__, + }) + } + } + deserializer.deserialize_struct("livekit.DataPacket", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for data_packet::Kind { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Reliable => "RELIABLE", + Self::Lossy => "LOSSY", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for data_packet::Kind { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "RELIABLE", + "LOSSY", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = data_packet::Kind; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "RELIABLE" => Ok(data_packet::Kind::Reliable), + "LOSSY" => Ok(data_packet::Kind::Lossy), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +impl serde::Serialize for DeleteIngressRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -3319,65 +3765,30 @@ impl serde::Serialize for DirectFileOutput { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.filepath.is_empty() { - len += 1; - } - if self.disable_manifest { - len += 1; - } - if self.output.is_some() { + if !self.ingress_id.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.DirectFileOutput", len)?; - if !self.filepath.is_empty() { - struct_ser.serialize_field("filepath", &self.filepath)?; - } - if self.disable_manifest { - struct_ser.serialize_field("disableManifest", &self.disable_manifest)?; - } - if let Some(v) = self.output.as_ref() { - match v { - direct_file_output::Output::S3(v) => { - struct_ser.serialize_field("s3", v)?; - } - direct_file_output::Output::Gcp(v) => { - struct_ser.serialize_field("gcp", v)?; - } - direct_file_output::Output::Azure(v) => { - struct_ser.serialize_field("azure", v)?; - } - direct_file_output::Output::AliOss(v) => { - struct_ser.serialize_field("aliOSS", v)?; - } - } + let mut struct_ser = serializer.serialize_struct("livekit.DeleteIngressRequest", len)?; + if !self.ingress_id.is_empty() { + struct_ser.serialize_field("ingressId", &self.ingress_id)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for DirectFileOutput { +impl<'de> serde::Deserialize<'de> for DeleteIngressRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "filepath", - "disable_manifest", - "disableManifest", - "s3", - "gcp", - "azure", - "aliOSS", + "ingress_id", + "ingressId", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Filepath, - DisableManifest, - S3, - Gcp, - Azure, - AliOss, + IngressId, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -3400,12 +3811,7 @@ impl<'de> serde::Deserialize<'de> for DirectFileOutput { E: serde::de::Error, { match value { - "filepath" => Ok(GeneratedField::Filepath), - "disableManifest" | "disable_manifest" => Ok(GeneratedField::DisableManifest), - "s3" => Ok(GeneratedField::S3), - "gcp" => Ok(GeneratedField::Gcp), - "azure" => Ok(GeneratedField::Azure), - "aliOSS" => Ok(GeneratedField::AliOss), + "ingressId" | "ingress_id" => Ok(GeneratedField::IngressId), _ => Ok(GeneratedField::__SkipField__), } } @@ -3415,77 +3821,39 @@ impl<'de> serde::Deserialize<'de> for DirectFileOutput { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DirectFileOutput; + type Value = DeleteIngressRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.DirectFileOutput") + formatter.write_str("struct livekit.DeleteIngressRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut filepath__ = None; - let mut disable_manifest__ = None; - let mut output__ = None; + let mut ingress_id__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Filepath => { - if filepath__.is_some() { - return Err(serde::de::Error::duplicate_field("filepath")); - } - filepath__ = Some(map_.next_value()?); - } - GeneratedField::DisableManifest => { - if disable_manifest__.is_some() { - return Err(serde::de::Error::duplicate_field("disableManifest")); - } - disable_manifest__ = Some(map_.next_value()?); - } - GeneratedField::S3 => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("s3")); - } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_file_output::Output::S3) -; - } - GeneratedField::Gcp => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("gcp")); - } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_file_output::Output::Gcp) -; - } - GeneratedField::Azure => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("azure")); - } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_file_output::Output::Azure) -; - } - GeneratedField::AliOss => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("aliOSS")); + GeneratedField::IngressId => { + if ingress_id__.is_some() { + return Err(serde::de::Error::duplicate_field("ingressId")); } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_file_output::Output::AliOss) -; + ingress_id__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(DirectFileOutput { - filepath: filepath__.unwrap_or_default(), - disable_manifest: disable_manifest__.unwrap_or_default(), - output: output__, + Ok(DeleteIngressRequest { + ingress_id: ingress_id__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.DirectFileOutput", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.DeleteIngressRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for DisabledCodecs { +impl serde::Serialize for DeleteRoomRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -3493,37 +3861,29 @@ impl serde::Serialize for DisabledCodecs { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.codecs.is_empty() { - len += 1; - } - if !self.publish.is_empty() { + if !self.room.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.DisabledCodecs", len)?; - if !self.codecs.is_empty() { - struct_ser.serialize_field("codecs", &self.codecs)?; - } - if !self.publish.is_empty() { - struct_ser.serialize_field("publish", &self.publish)?; + let mut struct_ser = serializer.serialize_struct("livekit.DeleteRoomRequest", len)?; + if !self.room.is_empty() { + struct_ser.serialize_field("room", &self.room)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for DisabledCodecs { +impl<'de> serde::Deserialize<'de> for DeleteRoomRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "codecs", - "publish", + "room", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Codecs, - Publish, + Room, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -3546,8 +3906,7 @@ impl<'de> serde::Deserialize<'de> for DisabledCodecs { E: serde::de::Error, { match value { - "codecs" => Ok(GeneratedField::Codecs), - "publish" => Ok(GeneratedField::Publish), + "room" => Ok(GeneratedField::Room), _ => Ok(GeneratedField::__SkipField__), } } @@ -3557,142 +3916,207 @@ impl<'de> serde::Deserialize<'de> for DisabledCodecs { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DisabledCodecs; + type Value = DeleteRoomRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.DisabledCodecs") + formatter.write_str("struct livekit.DeleteRoomRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut codecs__ = None; - let mut publish__ = None; + let mut room__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Codecs => { - if codecs__.is_some() { - return Err(serde::de::Error::duplicate_field("codecs")); - } - codecs__ = Some(map_.next_value()?); - } - GeneratedField::Publish => { - if publish__.is_some() { - return Err(serde::de::Error::duplicate_field("publish")); + GeneratedField::Room => { + if room__.is_some() { + return Err(serde::de::Error::duplicate_field("room")); } - publish__ = Some(map_.next_value()?); + room__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(DisabledCodecs { - codecs: codecs__.unwrap_or_default(), - publish: publish__.unwrap_or_default(), + Ok(DeleteRoomRequest { + room: room__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.DisabledCodecs", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.DeleteRoomRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for DisconnectReason { +impl serde::Serialize for DeleteRoomResponse { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { - let variant = match self { - Self::UnknownReason => "UNKNOWN_REASON", - Self::ClientInitiated => "CLIENT_INITIATED", - Self::DuplicateIdentity => "DUPLICATE_IDENTITY", - Self::ServerShutdown => "SERVER_SHUTDOWN", - Self::ParticipantRemoved => "PARTICIPANT_REMOVED", - Self::RoomDeleted => "ROOM_DELETED", - Self::StateMismatch => "STATE_MISMATCH", - Self::JoinFailure => "JOIN_FAILURE", - Self::Migration => "MIGRATION", - Self::SignalClose => "SIGNAL_CLOSE", - }; - serializer.serialize_str(variant) + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("livekit.DeleteRoomResponse", len)?; + struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for DisconnectReason { +impl<'de> serde::Deserialize<'de> for DeleteRoomResponse { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "UNKNOWN_REASON", - "CLIENT_INITIATED", - "DUPLICATE_IDENTITY", - "SERVER_SHUTDOWN", - "PARTICIPANT_REMOVED", - "ROOM_DELETED", - "STATE_MISMATCH", - "JOIN_FAILURE", - "MIGRATION", - "SIGNAL_CLOSE", ]; - struct GeneratedVisitor; + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Ok(GeneratedField::__SkipField__) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = DisconnectReason; + type Value = DeleteRoomResponse; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) + formatter.write_str("struct livekit.DeleteRoomResponse") } - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(DeleteRoomResponse { + }) } + } + deserializer.deserialize_struct("livekit.DeleteRoomResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for DeleteSipDispatchRuleRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sip_dispatch_rule_id.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.DeleteSIPDispatchRuleRequest", len)?; + if !self.sip_dispatch_rule_id.is_empty() { + struct_ser.serialize_field("sipDispatchRuleId", &self.sip_dispatch_rule_id)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for DeleteSipDispatchRuleRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "sip_dispatch_rule_id", + "sipDispatchRuleId", + ]; - fn visit_u64(self, v: u64) -> std::result::Result + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SipDispatchRuleId, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result where - E: serde::de::Error, + D: serde::Deserializer<'de>, { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sipDispatchRuleId" | "sip_dispatch_rule_id" => Ok(GeneratedField::SipDispatchRuleId), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DeleteSipDispatchRuleRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.DeleteSIPDispatchRuleRequest") } - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, { - match value { - "UNKNOWN_REASON" => Ok(DisconnectReason::UnknownReason), - "CLIENT_INITIATED" => Ok(DisconnectReason::ClientInitiated), - "DUPLICATE_IDENTITY" => Ok(DisconnectReason::DuplicateIdentity), - "SERVER_SHUTDOWN" => Ok(DisconnectReason::ServerShutdown), - "PARTICIPANT_REMOVED" => Ok(DisconnectReason::ParticipantRemoved), - "ROOM_DELETED" => Ok(DisconnectReason::RoomDeleted), - "STATE_MISMATCH" => Ok(DisconnectReason::StateMismatch), - "JOIN_FAILURE" => Ok(DisconnectReason::JoinFailure), - "MIGRATION" => Ok(DisconnectReason::Migration), - "SIGNAL_CLOSE" => Ok(DisconnectReason::SignalClose), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + let mut sip_dispatch_rule_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SipDispatchRuleId => { + if sip_dispatch_rule_id__.is_some() { + return Err(serde::de::Error::duplicate_field("sipDispatchRuleId")); + } + sip_dispatch_rule_id__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } } + Ok(DeleteSipDispatchRuleRequest { + sip_dispatch_rule_id: sip_dispatch_rule_id__.unwrap_or_default(), + }) } } - deserializer.deserialize_any(GeneratedVisitor) + deserializer.deserialize_struct("livekit.DeleteSIPDispatchRuleRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for EgressInfo { +impl serde::Serialize for DeleteSipTrunkRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -3700,188 +4124,161 @@ impl serde::Serialize for EgressInfo { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.egress_id.is_empty() { - len += 1; - } - if !self.room_id.is_empty() { - len += 1; - } - if !self.room_name.is_empty() { + if !self.sip_trunk_id.is_empty() { len += 1; } - if self.status != 0 { - len += 1; - } - if self.started_at != 0 { - len += 1; - } - if self.ended_at != 0 { - len += 1; + let mut struct_ser = serializer.serialize_struct("livekit.DeleteSIPTrunkRequest", len)?; + if !self.sip_trunk_id.is_empty() { + struct_ser.serialize_field("sipTrunkId", &self.sip_trunk_id)?; } - if self.updated_at != 0 { - len += 1; + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for DeleteSipTrunkRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "sip_trunk_id", + "sipTrunkId", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + SipTrunkId, + __SkipField__, } - if !self.error.is_empty() { - len += 1; - } - if !self.stream_results.is_empty() { - len += 1; - } - if !self.file_results.is_empty() { - len += 1; + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sipTrunkId" | "sip_trunk_id" => Ok(GeneratedField::SipTrunkId), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } } - if !self.segment_results.is_empty() { - len += 1; + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DeleteSipTrunkRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.DeleteSIPTrunkRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sip_trunk_id__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::SipTrunkId => { + if sip_trunk_id__.is_some() { + return Err(serde::de::Error::duplicate_field("sipTrunkId")); + } + sip_trunk_id__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(DeleteSipTrunkRequest { + sip_trunk_id: sip_trunk_id__.unwrap_or_default(), + }) + } } - if !self.image_results.is_empty() { + deserializer.deserialize_struct("livekit.DeleteSIPTrunkRequest", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for DirectFileOutput { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.filepath.is_empty() { len += 1; } - if self.request.is_some() { + if self.disable_manifest { len += 1; } - if self.result.is_some() { + if self.output.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.EgressInfo", len)?; - if !self.egress_id.is_empty() { - struct_ser.serialize_field("egressId", &self.egress_id)?; - } - if !self.room_id.is_empty() { - struct_ser.serialize_field("roomId", &self.room_id)?; - } - if !self.room_name.is_empty() { - struct_ser.serialize_field("roomName", &self.room_name)?; - } - if self.status != 0 { - let v = EgressStatus::try_from(self.status) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.status)))?; - struct_ser.serialize_field("status", &v)?; - } - if self.started_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("startedAt", ToString::to_string(&self.started_at).as_str())?; - } - if self.ended_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("endedAt", ToString::to_string(&self.ended_at).as_str())?; - } - if self.updated_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("updatedAt", ToString::to_string(&self.updated_at).as_str())?; - } - if !self.error.is_empty() { - struct_ser.serialize_field("error", &self.error)?; - } - if !self.stream_results.is_empty() { - struct_ser.serialize_field("streamResults", &self.stream_results)?; - } - if !self.file_results.is_empty() { - struct_ser.serialize_field("fileResults", &self.file_results)?; - } - if !self.segment_results.is_empty() { - struct_ser.serialize_field("segmentResults", &self.segment_results)?; + let mut struct_ser = serializer.serialize_struct("livekit.DirectFileOutput", len)?; + if !self.filepath.is_empty() { + struct_ser.serialize_field("filepath", &self.filepath)?; } - if !self.image_results.is_empty() { - struct_ser.serialize_field("imageResults", &self.image_results)?; + if self.disable_manifest { + struct_ser.serialize_field("disableManifest", &self.disable_manifest)?; } - if let Some(v) = self.request.as_ref() { + if let Some(v) = self.output.as_ref() { match v { - egress_info::Request::RoomComposite(v) => { - struct_ser.serialize_field("roomComposite", v)?; - } - egress_info::Request::Web(v) => { - struct_ser.serialize_field("web", v)?; - } - egress_info::Request::Participant(v) => { - struct_ser.serialize_field("participant", v)?; - } - egress_info::Request::TrackComposite(v) => { - struct_ser.serialize_field("trackComposite", v)?; - } - egress_info::Request::Track(v) => { - struct_ser.serialize_field("track", v)?; + direct_file_output::Output::S3(v) => { + struct_ser.serialize_field("s3", v)?; } - } - } - if let Some(v) = self.result.as_ref() { - match v { - egress_info::Result::Stream(v) => { - struct_ser.serialize_field("stream", v)?; + direct_file_output::Output::Gcp(v) => { + struct_ser.serialize_field("gcp", v)?; } - egress_info::Result::File(v) => { - struct_ser.serialize_field("file", v)?; + direct_file_output::Output::Azure(v) => { + struct_ser.serialize_field("azure", v)?; } - egress_info::Result::Segments(v) => { - struct_ser.serialize_field("segments", v)?; + direct_file_output::Output::AliOss(v) => { + struct_ser.serialize_field("aliOSS", v)?; } } } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for EgressInfo { +impl<'de> serde::Deserialize<'de> for DirectFileOutput { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "egress_id", - "egressId", - "room_id", - "roomId", - "room_name", - "roomName", - "status", - "started_at", - "startedAt", - "ended_at", - "endedAt", - "updated_at", - "updatedAt", - "error", - "stream_results", - "streamResults", - "file_results", - "fileResults", - "segment_results", - "segmentResults", - "image_results", - "imageResults", - "room_composite", - "roomComposite", - "web", - "participant", - "track_composite", - "trackComposite", - "track", - "stream", - "file", - "segments", + "filepath", + "disable_manifest", + "disableManifest", + "s3", + "gcp", + "azure", + "aliOSS", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - EgressId, - RoomId, - RoomName, - Status, - StartedAt, - EndedAt, - UpdatedAt, - Error, - StreamResults, - FileResults, - SegmentResults, - ImageResults, - RoomComposite, - Web, - Participant, - TrackComposite, - Track, - Stream, - File, - Segments, + Filepath, + DisableManifest, + S3, + Gcp, + Azure, + AliOss, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -3904,26 +4301,12 @@ impl<'de> serde::Deserialize<'de> for EgressInfo { E: serde::de::Error, { match value { - "egressId" | "egress_id" => Ok(GeneratedField::EgressId), - "roomId" | "room_id" => Ok(GeneratedField::RoomId), - "roomName" | "room_name" => Ok(GeneratedField::RoomName), - "status" => Ok(GeneratedField::Status), - "startedAt" | "started_at" => Ok(GeneratedField::StartedAt), - "endedAt" | "ended_at" => Ok(GeneratedField::EndedAt), - "updatedAt" | "updated_at" => Ok(GeneratedField::UpdatedAt), - "error" => Ok(GeneratedField::Error), - "streamResults" | "stream_results" => Ok(GeneratedField::StreamResults), - "fileResults" | "file_results" => Ok(GeneratedField::FileResults), - "segmentResults" | "segment_results" => Ok(GeneratedField::SegmentResults), - "imageResults" | "image_results" => Ok(GeneratedField::ImageResults), - "roomComposite" | "room_composite" => Ok(GeneratedField::RoomComposite), - "web" => Ok(GeneratedField::Web), - "participant" => Ok(GeneratedField::Participant), - "trackComposite" | "track_composite" => Ok(GeneratedField::TrackComposite), - "track" => Ok(GeneratedField::Track), - "stream" => Ok(GeneratedField::Stream), - "file" => Ok(GeneratedField::File), - "segments" => Ok(GeneratedField::Segments), + "filepath" => Ok(GeneratedField::Filepath), + "disableManifest" | "disable_manifest" => Ok(GeneratedField::DisableManifest), + "s3" => Ok(GeneratedField::S3), + "gcp" => Ok(GeneratedField::Gcp), + "azure" => Ok(GeneratedField::Azure), + "aliOSS" => Ok(GeneratedField::AliOss), _ => Ok(GeneratedField::__SkipField__), } } @@ -3933,164 +4316,59 @@ impl<'de> serde::Deserialize<'de> for EgressInfo { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EgressInfo; + type Value = DirectFileOutput; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.EgressInfo") + formatter.write_str("struct livekit.DirectFileOutput") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut egress_id__ = None; - let mut room_id__ = None; - let mut room_name__ = None; - let mut status__ = None; - let mut started_at__ = None; - let mut ended_at__ = None; - let mut updated_at__ = None; - let mut error__ = None; - let mut stream_results__ = None; - let mut file_results__ = None; - let mut segment_results__ = None; - let mut image_results__ = None; - let mut request__ = None; - let mut result__ = None; + let mut filepath__ = None; + let mut disable_manifest__ = None; + let mut output__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::EgressId => { - if egress_id__.is_some() { - return Err(serde::de::Error::duplicate_field("egressId")); - } - egress_id__ = Some(map_.next_value()?); - } - GeneratedField::RoomId => { - if room_id__.is_some() { - return Err(serde::de::Error::duplicate_field("roomId")); - } - room_id__ = Some(map_.next_value()?); - } - GeneratedField::RoomName => { - if room_name__.is_some() { - return Err(serde::de::Error::duplicate_field("roomName")); - } - room_name__ = Some(map_.next_value()?); - } - GeneratedField::Status => { - if status__.is_some() { - return Err(serde::de::Error::duplicate_field("status")); - } - status__ = Some(map_.next_value::()? as i32); - } - GeneratedField::StartedAt => { - if started_at__.is_some() { - return Err(serde::de::Error::duplicate_field("startedAt")); - } - started_at__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::EndedAt => { - if ended_at__.is_some() { - return Err(serde::de::Error::duplicate_field("endedAt")); - } - ended_at__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::UpdatedAt => { - if updated_at__.is_some() { - return Err(serde::de::Error::duplicate_field("updatedAt")); - } - updated_at__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Error => { - if error__.is_some() { - return Err(serde::de::Error::duplicate_field("error")); - } - error__ = Some(map_.next_value()?); - } - GeneratedField::StreamResults => { - if stream_results__.is_some() { - return Err(serde::de::Error::duplicate_field("streamResults")); - } - stream_results__ = Some(map_.next_value()?); - } - GeneratedField::FileResults => { - if file_results__.is_some() { - return Err(serde::de::Error::duplicate_field("fileResults")); - } - file_results__ = Some(map_.next_value()?); - } - GeneratedField::SegmentResults => { - if segment_results__.is_some() { - return Err(serde::de::Error::duplicate_field("segmentResults")); - } - segment_results__ = Some(map_.next_value()?); - } - GeneratedField::ImageResults => { - if image_results__.is_some() { - return Err(serde::de::Error::duplicate_field("imageResults")); - } - image_results__ = Some(map_.next_value()?); - } - GeneratedField::RoomComposite => { - if request__.is_some() { - return Err(serde::de::Error::duplicate_field("roomComposite")); - } - request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::RoomComposite) -; - } - GeneratedField::Web => { - if request__.is_some() { - return Err(serde::de::Error::duplicate_field("web")); - } - request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::Web) -; - } - GeneratedField::Participant => { - if request__.is_some() { - return Err(serde::de::Error::duplicate_field("participant")); + GeneratedField::Filepath => { + if filepath__.is_some() { + return Err(serde::de::Error::duplicate_field("filepath")); } - request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::Participant) -; + filepath__ = Some(map_.next_value()?); } - GeneratedField::TrackComposite => { - if request__.is_some() { - return Err(serde::de::Error::duplicate_field("trackComposite")); + GeneratedField::DisableManifest => { + if disable_manifest__.is_some() { + return Err(serde::de::Error::duplicate_field("disableManifest")); } - request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::TrackComposite) -; + disable_manifest__ = Some(map_.next_value()?); } - GeneratedField::Track => { - if request__.is_some() { - return Err(serde::de::Error::duplicate_field("track")); + GeneratedField::S3 => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("s3")); } - request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::Track) + output__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_file_output::Output::S3) ; } - GeneratedField::Stream => { - if result__.is_some() { - return Err(serde::de::Error::duplicate_field("stream")); + GeneratedField::Gcp => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("gcp")); } - result__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Result::Stream) + output__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_file_output::Output::Gcp) ; } - GeneratedField::File => { - if result__.is_some() { - return Err(serde::de::Error::duplicate_field("file")); + GeneratedField::Azure => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("azure")); } - result__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Result::File) + output__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_file_output::Output::Azure) ; } - GeneratedField::Segments => { - if result__.is_some() { - return Err(serde::de::Error::duplicate_field("segments")); + GeneratedField::AliOss => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("aliOSS")); } - result__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Result::Segments) + output__ = map_.next_value::<::std::option::Option<_>>()?.map(direct_file_output::Output::AliOss) ; } GeneratedField::__SkipField__ => { @@ -4098,73 +4376,180 @@ impl<'de> serde::Deserialize<'de> for EgressInfo { } } } - Ok(EgressInfo { - egress_id: egress_id__.unwrap_or_default(), - room_id: room_id__.unwrap_or_default(), - room_name: room_name__.unwrap_or_default(), - status: status__.unwrap_or_default(), - started_at: started_at__.unwrap_or_default(), - ended_at: ended_at__.unwrap_or_default(), - updated_at: updated_at__.unwrap_or_default(), - error: error__.unwrap_or_default(), - stream_results: stream_results__.unwrap_or_default(), - file_results: file_results__.unwrap_or_default(), - segment_results: segment_results__.unwrap_or_default(), - image_results: image_results__.unwrap_or_default(), - request: request__, - result: result__, + Ok(DirectFileOutput { + filepath: filepath__.unwrap_or_default(), + disable_manifest: disable_manifest__.unwrap_or_default(), + output: output__, }) } } - deserializer.deserialize_struct("livekit.EgressInfo", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.DirectFileOutput", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for EgressStatus { +impl serde::Serialize for DisabledCodecs { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { - let variant = match self { - Self::EgressStarting => "EGRESS_STARTING", - Self::EgressActive => "EGRESS_ACTIVE", - Self::EgressEnding => "EGRESS_ENDING", - Self::EgressComplete => "EGRESS_COMPLETE", - Self::EgressFailed => "EGRESS_FAILED", - Self::EgressAborted => "EGRESS_ABORTED", - Self::EgressLimitReached => "EGRESS_LIMIT_REACHED", - }; - serializer.serialize_str(variant) + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.codecs.is_empty() { + len += 1; + } + if !self.publish.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.DisabledCodecs", len)?; + if !self.codecs.is_empty() { + struct_ser.serialize_field("codecs", &self.codecs)?; + } + if !self.publish.is_empty() { + struct_ser.serialize_field("publish", &self.publish)?; + } + struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for EgressStatus { +impl<'de> serde::Deserialize<'de> for DisabledCodecs { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "EGRESS_STARTING", - "EGRESS_ACTIVE", - "EGRESS_ENDING", - "EGRESS_COMPLETE", - "EGRESS_FAILED", - "EGRESS_ABORTED", - "EGRESS_LIMIT_REACHED", + "codecs", + "publish", ]; - struct GeneratedVisitor; + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Codecs, + Publish, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "codecs" => Ok(GeneratedField::Codecs), + "publish" => Ok(GeneratedField::Publish), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EgressStatus; + type Value = DisabledCodecs; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) + formatter.write_str("struct livekit.DisabledCodecs") } - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut codecs__ = None; + let mut publish__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Codecs => { + if codecs__.is_some() { + return Err(serde::de::Error::duplicate_field("codecs")); + } + codecs__ = Some(map_.next_value()?); + } + GeneratedField::Publish => { + if publish__.is_some() { + return Err(serde::de::Error::duplicate_field("publish")); + } + publish__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(DisabledCodecs { + codecs: codecs__.unwrap_or_default(), + publish: publish__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.DisabledCodecs", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for DisconnectReason { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::UnknownReason => "UNKNOWN_REASON", + Self::ClientInitiated => "CLIENT_INITIATED", + Self::DuplicateIdentity => "DUPLICATE_IDENTITY", + Self::ServerShutdown => "SERVER_SHUTDOWN", + Self::ParticipantRemoved => "PARTICIPANT_REMOVED", + Self::RoomDeleted => "ROOM_DELETED", + Self::StateMismatch => "STATE_MISMATCH", + Self::JoinFailure => "JOIN_FAILURE", + Self::Migration => "MIGRATION", + Self::SignalClose => "SIGNAL_CLOSE", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for DisconnectReason { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "UNKNOWN_REASON", + "CLIENT_INITIATED", + "DUPLICATE_IDENTITY", + "SERVER_SHUTDOWN", + "PARTICIPANT_REMOVED", + "ROOM_DELETED", + "STATE_MISMATCH", + "JOIN_FAILURE", + "MIGRATION", + "SIGNAL_CLOSE", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = DisconnectReason; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, { i32::try_from(v) .ok() @@ -4191,13 +4576,16 @@ impl<'de> serde::Deserialize<'de> for EgressStatus { E: serde::de::Error, { match value { - "EGRESS_STARTING" => Ok(EgressStatus::EgressStarting), - "EGRESS_ACTIVE" => Ok(EgressStatus::EgressActive), - "EGRESS_ENDING" => Ok(EgressStatus::EgressEnding), - "EGRESS_COMPLETE" => Ok(EgressStatus::EgressComplete), - "EGRESS_FAILED" => Ok(EgressStatus::EgressFailed), - "EGRESS_ABORTED" => Ok(EgressStatus::EgressAborted), - "EGRESS_LIMIT_REACHED" => Ok(EgressStatus::EgressLimitReached), + "UNKNOWN_REASON" => Ok(DisconnectReason::UnknownReason), + "CLIENT_INITIATED" => Ok(DisconnectReason::ClientInitiated), + "DUPLICATE_IDENTITY" => Ok(DisconnectReason::DuplicateIdentity), + "SERVER_SHUTDOWN" => Ok(DisconnectReason::ServerShutdown), + "PARTICIPANT_REMOVED" => Ok(DisconnectReason::ParticipantRemoved), + "ROOM_DELETED" => Ok(DisconnectReason::RoomDeleted), + "STATE_MISMATCH" => Ok(DisconnectReason::StateMismatch), + "JOIN_FAILURE" => Ok(DisconnectReason::JoinFailure), + "MIGRATION" => Ok(DisconnectReason::Migration), + "SIGNAL_CLOSE" => Ok(DisconnectReason::SignalClose), _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } } @@ -4205,7 +4593,7 @@ impl<'de> serde::Deserialize<'de> for EgressStatus { deserializer.deserialize_any(GeneratedVisitor) } } -impl serde::Serialize for EncodedFileOutput { +impl serde::Serialize for EgressInfo { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -4213,82 +4601,202 @@ impl serde::Serialize for EncodedFileOutput { { use serde::ser::SerializeStruct; let mut len = 0; - if self.file_type != 0 { + if !self.egress_id.is_empty() { len += 1; } - if !self.filepath.is_empty() { + if !self.room_id.is_empty() { len += 1; } - if self.disable_manifest { + if !self.room_name.is_empty() { len += 1; } - if self.output.is_some() { + if self.status != 0 { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.EncodedFileOutput", len)?; - if self.file_type != 0 { - let v = EncodedFileType::try_from(self.file_type) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.file_type)))?; - struct_ser.serialize_field("fileType", &v)?; + if self.started_at != 0 { + len += 1; } - if !self.filepath.is_empty() { - struct_ser.serialize_field("filepath", &self.filepath)?; + if self.ended_at != 0 { + len += 1; } - if self.disable_manifest { - struct_ser.serialize_field("disableManifest", &self.disable_manifest)?; + if self.updated_at != 0 { + len += 1; } - if let Some(v) = self.output.as_ref() { + if !self.details.is_empty() { + len += 1; + } + if !self.error.is_empty() { + len += 1; + } + if !self.stream_results.is_empty() { + len += 1; + } + if !self.file_results.is_empty() { + len += 1; + } + if !self.segment_results.is_empty() { + len += 1; + } + if !self.image_results.is_empty() { + len += 1; + } + if self.request.is_some() { + len += 1; + } + if self.result.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.EgressInfo", len)?; + if !self.egress_id.is_empty() { + struct_ser.serialize_field("egressId", &self.egress_id)?; + } + if !self.room_id.is_empty() { + struct_ser.serialize_field("roomId", &self.room_id)?; + } + if !self.room_name.is_empty() { + struct_ser.serialize_field("roomName", &self.room_name)?; + } + if self.status != 0 { + let v = EgressStatus::try_from(self.status) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.status)))?; + struct_ser.serialize_field("status", &v)?; + } + if self.started_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("startedAt", ToString::to_string(&self.started_at).as_str())?; + } + if self.ended_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("endedAt", ToString::to_string(&self.ended_at).as_str())?; + } + if self.updated_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("updatedAt", ToString::to_string(&self.updated_at).as_str())?; + } + if !self.details.is_empty() { + struct_ser.serialize_field("details", &self.details)?; + } + if !self.error.is_empty() { + struct_ser.serialize_field("error", &self.error)?; + } + if !self.stream_results.is_empty() { + struct_ser.serialize_field("streamResults", &self.stream_results)?; + } + if !self.file_results.is_empty() { + struct_ser.serialize_field("fileResults", &self.file_results)?; + } + if !self.segment_results.is_empty() { + struct_ser.serialize_field("segmentResults", &self.segment_results)?; + } + if !self.image_results.is_empty() { + struct_ser.serialize_field("imageResults", &self.image_results)?; + } + if let Some(v) = self.request.as_ref() { match v { - encoded_file_output::Output::S3(v) => { - struct_ser.serialize_field("s3", v)?; + egress_info::Request::RoomComposite(v) => { + struct_ser.serialize_field("roomComposite", v)?; } - encoded_file_output::Output::Gcp(v) => { - struct_ser.serialize_field("gcp", v)?; + egress_info::Request::Web(v) => { + struct_ser.serialize_field("web", v)?; } - encoded_file_output::Output::Azure(v) => { - struct_ser.serialize_field("azure", v)?; + egress_info::Request::Participant(v) => { + struct_ser.serialize_field("participant", v)?; } - encoded_file_output::Output::AliOss(v) => { - struct_ser.serialize_field("aliOSS", v)?; + egress_info::Request::TrackComposite(v) => { + struct_ser.serialize_field("trackComposite", v)?; + } + egress_info::Request::Track(v) => { + struct_ser.serialize_field("track", v)?; + } + } + } + if let Some(v) = self.result.as_ref() { + match v { + egress_info::Result::Stream(v) => { + struct_ser.serialize_field("stream", v)?; + } + egress_info::Result::File(v) => { + struct_ser.serialize_field("file", v)?; + } + egress_info::Result::Segments(v) => { + struct_ser.serialize_field("segments", v)?; } } } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for EncodedFileOutput { +impl<'de> serde::Deserialize<'de> for EgressInfo { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "file_type", - "fileType", - "filepath", - "disable_manifest", - "disableManifest", - "s3", - "gcp", - "azure", - "aliOSS", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - FileType, - Filepath, - DisableManifest, - S3, - Gcp, - Azure, - AliOss, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, + "egress_id", + "egressId", + "room_id", + "roomId", + "room_name", + "roomName", + "status", + "started_at", + "startedAt", + "ended_at", + "endedAt", + "updated_at", + "updatedAt", + "details", + "error", + "stream_results", + "streamResults", + "file_results", + "fileResults", + "segment_results", + "segmentResults", + "image_results", + "imageResults", + "room_composite", + "roomComposite", + "web", + "participant", + "track_composite", + "trackComposite", + "track", + "stream", + "file", + "segments", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + EgressId, + RoomId, + RoomName, + Status, + StartedAt, + EndedAt, + UpdatedAt, + Details, + Error, + StreamResults, + FileResults, + SegmentResults, + ImageResults, + RoomComposite, + Web, + Participant, + TrackComposite, + Track, + Stream, + File, + Segments, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, { struct GeneratedVisitor; @@ -4305,13 +4813,27 @@ impl<'de> serde::Deserialize<'de> for EncodedFileOutput { E: serde::de::Error, { match value { - "fileType" | "file_type" => Ok(GeneratedField::FileType), - "filepath" => Ok(GeneratedField::Filepath), - "disableManifest" | "disable_manifest" => Ok(GeneratedField::DisableManifest), - "s3" => Ok(GeneratedField::S3), - "gcp" => Ok(GeneratedField::Gcp), - "azure" => Ok(GeneratedField::Azure), - "aliOSS" => Ok(GeneratedField::AliOss), + "egressId" | "egress_id" => Ok(GeneratedField::EgressId), + "roomId" | "room_id" => Ok(GeneratedField::RoomId), + "roomName" | "room_name" => Ok(GeneratedField::RoomName), + "status" => Ok(GeneratedField::Status), + "startedAt" | "started_at" => Ok(GeneratedField::StartedAt), + "endedAt" | "ended_at" => Ok(GeneratedField::EndedAt), + "updatedAt" | "updated_at" => Ok(GeneratedField::UpdatedAt), + "details" => Ok(GeneratedField::Details), + "error" => Ok(GeneratedField::Error), + "streamResults" | "stream_results" => Ok(GeneratedField::StreamResults), + "fileResults" | "file_results" => Ok(GeneratedField::FileResults), + "segmentResults" | "segment_results" => Ok(GeneratedField::SegmentResults), + "imageResults" | "image_results" => Ok(GeneratedField::ImageResults), + "roomComposite" | "room_composite" => Ok(GeneratedField::RoomComposite), + "web" => Ok(GeneratedField::Web), + "participant" => Ok(GeneratedField::Participant), + "trackComposite" | "track_composite" => Ok(GeneratedField::TrackComposite), + "track" => Ok(GeneratedField::Track), + "stream" => Ok(GeneratedField::Stream), + "file" => Ok(GeneratedField::File), + "segments" => Ok(GeneratedField::Segments), _ => Ok(GeneratedField::__SkipField__), } } @@ -4321,114 +4843,238 @@ impl<'de> serde::Deserialize<'de> for EncodedFileOutput { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EncodedFileOutput; + type Value = EgressInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.EncodedFileOutput") + formatter.write_str("struct livekit.EgressInfo") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut file_type__ = None; - let mut filepath__ = None; - let mut disable_manifest__ = None; - let mut output__ = None; + let mut egress_id__ = None; + let mut room_id__ = None; + let mut room_name__ = None; + let mut status__ = None; + let mut started_at__ = None; + let mut ended_at__ = None; + let mut updated_at__ = None; + let mut details__ = None; + let mut error__ = None; + let mut stream_results__ = None; + let mut file_results__ = None; + let mut segment_results__ = None; + let mut image_results__ = None; + let mut request__ = None; + let mut result__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::FileType => { - if file_type__.is_some() { - return Err(serde::de::Error::duplicate_field("fileType")); + GeneratedField::EgressId => { + if egress_id__.is_some() { + return Err(serde::de::Error::duplicate_field("egressId")); } - file_type__ = Some(map_.next_value::()? as i32); + egress_id__ = Some(map_.next_value()?); } - GeneratedField::Filepath => { - if filepath__.is_some() { - return Err(serde::de::Error::duplicate_field("filepath")); + GeneratedField::RoomId => { + if room_id__.is_some() { + return Err(serde::de::Error::duplicate_field("roomId")); } - filepath__ = Some(map_.next_value()?); + room_id__ = Some(map_.next_value()?); } - GeneratedField::DisableManifest => { - if disable_manifest__.is_some() { - return Err(serde::de::Error::duplicate_field("disableManifest")); + GeneratedField::RoomName => { + if room_name__.is_some() { + return Err(serde::de::Error::duplicate_field("roomName")); } - disable_manifest__ = Some(map_.next_value()?); + room_name__ = Some(map_.next_value()?); } - GeneratedField::S3 => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("s3")); + GeneratedField::Status => { + if status__.is_some() { + return Err(serde::de::Error::duplicate_field("status")); } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(encoded_file_output::Output::S3) + status__ = Some(map_.next_value::()? as i32); + } + GeneratedField::StartedAt => { + if started_at__.is_some() { + return Err(serde::de::Error::duplicate_field("startedAt")); + } + started_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::EndedAt => { + if ended_at__.is_some() { + return Err(serde::de::Error::duplicate_field("endedAt")); + } + ended_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::UpdatedAt => { + if updated_at__.is_some() { + return Err(serde::de::Error::duplicate_field("updatedAt")); + } + updated_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Details => { + if details__.is_some() { + return Err(serde::de::Error::duplicate_field("details")); + } + details__ = Some(map_.next_value()?); + } + GeneratedField::Error => { + if error__.is_some() { + return Err(serde::de::Error::duplicate_field("error")); + } + error__ = Some(map_.next_value()?); + } + GeneratedField::StreamResults => { + if stream_results__.is_some() { + return Err(serde::de::Error::duplicate_field("streamResults")); + } + stream_results__ = Some(map_.next_value()?); + } + GeneratedField::FileResults => { + if file_results__.is_some() { + return Err(serde::de::Error::duplicate_field("fileResults")); + } + file_results__ = Some(map_.next_value()?); + } + GeneratedField::SegmentResults => { + if segment_results__.is_some() { + return Err(serde::de::Error::duplicate_field("segmentResults")); + } + segment_results__ = Some(map_.next_value()?); + } + GeneratedField::ImageResults => { + if image_results__.is_some() { + return Err(serde::de::Error::duplicate_field("imageResults")); + } + image_results__ = Some(map_.next_value()?); + } + GeneratedField::RoomComposite => { + if request__.is_some() { + return Err(serde::de::Error::duplicate_field("roomComposite")); + } + request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::RoomComposite) ; } - GeneratedField::Gcp => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("gcp")); + GeneratedField::Web => { + if request__.is_some() { + return Err(serde::de::Error::duplicate_field("web")); } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(encoded_file_output::Output::Gcp) + request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::Web) ; } - GeneratedField::Azure => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("azure")); + GeneratedField::Participant => { + if request__.is_some() { + return Err(serde::de::Error::duplicate_field("participant")); } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(encoded_file_output::Output::Azure) + request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::Participant) ; } - GeneratedField::AliOss => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("aliOSS")); + GeneratedField::TrackComposite => { + if request__.is_some() { + return Err(serde::de::Error::duplicate_field("trackComposite")); } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(encoded_file_output::Output::AliOss) + request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::TrackComposite) ; } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; + GeneratedField::Track => { + if request__.is_some() { + return Err(serde::de::Error::duplicate_field("track")); + } + request__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Request::Track) +; } - } - } - Ok(EncodedFileOutput { - file_type: file_type__.unwrap_or_default(), - filepath: filepath__.unwrap_or_default(), - disable_manifest: disable_manifest__.unwrap_or_default(), - output: output__, - }) - } - } - deserializer.deserialize_struct("livekit.EncodedFileOutput", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for EncodedFileType { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where + GeneratedField::Stream => { + if result__.is_some() { + return Err(serde::de::Error::duplicate_field("stream")); + } + result__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Result::Stream) +; + } + GeneratedField::File => { + if result__.is_some() { + return Err(serde::de::Error::duplicate_field("file")); + } + result__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Result::File) +; + } + GeneratedField::Segments => { + if result__.is_some() { + return Err(serde::de::Error::duplicate_field("segments")); + } + result__ = map_.next_value::<::std::option::Option<_>>()?.map(egress_info::Result::Segments) +; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(EgressInfo { + egress_id: egress_id__.unwrap_or_default(), + room_id: room_id__.unwrap_or_default(), + room_name: room_name__.unwrap_or_default(), + status: status__.unwrap_or_default(), + started_at: started_at__.unwrap_or_default(), + ended_at: ended_at__.unwrap_or_default(), + updated_at: updated_at__.unwrap_or_default(), + details: details__.unwrap_or_default(), + error: error__.unwrap_or_default(), + stream_results: stream_results__.unwrap_or_default(), + file_results: file_results__.unwrap_or_default(), + segment_results: segment_results__.unwrap_or_default(), + image_results: image_results__.unwrap_or_default(), + request: request__, + result: result__, + }) + } + } + deserializer.deserialize_struct("livekit.EgressInfo", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for EgressStatus { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where S: serde::Serializer, { let variant = match self { - Self::DefaultFiletype => "DEFAULT_FILETYPE", - Self::Mp4 => "MP4", - Self::Ogg => "OGG", + Self::EgressStarting => "EGRESS_STARTING", + Self::EgressActive => "EGRESS_ACTIVE", + Self::EgressEnding => "EGRESS_ENDING", + Self::EgressComplete => "EGRESS_COMPLETE", + Self::EgressFailed => "EGRESS_FAILED", + Self::EgressAborted => "EGRESS_ABORTED", + Self::EgressLimitReached => "EGRESS_LIMIT_REACHED", }; serializer.serialize_str(variant) } } -impl<'de> serde::Deserialize<'de> for EncodedFileType { +impl<'de> serde::Deserialize<'de> for EgressStatus { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "DEFAULT_FILETYPE", - "MP4", - "OGG", + "EGRESS_STARTING", + "EGRESS_ACTIVE", + "EGRESS_ENDING", + "EGRESS_COMPLETE", + "EGRESS_FAILED", + "EGRESS_ABORTED", + "EGRESS_LIMIT_REACHED", ]; struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EncodedFileType; + type Value = EgressStatus; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(formatter, "expected one of: {:?}", &FIELDS) @@ -4463,9 +5109,13 @@ impl<'de> serde::Deserialize<'de> for EncodedFileType { E: serde::de::Error, { match value { - "DEFAULT_FILETYPE" => Ok(EncodedFileType::DefaultFiletype), - "MP4" => Ok(EncodedFileType::Mp4), - "OGG" => Ok(EncodedFileType::Ogg), + "EGRESS_STARTING" => Ok(EgressStatus::EgressStarting), + "EGRESS_ACTIVE" => Ok(EgressStatus::EgressActive), + "EGRESS_ENDING" => Ok(EgressStatus::EgressEnding), + "EGRESS_COMPLETE" => Ok(EgressStatus::EgressComplete), + "EGRESS_FAILED" => Ok(EgressStatus::EgressFailed), + "EGRESS_ABORTED" => Ok(EgressStatus::EgressAborted), + "EGRESS_LIMIT_REACHED" => Ok(EgressStatus::EgressLimitReached), _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } } @@ -4473,7 +5123,7 @@ impl<'de> serde::Deserialize<'de> for EncodedFileType { deserializer.deserialize_any(GeneratedVisitor) } } -impl serde::Serialize for EncodingOptions { +impl serde::Serialize for EncodedFileOutput { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -4481,129 +5131,76 @@ impl serde::Serialize for EncodingOptions { { use serde::ser::SerializeStruct; let mut len = 0; - if self.width != 0 { - len += 1; - } - if self.height != 0 { - len += 1; - } - if self.depth != 0 { - len += 1; - } - if self.framerate != 0 { - len += 1; - } - if self.audio_codec != 0 { - len += 1; - } - if self.audio_bitrate != 0 { - len += 1; - } - if self.audio_quality != 0 { - len += 1; - } - if self.audio_frequency != 0 { - len += 1; - } - if self.video_codec != 0 { + if self.file_type != 0 { len += 1; } - if self.video_bitrate != 0 { + if !self.filepath.is_empty() { len += 1; } - if self.video_quality != 0 { + if self.disable_manifest { len += 1; } - if self.key_frame_interval != 0. { + if self.output.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.EncodingOptions", len)?; - if self.width != 0 { - struct_ser.serialize_field("width", &self.width)?; - } - if self.height != 0 { - struct_ser.serialize_field("height", &self.height)?; - } - if self.depth != 0 { - struct_ser.serialize_field("depth", &self.depth)?; - } - if self.framerate != 0 { - struct_ser.serialize_field("framerate", &self.framerate)?; - } - if self.audio_codec != 0 { - let v = AudioCodec::try_from(self.audio_codec) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.audio_codec)))?; - struct_ser.serialize_field("audioCodec", &v)?; - } - if self.audio_bitrate != 0 { - struct_ser.serialize_field("audioBitrate", &self.audio_bitrate)?; - } - if self.audio_quality != 0 { - struct_ser.serialize_field("audioQuality", &self.audio_quality)?; - } - if self.audio_frequency != 0 { - struct_ser.serialize_field("audioFrequency", &self.audio_frequency)?; - } - if self.video_codec != 0 { - let v = VideoCodec::try_from(self.video_codec) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.video_codec)))?; - struct_ser.serialize_field("videoCodec", &v)?; + let mut struct_ser = serializer.serialize_struct("livekit.EncodedFileOutput", len)?; + if self.file_type != 0 { + let v = EncodedFileType::try_from(self.file_type) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.file_type)))?; + struct_ser.serialize_field("fileType", &v)?; } - if self.video_bitrate != 0 { - struct_ser.serialize_field("videoBitrate", &self.video_bitrate)?; + if !self.filepath.is_empty() { + struct_ser.serialize_field("filepath", &self.filepath)?; } - if self.video_quality != 0 { - struct_ser.serialize_field("videoQuality", &self.video_quality)?; + if self.disable_manifest { + struct_ser.serialize_field("disableManifest", &self.disable_manifest)?; } - if self.key_frame_interval != 0. { - struct_ser.serialize_field("keyFrameInterval", &self.key_frame_interval)?; + if let Some(v) = self.output.as_ref() { + match v { + encoded_file_output::Output::S3(v) => { + struct_ser.serialize_field("s3", v)?; + } + encoded_file_output::Output::Gcp(v) => { + struct_ser.serialize_field("gcp", v)?; + } + encoded_file_output::Output::Azure(v) => { + struct_ser.serialize_field("azure", v)?; + } + encoded_file_output::Output::AliOss(v) => { + struct_ser.serialize_field("aliOSS", v)?; + } + } } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for EncodingOptions { +impl<'de> serde::Deserialize<'de> for EncodedFileOutput { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "width", - "height", - "depth", - "framerate", - "audio_codec", - "audioCodec", - "audio_bitrate", - "audioBitrate", - "audio_quality", - "audioQuality", - "audio_frequency", - "audioFrequency", - "video_codec", - "videoCodec", - "video_bitrate", - "videoBitrate", - "video_quality", - "videoQuality", - "key_frame_interval", - "keyFrameInterval", + "file_type", + "fileType", + "filepath", + "disable_manifest", + "disableManifest", + "s3", + "gcp", + "azure", + "aliOSS", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Width, - Height, - Depth, - Framerate, - AudioCodec, - AudioBitrate, - AudioQuality, - AudioFrequency, - VideoCodec, - VideoBitrate, - VideoQuality, - KeyFrameInterval, + FileType, + Filepath, + DisableManifest, + S3, + Gcp, + Azure, + AliOss, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -4626,18 +5223,13 @@ impl<'de> serde::Deserialize<'de> for EncodingOptions { E: serde::de::Error, { match value { - "width" => Ok(GeneratedField::Width), - "height" => Ok(GeneratedField::Height), - "depth" => Ok(GeneratedField::Depth), - "framerate" => Ok(GeneratedField::Framerate), - "audioCodec" | "audio_codec" => Ok(GeneratedField::AudioCodec), - "audioBitrate" | "audio_bitrate" => Ok(GeneratedField::AudioBitrate), - "audioQuality" | "audio_quality" => Ok(GeneratedField::AudioQuality), - "audioFrequency" | "audio_frequency" => Ok(GeneratedField::AudioFrequency), - "videoCodec" | "video_codec" => Ok(GeneratedField::VideoCodec), - "videoBitrate" | "video_bitrate" => Ok(GeneratedField::VideoBitrate), - "videoQuality" | "video_quality" => Ok(GeneratedField::VideoQuality), - "keyFrameInterval" | "key_frame_interval" => Ok(GeneratedField::KeyFrameInterval), + "fileType" | "file_type" => Ok(GeneratedField::FileType), + "filepath" => Ok(GeneratedField::Filepath), + "disableManifest" | "disable_manifest" => Ok(GeneratedField::DisableManifest), + "s3" => Ok(GeneratedField::S3), + "gcp" => Ok(GeneratedField::Gcp), + "azure" => Ok(GeneratedField::Azure), + "aliOSS" => Ok(GeneratedField::AliOss), _ => Ok(GeneratedField::__SkipField__), } } @@ -4647,186 +5239,114 @@ impl<'de> serde::Deserialize<'de> for EncodingOptions { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EncodingOptions; + type Value = EncodedFileOutput; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.EncodingOptions") + formatter.write_str("struct livekit.EncodedFileOutput") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut width__ = None; - let mut height__ = None; - let mut depth__ = None; - let mut framerate__ = None; - let mut audio_codec__ = None; - let mut audio_bitrate__ = None; - let mut audio_quality__ = None; - let mut audio_frequency__ = None; - let mut video_codec__ = None; - let mut video_bitrate__ = None; - let mut video_quality__ = None; - let mut key_frame_interval__ = None; + let mut file_type__ = None; + let mut filepath__ = None; + let mut disable_manifest__ = None; + let mut output__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Width => { - if width__.is_some() { - return Err(serde::de::Error::duplicate_field("width")); - } - width__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Height => { - if height__.is_some() { - return Err(serde::de::Error::duplicate_field("height")); - } - height__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Depth => { - if depth__.is_some() { - return Err(serde::de::Error::duplicate_field("depth")); - } - depth__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Framerate => { - if framerate__.is_some() { - return Err(serde::de::Error::duplicate_field("framerate")); - } - framerate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::AudioCodec => { - if audio_codec__.is_some() { - return Err(serde::de::Error::duplicate_field("audioCodec")); - } - audio_codec__ = Some(map_.next_value::()? as i32); - } - GeneratedField::AudioBitrate => { - if audio_bitrate__.is_some() { - return Err(serde::de::Error::duplicate_field("audioBitrate")); + GeneratedField::FileType => { + if file_type__.is_some() { + return Err(serde::de::Error::duplicate_field("fileType")); } - audio_bitrate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + file_type__ = Some(map_.next_value::()? as i32); } - GeneratedField::AudioQuality => { - if audio_quality__.is_some() { - return Err(serde::de::Error::duplicate_field("audioQuality")); + GeneratedField::Filepath => { + if filepath__.is_some() { + return Err(serde::de::Error::duplicate_field("filepath")); } - audio_quality__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + filepath__ = Some(map_.next_value()?); } - GeneratedField::AudioFrequency => { - if audio_frequency__.is_some() { - return Err(serde::de::Error::duplicate_field("audioFrequency")); + GeneratedField::DisableManifest => { + if disable_manifest__.is_some() { + return Err(serde::de::Error::duplicate_field("disableManifest")); } - audio_frequency__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + disable_manifest__ = Some(map_.next_value()?); } - GeneratedField::VideoCodec => { - if video_codec__.is_some() { - return Err(serde::de::Error::duplicate_field("videoCodec")); + GeneratedField::S3 => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("s3")); } - video_codec__ = Some(map_.next_value::()? as i32); + output__ = map_.next_value::<::std::option::Option<_>>()?.map(encoded_file_output::Output::S3) +; } - GeneratedField::VideoBitrate => { - if video_bitrate__.is_some() { - return Err(serde::de::Error::duplicate_field("videoBitrate")); + GeneratedField::Gcp => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("gcp")); } - video_bitrate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + output__ = map_.next_value::<::std::option::Option<_>>()?.map(encoded_file_output::Output::Gcp) +; } - GeneratedField::VideoQuality => { - if video_quality__.is_some() { - return Err(serde::de::Error::duplicate_field("videoQuality")); + GeneratedField::Azure => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("azure")); } - video_quality__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + output__ = map_.next_value::<::std::option::Option<_>>()?.map(encoded_file_output::Output::Azure) +; } - GeneratedField::KeyFrameInterval => { - if key_frame_interval__.is_some() { - return Err(serde::de::Error::duplicate_field("keyFrameInterval")); + GeneratedField::AliOss => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("aliOSS")); } - key_frame_interval__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + output__ = map_.next_value::<::std::option::Option<_>>()?.map(encoded_file_output::Output::AliOss) +; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(EncodingOptions { - width: width__.unwrap_or_default(), - height: height__.unwrap_or_default(), - depth: depth__.unwrap_or_default(), - framerate: framerate__.unwrap_or_default(), - audio_codec: audio_codec__.unwrap_or_default(), - audio_bitrate: audio_bitrate__.unwrap_or_default(), - audio_quality: audio_quality__.unwrap_or_default(), - audio_frequency: audio_frequency__.unwrap_or_default(), - video_codec: video_codec__.unwrap_or_default(), - video_bitrate: video_bitrate__.unwrap_or_default(), - video_quality: video_quality__.unwrap_or_default(), - key_frame_interval: key_frame_interval__.unwrap_or_default(), + Ok(EncodedFileOutput { + file_type: file_type__.unwrap_or_default(), + filepath: filepath__.unwrap_or_default(), + disable_manifest: disable_manifest__.unwrap_or_default(), + output: output__, }) } } - deserializer.deserialize_struct("livekit.EncodingOptions", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.EncodedFileOutput", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for EncodingOptionsPreset { +impl serde::Serialize for EncodedFileType { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { let variant = match self { - Self::H264720p30 => "H264_720P_30", - Self::H264720p60 => "H264_720P_60", - Self::H2641080p30 => "H264_1080P_30", - Self::H2641080p60 => "H264_1080P_60", - Self::PortraitH264720p30 => "PORTRAIT_H264_720P_30", - Self::PortraitH264720p60 => "PORTRAIT_H264_720P_60", - Self::PortraitH2641080p30 => "PORTRAIT_H264_1080P_30", - Self::PortraitH2641080p60 => "PORTRAIT_H264_1080P_60", + Self::DefaultFiletype => "DEFAULT_FILETYPE", + Self::Mp4 => "MP4", + Self::Ogg => "OGG", }; serializer.serialize_str(variant) } } -impl<'de> serde::Deserialize<'de> for EncodingOptionsPreset { +impl<'de> serde::Deserialize<'de> for EncodedFileType { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "H264_720P_30", - "H264_720P_60", - "H264_1080P_30", - "H264_1080P_60", - "PORTRAIT_H264_720P_30", - "PORTRAIT_H264_720P_60", - "PORTRAIT_H264_1080P_30", - "PORTRAIT_H264_1080P_60", + "DEFAULT_FILETYPE", + "MP4", + "OGG", ]; struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = EncodingOptionsPreset; + type Value = EncodedFileType; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(formatter, "expected one of: {:?}", &FIELDS) @@ -4861,14 +5381,9 @@ impl<'de> serde::Deserialize<'de> for EncodingOptionsPreset { E: serde::de::Error, { match value { - "H264_720P_30" => Ok(EncodingOptionsPreset::H264720p30), - "H264_720P_60" => Ok(EncodingOptionsPreset::H264720p60), - "H264_1080P_30" => Ok(EncodingOptionsPreset::H2641080p30), - "H264_1080P_60" => Ok(EncodingOptionsPreset::H2641080p60), - "PORTRAIT_H264_720P_30" => Ok(EncodingOptionsPreset::PortraitH264720p30), - "PORTRAIT_H264_720P_60" => Ok(EncodingOptionsPreset::PortraitH264720p60), - "PORTRAIT_H264_1080P_30" => Ok(EncodingOptionsPreset::PortraitH2641080p30), - "PORTRAIT_H264_1080P_60" => Ok(EncodingOptionsPreset::PortraitH2641080p60), + "DEFAULT_FILETYPE" => Ok(EncodedFileType::DefaultFiletype), + "MP4" => Ok(EncodedFileType::Mp4), + "OGG" => Ok(EncodedFileType::Ogg), _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } } @@ -4876,229 +5391,137 @@ impl<'de> serde::Deserialize<'de> for EncodingOptionsPreset { deserializer.deserialize_any(GeneratedVisitor) } } -impl serde::Serialize for Encryption { +impl serde::Serialize for EncodingOptions { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; - let len = 0; - let struct_ser = serializer.serialize_struct("livekit.Encryption", len)?; - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for Encryption { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - __SkipField__, + let mut len = 0; + if self.width != 0 { + len += 1; } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - Ok(GeneratedField::__SkipField__) - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } + if self.height != 0 { + len += 1; } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = Encryption; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.Encryption") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - while map_.next_key::()?.is_some() { - let _ = map_.next_value::()?; - } - Ok(Encryption { - }) - } + if self.depth != 0 { + len += 1; } - deserializer.deserialize_struct("livekit.Encryption", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for encryption::Type { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::None => "NONE", - Self::Gcm => "GCM", - Self::Custom => "CUSTOM", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for encryption::Type { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "NONE", - "GCM", - "CUSTOM", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = encryption::Type; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "NONE" => Ok(encryption::Type::None), - "GCM" => Ok(encryption::Type::Gcm), - "CUSTOM" => Ok(encryption::Type::Custom), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } + if self.framerate != 0 { + len += 1; } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for FileInfo { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if !self.filename.is_empty() { + if self.audio_codec != 0 { len += 1; } - if self.started_at != 0 { + if self.audio_bitrate != 0 { len += 1; } - if self.ended_at != 0 { + if self.audio_quality != 0 { len += 1; } - if self.duration != 0 { + if self.audio_frequency != 0 { len += 1; } - if self.size != 0 { + if self.video_codec != 0 { len += 1; } - if !self.location.is_empty() { + if self.video_bitrate != 0 { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.FileInfo", len)?; - if !self.filename.is_empty() { - struct_ser.serialize_field("filename", &self.filename)?; + if self.video_quality != 0 { + len += 1; } - if self.started_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("startedAt", ToString::to_string(&self.started_at).as_str())?; + if self.key_frame_interval != 0. { + len += 1; } - if self.ended_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("endedAt", ToString::to_string(&self.ended_at).as_str())?; + let mut struct_ser = serializer.serialize_struct("livekit.EncodingOptions", len)?; + if self.width != 0 { + struct_ser.serialize_field("width", &self.width)?; } - if self.duration != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("duration", ToString::to_string(&self.duration).as_str())?; + if self.height != 0 { + struct_ser.serialize_field("height", &self.height)?; } - if self.size != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("size", ToString::to_string(&self.size).as_str())?; + if self.depth != 0 { + struct_ser.serialize_field("depth", &self.depth)?; } - if !self.location.is_empty() { - struct_ser.serialize_field("location", &self.location)?; + if self.framerate != 0 { + struct_ser.serialize_field("framerate", &self.framerate)?; + } + if self.audio_codec != 0 { + let v = AudioCodec::try_from(self.audio_codec) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.audio_codec)))?; + struct_ser.serialize_field("audioCodec", &v)?; + } + if self.audio_bitrate != 0 { + struct_ser.serialize_field("audioBitrate", &self.audio_bitrate)?; + } + if self.audio_quality != 0 { + struct_ser.serialize_field("audioQuality", &self.audio_quality)?; + } + if self.audio_frequency != 0 { + struct_ser.serialize_field("audioFrequency", &self.audio_frequency)?; + } + if self.video_codec != 0 { + let v = VideoCodec::try_from(self.video_codec) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.video_codec)))?; + struct_ser.serialize_field("videoCodec", &v)?; + } + if self.video_bitrate != 0 { + struct_ser.serialize_field("videoBitrate", &self.video_bitrate)?; + } + if self.video_quality != 0 { + struct_ser.serialize_field("videoQuality", &self.video_quality)?; + } + if self.key_frame_interval != 0. { + struct_ser.serialize_field("keyFrameInterval", &self.key_frame_interval)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for FileInfo { +impl<'de> serde::Deserialize<'de> for EncodingOptions { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "filename", - "started_at", - "startedAt", - "ended_at", - "endedAt", - "duration", - "size", - "location", + "width", + "height", + "depth", + "framerate", + "audio_codec", + "audioCodec", + "audio_bitrate", + "audioBitrate", + "audio_quality", + "audioQuality", + "audio_frequency", + "audioFrequency", + "video_codec", + "videoCodec", + "video_bitrate", + "videoBitrate", + "video_quality", + "videoQuality", + "key_frame_interval", + "keyFrameInterval", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Filename, - StartedAt, - EndedAt, - Duration, - Size, - Location, + Width, + Height, + Depth, + Framerate, + AudioCodec, + AudioBitrate, + AudioQuality, + AudioFrequency, + VideoCodec, + VideoBitrate, + VideoQuality, + KeyFrameInterval, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -5121,12 +5544,18 @@ impl<'de> serde::Deserialize<'de> for FileInfo { E: serde::de::Error, { match value { - "filename" => Ok(GeneratedField::Filename), - "startedAt" | "started_at" => Ok(GeneratedField::StartedAt), - "endedAt" | "ended_at" => Ok(GeneratedField::EndedAt), - "duration" => Ok(GeneratedField::Duration), - "size" => Ok(GeneratedField::Size), - "location" => Ok(GeneratedField::Location), + "width" => Ok(GeneratedField::Width), + "height" => Ok(GeneratedField::Height), + "depth" => Ok(GeneratedField::Depth), + "framerate" => Ok(GeneratedField::Framerate), + "audioCodec" | "audio_codec" => Ok(GeneratedField::AudioCodec), + "audioBitrate" | "audio_bitrate" => Ok(GeneratedField::AudioBitrate), + "audioQuality" | "audio_quality" => Ok(GeneratedField::AudioQuality), + "audioFrequency" | "audio_frequency" => Ok(GeneratedField::AudioFrequency), + "videoCodec" | "video_codec" => Ok(GeneratedField::VideoCodec), + "videoBitrate" | "video_bitrate" => Ok(GeneratedField::VideoBitrate), + "videoQuality" | "video_quality" => Ok(GeneratedField::VideoQuality), + "keyFrameInterval" | "key_frame_interval" => Ok(GeneratedField::KeyFrameInterval), _ => Ok(GeneratedField::__SkipField__), } } @@ -5136,125 +5565,258 @@ impl<'de> serde::Deserialize<'de> for FileInfo { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = FileInfo; + type Value = EncodingOptions; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.FileInfo") + formatter.write_str("struct livekit.EncodingOptions") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut filename__ = None; - let mut started_at__ = None; - let mut ended_at__ = None; - let mut duration__ = None; - let mut size__ = None; - let mut location__ = None; + let mut width__ = None; + let mut height__ = None; + let mut depth__ = None; + let mut framerate__ = None; + let mut audio_codec__ = None; + let mut audio_bitrate__ = None; + let mut audio_quality__ = None; + let mut audio_frequency__ = None; + let mut video_codec__ = None; + let mut video_bitrate__ = None; + let mut video_quality__ = None; + let mut key_frame_interval__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Filename => { - if filename__.is_some() { - return Err(serde::de::Error::duplicate_field("filename")); - } - filename__ = Some(map_.next_value()?); - } - GeneratedField::StartedAt => { - if started_at__.is_some() { - return Err(serde::de::Error::duplicate_field("startedAt")); + GeneratedField::Width => { + if width__.is_some() { + return Err(serde::de::Error::duplicate_field("width")); } - started_at__ = + width__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } - GeneratedField::EndedAt => { - if ended_at__.is_some() { - return Err(serde::de::Error::duplicate_field("endedAt")); + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); } - ended_at__ = + height__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } - GeneratedField::Duration => { - if duration__.is_some() { - return Err(serde::de::Error::duplicate_field("duration")); + GeneratedField::Depth => { + if depth__.is_some() { + return Err(serde::de::Error::duplicate_field("depth")); } - duration__ = + depth__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } - GeneratedField::Size => { - if size__.is_some() { - return Err(serde::de::Error::duplicate_field("size")); + GeneratedField::Framerate => { + if framerate__.is_some() { + return Err(serde::de::Error::duplicate_field("framerate")); } - size__ = + framerate__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } - GeneratedField::Location => { - if location__.is_some() { - return Err(serde::de::Error::duplicate_field("location")); + GeneratedField::AudioCodec => { + if audio_codec__.is_some() { + return Err(serde::de::Error::duplicate_field("audioCodec")); } - location__ = Some(map_.next_value()?); + audio_codec__ = Some(map_.next_value::()? as i32); + } + GeneratedField::AudioBitrate => { + if audio_bitrate__.is_some() { + return Err(serde::de::Error::duplicate_field("audioBitrate")); + } + audio_bitrate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::AudioQuality => { + if audio_quality__.is_some() { + return Err(serde::de::Error::duplicate_field("audioQuality")); + } + audio_quality__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::AudioFrequency => { + if audio_frequency__.is_some() { + return Err(serde::de::Error::duplicate_field("audioFrequency")); + } + audio_frequency__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::VideoCodec => { + if video_codec__.is_some() { + return Err(serde::de::Error::duplicate_field("videoCodec")); + } + video_codec__ = Some(map_.next_value::()? as i32); + } + GeneratedField::VideoBitrate => { + if video_bitrate__.is_some() { + return Err(serde::de::Error::duplicate_field("videoBitrate")); + } + video_bitrate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::VideoQuality => { + if video_quality__.is_some() { + return Err(serde::de::Error::duplicate_field("videoQuality")); + } + video_quality__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::KeyFrameInterval => { + if key_frame_interval__.is_some() { + return Err(serde::de::Error::duplicate_field("keyFrameInterval")); + } + key_frame_interval__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(FileInfo { - filename: filename__.unwrap_or_default(), - started_at: started_at__.unwrap_or_default(), - ended_at: ended_at__.unwrap_or_default(), - duration: duration__.unwrap_or_default(), - size: size__.unwrap_or_default(), - location: location__.unwrap_or_default(), + Ok(EncodingOptions { + width: width__.unwrap_or_default(), + height: height__.unwrap_or_default(), + depth: depth__.unwrap_or_default(), + framerate: framerate__.unwrap_or_default(), + audio_codec: audio_codec__.unwrap_or_default(), + audio_bitrate: audio_bitrate__.unwrap_or_default(), + audio_quality: audio_quality__.unwrap_or_default(), + audio_frequency: audio_frequency__.unwrap_or_default(), + video_codec: video_codec__.unwrap_or_default(), + video_bitrate: video_bitrate__.unwrap_or_default(), + video_quality: video_quality__.unwrap_or_default(), + key_frame_interval: key_frame_interval__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.FileInfo", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.EncodingOptions", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for GcpUpload { +impl serde::Serialize for EncodingOptionsPreset { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { - use serde::ser::SerializeStruct; - let mut len = 0; - if !self.credentials.is_empty() { - len += 1; - } - if !self.bucket.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("livekit.GCPUpload", len)?; - if !self.credentials.is_empty() { - struct_ser.serialize_field("credentials", &self.credentials)?; - } - if !self.bucket.is_empty() { - struct_ser.serialize_field("bucket", &self.bucket)?; + let variant = match self { + Self::H264720p30 => "H264_720P_30", + Self::H264720p60 => "H264_720P_60", + Self::H2641080p30 => "H264_1080P_30", + Self::H2641080p60 => "H264_1080P_60", + Self::PortraitH264720p30 => "PORTRAIT_H264_720P_30", + Self::PortraitH264720p60 => "PORTRAIT_H264_720P_60", + Self::PortraitH2641080p30 => "PORTRAIT_H264_1080P_30", + Self::PortraitH2641080p60 => "PORTRAIT_H264_1080P_60", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for EncodingOptionsPreset { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "H264_720P_30", + "H264_720P_60", + "H264_1080P_30", + "H264_1080P_60", + "PORTRAIT_H264_720P_30", + "PORTRAIT_H264_720P_60", + "PORTRAIT_H264_1080P_30", + "PORTRAIT_H264_1080P_60", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = EncodingOptionsPreset; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "H264_720P_30" => Ok(EncodingOptionsPreset::H264720p30), + "H264_720P_60" => Ok(EncodingOptionsPreset::H264720p60), + "H264_1080P_30" => Ok(EncodingOptionsPreset::H2641080p30), + "H264_1080P_60" => Ok(EncodingOptionsPreset::H2641080p60), + "PORTRAIT_H264_720P_30" => Ok(EncodingOptionsPreset::PortraitH264720p30), + "PORTRAIT_H264_720P_60" => Ok(EncodingOptionsPreset::PortraitH264720p60), + "PORTRAIT_H264_1080P_30" => Ok(EncodingOptionsPreset::PortraitH2641080p30), + "PORTRAIT_H264_1080P_60" => Ok(EncodingOptionsPreset::PortraitH2641080p60), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } } + deserializer.deserialize_any(GeneratedVisitor) + } +} +impl serde::Serialize for Encryption { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("livekit.Encryption", len)?; struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for GcpUpload { +impl<'de> serde::Deserialize<'de> for Encryption { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "credentials", - "bucket", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Credentials, - Bucket, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -5276,11 +5838,7 @@ impl<'de> serde::Deserialize<'de> for GcpUpload { where E: serde::de::Error, { - match value { - "credentials" => Ok(GeneratedField::Credentials), - "bucket" => Ok(GeneratedField::Bucket), - _ => Ok(GeneratedField::__SkipField__), - } + Ok(GeneratedField::__SkipField__) } } deserializer.deserialize_identifier(GeneratedVisitor) @@ -5288,47 +5846,101 @@ impl<'de> serde::Deserialize<'de> for GcpUpload { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GcpUpload; + type Value = Encryption; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.GCPUpload") + formatter.write_str("struct livekit.Encryption") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut credentials__ = None; - let mut bucket__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Credentials => { - if credentials__.is_some() { - return Err(serde::de::Error::duplicate_field("credentials")); - } - credentials__ = Some(map_.next_value()?); - } - GeneratedField::Bucket => { - if bucket__.is_some() { - return Err(serde::de::Error::duplicate_field("bucket")); - } - bucket__ = Some(map_.next_value()?); - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; } - Ok(GcpUpload { - credentials: credentials__.unwrap_or_default(), - bucket: bucket__.unwrap_or_default(), + Ok(Encryption { }) } } - deserializer.deserialize_struct("livekit.GCPUpload", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.Encryption", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for IceServer { +impl serde::Serialize for encryption::Type { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::None => "NONE", + Self::Gcm => "GCM", + Self::Custom => "CUSTOM", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for encryption::Type { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "NONE", + "GCM", + "CUSTOM", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = encryption::Type; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "NONE" => Ok(encryption::Type::None), + "GCM" => Ok(encryption::Type::Gcm), + "CUSTOM" => Ok(encryption::Type::Custom), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +impl serde::Serialize for FileInfo { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -5336,45 +5948,75 @@ impl serde::Serialize for IceServer { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.urls.is_empty() { + if !self.filename.is_empty() { len += 1; } - if !self.username.is_empty() { + if self.started_at != 0 { len += 1; } - if !self.credential.is_empty() { + if self.ended_at != 0 { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ICEServer", len)?; - if !self.urls.is_empty() { - struct_ser.serialize_field("urls", &self.urls)?; + if self.duration != 0 { + len += 1; } - if !self.username.is_empty() { - struct_ser.serialize_field("username", &self.username)?; + if self.size != 0 { + len += 1; } - if !self.credential.is_empty() { - struct_ser.serialize_field("credential", &self.credential)?; + if !self.location.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.FileInfo", len)?; + if !self.filename.is_empty() { + struct_ser.serialize_field("filename", &self.filename)?; + } + if self.started_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("startedAt", ToString::to_string(&self.started_at).as_str())?; + } + if self.ended_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("endedAt", ToString::to_string(&self.ended_at).as_str())?; + } + if self.duration != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("duration", ToString::to_string(&self.duration).as_str())?; + } + if self.size != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("size", ToString::to_string(&self.size).as_str())?; + } + if !self.location.is_empty() { + struct_ser.serialize_field("location", &self.location)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for IceServer { +impl<'de> serde::Deserialize<'de> for FileInfo { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "urls", - "username", - "credential", + "filename", + "started_at", + "startedAt", + "ended_at", + "endedAt", + "duration", + "size", + "location", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Urls, - Username, - Credential, + Filename, + StartedAt, + EndedAt, + Duration, + Size, + Location, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -5397,9 +6039,12 @@ impl<'de> serde::Deserialize<'de> for IceServer { E: serde::de::Error, { match value { - "urls" => Ok(GeneratedField::Urls), - "username" => Ok(GeneratedField::Username), - "credential" => Ok(GeneratedField::Credential), + "filename" => Ok(GeneratedField::Filename), + "startedAt" | "started_at" => Ok(GeneratedField::StartedAt), + "endedAt" | "ended_at" => Ok(GeneratedField::EndedAt), + "duration" => Ok(GeneratedField::Duration), + "size" => Ok(GeneratedField::Size), + "location" => Ok(GeneratedField::Location), _ => Ok(GeneratedField::__SkipField__), } } @@ -5409,197 +6054,87 @@ impl<'de> serde::Deserialize<'de> for IceServer { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IceServer; + type Value = FileInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ICEServer") + formatter.write_str("struct livekit.FileInfo") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut urls__ = None; - let mut username__ = None; - let mut credential__ = None; + let mut filename__ = None; + let mut started_at__ = None; + let mut ended_at__ = None; + let mut duration__ = None; + let mut size__ = None; + let mut location__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Urls => { - if urls__.is_some() { - return Err(serde::de::Error::duplicate_field("urls")); + GeneratedField::Filename => { + if filename__.is_some() { + return Err(serde::de::Error::duplicate_field("filename")); } - urls__ = Some(map_.next_value()?); + filename__ = Some(map_.next_value()?); } - GeneratedField::Username => { - if username__.is_some() { - return Err(serde::de::Error::duplicate_field("username")); + GeneratedField::StartedAt => { + if started_at__.is_some() { + return Err(serde::de::Error::duplicate_field("startedAt")); } - username__ = Some(map_.next_value()?); + started_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } - GeneratedField::Credential => { - if credential__.is_some() { - return Err(serde::de::Error::duplicate_field("credential")); + GeneratedField::EndedAt => { + if ended_at__.is_some() { + return Err(serde::de::Error::duplicate_field("endedAt")); } - credential__ = Some(map_.next_value()?); + ended_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Duration => { + if duration__.is_some() { + return Err(serde::de::Error::duplicate_field("duration")); + } + duration__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Size => { + if size__.is_some() { + return Err(serde::de::Error::duplicate_field("size")); + } + size__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Location => { + if location__.is_some() { + return Err(serde::de::Error::duplicate_field("location")); + } + location__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(IceServer { - urls: urls__.unwrap_or_default(), - username: username__.unwrap_or_default(), - credential: credential__.unwrap_or_default(), + Ok(FileInfo { + filename: filename__.unwrap_or_default(), + started_at: started_at__.unwrap_or_default(), + ended_at: ended_at__.unwrap_or_default(), + duration: duration__.unwrap_or_default(), + size: size__.unwrap_or_default(), + location: location__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ICEServer", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.FileInfo", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ImageCodec { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::IcDefault => "IC_DEFAULT", - Self::IcJpeg => "IC_JPEG", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for ImageCodec { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "IC_DEFAULT", - "IC_JPEG", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ImageCodec; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "IC_DEFAULT" => Ok(ImageCodec::IcDefault), - "IC_JPEG" => Ok(ImageCodec::IcJpeg), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for ImageFileSuffix { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::ImageSuffixIndex => "IMAGE_SUFFIX_INDEX", - Self::ImageSuffixTimestamp => "IMAGE_SUFFIX_TIMESTAMP", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for ImageFileSuffix { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "IMAGE_SUFFIX_INDEX", - "IMAGE_SUFFIX_TIMESTAMP", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ImageFileSuffix; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "IMAGE_SUFFIX_INDEX" => Ok(ImageFileSuffix::ImageSuffixIndex), - "IMAGE_SUFFIX_TIMESTAMP" => Ok(ImageFileSuffix::ImageSuffixTimestamp), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for ImageOutput { +impl serde::Serialize for GcpUpload { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -5607,113 +6142,45 @@ impl serde::Serialize for ImageOutput { { use serde::ser::SerializeStruct; let mut len = 0; - if self.capture_interval != 0 { - len += 1; - } - if self.width != 0 { - len += 1; - } - if self.height != 0 { - len += 1; - } - if !self.filename_prefix.is_empty() { - len += 1; - } - if self.filename_suffix != 0 { - len += 1; - } - if self.image_codec != 0 { + if !self.credentials.is_empty() { len += 1; } - if self.disable_manifest { + if !self.bucket.is_empty() { len += 1; } - if self.output.is_some() { + if self.proxy.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ImageOutput", len)?; - if self.capture_interval != 0 { - struct_ser.serialize_field("captureInterval", &self.capture_interval)?; - } - if self.width != 0 { - struct_ser.serialize_field("width", &self.width)?; - } - if self.height != 0 { - struct_ser.serialize_field("height", &self.height)?; - } - if !self.filename_prefix.is_empty() { - struct_ser.serialize_field("filenamePrefix", &self.filename_prefix)?; - } - if self.filename_suffix != 0 { - let v = ImageFileSuffix::try_from(self.filename_suffix) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.filename_suffix)))?; - struct_ser.serialize_field("filenameSuffix", &v)?; - } - if self.image_codec != 0 { - let v = ImageCodec::try_from(self.image_codec) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.image_codec)))?; - struct_ser.serialize_field("imageCodec", &v)?; + let mut struct_ser = serializer.serialize_struct("livekit.GCPUpload", len)?; + if !self.credentials.is_empty() { + struct_ser.serialize_field("credentials", &self.credentials)?; } - if self.disable_manifest { - struct_ser.serialize_field("disableManifest", &self.disable_manifest)?; + if !self.bucket.is_empty() { + struct_ser.serialize_field("bucket", &self.bucket)?; } - if let Some(v) = self.output.as_ref() { - match v { - image_output::Output::S3(v) => { - struct_ser.serialize_field("s3", v)?; - } - image_output::Output::Gcp(v) => { - struct_ser.serialize_field("gcp", v)?; - } - image_output::Output::Azure(v) => { - struct_ser.serialize_field("azure", v)?; - } - image_output::Output::AliOss(v) => { - struct_ser.serialize_field("aliOSS", v)?; - } - } + if let Some(v) = self.proxy.as_ref() { + struct_ser.serialize_field("proxy", v)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ImageOutput { +impl<'de> serde::Deserialize<'de> for GcpUpload { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "capture_interval", - "captureInterval", - "width", - "height", - "filename_prefix", - "filenamePrefix", - "filename_suffix", - "filenameSuffix", - "image_codec", - "imageCodec", - "disable_manifest", - "disableManifest", - "s3", - "gcp", - "azure", - "aliOSS", + "credentials", + "bucket", + "proxy", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - CaptureInterval, - Width, - Height, - FilenamePrefix, - FilenameSuffix, - ImageCodec, - DisableManifest, - S3, - Gcp, - Azure, - AliOss, + Credentials, + Bucket, + Proxy, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -5736,17 +6203,9 @@ impl<'de> serde::Deserialize<'de> for ImageOutput { E: serde::de::Error, { match value { - "captureInterval" | "capture_interval" => Ok(GeneratedField::CaptureInterval), - "width" => Ok(GeneratedField::Width), - "height" => Ok(GeneratedField::Height), - "filenamePrefix" | "filename_prefix" => Ok(GeneratedField::FilenamePrefix), - "filenameSuffix" | "filename_suffix" => Ok(GeneratedField::FilenameSuffix), - "imageCodec" | "image_codec" => Ok(GeneratedField::ImageCodec), - "disableManifest" | "disable_manifest" => Ok(GeneratedField::DisableManifest), - "s3" => Ok(GeneratedField::S3), - "gcp" => Ok(GeneratedField::Gcp), - "azure" => Ok(GeneratedField::Azure), - "aliOSS" => Ok(GeneratedField::AliOss), + "credentials" => Ok(GeneratedField::Credentials), + "bucket" => Ok(GeneratedField::Bucket), + "proxy" => Ok(GeneratedField::Proxy), _ => Ok(GeneratedField::__SkipField__), } } @@ -5756,123 +6215,55 @@ impl<'de> serde::Deserialize<'de> for ImageOutput { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ImageOutput; + type Value = GcpUpload; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ImageOutput") + formatter.write_str("struct livekit.GCPUpload") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut capture_interval__ = None; - let mut width__ = None; - let mut height__ = None; - let mut filename_prefix__ = None; - let mut filename_suffix__ = None; - let mut image_codec__ = None; - let mut disable_manifest__ = None; - let mut output__ = None; + let mut credentials__ = None; + let mut bucket__ = None; + let mut proxy__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::CaptureInterval => { - if capture_interval__.is_some() { - return Err(serde::de::Error::duplicate_field("captureInterval")); + GeneratedField::Credentials => { + if credentials__.is_some() { + return Err(serde::de::Error::duplicate_field("credentials")); } - capture_interval__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + credentials__ = Some(map_.next_value()?); } - GeneratedField::Width => { - if width__.is_some() { - return Err(serde::de::Error::duplicate_field("width")); - } - width__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Height => { - if height__.is_some() { - return Err(serde::de::Error::duplicate_field("height")); - } - height__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::FilenamePrefix => { - if filename_prefix__.is_some() { - return Err(serde::de::Error::duplicate_field("filenamePrefix")); - } - filename_prefix__ = Some(map_.next_value()?); - } - GeneratedField::FilenameSuffix => { - if filename_suffix__.is_some() { - return Err(serde::de::Error::duplicate_field("filenameSuffix")); - } - filename_suffix__ = Some(map_.next_value::()? as i32); - } - GeneratedField::ImageCodec => { - if image_codec__.is_some() { - return Err(serde::de::Error::duplicate_field("imageCodec")); - } - image_codec__ = Some(map_.next_value::()? as i32); - } - GeneratedField::DisableManifest => { - if disable_manifest__.is_some() { - return Err(serde::de::Error::duplicate_field("disableManifest")); - } - disable_manifest__ = Some(map_.next_value()?); - } - GeneratedField::S3 => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("s3")); - } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(image_output::Output::S3) -; - } - GeneratedField::Gcp => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("gcp")); - } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(image_output::Output::Gcp) -; - } - GeneratedField::Azure => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("azure")); + GeneratedField::Bucket => { + if bucket__.is_some() { + return Err(serde::de::Error::duplicate_field("bucket")); } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(image_output::Output::Azure) -; + bucket__ = Some(map_.next_value()?); } - GeneratedField::AliOss => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("aliOSS")); + GeneratedField::Proxy => { + if proxy__.is_some() { + return Err(serde::de::Error::duplicate_field("proxy")); } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(image_output::Output::AliOss) -; + proxy__ = map_.next_value()?; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ImageOutput { - capture_interval: capture_interval__.unwrap_or_default(), - width: width__.unwrap_or_default(), - height: height__.unwrap_or_default(), - filename_prefix: filename_prefix__.unwrap_or_default(), - filename_suffix: filename_suffix__.unwrap_or_default(), - image_codec: image_codec__.unwrap_or_default(), - disable_manifest: disable_manifest__.unwrap_or_default(), - output: output__, + Ok(GcpUpload { + credentials: credentials__.unwrap_or_default(), + bucket: bucket__.unwrap_or_default(), + proxy: proxy__, }) } } - deserializer.deserialize_struct("livekit.ImageOutput", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.GCPUpload", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ImagesInfo { +impl serde::Serialize for IceServer { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -5880,51 +6271,45 @@ impl serde::Serialize for ImagesInfo { { use serde::ser::SerializeStruct; let mut len = 0; - if self.image_count != 0 { + if !self.urls.is_empty() { len += 1; } - if self.started_at != 0 { + if !self.username.is_empty() { len += 1; } - if self.ended_at != 0 { + if !self.credential.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ImagesInfo", len)?; - if self.image_count != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("imageCount", ToString::to_string(&self.image_count).as_str())?; + let mut struct_ser = serializer.serialize_struct("livekit.ICEServer", len)?; + if !self.urls.is_empty() { + struct_ser.serialize_field("urls", &self.urls)?; } - if self.started_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("startedAt", ToString::to_string(&self.started_at).as_str())?; + if !self.username.is_empty() { + struct_ser.serialize_field("username", &self.username)?; } - if self.ended_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("endedAt", ToString::to_string(&self.ended_at).as_str())?; + if !self.credential.is_empty() { + struct_ser.serialize_field("credential", &self.credential)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ImagesInfo { +impl<'de> serde::Deserialize<'de> for IceServer { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "image_count", - "imageCount", - "started_at", - "startedAt", - "ended_at", - "endedAt", + "urls", + "username", + "credential", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - ImageCount, - StartedAt, - EndedAt, + Urls, + Username, + Credential, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -5947,9 +6332,9 @@ impl<'de> serde::Deserialize<'de> for ImagesInfo { E: serde::de::Error, { match value { - "imageCount" | "image_count" => Ok(GeneratedField::ImageCount), - "startedAt" | "started_at" => Ok(GeneratedField::StartedAt), - "endedAt" | "ended_at" => Ok(GeneratedField::EndedAt), + "urls" => Ok(GeneratedField::Urls), + "username" => Ok(GeneratedField::Username), + "credential" => Ok(GeneratedField::Credential), _ => Ok(GeneratedField::__SkipField__), } } @@ -5959,242 +6344,153 @@ impl<'de> serde::Deserialize<'de> for ImagesInfo { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ImagesInfo; + type Value = IceServer; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ImagesInfo") + formatter.write_str("struct livekit.ICEServer") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut image_count__ = None; - let mut started_at__ = None; - let mut ended_at__ = None; + let mut urls__ = None; + let mut username__ = None; + let mut credential__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::ImageCount => { - if image_count__.is_some() { - return Err(serde::de::Error::duplicate_field("imageCount")); + GeneratedField::Urls => { + if urls__.is_some() { + return Err(serde::de::Error::duplicate_field("urls")); } - image_count__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + urls__ = Some(map_.next_value()?); } - GeneratedField::StartedAt => { - if started_at__.is_some() { - return Err(serde::de::Error::duplicate_field("startedAt")); + GeneratedField::Username => { + if username__.is_some() { + return Err(serde::de::Error::duplicate_field("username")); } - started_at__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + username__ = Some(map_.next_value()?); } - GeneratedField::EndedAt => { - if ended_at__.is_some() { - return Err(serde::de::Error::duplicate_field("endedAt")); + GeneratedField::Credential => { + if credential__.is_some() { + return Err(serde::de::Error::duplicate_field("credential")); } - ended_at__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + credential__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ImagesInfo { - image_count: image_count__.unwrap_or_default(), - started_at: started_at__.unwrap_or_default(), - ended_at: ended_at__.unwrap_or_default(), + Ok(IceServer { + urls: urls__.unwrap_or_default(), + username: username__.unwrap_or_default(), + credential: credential__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ImagesInfo", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ICEServer", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for IngressAudioEncodingOptions { +impl serde::Serialize for ImageCodec { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.audio_codec != 0 { - len += 1; - } - if self.bitrate != 0 { - len += 1; - } - if self.disable_dtx { - len += 1; - } - if self.channels != 0 { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("livekit.IngressAudioEncodingOptions", len)?; - if self.audio_codec != 0 { - let v = AudioCodec::try_from(self.audio_codec) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.audio_codec)))?; - struct_ser.serialize_field("audioCodec", &v)?; - } - if self.bitrate != 0 { - struct_ser.serialize_field("bitrate", &self.bitrate)?; - } - if self.disable_dtx { - struct_ser.serialize_field("disableDtx", &self.disable_dtx)?; - } - if self.channels != 0 { - struct_ser.serialize_field("channels", &self.channels)?; - } - struct_ser.end() + let variant = match self { + Self::IcDefault => "IC_DEFAULT", + Self::IcJpeg => "IC_JPEG", + }; + serializer.serialize_str(variant) } } -impl<'de> serde::Deserialize<'de> for IngressAudioEncodingOptions { +impl<'de> serde::Deserialize<'de> for ImageCodec { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "audio_codec", - "audioCodec", - "bitrate", - "disable_dtx", - "disableDtx", - "channels", + "IC_DEFAULT", + "IC_JPEG", ]; - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - AudioCodec, - Bitrate, - DisableDtx, - Channels, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; + struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ImageCodec; - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "audioCodec" | "audio_codec" => Ok(GeneratedField::AudioCodec), - "bitrate" => Ok(GeneratedField::Bitrate), - "disableDtx" | "disable_dtx" => Ok(GeneratedField::DisableDtx), - "channels" => Ok(GeneratedField::Channels), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) } - } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IngressAudioEncodingOptions; - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.IngressAudioEncodingOptions") + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) } - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, { - let mut audio_codec__ = None; - let mut bitrate__ = None; - let mut disable_dtx__ = None; - let mut channels__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::AudioCodec => { - if audio_codec__.is_some() { - return Err(serde::de::Error::duplicate_field("audioCodec")); - } - audio_codec__ = Some(map_.next_value::()? as i32); - } - GeneratedField::Bitrate => { - if bitrate__.is_some() { - return Err(serde::de::Error::duplicate_field("bitrate")); - } - bitrate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::DisableDtx => { - if disable_dtx__.is_some() { - return Err(serde::de::Error::duplicate_field("disableDtx")); - } - disable_dtx__ = Some(map_.next_value()?); - } - GeneratedField::Channels => { - if channels__.is_some() { - return Err(serde::de::Error::duplicate_field("channels")); - } - channels__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } + match value { + "IC_DEFAULT" => Ok(ImageCodec::IcDefault), + "IC_JPEG" => Ok(ImageCodec::IcJpeg), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } - Ok(IngressAudioEncodingOptions { - audio_codec: audio_codec__.unwrap_or_default(), - bitrate: bitrate__.unwrap_or_default(), - disable_dtx: disable_dtx__.unwrap_or_default(), - channels: channels__.unwrap_or_default(), - }) } } - deserializer.deserialize_struct("livekit.IngressAudioEncodingOptions", FIELDS, GeneratedVisitor) + deserializer.deserialize_any(GeneratedVisitor) } } -impl serde::Serialize for IngressAudioEncodingPreset { +impl serde::Serialize for ImageFileSuffix { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { let variant = match self { - Self::OpusStereo96kbps => "OPUS_STEREO_96KBPS", - Self::OpusMono64kbs => "OPUS_MONO_64KBS", + Self::ImageSuffixIndex => "IMAGE_SUFFIX_INDEX", + Self::ImageSuffixTimestamp => "IMAGE_SUFFIX_TIMESTAMP", }; serializer.serialize_str(variant) } } -impl<'de> serde::Deserialize<'de> for IngressAudioEncodingPreset { +impl<'de> serde::Deserialize<'de> for ImageFileSuffix { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "OPUS_STEREO_96KBPS", - "OPUS_MONO_64KBS", + "IMAGE_SUFFIX_INDEX", + "IMAGE_SUFFIX_TIMESTAMP", ]; struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IngressAudioEncodingPreset; + type Value = ImageFileSuffix; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(formatter, "expected one of: {:?}", &FIELDS) @@ -6229,8 +6525,8 @@ impl<'de> serde::Deserialize<'de> for IngressAudioEncodingPreset { E: serde::de::Error, { match value { - "OPUS_STEREO_96KBPS" => Ok(IngressAudioEncodingPreset::OpusStereo96kbps), - "OPUS_MONO_64KBS" => Ok(IngressAudioEncodingPreset::OpusMono64kbs), + "IMAGE_SUFFIX_INDEX" => Ok(ImageFileSuffix::ImageSuffixIndex), + "IMAGE_SUFFIX_TIMESTAMP" => Ok(ImageFileSuffix::ImageSuffixTimestamp), _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } } @@ -6238,7 +6534,7 @@ impl<'de> serde::Deserialize<'de> for IngressAudioEncodingPreset { deserializer.deserialize_any(GeneratedVisitor) } } -impl serde::Serialize for IngressAudioOptions { +impl serde::Serialize for ImageOutput { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -6246,58 +6542,113 @@ impl serde::Serialize for IngressAudioOptions { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.name.is_empty() { + if self.capture_interval != 0 { len += 1; } - if self.source != 0 { + if self.width != 0 { len += 1; } - if self.encoding_options.is_some() { + if self.height != 0 { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.IngressAudioOptions", len)?; - if !self.name.is_empty() { - struct_ser.serialize_field("name", &self.name)?; + if !self.filename_prefix.is_empty() { + len += 1; } - if self.source != 0 { - let v = TrackSource::try_from(self.source) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.source)))?; - struct_ser.serialize_field("source", &v)?; + if self.filename_suffix != 0 { + len += 1; } - if let Some(v) = self.encoding_options.as_ref() { + if self.image_codec != 0 { + len += 1; + } + if self.disable_manifest { + len += 1; + } + if self.output.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.ImageOutput", len)?; + if self.capture_interval != 0 { + struct_ser.serialize_field("captureInterval", &self.capture_interval)?; + } + if self.width != 0 { + struct_ser.serialize_field("width", &self.width)?; + } + if self.height != 0 { + struct_ser.serialize_field("height", &self.height)?; + } + if !self.filename_prefix.is_empty() { + struct_ser.serialize_field("filenamePrefix", &self.filename_prefix)?; + } + if self.filename_suffix != 0 { + let v = ImageFileSuffix::try_from(self.filename_suffix) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.filename_suffix)))?; + struct_ser.serialize_field("filenameSuffix", &v)?; + } + if self.image_codec != 0 { + let v = ImageCodec::try_from(self.image_codec) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.image_codec)))?; + struct_ser.serialize_field("imageCodec", &v)?; + } + if self.disable_manifest { + struct_ser.serialize_field("disableManifest", &self.disable_manifest)?; + } + if let Some(v) = self.output.as_ref() { match v { - ingress_audio_options::EncodingOptions::Preset(v) => { - let v = IngressAudioEncodingPreset::try_from(*v) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("preset", &v)?; + image_output::Output::S3(v) => { + struct_ser.serialize_field("s3", v)?; } - ingress_audio_options::EncodingOptions::Options(v) => { - struct_ser.serialize_field("options", v)?; + image_output::Output::Gcp(v) => { + struct_ser.serialize_field("gcp", v)?; + } + image_output::Output::Azure(v) => { + struct_ser.serialize_field("azure", v)?; + } + image_output::Output::AliOss(v) => { + struct_ser.serialize_field("aliOSS", v)?; } } } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for IngressAudioOptions { +impl<'de> serde::Deserialize<'de> for ImageOutput { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "name", - "source", - "preset", - "options", + "capture_interval", + "captureInterval", + "width", + "height", + "filename_prefix", + "filenamePrefix", + "filename_suffix", + "filenameSuffix", + "image_codec", + "imageCodec", + "disable_manifest", + "disableManifest", + "s3", + "gcp", + "azure", + "aliOSS", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Name, - Source, - Preset, - Options, + CaptureInterval, + Width, + Height, + FilenamePrefix, + FilenameSuffix, + ImageCodec, + DisableManifest, + S3, + Gcp, + Azure, + AliOss, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -6320,10 +6671,17 @@ impl<'de> serde::Deserialize<'de> for IngressAudioOptions { E: serde::de::Error, { match value { - "name" => Ok(GeneratedField::Name), - "source" => Ok(GeneratedField::Source), - "preset" => Ok(GeneratedField::Preset), - "options" => Ok(GeneratedField::Options), + "captureInterval" | "capture_interval" => Ok(GeneratedField::CaptureInterval), + "width" => Ok(GeneratedField::Width), + "height" => Ok(GeneratedField::Height), + "filenamePrefix" | "filename_prefix" => Ok(GeneratedField::FilenamePrefix), + "filenameSuffix" | "filename_suffix" => Ok(GeneratedField::FilenameSuffix), + "imageCodec" | "image_codec" => Ok(GeneratedField::ImageCodec), + "disableManifest" | "disable_manifest" => Ok(GeneratedField::DisableManifest), + "s3" => Ok(GeneratedField::S3), + "gcp" => Ok(GeneratedField::Gcp), + "azure" => Ok(GeneratedField::Azure), + "aliOSS" => Ok(GeneratedField::AliOss), _ => Ok(GeneratedField::__SkipField__), } } @@ -6333,44 +6691,100 @@ impl<'de> serde::Deserialize<'de> for IngressAudioOptions { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IngressAudioOptions; + type Value = ImageOutput; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.IngressAudioOptions") + formatter.write_str("struct livekit.ImageOutput") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut name__ = None; - let mut source__ = None; - let mut encoding_options__ = None; + let mut capture_interval__ = None; + let mut width__ = None; + let mut height__ = None; + let mut filename_prefix__ = None; + let mut filename_suffix__ = None; + let mut image_codec__ = None; + let mut disable_manifest__ = None; + let mut output__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); + GeneratedField::CaptureInterval => { + if capture_interval__.is_some() { + return Err(serde::de::Error::duplicate_field("captureInterval")); } - name__ = Some(map_.next_value()?); + capture_interval__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } - GeneratedField::Source => { - if source__.is_some() { - return Err(serde::de::Error::duplicate_field("source")); + GeneratedField::Width => { + if width__.is_some() { + return Err(serde::de::Error::duplicate_field("width")); } - source__ = Some(map_.next_value::()? as i32); + width__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } - GeneratedField::Preset => { - if encoding_options__.is_some() { - return Err(serde::de::Error::duplicate_field("preset")); + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); } - encoding_options__ = map_.next_value::<::std::option::Option>()?.map(|x| ingress_audio_options::EncodingOptions::Preset(x as i32)); + height__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } - GeneratedField::Options => { - if encoding_options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); + GeneratedField::FilenamePrefix => { + if filename_prefix__.is_some() { + return Err(serde::de::Error::duplicate_field("filenamePrefix")); } - encoding_options__ = map_.next_value::<::std::option::Option<_>>()?.map(ingress_audio_options::EncodingOptions::Options) + filename_prefix__ = Some(map_.next_value()?); + } + GeneratedField::FilenameSuffix => { + if filename_suffix__.is_some() { + return Err(serde::de::Error::duplicate_field("filenameSuffix")); + } + filename_suffix__ = Some(map_.next_value::()? as i32); + } + GeneratedField::ImageCodec => { + if image_codec__.is_some() { + return Err(serde::de::Error::duplicate_field("imageCodec")); + } + image_codec__ = Some(map_.next_value::()? as i32); + } + GeneratedField::DisableManifest => { + if disable_manifest__.is_some() { + return Err(serde::de::Error::duplicate_field("disableManifest")); + } + disable_manifest__ = Some(map_.next_value()?); + } + GeneratedField::S3 => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("s3")); + } + output__ = map_.next_value::<::std::option::Option<_>>()?.map(image_output::Output::S3) +; + } + GeneratedField::Gcp => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("gcp")); + } + output__ = map_.next_value::<::std::option::Option<_>>()?.map(image_output::Output::Gcp) +; + } + GeneratedField::Azure => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("azure")); + } + output__ = map_.next_value::<::std::option::Option<_>>()?.map(image_output::Output::Azure) +; + } + GeneratedField::AliOss => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("aliOSS")); + } + output__ = map_.next_value::<::std::option::Option<_>>()?.map(image_output::Output::AliOss) ; } GeneratedField::__SkipField__ => { @@ -6378,17 +6792,22 @@ impl<'de> serde::Deserialize<'de> for IngressAudioOptions { } } } - Ok(IngressAudioOptions { - name: name__.unwrap_or_default(), - source: source__.unwrap_or_default(), - encoding_options: encoding_options__, + Ok(ImageOutput { + capture_interval: capture_interval__.unwrap_or_default(), + width: width__.unwrap_or_default(), + height: height__.unwrap_or_default(), + filename_prefix: filename_prefix__.unwrap_or_default(), + filename_suffix: filename_suffix__.unwrap_or_default(), + image_codec: image_codec__.unwrap_or_default(), + disable_manifest: disable_manifest__.unwrap_or_default(), + output: output__, }) } } - deserializer.deserialize_struct("livekit.IngressAudioOptions", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ImageOutput", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for IngressInfo { +impl serde::Serialize for ImagesInfo { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -6396,143 +6815,51 @@ impl serde::Serialize for IngressInfo { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.ingress_id.is_empty() { - len += 1; - } - if !self.name.is_empty() { - len += 1; - } - if !self.stream_key.is_empty() { - len += 1; - } - if !self.url.is_empty() { - len += 1; - } - if self.input_type != 0 { - len += 1; - } - if self.bypass_transcoding { - len += 1; - } - if self.audio.is_some() { - len += 1; - } - if self.video.is_some() { - len += 1; - } - if !self.room_name.is_empty() { - len += 1; - } - if !self.participant_identity.is_empty() { - len += 1; - } - if !self.participant_name.is_empty() { - len += 1; - } - if !self.participant_metadata.is_empty() { + if self.image_count != 0 { len += 1; } - if self.reusable { + if self.started_at != 0 { len += 1; } - if self.state.is_some() { + if self.ended_at != 0 { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.IngressInfo", len)?; - if !self.ingress_id.is_empty() { - struct_ser.serialize_field("ingressId", &self.ingress_id)?; - } - if !self.name.is_empty() { - struct_ser.serialize_field("name", &self.name)?; - } - if !self.stream_key.is_empty() { - struct_ser.serialize_field("streamKey", &self.stream_key)?; - } - if !self.url.is_empty() { - struct_ser.serialize_field("url", &self.url)?; - } - if self.input_type != 0 { - let v = IngressInput::try_from(self.input_type) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.input_type)))?; - struct_ser.serialize_field("inputType", &v)?; - } - if self.bypass_transcoding { - struct_ser.serialize_field("bypassTranscoding", &self.bypass_transcoding)?; - } - if let Some(v) = self.audio.as_ref() { - struct_ser.serialize_field("audio", v)?; - } - if let Some(v) = self.video.as_ref() { - struct_ser.serialize_field("video", v)?; - } - if !self.room_name.is_empty() { - struct_ser.serialize_field("roomName", &self.room_name)?; - } - if !self.participant_identity.is_empty() { - struct_ser.serialize_field("participantIdentity", &self.participant_identity)?; - } - if !self.participant_name.is_empty() { - struct_ser.serialize_field("participantName", &self.participant_name)?; - } - if !self.participant_metadata.is_empty() { - struct_ser.serialize_field("participantMetadata", &self.participant_metadata)?; + let mut struct_ser = serializer.serialize_struct("livekit.ImagesInfo", len)?; + if self.image_count != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("imageCount", ToString::to_string(&self.image_count).as_str())?; } - if self.reusable { - struct_ser.serialize_field("reusable", &self.reusable)?; + if self.started_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("startedAt", ToString::to_string(&self.started_at).as_str())?; } - if let Some(v) = self.state.as_ref() { - struct_ser.serialize_field("state", v)?; + if self.ended_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("endedAt", ToString::to_string(&self.ended_at).as_str())?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for IngressInfo { +impl<'de> serde::Deserialize<'de> for ImagesInfo { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "ingress_id", - "ingressId", - "name", - "stream_key", - "streamKey", - "url", - "input_type", - "inputType", - "bypass_transcoding", - "bypassTranscoding", - "audio", - "video", - "room_name", - "roomName", - "participant_identity", - "participantIdentity", - "participant_name", - "participantName", - "participant_metadata", - "participantMetadata", - "reusable", - "state", + "image_count", + "imageCount", + "started_at", + "startedAt", + "ended_at", + "endedAt", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - IngressId, - Name, - StreamKey, - Url, - InputType, - BypassTranscoding, - Audio, - Video, - RoomName, - ParticipantIdentity, - ParticipantName, - ParticipantMetadata, - Reusable, - State, + ImageCount, + StartedAt, + EndedAt, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -6555,20 +6882,9 @@ impl<'de> serde::Deserialize<'de> for IngressInfo { E: serde::de::Error, { match value { - "ingressId" | "ingress_id" => Ok(GeneratedField::IngressId), - "name" => Ok(GeneratedField::Name), - "streamKey" | "stream_key" => Ok(GeneratedField::StreamKey), - "url" => Ok(GeneratedField::Url), - "inputType" | "input_type" => Ok(GeneratedField::InputType), - "bypassTranscoding" | "bypass_transcoding" => Ok(GeneratedField::BypassTranscoding), - "audio" => Ok(GeneratedField::Audio), - "video" => Ok(GeneratedField::Video), - "roomName" | "room_name" => Ok(GeneratedField::RoomName), - "participantIdentity" | "participant_identity" => Ok(GeneratedField::ParticipantIdentity), - "participantName" | "participant_name" => Ok(GeneratedField::ParticipantName), - "participantMetadata" | "participant_metadata" => Ok(GeneratedField::ParticipantMetadata), - "reusable" => Ok(GeneratedField::Reusable), - "state" => Ok(GeneratedField::State), + "imageCount" | "image_count" => Ok(GeneratedField::ImageCount), + "startedAt" | "started_at" => Ok(GeneratedField::StartedAt), + "endedAt" | "ended_at" => Ok(GeneratedField::EndedAt), _ => Ok(GeneratedField::__SkipField__), } } @@ -6578,217 +6894,286 @@ impl<'de> serde::Deserialize<'de> for IngressInfo { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IngressInfo; + type Value = ImagesInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.IngressInfo") + formatter.write_str("struct livekit.ImagesInfo") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut ingress_id__ = None; - let mut name__ = None; - let mut stream_key__ = None; - let mut url__ = None; - let mut input_type__ = None; - let mut bypass_transcoding__ = None; - let mut audio__ = None; - let mut video__ = None; - let mut room_name__ = None; - let mut participant_identity__ = None; - let mut participant_name__ = None; - let mut participant_metadata__ = None; - let mut reusable__ = None; - let mut state__ = None; + let mut image_count__ = None; + let mut started_at__ = None; + let mut ended_at__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::IngressId => { - if ingress_id__.is_some() { - return Err(serde::de::Error::duplicate_field("ingressId")); - } - ingress_id__ = Some(map_.next_value()?); - } - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = Some(map_.next_value()?); - } - GeneratedField::StreamKey => { - if stream_key__.is_some() { - return Err(serde::de::Error::duplicate_field("streamKey")); - } - stream_key__ = Some(map_.next_value()?); - } - GeneratedField::Url => { - if url__.is_some() { - return Err(serde::de::Error::duplicate_field("url")); - } - url__ = Some(map_.next_value()?); - } - GeneratedField::InputType => { - if input_type__.is_some() { - return Err(serde::de::Error::duplicate_field("inputType")); - } - input_type__ = Some(map_.next_value::()? as i32); - } - GeneratedField::BypassTranscoding => { - if bypass_transcoding__.is_some() { - return Err(serde::de::Error::duplicate_field("bypassTranscoding")); - } - bypass_transcoding__ = Some(map_.next_value()?); - } - GeneratedField::Audio => { - if audio__.is_some() { - return Err(serde::de::Error::duplicate_field("audio")); - } - audio__ = map_.next_value()?; - } - GeneratedField::Video => { - if video__.is_some() { - return Err(serde::de::Error::duplicate_field("video")); - } - video__ = map_.next_value()?; - } - GeneratedField::RoomName => { - if room_name__.is_some() { - return Err(serde::de::Error::duplicate_field("roomName")); - } - room_name__ = Some(map_.next_value()?); - } - GeneratedField::ParticipantIdentity => { - if participant_identity__.is_some() { - return Err(serde::de::Error::duplicate_field("participantIdentity")); - } - participant_identity__ = Some(map_.next_value()?); - } - GeneratedField::ParticipantName => { - if participant_name__.is_some() { - return Err(serde::de::Error::duplicate_field("participantName")); - } - participant_name__ = Some(map_.next_value()?); - } - GeneratedField::ParticipantMetadata => { - if participant_metadata__.is_some() { - return Err(serde::de::Error::duplicate_field("participantMetadata")); + GeneratedField::ImageCount => { + if image_count__.is_some() { + return Err(serde::de::Error::duplicate_field("imageCount")); } - participant_metadata__ = Some(map_.next_value()?); + image_count__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } - GeneratedField::Reusable => { - if reusable__.is_some() { - return Err(serde::de::Error::duplicate_field("reusable")); + GeneratedField::StartedAt => { + if started_at__.is_some() { + return Err(serde::de::Error::duplicate_field("startedAt")); } - reusable__ = Some(map_.next_value()?); + started_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } - GeneratedField::State => { - if state__.is_some() { - return Err(serde::de::Error::duplicate_field("state")); + GeneratedField::EndedAt => { + if ended_at__.is_some() { + return Err(serde::de::Error::duplicate_field("endedAt")); } - state__ = map_.next_value()?; + ended_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(IngressInfo { - ingress_id: ingress_id__.unwrap_or_default(), - name: name__.unwrap_or_default(), - stream_key: stream_key__.unwrap_or_default(), - url: url__.unwrap_or_default(), - input_type: input_type__.unwrap_or_default(), - bypass_transcoding: bypass_transcoding__.unwrap_or_default(), - audio: audio__, - video: video__, - room_name: room_name__.unwrap_or_default(), - participant_identity: participant_identity__.unwrap_or_default(), - participant_name: participant_name__.unwrap_or_default(), - participant_metadata: participant_metadata__.unwrap_or_default(), - reusable: reusable__.unwrap_or_default(), - state: state__, + Ok(ImagesInfo { + image_count: image_count__.unwrap_or_default(), + started_at: started_at__.unwrap_or_default(), + ended_at: ended_at__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.IngressInfo", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ImagesInfo", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for IngressInput { +impl serde::Serialize for IngressAudioEncodingOptions { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { - let variant = match self { - Self::RtmpInput => "RTMP_INPUT", - Self::WhipInput => "WHIP_INPUT", - Self::UrlInput => "URL_INPUT", - }; - serializer.serialize_str(variant) + use serde::ser::SerializeStruct; + let mut len = 0; + if self.audio_codec != 0 { + len += 1; + } + if self.bitrate != 0 { + len += 1; + } + if self.disable_dtx { + len += 1; + } + if self.channels != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.IngressAudioEncodingOptions", len)?; + if self.audio_codec != 0 { + let v = AudioCodec::try_from(self.audio_codec) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.audio_codec)))?; + struct_ser.serialize_field("audioCodec", &v)?; + } + if self.bitrate != 0 { + struct_ser.serialize_field("bitrate", &self.bitrate)?; + } + if self.disable_dtx { + struct_ser.serialize_field("disableDtx", &self.disable_dtx)?; + } + if self.channels != 0 { + struct_ser.serialize_field("channels", &self.channels)?; + } + struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for IngressInput { +impl<'de> serde::Deserialize<'de> for IngressAudioEncodingOptions { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "RTMP_INPUT", - "WHIP_INPUT", - "URL_INPUT", + "audio_codec", + "audioCodec", + "bitrate", + "disable_dtx", + "disableDtx", + "channels", ]; - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IngressInput; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + AudioCodec, + Bitrate, + DisableDtx, + Channels, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result where - E: serde::de::Error, + D: serde::Deserializer<'de>, { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } + struct GeneratedVisitor; - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "RTMP_INPUT" => Ok(IngressInput::RtmpInput), - "WHIP_INPUT" => Ok(IngressInput::WhipInput), - "URL_INPUT" => Ok(IngressInput::UrlInput), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "audioCodec" | "audio_codec" => Ok(GeneratedField::AudioCodec), + "bitrate" => Ok(GeneratedField::Bitrate), + "disableDtx" | "disable_dtx" => Ok(GeneratedField::DisableDtx), + "channels" => Ok(GeneratedField::Channels), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = IngressAudioEncodingOptions; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.IngressAudioEncodingOptions") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut audio_codec__ = None; + let mut bitrate__ = None; + let mut disable_dtx__ = None; + let mut channels__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AudioCodec => { + if audio_codec__.is_some() { + return Err(serde::de::Error::duplicate_field("audioCodec")); + } + audio_codec__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Bitrate => { + if bitrate__.is_some() { + return Err(serde::de::Error::duplicate_field("bitrate")); + } + bitrate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::DisableDtx => { + if disable_dtx__.is_some() { + return Err(serde::de::Error::duplicate_field("disableDtx")); + } + disable_dtx__ = Some(map_.next_value()?); + } + GeneratedField::Channels => { + if channels__.is_some() { + return Err(serde::de::Error::duplicate_field("channels")); + } + channels__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(IngressAudioEncodingOptions { + audio_codec: audio_codec__.unwrap_or_default(), + bitrate: bitrate__.unwrap_or_default(), + disable_dtx: disable_dtx__.unwrap_or_default(), + channels: channels__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.IngressAudioEncodingOptions", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for IngressAudioEncodingPreset { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::OpusStereo96kbps => "OPUS_STEREO_96KBPS", + Self::OpusMono64kbs => "OPUS_MONO_64KBS", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for IngressAudioEncodingPreset { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "OPUS_STEREO_96KBPS", + "OPUS_MONO_64KBS", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = IngressAudioEncodingPreset; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "OPUS_STEREO_96KBPS" => Ok(IngressAudioEncodingPreset::OpusStereo96kbps), + "OPUS_MONO_64KBS" => Ok(IngressAudioEncodingPreset::OpusMono64kbs), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } } } deserializer.deserialize_any(GeneratedVisitor) } } -impl serde::Serialize for IngressState { +impl serde::Serialize for IngressAudioOptions { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -6796,101 +7181,58 @@ impl serde::Serialize for IngressState { { use serde::ser::SerializeStruct; let mut len = 0; - if self.status != 0 { - len += 1; - } - if !self.error.is_empty() { - len += 1; - } - if self.video.is_some() { - len += 1; - } - if self.audio.is_some() { - len += 1; - } - if !self.room_id.is_empty() { - len += 1; - } - if self.started_at != 0 { - len += 1; - } - if self.ended_at != 0 { + if !self.name.is_empty() { len += 1; } - if !self.resource_id.is_empty() { + if self.source != 0 { len += 1; } - if !self.tracks.is_empty() { + if self.encoding_options.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.IngressState", len)?; - if self.status != 0 { - let v = ingress_state::Status::try_from(self.status) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.status)))?; - struct_ser.serialize_field("status", &v)?; - } - if !self.error.is_empty() { - struct_ser.serialize_field("error", &self.error)?; - } - if let Some(v) = self.video.as_ref() { - struct_ser.serialize_field("video", v)?; - } - if let Some(v) = self.audio.as_ref() { - struct_ser.serialize_field("audio", v)?; - } - if !self.room_id.is_empty() { - struct_ser.serialize_field("roomId", &self.room_id)?; - } - if self.started_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("startedAt", ToString::to_string(&self.started_at).as_str())?; - } - if self.ended_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("endedAt", ToString::to_string(&self.ended_at).as_str())?; + let mut struct_ser = serializer.serialize_struct("livekit.IngressAudioOptions", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; } - if !self.resource_id.is_empty() { - struct_ser.serialize_field("resourceId", &self.resource_id)?; + if self.source != 0 { + let v = TrackSource::try_from(self.source) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.source)))?; + struct_ser.serialize_field("source", &v)?; } - if !self.tracks.is_empty() { - struct_ser.serialize_field("tracks", &self.tracks)?; + if let Some(v) = self.encoding_options.as_ref() { + match v { + ingress_audio_options::EncodingOptions::Preset(v) => { + let v = IngressAudioEncodingPreset::try_from(*v) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?; + struct_ser.serialize_field("preset", &v)?; + } + ingress_audio_options::EncodingOptions::Options(v) => { + struct_ser.serialize_field("options", v)?; + } + } } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for IngressState { +impl<'de> serde::Deserialize<'de> for IngressAudioOptions { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "status", - "error", - "video", - "audio", - "room_id", - "roomId", - "started_at", - "startedAt", - "ended_at", - "endedAt", - "resource_id", - "resourceId", - "tracks", + "name", + "source", + "preset", + "options", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Status, - Error, - Video, - Audio, - RoomId, - StartedAt, - EndedAt, - ResourceId, - Tracks, + Name, + Source, + Preset, + Options, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -6913,15 +7255,10 @@ impl<'de> serde::Deserialize<'de> for IngressState { E: serde::de::Error, { match value { - "status" => Ok(GeneratedField::Status), - "error" => Ok(GeneratedField::Error), - "video" => Ok(GeneratedField::Video), - "audio" => Ok(GeneratedField::Audio), - "roomId" | "room_id" => Ok(GeneratedField::RoomId), - "startedAt" | "started_at" => Ok(GeneratedField::StartedAt), - "endedAt" | "ended_at" => Ok(GeneratedField::EndedAt), - "resourceId" | "resource_id" => Ok(GeneratedField::ResourceId), - "tracks" => Ok(GeneratedField::Tracks), + "name" => Ok(GeneratedField::Name), + "source" => Ok(GeneratedField::Source), + "preset" => Ok(GeneratedField::Preset), + "options" => Ok(GeneratedField::Options), _ => Ok(GeneratedField::__SkipField__), } } @@ -6931,187 +7268,62 @@ impl<'de> serde::Deserialize<'de> for IngressState { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IngressState; + type Value = IngressAudioOptions; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.IngressState") + formatter.write_str("struct livekit.IngressAudioOptions") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut status__ = None; - let mut error__ = None; - let mut video__ = None; - let mut audio__ = None; - let mut room_id__ = None; - let mut started_at__ = None; - let mut ended_at__ = None; - let mut resource_id__ = None; - let mut tracks__ = None; + let mut name__ = None; + let mut source__ = None; + let mut encoding_options__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Status => { - if status__.is_some() { - return Err(serde::de::Error::duplicate_field("status")); - } - status__ = Some(map_.next_value::()? as i32); - } - GeneratedField::Error => { - if error__.is_some() { - return Err(serde::de::Error::duplicate_field("error")); - } - error__ = Some(map_.next_value()?); - } - GeneratedField::Video => { - if video__.is_some() { - return Err(serde::de::Error::duplicate_field("video")); - } - video__ = map_.next_value()?; - } - GeneratedField::Audio => { - if audio__.is_some() { - return Err(serde::de::Error::duplicate_field("audio")); - } - audio__ = map_.next_value()?; - } - GeneratedField::RoomId => { - if room_id__.is_some() { - return Err(serde::de::Error::duplicate_field("roomId")); - } - room_id__ = Some(map_.next_value()?); - } - GeneratedField::StartedAt => { - if started_at__.is_some() { - return Err(serde::de::Error::duplicate_field("startedAt")); + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); } - started_at__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + name__ = Some(map_.next_value()?); } - GeneratedField::EndedAt => { - if ended_at__.is_some() { - return Err(serde::de::Error::duplicate_field("endedAt")); + GeneratedField::Source => { + if source__.is_some() { + return Err(serde::de::Error::duplicate_field("source")); } - ended_at__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + source__ = Some(map_.next_value::()? as i32); } - GeneratedField::ResourceId => { - if resource_id__.is_some() { - return Err(serde::de::Error::duplicate_field("resourceId")); + GeneratedField::Preset => { + if encoding_options__.is_some() { + return Err(serde::de::Error::duplicate_field("preset")); } - resource_id__ = Some(map_.next_value()?); + encoding_options__ = map_.next_value::<::std::option::Option>()?.map(|x| ingress_audio_options::EncodingOptions::Preset(x as i32)); } - GeneratedField::Tracks => { - if tracks__.is_some() { - return Err(serde::de::Error::duplicate_field("tracks")); + GeneratedField::Options => { + if encoding_options__.is_some() { + return Err(serde::de::Error::duplicate_field("options")); } - tracks__ = Some(map_.next_value()?); + encoding_options__ = map_.next_value::<::std::option::Option<_>>()?.map(ingress_audio_options::EncodingOptions::Options) +; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(IngressState { - status: status__.unwrap_or_default(), - error: error__.unwrap_or_default(), - video: video__, - audio: audio__, - room_id: room_id__.unwrap_or_default(), - started_at: started_at__.unwrap_or_default(), - ended_at: ended_at__.unwrap_or_default(), - resource_id: resource_id__.unwrap_or_default(), - tracks: tracks__.unwrap_or_default(), + Ok(IngressAudioOptions { + name: name__.unwrap_or_default(), + source: source__.unwrap_or_default(), + encoding_options: encoding_options__, }) } } - deserializer.deserialize_struct("livekit.IngressState", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ingress_state::Status { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::EndpointInactive => "ENDPOINT_INACTIVE", - Self::EndpointBuffering => "ENDPOINT_BUFFERING", - Self::EndpointPublishing => "ENDPOINT_PUBLISHING", - Self::EndpointError => "ENDPOINT_ERROR", - Self::EndpointComplete => "ENDPOINT_COMPLETE", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for ingress_state::Status { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "ENDPOINT_INACTIVE", - "ENDPOINT_BUFFERING", - "ENDPOINT_PUBLISHING", - "ENDPOINT_ERROR", - "ENDPOINT_COMPLETE", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ingress_state::Status; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "ENDPOINT_INACTIVE" => Ok(ingress_state::Status::EndpointInactive), - "ENDPOINT_BUFFERING" => Ok(ingress_state::Status::EndpointBuffering), - "ENDPOINT_PUBLISHING" => Ok(ingress_state::Status::EndpointPublishing), - "ENDPOINT_ERROR" => Ok(ingress_state::Status::EndpointError), - "ENDPOINT_COMPLETE" => Ok(ingress_state::Status::EndpointComplete), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) + deserializer.deserialize_struct("livekit.IngressAudioOptions", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for IngressVideoEncodingOptions { +impl serde::Serialize for IngressInfo { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -7119,296 +7331,151 @@ impl serde::Serialize for IngressVideoEncodingOptions { { use serde::ser::SerializeStruct; let mut len = 0; - if self.video_codec != 0 { + if !self.ingress_id.is_empty() { len += 1; } - if self.frame_rate != 0. { + if !self.name.is_empty() { len += 1; } - if !self.layers.is_empty() { + if !self.stream_key.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.IngressVideoEncodingOptions", len)?; - if self.video_codec != 0 { - let v = VideoCodec::try_from(self.video_codec) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.video_codec)))?; - struct_ser.serialize_field("videoCodec", &v)?; + if !self.url.is_empty() { + len += 1; } - if self.frame_rate != 0. { - struct_ser.serialize_field("frameRate", &self.frame_rate)?; + if self.input_type != 0 { + len += 1; } - if !self.layers.is_empty() { - struct_ser.serialize_field("layers", &self.layers)?; + if self.bypass_transcoding { + len += 1; } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for IngressVideoEncodingOptions { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "video_codec", - "videoCodec", - "frame_rate", - "frameRate", - "layers", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - VideoCodec, - FrameRate, - Layers, - __SkipField__, + if self.audio.is_some() { + len += 1; } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "videoCodec" | "video_codec" => Ok(GeneratedField::VideoCodec), - "frameRate" | "frame_rate" => Ok(GeneratedField::FrameRate), - "layers" => Ok(GeneratedField::Layers), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } + if self.video.is_some() { + len += 1; } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IngressVideoEncodingOptions; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.IngressVideoEncodingOptions") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut video_codec__ = None; - let mut frame_rate__ = None; - let mut layers__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::VideoCodec => { - if video_codec__.is_some() { - return Err(serde::de::Error::duplicate_field("videoCodec")); - } - video_codec__ = Some(map_.next_value::()? as i32); - } - GeneratedField::FrameRate => { - if frame_rate__.is_some() { - return Err(serde::de::Error::duplicate_field("frameRate")); - } - frame_rate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Layers => { - if layers__.is_some() { - return Err(serde::de::Error::duplicate_field("layers")); - } - layers__ = Some(map_.next_value()?); - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(IngressVideoEncodingOptions { - video_codec: video_codec__.unwrap_or_default(), - frame_rate: frame_rate__.unwrap_or_default(), - layers: layers__.unwrap_or_default(), - }) - } + if !self.room_name.is_empty() { + len += 1; } - deserializer.deserialize_struct("livekit.IngressVideoEncodingOptions", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for IngressVideoEncodingPreset { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::H264720p30fps3Layers => "H264_720P_30FPS_3_LAYERS", - Self::H2641080p30fps3Layers => "H264_1080P_30FPS_3_LAYERS", - Self::H264540p25fps2Layers => "H264_540P_25FPS_2_LAYERS", - Self::H264720p30fps1Layer => "H264_720P_30FPS_1_LAYER", - Self::H2641080p30fps1Layer => "H264_1080P_30FPS_1_LAYER", - Self::H264720p30fps3LayersHighMotion => "H264_720P_30FPS_3_LAYERS_HIGH_MOTION", - Self::H2641080p30fps3LayersHighMotion => "H264_1080P_30FPS_3_LAYERS_HIGH_MOTION", - Self::H264540p25fps2LayersHighMotion => "H264_540P_25FPS_2_LAYERS_HIGH_MOTION", - Self::H264720p30fps1LayerHighMotion => "H264_720P_30FPS_1_LAYER_HIGH_MOTION", - Self::H2641080p30fps1LayerHighMotion => "H264_1080P_30FPS_1_LAYER_HIGH_MOTION", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for IngressVideoEncodingPreset { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "H264_720P_30FPS_3_LAYERS", - "H264_1080P_30FPS_3_LAYERS", - "H264_540P_25FPS_2_LAYERS", - "H264_720P_30FPS_1_LAYER", - "H264_1080P_30FPS_1_LAYER", - "H264_720P_30FPS_3_LAYERS_HIGH_MOTION", - "H264_1080P_30FPS_3_LAYERS_HIGH_MOTION", - "H264_540P_25FPS_2_LAYERS_HIGH_MOTION", - "H264_720P_30FPS_1_LAYER_HIGH_MOTION", - "H264_1080P_30FPS_1_LAYER_HIGH_MOTION", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IngressVideoEncodingPreset; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "H264_720P_30FPS_3_LAYERS" => Ok(IngressVideoEncodingPreset::H264720p30fps3Layers), - "H264_1080P_30FPS_3_LAYERS" => Ok(IngressVideoEncodingPreset::H2641080p30fps3Layers), - "H264_540P_25FPS_2_LAYERS" => Ok(IngressVideoEncodingPreset::H264540p25fps2Layers), - "H264_720P_30FPS_1_LAYER" => Ok(IngressVideoEncodingPreset::H264720p30fps1Layer), - "H264_1080P_30FPS_1_LAYER" => Ok(IngressVideoEncodingPreset::H2641080p30fps1Layer), - "H264_720P_30FPS_3_LAYERS_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H264720p30fps3LayersHighMotion), - "H264_1080P_30FPS_3_LAYERS_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H2641080p30fps3LayersHighMotion), - "H264_540P_25FPS_2_LAYERS_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H264540p25fps2LayersHighMotion), - "H264_720P_30FPS_1_LAYER_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H264720p30fps1LayerHighMotion), - "H264_1080P_30FPS_1_LAYER_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H2641080p30fps1LayerHighMotion), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } + if !self.participant_identity.is_empty() { + len += 1; } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for IngressVideoOptions { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if !self.name.is_empty() { + if !self.participant_name.is_empty() { len += 1; } - if self.source != 0 { + if !self.participant_metadata.is_empty() { len += 1; } - if self.encoding_options.is_some() { + if self.reusable { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.IngressVideoOptions", len)?; + if self.state.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.IngressInfo", len)?; + if !self.ingress_id.is_empty() { + struct_ser.serialize_field("ingressId", &self.ingress_id)?; + } if !self.name.is_empty() { struct_ser.serialize_field("name", &self.name)?; } - if self.source != 0 { - let v = TrackSource::try_from(self.source) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.source)))?; - struct_ser.serialize_field("source", &v)?; + if !self.stream_key.is_empty() { + struct_ser.serialize_field("streamKey", &self.stream_key)?; } - if let Some(v) = self.encoding_options.as_ref() { - match v { - ingress_video_options::EncodingOptions::Preset(v) => { - let v = IngressVideoEncodingPreset::try_from(*v) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("preset", &v)?; - } - ingress_video_options::EncodingOptions::Options(v) => { - struct_ser.serialize_field("options", v)?; - } - } + if !self.url.is_empty() { + struct_ser.serialize_field("url", &self.url)?; + } + if self.input_type != 0 { + let v = IngressInput::try_from(self.input_type) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.input_type)))?; + struct_ser.serialize_field("inputType", &v)?; + } + if self.bypass_transcoding { + struct_ser.serialize_field("bypassTranscoding", &self.bypass_transcoding)?; + } + if let Some(v) = self.audio.as_ref() { + struct_ser.serialize_field("audio", v)?; + } + if let Some(v) = self.video.as_ref() { + struct_ser.serialize_field("video", v)?; + } + if !self.room_name.is_empty() { + struct_ser.serialize_field("roomName", &self.room_name)?; + } + if !self.participant_identity.is_empty() { + struct_ser.serialize_field("participantIdentity", &self.participant_identity)?; + } + if !self.participant_name.is_empty() { + struct_ser.serialize_field("participantName", &self.participant_name)?; + } + if !self.participant_metadata.is_empty() { + struct_ser.serialize_field("participantMetadata", &self.participant_metadata)?; + } + if self.reusable { + struct_ser.serialize_field("reusable", &self.reusable)?; + } + if let Some(v) = self.state.as_ref() { + struct_ser.serialize_field("state", v)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for IngressVideoOptions { +impl<'de> serde::Deserialize<'de> for IngressInfo { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ + "ingress_id", + "ingressId", "name", - "source", - "preset", - "options", + "stream_key", + "streamKey", + "url", + "input_type", + "inputType", + "bypass_transcoding", + "bypassTranscoding", + "audio", + "video", + "room_name", + "roomName", + "participant_identity", + "participantIdentity", + "participant_name", + "participantName", + "participant_metadata", + "participantMetadata", + "reusable", + "state", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { + IngressId, Name, - Source, - Preset, - Options, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; + StreamKey, + Url, + InputType, + BypassTranscoding, + Audio, + Video, + RoomName, + ParticipantIdentity, + ParticipantName, + ParticipantMetadata, + Reusable, + State, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = GeneratedField; @@ -7423,10 +7490,20 @@ impl<'de> serde::Deserialize<'de> for IngressVideoOptions { E: serde::de::Error, { match value { + "ingressId" | "ingress_id" => Ok(GeneratedField::IngressId), "name" => Ok(GeneratedField::Name), - "source" => Ok(GeneratedField::Source), - "preset" => Ok(GeneratedField::Preset), - "options" => Ok(GeneratedField::Options), + "streamKey" | "stream_key" => Ok(GeneratedField::StreamKey), + "url" => Ok(GeneratedField::Url), + "inputType" | "input_type" => Ok(GeneratedField::InputType), + "bypassTranscoding" | "bypass_transcoding" => Ok(GeneratedField::BypassTranscoding), + "audio" => Ok(GeneratedField::Audio), + "video" => Ok(GeneratedField::Video), + "roomName" | "room_name" => Ok(GeneratedField::RoomName), + "participantIdentity" | "participant_identity" => Ok(GeneratedField::ParticipantIdentity), + "participantName" | "participant_name" => Ok(GeneratedField::ParticipantName), + "participantMetadata" | "participant_metadata" => Ok(GeneratedField::ParticipantMetadata), + "reusable" => Ok(GeneratedField::Reusable), + "state" => Ok(GeneratedField::State), _ => Ok(GeneratedField::__SkipField__), } } @@ -7436,217 +7513,217 @@ impl<'de> serde::Deserialize<'de> for IngressVideoOptions { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = IngressVideoOptions; + type Value = IngressInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.IngressVideoOptions") + formatter.write_str("struct livekit.IngressInfo") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { + let mut ingress_id__ = None; let mut name__ = None; - let mut source__ = None; - let mut encoding_options__ = None; + let mut stream_key__ = None; + let mut url__ = None; + let mut input_type__ = None; + let mut bypass_transcoding__ = None; + let mut audio__ = None; + let mut video__ = None; + let mut room_name__ = None; + let mut participant_identity__ = None; + let mut participant_name__ = None; + let mut participant_metadata__ = None; + let mut reusable__ = None; + let mut state__ = None; while let Some(k) = map_.next_key()? { match k { + GeneratedField::IngressId => { + if ingress_id__.is_some() { + return Err(serde::de::Error::duplicate_field("ingressId")); + } + ingress_id__ = Some(map_.next_value()?); + } GeneratedField::Name => { if name__.is_some() { return Err(serde::de::Error::duplicate_field("name")); } name__ = Some(map_.next_value()?); } - GeneratedField::Source => { - if source__.is_some() { - return Err(serde::de::Error::duplicate_field("source")); + GeneratedField::StreamKey => { + if stream_key__.is_some() { + return Err(serde::de::Error::duplicate_field("streamKey")); } - source__ = Some(map_.next_value::()? as i32); + stream_key__ = Some(map_.next_value()?); } - GeneratedField::Preset => { - if encoding_options__.is_some() { - return Err(serde::de::Error::duplicate_field("preset")); + GeneratedField::Url => { + if url__.is_some() { + return Err(serde::de::Error::duplicate_field("url")); } - encoding_options__ = map_.next_value::<::std::option::Option>()?.map(|x| ingress_video_options::EncodingOptions::Preset(x as i32)); + url__ = Some(map_.next_value()?); } - GeneratedField::Options => { - if encoding_options__.is_some() { - return Err(serde::de::Error::duplicate_field("options")); + GeneratedField::InputType => { + if input_type__.is_some() { + return Err(serde::de::Error::duplicate_field("inputType")); } - encoding_options__ = map_.next_value::<::std::option::Option<_>>()?.map(ingress_video_options::EncodingOptions::Options) -; + input_type__ = Some(map_.next_value::()? as i32); + } + GeneratedField::BypassTranscoding => { + if bypass_transcoding__.is_some() { + return Err(serde::de::Error::duplicate_field("bypassTranscoding")); + } + bypass_transcoding__ = Some(map_.next_value()?); + } + GeneratedField::Audio => { + if audio__.is_some() { + return Err(serde::de::Error::duplicate_field("audio")); + } + audio__ = map_.next_value()?; + } + GeneratedField::Video => { + if video__.is_some() { + return Err(serde::de::Error::duplicate_field("video")); + } + video__ = map_.next_value()?; + } + GeneratedField::RoomName => { + if room_name__.is_some() { + return Err(serde::de::Error::duplicate_field("roomName")); + } + room_name__ = Some(map_.next_value()?); + } + GeneratedField::ParticipantIdentity => { + if participant_identity__.is_some() { + return Err(serde::de::Error::duplicate_field("participantIdentity")); + } + participant_identity__ = Some(map_.next_value()?); + } + GeneratedField::ParticipantName => { + if participant_name__.is_some() { + return Err(serde::de::Error::duplicate_field("participantName")); + } + participant_name__ = Some(map_.next_value()?); + } + GeneratedField::ParticipantMetadata => { + if participant_metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("participantMetadata")); + } + participant_metadata__ = Some(map_.next_value()?); + } + GeneratedField::Reusable => { + if reusable__.is_some() { + return Err(serde::de::Error::duplicate_field("reusable")); + } + reusable__ = Some(map_.next_value()?); + } + GeneratedField::State => { + if state__.is_some() { + return Err(serde::de::Error::duplicate_field("state")); + } + state__ = map_.next_value()?; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(IngressVideoOptions { + Ok(IngressInfo { + ingress_id: ingress_id__.unwrap_or_default(), name: name__.unwrap_or_default(), - source: source__.unwrap_or_default(), - encoding_options: encoding_options__, + stream_key: stream_key__.unwrap_or_default(), + url: url__.unwrap_or_default(), + input_type: input_type__.unwrap_or_default(), + bypass_transcoding: bypass_transcoding__.unwrap_or_default(), + audio: audio__, + video: video__, + room_name: room_name__.unwrap_or_default(), + participant_identity: participant_identity__.unwrap_or_default(), + participant_name: participant_name__.unwrap_or_default(), + participant_metadata: participant_metadata__.unwrap_or_default(), + reusable: reusable__.unwrap_or_default(), + state: state__, }) } } - deserializer.deserialize_struct("livekit.IngressVideoOptions", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.IngressInfo", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for InputAudioState { +impl serde::Serialize for IngressInput { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { - use serde::ser::SerializeStruct; - let mut len = 0; - if !self.mime_type.is_empty() { - len += 1; - } - if self.average_bitrate != 0 { - len += 1; - } - if self.channels != 0 { - len += 1; - } - if self.sample_rate != 0 { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("livekit.InputAudioState", len)?; - if !self.mime_type.is_empty() { - struct_ser.serialize_field("mimeType", &self.mime_type)?; - } - if self.average_bitrate != 0 { - struct_ser.serialize_field("averageBitrate", &self.average_bitrate)?; - } - if self.channels != 0 { - struct_ser.serialize_field("channels", &self.channels)?; - } - if self.sample_rate != 0 { - struct_ser.serialize_field("sampleRate", &self.sample_rate)?; - } - struct_ser.end() + let variant = match self { + Self::RtmpInput => "RTMP_INPUT", + Self::WhipInput => "WHIP_INPUT", + Self::UrlInput => "URL_INPUT", + }; + serializer.serialize_str(variant) } } -impl<'de> serde::Deserialize<'de> for InputAudioState { +impl<'de> serde::Deserialize<'de> for IngressInput { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "mime_type", - "mimeType", - "average_bitrate", - "averageBitrate", - "channels", - "sample_rate", - "sampleRate", + "RTMP_INPUT", + "WHIP_INPUT", + "URL_INPUT", ]; - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - MimeType, - AverageBitrate, - Channels, - SampleRate, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "mimeType" | "mime_type" => Ok(GeneratedField::MimeType), - "averageBitrate" | "average_bitrate" => Ok(GeneratedField::AverageBitrate), - "channels" => Ok(GeneratedField::Channels), - "sampleRate" | "sample_rate" => Ok(GeneratedField::SampleRate), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = InputAudioState; + type Value = IngressInput; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.InputAudioState") + write!(formatter, "expected one of: {:?}", &FIELDS) } - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, { - let mut mime_type__ = None; - let mut average_bitrate__ = None; - let mut channels__ = None; - let mut sample_rate__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::MimeType => { - if mime_type__.is_some() { - return Err(serde::de::Error::duplicate_field("mimeType")); - } - mime_type__ = Some(map_.next_value()?); - } - GeneratedField::AverageBitrate => { - if average_bitrate__.is_some() { - return Err(serde::de::Error::duplicate_field("averageBitrate")); - } - average_bitrate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Channels => { - if channels__.is_some() { - return Err(serde::de::Error::duplicate_field("channels")); - } - channels__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::SampleRate => { - if sample_rate__.is_some() { - return Err(serde::de::Error::duplicate_field("sampleRate")); - } - sample_rate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "RTMP_INPUT" => Ok(IngressInput::RtmpInput), + "WHIP_INPUT" => Ok(IngressInput::WhipInput), + "URL_INPUT" => Ok(IngressInput::UrlInput), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } - Ok(InputAudioState { - mime_type: mime_type__.unwrap_or_default(), - average_bitrate: average_bitrate__.unwrap_or_default(), - channels: channels__.unwrap_or_default(), - sample_rate: sample_rate__.unwrap_or_default(), - }) } } - deserializer.deserialize_struct("livekit.InputAudioState", FIELDS, GeneratedVisitor) + deserializer.deserialize_any(GeneratedVisitor) } } -impl serde::Serialize for InputVideoState { +impl serde::Serialize for IngressState { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -7654,63 +7731,101 @@ impl serde::Serialize for InputVideoState { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.mime_type.is_empty() { + if self.status != 0 { len += 1; } - if self.average_bitrate != 0 { + if !self.error.is_empty() { len += 1; } - if self.width != 0 { + if self.video.is_some() { len += 1; } - if self.height != 0 { + if self.audio.is_some() { len += 1; } - if self.framerate != 0. { + if !self.room_id.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.InputVideoState", len)?; - if !self.mime_type.is_empty() { - struct_ser.serialize_field("mimeType", &self.mime_type)?; + if self.started_at != 0 { + len += 1; } - if self.average_bitrate != 0 { - struct_ser.serialize_field("averageBitrate", &self.average_bitrate)?; + if self.ended_at != 0 { + len += 1; } - if self.width != 0 { - struct_ser.serialize_field("width", &self.width)?; + if !self.resource_id.is_empty() { + len += 1; } - if self.height != 0 { - struct_ser.serialize_field("height", &self.height)?; + if !self.tracks.is_empty() { + len += 1; } - if self.framerate != 0. { - struct_ser.serialize_field("framerate", &self.framerate)?; + let mut struct_ser = serializer.serialize_struct("livekit.IngressState", len)?; + if self.status != 0 { + let v = ingress_state::Status::try_from(self.status) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.status)))?; + struct_ser.serialize_field("status", &v)?; + } + if !self.error.is_empty() { + struct_ser.serialize_field("error", &self.error)?; + } + if let Some(v) = self.video.as_ref() { + struct_ser.serialize_field("video", v)?; + } + if let Some(v) = self.audio.as_ref() { + struct_ser.serialize_field("audio", v)?; + } + if !self.room_id.is_empty() { + struct_ser.serialize_field("roomId", &self.room_id)?; + } + if self.started_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("startedAt", ToString::to_string(&self.started_at).as_str())?; + } + if self.ended_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("endedAt", ToString::to_string(&self.ended_at).as_str())?; + } + if !self.resource_id.is_empty() { + struct_ser.serialize_field("resourceId", &self.resource_id)?; + } + if !self.tracks.is_empty() { + struct_ser.serialize_field("tracks", &self.tracks)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for InputVideoState { +impl<'de> serde::Deserialize<'de> for IngressState { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "mime_type", - "mimeType", - "average_bitrate", - "averageBitrate", - "width", - "height", - "framerate", + "status", + "error", + "video", + "audio", + "room_id", + "roomId", + "started_at", + "startedAt", + "ended_at", + "endedAt", + "resource_id", + "resourceId", + "tracks", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - MimeType, - AverageBitrate, - Width, - Height, - Framerate, + Status, + Error, + Video, + Audio, + RoomId, + StartedAt, + EndedAt, + ResourceId, + Tracks, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -7733,11 +7848,15 @@ impl<'de> serde::Deserialize<'de> for InputVideoState { E: serde::de::Error, { match value { - "mimeType" | "mime_type" => Ok(GeneratedField::MimeType), - "averageBitrate" | "average_bitrate" => Ok(GeneratedField::AverageBitrate), - "width" => Ok(GeneratedField::Width), - "height" => Ok(GeneratedField::Height), - "framerate" => Ok(GeneratedField::Framerate), + "status" => Ok(GeneratedField::Status), + "error" => Ok(GeneratedField::Error), + "video" => Ok(GeneratedField::Video), + "audio" => Ok(GeneratedField::Audio), + "roomId" | "room_id" => Ok(GeneratedField::RoomId), + "startedAt" | "started_at" => Ok(GeneratedField::StartedAt), + "endedAt" | "ended_at" => Ok(GeneratedField::EndedAt), + "resourceId" | "resource_id" => Ok(GeneratedField::ResourceId), + "tracks" => Ok(GeneratedField::Tracks), _ => Ok(GeneratedField::__SkipField__), } } @@ -7747,79 +7866,187 @@ impl<'de> serde::Deserialize<'de> for InputVideoState { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = InputVideoState; + type Value = IngressState; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.InputVideoState") + formatter.write_str("struct livekit.IngressState") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut mime_type__ = None; - let mut average_bitrate__ = None; - let mut width__ = None; - let mut height__ = None; - let mut framerate__ = None; + let mut status__ = None; + let mut error__ = None; + let mut video__ = None; + let mut audio__ = None; + let mut room_id__ = None; + let mut started_at__ = None; + let mut ended_at__ = None; + let mut resource_id__ = None; + let mut tracks__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::MimeType => { - if mime_type__.is_some() { - return Err(serde::de::Error::duplicate_field("mimeType")); + GeneratedField::Status => { + if status__.is_some() { + return Err(serde::de::Error::duplicate_field("status")); } - mime_type__ = Some(map_.next_value()?); + status__ = Some(map_.next_value::()? as i32); } - GeneratedField::AverageBitrate => { - if average_bitrate__.is_some() { - return Err(serde::de::Error::duplicate_field("averageBitrate")); + GeneratedField::Error => { + if error__.is_some() { + return Err(serde::de::Error::duplicate_field("error")); } - average_bitrate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + error__ = Some(map_.next_value()?); } - GeneratedField::Width => { - if width__.is_some() { - return Err(serde::de::Error::duplicate_field("width")); + GeneratedField::Video => { + if video__.is_some() { + return Err(serde::de::Error::duplicate_field("video")); } - width__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + video__ = map_.next_value()?; } - GeneratedField::Height => { - if height__.is_some() { - return Err(serde::de::Error::duplicate_field("height")); + GeneratedField::Audio => { + if audio__.is_some() { + return Err(serde::de::Error::duplicate_field("audio")); } - height__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + audio__ = map_.next_value()?; } - GeneratedField::Framerate => { - if framerate__.is_some() { - return Err(serde::de::Error::duplicate_field("framerate")); + GeneratedField::RoomId => { + if room_id__.is_some() { + return Err(serde::de::Error::duplicate_field("roomId")); } - framerate__ = + room_id__ = Some(map_.next_value()?); + } + GeneratedField::StartedAt => { + if started_at__.is_some() { + return Err(serde::de::Error::duplicate_field("startedAt")); + } + started_at__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::EndedAt => { + if ended_at__.is_some() { + return Err(serde::de::Error::duplicate_field("endedAt")); + } + ended_at__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } + GeneratedField::ResourceId => { + if resource_id__.is_some() { + return Err(serde::de::Error::duplicate_field("resourceId")); + } + resource_id__ = Some(map_.next_value()?); + } + GeneratedField::Tracks => { + if tracks__.is_some() { + return Err(serde::de::Error::duplicate_field("tracks")); + } + tracks__ = Some(map_.next_value()?); + } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(InputVideoState { - mime_type: mime_type__.unwrap_or_default(), - average_bitrate: average_bitrate__.unwrap_or_default(), - width: width__.unwrap_or_default(), - height: height__.unwrap_or_default(), - framerate: framerate__.unwrap_or_default(), + Ok(IngressState { + status: status__.unwrap_or_default(), + error: error__.unwrap_or_default(), + video: video__, + audio: audio__, + room_id: room_id__.unwrap_or_default(), + started_at: started_at__.unwrap_or_default(), + ended_at: ended_at__.unwrap_or_default(), + resource_id: resource_id__.unwrap_or_default(), + tracks: tracks__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.InputVideoState", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.IngressState", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for JoinResponse { +impl serde::Serialize for ingress_state::Status { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::EndpointInactive => "ENDPOINT_INACTIVE", + Self::EndpointBuffering => "ENDPOINT_BUFFERING", + Self::EndpointPublishing => "ENDPOINT_PUBLISHING", + Self::EndpointError => "ENDPOINT_ERROR", + Self::EndpointComplete => "ENDPOINT_COMPLETE", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for ingress_state::Status { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "ENDPOINT_INACTIVE", + "ENDPOINT_BUFFERING", + "ENDPOINT_PUBLISHING", + "ENDPOINT_ERROR", + "ENDPOINT_COMPLETE", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ingress_state::Status; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "ENDPOINT_INACTIVE" => Ok(ingress_state::Status::EndpointInactive), + "ENDPOINT_BUFFERING" => Ok(ingress_state::Status::EndpointBuffering), + "ENDPOINT_PUBLISHING" => Ok(ingress_state::Status::EndpointPublishing), + "ENDPOINT_ERROR" => Ok(ingress_state::Status::EndpointError), + "ENDPOINT_COMPLETE" => Ok(ingress_state::Status::EndpointComplete), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +impl serde::Serialize for IngressVideoEncodingOptions { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -7827,138 +8054,50 @@ impl serde::Serialize for JoinResponse { { use serde::ser::SerializeStruct; let mut len = 0; - if self.room.is_some() { - len += 1; - } - if self.participant.is_some() { - len += 1; - } - if !self.other_participants.is_empty() { - len += 1; - } - if !self.server_version.is_empty() { - len += 1; - } - if !self.ice_servers.is_empty() { - len += 1; - } - if self.subscriber_primary { - len += 1; - } - if !self.alternative_url.is_empty() { - len += 1; - } - if self.client_configuration.is_some() { - len += 1; - } - if !self.server_region.is_empty() { - len += 1; - } - if self.ping_timeout != 0 { - len += 1; - } - if self.ping_interval != 0 { + if self.video_codec != 0 { len += 1; } - if self.server_info.is_some() { + if self.frame_rate != 0. { len += 1; } - if !self.sif_trailer.is_empty() { + if !self.layers.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.JoinResponse", len)?; - if let Some(v) = self.room.as_ref() { - struct_ser.serialize_field("room", v)?; - } - if let Some(v) = self.participant.as_ref() { - struct_ser.serialize_field("participant", v)?; - } - if !self.other_participants.is_empty() { - struct_ser.serialize_field("otherParticipants", &self.other_participants)?; - } - if !self.server_version.is_empty() { - struct_ser.serialize_field("serverVersion", &self.server_version)?; - } - if !self.ice_servers.is_empty() { - struct_ser.serialize_field("iceServers", &self.ice_servers)?; - } - if self.subscriber_primary { - struct_ser.serialize_field("subscriberPrimary", &self.subscriber_primary)?; - } - if !self.alternative_url.is_empty() { - struct_ser.serialize_field("alternativeUrl", &self.alternative_url)?; - } - if let Some(v) = self.client_configuration.as_ref() { - struct_ser.serialize_field("clientConfiguration", v)?; - } - if !self.server_region.is_empty() { - struct_ser.serialize_field("serverRegion", &self.server_region)?; - } - if self.ping_timeout != 0 { - struct_ser.serialize_field("pingTimeout", &self.ping_timeout)?; - } - if self.ping_interval != 0 { - struct_ser.serialize_field("pingInterval", &self.ping_interval)?; + let mut struct_ser = serializer.serialize_struct("livekit.IngressVideoEncodingOptions", len)?; + if self.video_codec != 0 { + let v = VideoCodec::try_from(self.video_codec) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.video_codec)))?; + struct_ser.serialize_field("videoCodec", &v)?; } - if let Some(v) = self.server_info.as_ref() { - struct_ser.serialize_field("serverInfo", v)?; + if self.frame_rate != 0. { + struct_ser.serialize_field("frameRate", &self.frame_rate)?; } - if !self.sif_trailer.is_empty() { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("sifTrailer", pbjson::private::base64::encode(&self.sif_trailer).as_str())?; + if !self.layers.is_empty() { + struct_ser.serialize_field("layers", &self.layers)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for JoinResponse { +impl<'de> serde::Deserialize<'de> for IngressVideoEncodingOptions { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "room", - "participant", - "other_participants", - "otherParticipants", - "server_version", - "serverVersion", - "ice_servers", - "iceServers", - "subscriber_primary", - "subscriberPrimary", - "alternative_url", - "alternativeUrl", - "client_configuration", - "clientConfiguration", - "server_region", - "serverRegion", - "ping_timeout", - "pingTimeout", - "ping_interval", - "pingInterval", - "server_info", - "serverInfo", - "sif_trailer", - "sifTrailer", + "video_codec", + "videoCodec", + "frame_rate", + "frameRate", + "layers", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Room, - Participant, - OtherParticipants, - ServerVersion, - IceServers, - SubscriberPrimary, - AlternativeUrl, - ClientConfiguration, - ServerRegion, - PingTimeout, - PingInterval, - ServerInfo, - SifTrailer, - __SkipField__, + VideoCodec, + FrameRate, + Layers, + __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { fn deserialize(deserializer: D) -> std::result::Result @@ -7980,19 +8119,9 @@ impl<'de> serde::Deserialize<'de> for JoinResponse { E: serde::de::Error, { match value { - "room" => Ok(GeneratedField::Room), - "participant" => Ok(GeneratedField::Participant), - "otherParticipants" | "other_participants" => Ok(GeneratedField::OtherParticipants), - "serverVersion" | "server_version" => Ok(GeneratedField::ServerVersion), - "iceServers" | "ice_servers" => Ok(GeneratedField::IceServers), - "subscriberPrimary" | "subscriber_primary" => Ok(GeneratedField::SubscriberPrimary), - "alternativeUrl" | "alternative_url" => Ok(GeneratedField::AlternativeUrl), - "clientConfiguration" | "client_configuration" => Ok(GeneratedField::ClientConfiguration), - "serverRegion" | "server_region" => Ok(GeneratedField::ServerRegion), - "pingTimeout" | "ping_timeout" => Ok(GeneratedField::PingTimeout), - "pingInterval" | "ping_interval" => Ok(GeneratedField::PingInterval), - "serverInfo" | "server_info" => Ok(GeneratedField::ServerInfo), - "sifTrailer" | "sif_trailer" => Ok(GeneratedField::SifTrailer), + "videoCodec" | "video_codec" => Ok(GeneratedField::VideoCodec), + "frameRate" | "frame_rate" => Ok(GeneratedField::FrameRate), + "layers" => Ok(GeneratedField::Layers), _ => Ok(GeneratedField::__SkipField__), } } @@ -8002,321 +8131,100 @@ impl<'de> serde::Deserialize<'de> for JoinResponse { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = JoinResponse; + type Value = IngressVideoEncodingOptions; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.JoinResponse") + formatter.write_str("struct livekit.IngressVideoEncodingOptions") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut room__ = None; - let mut participant__ = None; - let mut other_participants__ = None; - let mut server_version__ = None; - let mut ice_servers__ = None; - let mut subscriber_primary__ = None; - let mut alternative_url__ = None; - let mut client_configuration__ = None; - let mut server_region__ = None; - let mut ping_timeout__ = None; - let mut ping_interval__ = None; - let mut server_info__ = None; - let mut sif_trailer__ = None; + let mut video_codec__ = None; + let mut frame_rate__ = None; + let mut layers__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Room => { - if room__.is_some() { - return Err(serde::de::Error::duplicate_field("room")); - } - room__ = map_.next_value()?; - } - GeneratedField::Participant => { - if participant__.is_some() { - return Err(serde::de::Error::duplicate_field("participant")); - } - participant__ = map_.next_value()?; - } - GeneratedField::OtherParticipants => { - if other_participants__.is_some() { - return Err(serde::de::Error::duplicate_field("otherParticipants")); - } - other_participants__ = Some(map_.next_value()?); - } - GeneratedField::ServerVersion => { - if server_version__.is_some() { - return Err(serde::de::Error::duplicate_field("serverVersion")); - } - server_version__ = Some(map_.next_value()?); - } - GeneratedField::IceServers => { - if ice_servers__.is_some() { - return Err(serde::de::Error::duplicate_field("iceServers")); - } - ice_servers__ = Some(map_.next_value()?); - } - GeneratedField::SubscriberPrimary => { - if subscriber_primary__.is_some() { - return Err(serde::de::Error::duplicate_field("subscriberPrimary")); - } - subscriber_primary__ = Some(map_.next_value()?); - } - GeneratedField::AlternativeUrl => { - if alternative_url__.is_some() { - return Err(serde::de::Error::duplicate_field("alternativeUrl")); - } - alternative_url__ = Some(map_.next_value()?); - } - GeneratedField::ClientConfiguration => { - if client_configuration__.is_some() { - return Err(serde::de::Error::duplicate_field("clientConfiguration")); - } - client_configuration__ = map_.next_value()?; - } - GeneratedField::ServerRegion => { - if server_region__.is_some() { - return Err(serde::de::Error::duplicate_field("serverRegion")); - } - server_region__ = Some(map_.next_value()?); - } - GeneratedField::PingTimeout => { - if ping_timeout__.is_some() { - return Err(serde::de::Error::duplicate_field("pingTimeout")); + GeneratedField::VideoCodec => { + if video_codec__.is_some() { + return Err(serde::de::Error::duplicate_field("videoCodec")); } - ping_timeout__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + video_codec__ = Some(map_.next_value::()? as i32); } - GeneratedField::PingInterval => { - if ping_interval__.is_some() { - return Err(serde::de::Error::duplicate_field("pingInterval")); + GeneratedField::FrameRate => { + if frame_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("frameRate")); } - ping_interval__ = + frame_rate__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } - GeneratedField::ServerInfo => { - if server_info__.is_some() { - return Err(serde::de::Error::duplicate_field("serverInfo")); - } - server_info__ = map_.next_value()?; - } - GeneratedField::SifTrailer => { - if sif_trailer__.is_some() { - return Err(serde::de::Error::duplicate_field("sifTrailer")); + GeneratedField::Layers => { + if layers__.is_some() { + return Err(serde::de::Error::duplicate_field("layers")); } - sif_trailer__ = - Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) - ; + layers__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(JoinResponse { - room: room__, - participant: participant__, - other_participants: other_participants__.unwrap_or_default(), - server_version: server_version__.unwrap_or_default(), - ice_servers: ice_servers__.unwrap_or_default(), - subscriber_primary: subscriber_primary__.unwrap_or_default(), - alternative_url: alternative_url__.unwrap_or_default(), - client_configuration: client_configuration__, - server_region: server_region__.unwrap_or_default(), - ping_timeout: ping_timeout__.unwrap_or_default(), - ping_interval: ping_interval__.unwrap_or_default(), - server_info: server_info__, - sif_trailer: sif_trailer__.unwrap_or_default(), + Ok(IngressVideoEncodingOptions { + video_codec: video_codec__.unwrap_or_default(), + frame_rate: frame_rate__.unwrap_or_default(), + layers: layers__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.JoinResponse", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.IngressVideoEncodingOptions", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for LeaveRequest { +impl serde::Serialize for IngressVideoEncodingPreset { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { - use serde::ser::SerializeStruct; - let mut len = 0; - if self.can_reconnect { - len += 1; - } - if self.reason != 0 { - len += 1; - } - if self.action != 0 { - len += 1; - } - if self.regions.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("livekit.LeaveRequest", len)?; - if self.can_reconnect { - struct_ser.serialize_field("canReconnect", &self.can_reconnect)?; - } - if self.reason != 0 { - let v = DisconnectReason::try_from(self.reason) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.reason)))?; - struct_ser.serialize_field("reason", &v)?; - } - if self.action != 0 { - let v = leave_request::Action::try_from(self.action) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.action)))?; - struct_ser.serialize_field("action", &v)?; - } - if let Some(v) = self.regions.as_ref() { - struct_ser.serialize_field("regions", v)?; - } - struct_ser.end() + let variant = match self { + Self::H264720p30fps3Layers => "H264_720P_30FPS_3_LAYERS", + Self::H2641080p30fps3Layers => "H264_1080P_30FPS_3_LAYERS", + Self::H264540p25fps2Layers => "H264_540P_25FPS_2_LAYERS", + Self::H264720p30fps1Layer => "H264_720P_30FPS_1_LAYER", + Self::H2641080p30fps1Layer => "H264_1080P_30FPS_1_LAYER", + Self::H264720p30fps3LayersHighMotion => "H264_720P_30FPS_3_LAYERS_HIGH_MOTION", + Self::H2641080p30fps3LayersHighMotion => "H264_1080P_30FPS_3_LAYERS_HIGH_MOTION", + Self::H264540p25fps2LayersHighMotion => "H264_540P_25FPS_2_LAYERS_HIGH_MOTION", + Self::H264720p30fps1LayerHighMotion => "H264_720P_30FPS_1_LAYER_HIGH_MOTION", + Self::H2641080p30fps1LayerHighMotion => "H264_1080P_30FPS_1_LAYER_HIGH_MOTION", + }; + serializer.serialize_str(variant) } } -impl<'de> serde::Deserialize<'de> for LeaveRequest { +impl<'de> serde::Deserialize<'de> for IngressVideoEncodingPreset { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "can_reconnect", - "canReconnect", - "reason", - "action", - "regions", + "H264_720P_30FPS_3_LAYERS", + "H264_1080P_30FPS_3_LAYERS", + "H264_540P_25FPS_2_LAYERS", + "H264_720P_30FPS_1_LAYER", + "H264_1080P_30FPS_1_LAYER", + "H264_720P_30FPS_3_LAYERS_HIGH_MOTION", + "H264_1080P_30FPS_3_LAYERS_HIGH_MOTION", + "H264_540P_25FPS_2_LAYERS_HIGH_MOTION", + "H264_720P_30FPS_1_LAYER_HIGH_MOTION", + "H264_1080P_30FPS_1_LAYER_HIGH_MOTION", ]; - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - CanReconnect, - Reason, - Action, - Regions, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "canReconnect" | "can_reconnect" => Ok(GeneratedField::CanReconnect), - "reason" => Ok(GeneratedField::Reason), - "action" => Ok(GeneratedField::Action), - "regions" => Ok(GeneratedField::Regions), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } - } struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = LeaveRequest; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.LeaveRequest") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut can_reconnect__ = None; - let mut reason__ = None; - let mut action__ = None; - let mut regions__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::CanReconnect => { - if can_reconnect__.is_some() { - return Err(serde::de::Error::duplicate_field("canReconnect")); - } - can_reconnect__ = Some(map_.next_value()?); - } - GeneratedField::Reason => { - if reason__.is_some() { - return Err(serde::de::Error::duplicate_field("reason")); - } - reason__ = Some(map_.next_value::()? as i32); - } - GeneratedField::Action => { - if action__.is_some() { - return Err(serde::de::Error::duplicate_field("action")); - } - action__ = Some(map_.next_value::()? as i32); - } - GeneratedField::Regions => { - if regions__.is_some() { - return Err(serde::de::Error::duplicate_field("regions")); - } - regions__ = map_.next_value()?; - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(LeaveRequest { - can_reconnect: can_reconnect__.unwrap_or_default(), - reason: reason__.unwrap_or_default(), - action: action__.unwrap_or_default(), - regions: regions__, - }) - } - } - deserializer.deserialize_struct("livekit.LeaveRequest", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for leave_request::Action { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Disconnect => "DISCONNECT", - Self::Resume => "RESUME", - Self::Reconnect => "RECONNECT", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for leave_request::Action { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "DISCONNECT", - "RESUME", - "RECONNECT", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = leave_request::Action; + type Value = IngressVideoEncodingPreset; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(formatter, "expected one of: {:?}", &FIELDS) @@ -8351,9 +8259,16 @@ impl<'de> serde::Deserialize<'de> for leave_request::Action { E: serde::de::Error, { match value { - "DISCONNECT" => Ok(leave_request::Action::Disconnect), - "RESUME" => Ok(leave_request::Action::Resume), - "RECONNECT" => Ok(leave_request::Action::Reconnect), + "H264_720P_30FPS_3_LAYERS" => Ok(IngressVideoEncodingPreset::H264720p30fps3Layers), + "H264_1080P_30FPS_3_LAYERS" => Ok(IngressVideoEncodingPreset::H2641080p30fps3Layers), + "H264_540P_25FPS_2_LAYERS" => Ok(IngressVideoEncodingPreset::H264540p25fps2Layers), + "H264_720P_30FPS_1_LAYER" => Ok(IngressVideoEncodingPreset::H264720p30fps1Layer), + "H264_1080P_30FPS_1_LAYER" => Ok(IngressVideoEncodingPreset::H2641080p30fps1Layer), + "H264_720P_30FPS_3_LAYERS_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H264720p30fps3LayersHighMotion), + "H264_1080P_30FPS_3_LAYERS_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H2641080p30fps3LayersHighMotion), + "H264_540P_25FPS_2_LAYERS_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H264540p25fps2LayersHighMotion), + "H264_720P_30FPS_1_LAYER_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H264720p30fps1LayerHighMotion), + "H264_1080P_30FPS_1_LAYER_HIGH_MOTION" => Ok(IngressVideoEncodingPreset::H2641080p30fps1LayerHighMotion), _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), } } @@ -8361,7 +8276,7 @@ impl<'de> serde::Deserialize<'de> for leave_request::Action { deserializer.deserialize_any(GeneratedVisitor) } } -impl serde::Serialize for ListEgressRequest { +impl serde::Serialize for IngressVideoOptions { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -8369,47 +8284,58 @@ impl serde::Serialize for ListEgressRequest { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.room_name.is_empty() { + if !self.name.is_empty() { len += 1; } - if !self.egress_id.is_empty() { + if self.source != 0 { len += 1; } - if self.active { + if self.encoding_options.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ListEgressRequest", len)?; - if !self.room_name.is_empty() { - struct_ser.serialize_field("roomName", &self.room_name)?; + let mut struct_ser = serializer.serialize_struct("livekit.IngressVideoOptions", len)?; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; } - if !self.egress_id.is_empty() { - struct_ser.serialize_field("egressId", &self.egress_id)?; + if self.source != 0 { + let v = TrackSource::try_from(self.source) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.source)))?; + struct_ser.serialize_field("source", &v)?; } - if self.active { - struct_ser.serialize_field("active", &self.active)?; + if let Some(v) = self.encoding_options.as_ref() { + match v { + ingress_video_options::EncodingOptions::Preset(v) => { + let v = IngressVideoEncodingPreset::try_from(*v) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?; + struct_ser.serialize_field("preset", &v)?; + } + ingress_video_options::EncodingOptions::Options(v) => { + struct_ser.serialize_field("options", v)?; + } + } } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ListEgressRequest { +impl<'de> serde::Deserialize<'de> for IngressVideoOptions { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "room_name", - "roomName", - "egress_id", - "egressId", - "active", + "name", + "source", + "preset", + "options", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - RoomName, - EgressId, - Active, + Name, + Source, + Preset, + Options, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -8432,9 +8358,10 @@ impl<'de> serde::Deserialize<'de> for ListEgressRequest { E: serde::de::Error, { match value { - "roomName" | "room_name" => Ok(GeneratedField::RoomName), - "egressId" | "egress_id" => Ok(GeneratedField::EgressId), - "active" => Ok(GeneratedField::Active), + "name" => Ok(GeneratedField::Name), + "source" => Ok(GeneratedField::Source), + "preset" => Ok(GeneratedField::Preset), + "options" => Ok(GeneratedField::Options), _ => Ok(GeneratedField::__SkipField__), } } @@ -8444,55 +8371,62 @@ impl<'de> serde::Deserialize<'de> for ListEgressRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ListEgressRequest; + type Value = IngressVideoOptions; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ListEgressRequest") + formatter.write_str("struct livekit.IngressVideoOptions") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut room_name__ = None; - let mut egress_id__ = None; - let mut active__ = None; + let mut name__ = None; + let mut source__ = None; + let mut encoding_options__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::RoomName => { - if room_name__.is_some() { - return Err(serde::de::Error::duplicate_field("roomName")); + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); } - room_name__ = Some(map_.next_value()?); + name__ = Some(map_.next_value()?); } - GeneratedField::EgressId => { - if egress_id__.is_some() { - return Err(serde::de::Error::duplicate_field("egressId")); + GeneratedField::Source => { + if source__.is_some() { + return Err(serde::de::Error::duplicate_field("source")); } - egress_id__ = Some(map_.next_value()?); + source__ = Some(map_.next_value::()? as i32); } - GeneratedField::Active => { - if active__.is_some() { - return Err(serde::de::Error::duplicate_field("active")); + GeneratedField::Preset => { + if encoding_options__.is_some() { + return Err(serde::de::Error::duplicate_field("preset")); } - active__ = Some(map_.next_value()?); + encoding_options__ = map_.next_value::<::std::option::Option>()?.map(|x| ingress_video_options::EncodingOptions::Preset(x as i32)); + } + GeneratedField::Options => { + if encoding_options__.is_some() { + return Err(serde::de::Error::duplicate_field("options")); + } + encoding_options__ = map_.next_value::<::std::option::Option<_>>()?.map(ingress_video_options::EncodingOptions::Options) +; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ListEgressRequest { - room_name: room_name__.unwrap_or_default(), - egress_id: egress_id__.unwrap_or_default(), - active: active__.unwrap_or_default(), + Ok(IngressVideoOptions { + name: name__.unwrap_or_default(), + source: source__.unwrap_or_default(), + encoding_options: encoding_options__, }) } } - deserializer.deserialize_struct("livekit.ListEgressRequest", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.IngressVideoOptions", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ListEgressResponse { +impl serde::Serialize for InputAudioState { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -8500,29 +8434,56 @@ impl serde::Serialize for ListEgressResponse { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.items.is_empty() { + if !self.mime_type.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ListEgressResponse", len)?; - if !self.items.is_empty() { - struct_ser.serialize_field("items", &self.items)?; + if self.average_bitrate != 0 { + len += 1; + } + if self.channels != 0 { + len += 1; + } + if self.sample_rate != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.InputAudioState", len)?; + if !self.mime_type.is_empty() { + struct_ser.serialize_field("mimeType", &self.mime_type)?; + } + if self.average_bitrate != 0 { + struct_ser.serialize_field("averageBitrate", &self.average_bitrate)?; + } + if self.channels != 0 { + struct_ser.serialize_field("channels", &self.channels)?; + } + if self.sample_rate != 0 { + struct_ser.serialize_field("sampleRate", &self.sample_rate)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ListEgressResponse { +impl<'de> serde::Deserialize<'de> for InputAudioState { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "items", + "mime_type", + "mimeType", + "average_bitrate", + "averageBitrate", + "channels", + "sample_rate", + "sampleRate", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Items, + MimeType, + AverageBitrate, + Channels, + SampleRate, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -8545,49 +8506,82 @@ impl<'de> serde::Deserialize<'de> for ListEgressResponse { E: serde::de::Error, { match value { - "items" => Ok(GeneratedField::Items), - _ => Ok(GeneratedField::__SkipField__), - } - } + "mimeType" | "mime_type" => Ok(GeneratedField::MimeType), + "averageBitrate" | "average_bitrate" => Ok(GeneratedField::AverageBitrate), + "channels" => Ok(GeneratedField::Channels), + "sampleRate" | "sample_rate" => Ok(GeneratedField::SampleRate), + _ => Ok(GeneratedField::__SkipField__), + } + } } deserializer.deserialize_identifier(GeneratedVisitor) } } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ListEgressResponse; + type Value = InputAudioState; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ListEgressResponse") + formatter.write_str("struct livekit.InputAudioState") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut items__ = None; + let mut mime_type__ = None; + let mut average_bitrate__ = None; + let mut channels__ = None; + let mut sample_rate__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Items => { - if items__.is_some() { - return Err(serde::de::Error::duplicate_field("items")); + GeneratedField::MimeType => { + if mime_type__.is_some() { + return Err(serde::de::Error::duplicate_field("mimeType")); } - items__ = Some(map_.next_value()?); + mime_type__ = Some(map_.next_value()?); + } + GeneratedField::AverageBitrate => { + if average_bitrate__.is_some() { + return Err(serde::de::Error::duplicate_field("averageBitrate")); + } + average_bitrate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Channels => { + if channels__.is_some() { + return Err(serde::de::Error::duplicate_field("channels")); + } + channels__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::SampleRate => { + if sample_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("sampleRate")); + } + sample_rate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ListEgressResponse { - items: items__.unwrap_or_default(), + Ok(InputAudioState { + mime_type: mime_type__.unwrap_or_default(), + average_bitrate: average_bitrate__.unwrap_or_default(), + channels: channels__.unwrap_or_default(), + sample_rate: sample_rate__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ListEgressResponse", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.InputAudioState", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ListIngressRequest { +impl serde::Serialize for InputVideoState { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -8595,39 +8589,63 @@ impl serde::Serialize for ListIngressRequest { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.room_name.is_empty() { + if !self.mime_type.is_empty() { len += 1; } - if !self.ingress_id.is_empty() { + if self.average_bitrate != 0 { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ListIngressRequest", len)?; - if !self.room_name.is_empty() { - struct_ser.serialize_field("roomName", &self.room_name)?; + if self.width != 0 { + len += 1; } - if !self.ingress_id.is_empty() { - struct_ser.serialize_field("ingressId", &self.ingress_id)?; + if self.height != 0 { + len += 1; + } + if self.framerate != 0. { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.InputVideoState", len)?; + if !self.mime_type.is_empty() { + struct_ser.serialize_field("mimeType", &self.mime_type)?; + } + if self.average_bitrate != 0 { + struct_ser.serialize_field("averageBitrate", &self.average_bitrate)?; + } + if self.width != 0 { + struct_ser.serialize_field("width", &self.width)?; + } + if self.height != 0 { + struct_ser.serialize_field("height", &self.height)?; + } + if self.framerate != 0. { + struct_ser.serialize_field("framerate", &self.framerate)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ListIngressRequest { +impl<'de> serde::Deserialize<'de> for InputVideoState { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "room_name", - "roomName", - "ingress_id", - "ingressId", + "mime_type", + "mimeType", + "average_bitrate", + "averageBitrate", + "width", + "height", + "framerate", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - RoomName, - IngressId, + MimeType, + AverageBitrate, + Width, + Height, + Framerate, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -8650,8 +8668,11 @@ impl<'de> serde::Deserialize<'de> for ListIngressRequest { E: serde::de::Error, { match value { - "roomName" | "room_name" => Ok(GeneratedField::RoomName), - "ingressId" | "ingress_id" => Ok(GeneratedField::IngressId), + "mimeType" | "mime_type" => Ok(GeneratedField::MimeType), + "averageBitrate" | "average_bitrate" => Ok(GeneratedField::AverageBitrate), + "width" => Ok(GeneratedField::Width), + "height" => Ok(GeneratedField::Height), + "framerate" => Ok(GeneratedField::Framerate), _ => Ok(GeneratedField::__SkipField__), } } @@ -8661,47 +8682,79 @@ impl<'de> serde::Deserialize<'de> for ListIngressRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ListIngressRequest; + type Value = InputVideoState; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ListIngressRequest") + formatter.write_str("struct livekit.InputVideoState") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut room_name__ = None; - let mut ingress_id__ = None; + let mut mime_type__ = None; + let mut average_bitrate__ = None; + let mut width__ = None; + let mut height__ = None; + let mut framerate__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::RoomName => { - if room_name__.is_some() { - return Err(serde::de::Error::duplicate_field("roomName")); + GeneratedField::MimeType => { + if mime_type__.is_some() { + return Err(serde::de::Error::duplicate_field("mimeType")); } - room_name__ = Some(map_.next_value()?); + mime_type__ = Some(map_.next_value()?); } - GeneratedField::IngressId => { - if ingress_id__.is_some() { - return Err(serde::de::Error::duplicate_field("ingressId")); + GeneratedField::AverageBitrate => { + if average_bitrate__.is_some() { + return Err(serde::de::Error::duplicate_field("averageBitrate")); } - ingress_id__ = Some(map_.next_value()?); + average_bitrate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Width => { + if width__.is_some() { + return Err(serde::de::Error::duplicate_field("width")); + } + width__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Framerate => { + if framerate__.is_some() { + return Err(serde::de::Error::duplicate_field("framerate")); + } + framerate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ListIngressRequest { - room_name: room_name__.unwrap_or_default(), - ingress_id: ingress_id__.unwrap_or_default(), + Ok(InputVideoState { + mime_type: mime_type__.unwrap_or_default(), + average_bitrate: average_bitrate__.unwrap_or_default(), + width: width__.unwrap_or_default(), + height: height__.unwrap_or_default(), + framerate: framerate__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ListIngressRequest", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.InputVideoState", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ListIngressResponse { +impl serde::Serialize for JoinResponse { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -8709,112 +8762,90 @@ impl serde::Serialize for ListIngressResponse { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.items.is_empty() { + if self.room.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ListIngressResponse", len)?; - if !self.items.is_empty() { - struct_ser.serialize_field("items", &self.items)?; + if self.participant.is_some() { + len += 1; } - struct_ser.end() - } -} -impl<'de> serde::Deserialize<'de> for ListIngressResponse { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "items", - ]; - - #[allow(clippy::enum_variant_names)] - enum GeneratedField { - Items, - __SkipField__, + if !self.other_participants.is_empty() { + len += 1; } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "items" => Ok(GeneratedField::Items), - _ => Ok(GeneratedField::__SkipField__), - } - } - } - deserializer.deserialize_identifier(GeneratedVisitor) - } + if !self.server_version.is_empty() { + len += 1; } - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ListIngressResponse; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ListIngressResponse") - } - - fn visit_map(self, mut map_: V) -> std::result::Result - where - V: serde::de::MapAccess<'de>, - { - let mut items__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::Items => { - if items__.is_some() { - return Err(serde::de::Error::duplicate_field("items")); - } - items__ = Some(map_.next_value()?); - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } - } - Ok(ListIngressResponse { - items: items__.unwrap_or_default(), - }) - } + if !self.ice_servers.is_empty() { + len += 1; } - deserializer.deserialize_struct("livekit.ListIngressResponse", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ListParticipantsRequest { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - use serde::ser::SerializeStruct; - let mut len = 0; - if !self.room.is_empty() { + if self.subscriber_primary { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ListParticipantsRequest", len)?; - if !self.room.is_empty() { - struct_ser.serialize_field("room", &self.room)?; + if !self.alternative_url.is_empty() { + len += 1; + } + if self.client_configuration.is_some() { + len += 1; + } + if !self.server_region.is_empty() { + len += 1; + } + if self.ping_timeout != 0 { + len += 1; + } + if self.ping_interval != 0 { + len += 1; + } + if self.server_info.is_some() { + len += 1; + } + if !self.sif_trailer.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.JoinResponse", len)?; + if let Some(v) = self.room.as_ref() { + struct_ser.serialize_field("room", v)?; + } + if let Some(v) = self.participant.as_ref() { + struct_ser.serialize_field("participant", v)?; + } + if !self.other_participants.is_empty() { + struct_ser.serialize_field("otherParticipants", &self.other_participants)?; + } + if !self.server_version.is_empty() { + struct_ser.serialize_field("serverVersion", &self.server_version)?; + } + if !self.ice_servers.is_empty() { + struct_ser.serialize_field("iceServers", &self.ice_servers)?; + } + if self.subscriber_primary { + struct_ser.serialize_field("subscriberPrimary", &self.subscriber_primary)?; + } + if !self.alternative_url.is_empty() { + struct_ser.serialize_field("alternativeUrl", &self.alternative_url)?; + } + if let Some(v) = self.client_configuration.as_ref() { + struct_ser.serialize_field("clientConfiguration", v)?; + } + if !self.server_region.is_empty() { + struct_ser.serialize_field("serverRegion", &self.server_region)?; + } + if self.ping_timeout != 0 { + struct_ser.serialize_field("pingTimeout", &self.ping_timeout)?; + } + if self.ping_interval != 0 { + struct_ser.serialize_field("pingInterval", &self.ping_interval)?; + } + if let Some(v) = self.server_info.as_ref() { + struct_ser.serialize_field("serverInfo", v)?; + } + if !self.sif_trailer.is_empty() { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("sifTrailer", pbjson::private::base64::encode(&self.sif_trailer).as_str())?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ListParticipantsRequest { +impl<'de> serde::Deserialize<'de> for JoinResponse { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where @@ -8822,11 +8853,46 @@ impl<'de> serde::Deserialize<'de> for ListParticipantsRequest { { const FIELDS: &[&str] = &[ "room", + "participant", + "other_participants", + "otherParticipants", + "server_version", + "serverVersion", + "ice_servers", + "iceServers", + "subscriber_primary", + "subscriberPrimary", + "alternative_url", + "alternativeUrl", + "client_configuration", + "clientConfiguration", + "server_region", + "serverRegion", + "ping_timeout", + "pingTimeout", + "ping_interval", + "pingInterval", + "server_info", + "serverInfo", + "sif_trailer", + "sifTrailer", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { Room, + Participant, + OtherParticipants, + ServerVersion, + IceServers, + SubscriberPrimary, + AlternativeUrl, + ClientConfiguration, + ServerRegion, + PingTimeout, + PingInterval, + ServerInfo, + SifTrailer, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -8850,6 +8916,18 @@ impl<'de> serde::Deserialize<'de> for ListParticipantsRequest { { match value { "room" => Ok(GeneratedField::Room), + "participant" => Ok(GeneratedField::Participant), + "otherParticipants" | "other_participants" => Ok(GeneratedField::OtherParticipants), + "serverVersion" | "server_version" => Ok(GeneratedField::ServerVersion), + "iceServers" | "ice_servers" => Ok(GeneratedField::IceServers), + "subscriberPrimary" | "subscriber_primary" => Ok(GeneratedField::SubscriberPrimary), + "alternativeUrl" | "alternative_url" => Ok(GeneratedField::AlternativeUrl), + "clientConfiguration" | "client_configuration" => Ok(GeneratedField::ClientConfiguration), + "serverRegion" | "server_region" => Ok(GeneratedField::ServerRegion), + "pingTimeout" | "ping_timeout" => Ok(GeneratedField::PingTimeout), + "pingInterval" | "ping_interval" => Ok(GeneratedField::PingInterval), + "serverInfo" | "server_info" => Ok(GeneratedField::ServerInfo), + "sifTrailer" | "sif_trailer" => Ok(GeneratedField::SifTrailer), _ => Ok(GeneratedField::__SkipField__), } } @@ -8859,69 +8937,200 @@ impl<'de> serde::Deserialize<'de> for ListParticipantsRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ListParticipantsRequest; + type Value = JoinResponse; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ListParticipantsRequest") + formatter.write_str("struct livekit.JoinResponse") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { let mut room__ = None; + let mut participant__ = None; + let mut other_participants__ = None; + let mut server_version__ = None; + let mut ice_servers__ = None; + let mut subscriber_primary__ = None; + let mut alternative_url__ = None; + let mut client_configuration__ = None; + let mut server_region__ = None; + let mut ping_timeout__ = None; + let mut ping_interval__ = None; + let mut server_info__ = None; + let mut sif_trailer__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::Room => { if room__.is_some() { return Err(serde::de::Error::duplicate_field("room")); } - room__ = Some(map_.next_value()?); + room__ = map_.next_value()?; + } + GeneratedField::Participant => { + if participant__.is_some() { + return Err(serde::de::Error::duplicate_field("participant")); + } + participant__ = map_.next_value()?; + } + GeneratedField::OtherParticipants => { + if other_participants__.is_some() { + return Err(serde::de::Error::duplicate_field("otherParticipants")); + } + other_participants__ = Some(map_.next_value()?); + } + GeneratedField::ServerVersion => { + if server_version__.is_some() { + return Err(serde::de::Error::duplicate_field("serverVersion")); + } + server_version__ = Some(map_.next_value()?); + } + GeneratedField::IceServers => { + if ice_servers__.is_some() { + return Err(serde::de::Error::duplicate_field("iceServers")); + } + ice_servers__ = Some(map_.next_value()?); + } + GeneratedField::SubscriberPrimary => { + if subscriber_primary__.is_some() { + return Err(serde::de::Error::duplicate_field("subscriberPrimary")); + } + subscriber_primary__ = Some(map_.next_value()?); + } + GeneratedField::AlternativeUrl => { + if alternative_url__.is_some() { + return Err(serde::de::Error::duplicate_field("alternativeUrl")); + } + alternative_url__ = Some(map_.next_value()?); + } + GeneratedField::ClientConfiguration => { + if client_configuration__.is_some() { + return Err(serde::de::Error::duplicate_field("clientConfiguration")); + } + client_configuration__ = map_.next_value()?; + } + GeneratedField::ServerRegion => { + if server_region__.is_some() { + return Err(serde::de::Error::duplicate_field("serverRegion")); + } + server_region__ = Some(map_.next_value()?); + } + GeneratedField::PingTimeout => { + if ping_timeout__.is_some() { + return Err(serde::de::Error::duplicate_field("pingTimeout")); + } + ping_timeout__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PingInterval => { + if ping_interval__.is_some() { + return Err(serde::de::Error::duplicate_field("pingInterval")); + } + ping_interval__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::ServerInfo => { + if server_info__.is_some() { + return Err(serde::de::Error::duplicate_field("serverInfo")); + } + server_info__ = map_.next_value()?; + } + GeneratedField::SifTrailer => { + if sif_trailer__.is_some() { + return Err(serde::de::Error::duplicate_field("sifTrailer")); + } + sif_trailer__ = + Some(map_.next_value::<::pbjson::private::BytesDeserialize<_>>()?.0) + ; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ListParticipantsRequest { - room: room__.unwrap_or_default(), - }) - } - } - deserializer.deserialize_struct("livekit.ListParticipantsRequest", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ListParticipantsResponse { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, + Ok(JoinResponse { + room: room__, + participant: participant__, + other_participants: other_participants__.unwrap_or_default(), + server_version: server_version__.unwrap_or_default(), + ice_servers: ice_servers__.unwrap_or_default(), + subscriber_primary: subscriber_primary__.unwrap_or_default(), + alternative_url: alternative_url__.unwrap_or_default(), + client_configuration: client_configuration__, + server_region: server_region__.unwrap_or_default(), + ping_timeout: ping_timeout__.unwrap_or_default(), + ping_interval: ping_interval__.unwrap_or_default(), + server_info: server_info__, + sif_trailer: sif_trailer__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.JoinResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for LeaveRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, { use serde::ser::SerializeStruct; let mut len = 0; - if !self.participants.is_empty() { + if self.can_reconnect { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ListParticipantsResponse", len)?; - if !self.participants.is_empty() { - struct_ser.serialize_field("participants", &self.participants)?; + if self.reason != 0 { + len += 1; + } + if self.action != 0 { + len += 1; + } + if self.regions.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.LeaveRequest", len)?; + if self.can_reconnect { + struct_ser.serialize_field("canReconnect", &self.can_reconnect)?; + } + if self.reason != 0 { + let v = DisconnectReason::try_from(self.reason) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.reason)))?; + struct_ser.serialize_field("reason", &v)?; + } + if self.action != 0 { + let v = leave_request::Action::try_from(self.action) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.action)))?; + struct_ser.serialize_field("action", &v)?; + } + if let Some(v) = self.regions.as_ref() { + struct_ser.serialize_field("regions", v)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ListParticipantsResponse { +impl<'de> serde::Deserialize<'de> for LeaveRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "participants", + "can_reconnect", + "canReconnect", + "reason", + "action", + "regions", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Participants, + CanReconnect, + Reason, + Action, + Regions, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -8944,7 +9153,10 @@ impl<'de> serde::Deserialize<'de> for ListParticipantsResponse { E: serde::de::Error, { match value { - "participants" => Ok(GeneratedField::Participants), + "canReconnect" | "can_reconnect" => Ok(GeneratedField::CanReconnect), + "reason" => Ok(GeneratedField::Reason), + "action" => Ok(GeneratedField::Action), + "regions" => Ok(GeneratedField::Regions), _ => Ok(GeneratedField::__SkipField__), } } @@ -8954,39 +9166,137 @@ impl<'de> serde::Deserialize<'de> for ListParticipantsResponse { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ListParticipantsResponse; + type Value = LeaveRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ListParticipantsResponse") + formatter.write_str("struct livekit.LeaveRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut participants__ = None; + let mut can_reconnect__ = None; + let mut reason__ = None; + let mut action__ = None; + let mut regions__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Participants => { - if participants__.is_some() { - return Err(serde::de::Error::duplicate_field("participants")); + GeneratedField::CanReconnect => { + if can_reconnect__.is_some() { + return Err(serde::de::Error::duplicate_field("canReconnect")); } - participants__ = Some(map_.next_value()?); + can_reconnect__ = Some(map_.next_value()?); + } + GeneratedField::Reason => { + if reason__.is_some() { + return Err(serde::de::Error::duplicate_field("reason")); + } + reason__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Action => { + if action__.is_some() { + return Err(serde::de::Error::duplicate_field("action")); + } + action__ = Some(map_.next_value::()? as i32); + } + GeneratedField::Regions => { + if regions__.is_some() { + return Err(serde::de::Error::duplicate_field("regions")); + } + regions__ = map_.next_value()?; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ListParticipantsResponse { - participants: participants__.unwrap_or_default(), + Ok(LeaveRequest { + can_reconnect: can_reconnect__.unwrap_or_default(), + reason: reason__.unwrap_or_default(), + action: action__.unwrap_or_default(), + regions: regions__, }) } } - deserializer.deserialize_struct("livekit.ListParticipantsResponse", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.LeaveRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ListRoomsRequest { +impl serde::Serialize for leave_request::Action { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Disconnect => "DISCONNECT", + Self::Resume => "RESUME", + Self::Reconnect => "RECONNECT", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for leave_request::Action { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "DISCONNECT", + "RESUME", + "RECONNECT", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = leave_request::Action; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "DISCONNECT" => Ok(leave_request::Action::Disconnect), + "RESUME" => Ok(leave_request::Action::Resume), + "RECONNECT" => Ok(leave_request::Action::Reconnect), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +impl serde::Serialize for ListEgressRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -8994,29 +9304,47 @@ impl serde::Serialize for ListRoomsRequest { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.names.is_empty() { + if !self.room_name.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ListRoomsRequest", len)?; - if !self.names.is_empty() { - struct_ser.serialize_field("names", &self.names)?; + if !self.egress_id.is_empty() { + len += 1; + } + if self.active { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.ListEgressRequest", len)?; + if !self.room_name.is_empty() { + struct_ser.serialize_field("roomName", &self.room_name)?; + } + if !self.egress_id.is_empty() { + struct_ser.serialize_field("egressId", &self.egress_id)?; + } + if self.active { + struct_ser.serialize_field("active", &self.active)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ListRoomsRequest { +impl<'de> serde::Deserialize<'de> for ListEgressRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "names", + "room_name", + "roomName", + "egress_id", + "egressId", + "active", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Names, + RoomName, + EgressId, + Active, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -9039,7 +9367,9 @@ impl<'de> serde::Deserialize<'de> for ListRoomsRequest { E: serde::de::Error, { match value { - "names" => Ok(GeneratedField::Names), + "roomName" | "room_name" => Ok(GeneratedField::RoomName), + "egressId" | "egress_id" => Ok(GeneratedField::EgressId), + "active" => Ok(GeneratedField::Active), _ => Ok(GeneratedField::__SkipField__), } } @@ -9049,39 +9379,55 @@ impl<'de> serde::Deserialize<'de> for ListRoomsRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ListRoomsRequest; + type Value = ListEgressRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ListRoomsRequest") + formatter.write_str("struct livekit.ListEgressRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut names__ = None; + let mut room_name__ = None; + let mut egress_id__ = None; + let mut active__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Names => { - if names__.is_some() { - return Err(serde::de::Error::duplicate_field("names")); + GeneratedField::RoomName => { + if room_name__.is_some() { + return Err(serde::de::Error::duplicate_field("roomName")); } - names__ = Some(map_.next_value()?); + room_name__ = Some(map_.next_value()?); } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; + GeneratedField::EgressId => { + if egress_id__.is_some() { + return Err(serde::de::Error::duplicate_field("egressId")); + } + egress_id__ = Some(map_.next_value()?); + } + GeneratedField::Active => { + if active__.is_some() { + return Err(serde::de::Error::duplicate_field("active")); + } + active__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; } } } - Ok(ListRoomsRequest { - names: names__.unwrap_or_default(), + Ok(ListEgressRequest { + room_name: room_name__.unwrap_or_default(), + egress_id: egress_id__.unwrap_or_default(), + active: active__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ListRoomsRequest", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListEgressRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ListRoomsResponse { +impl serde::Serialize for ListEgressResponse { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -9089,29 +9435,29 @@ impl serde::Serialize for ListRoomsResponse { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.rooms.is_empty() { + if !self.items.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ListRoomsResponse", len)?; - if !self.rooms.is_empty() { - struct_ser.serialize_field("rooms", &self.rooms)?; + let mut struct_ser = serializer.serialize_struct("livekit.ListEgressResponse", len)?; + if !self.items.is_empty() { + struct_ser.serialize_field("items", &self.items)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ListRoomsResponse { +impl<'de> serde::Deserialize<'de> for ListEgressResponse { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "rooms", + "items", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Rooms, + Items, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -9134,7 +9480,7 @@ impl<'de> serde::Deserialize<'de> for ListRoomsResponse { E: serde::de::Error, { match value { - "rooms" => Ok(GeneratedField::Rooms), + "items" => Ok(GeneratedField::Items), _ => Ok(GeneratedField::__SkipField__), } } @@ -9144,39 +9490,39 @@ impl<'de> serde::Deserialize<'de> for ListRoomsResponse { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ListRoomsResponse; + type Value = ListEgressResponse; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ListRoomsResponse") + formatter.write_str("struct livekit.ListEgressResponse") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut rooms__ = None; + let mut items__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Rooms => { - if rooms__.is_some() { - return Err(serde::de::Error::duplicate_field("rooms")); + GeneratedField::Items => { + if items__.is_some() { + return Err(serde::de::Error::duplicate_field("items")); } - rooms__ = Some(map_.next_value()?); + items__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ListRoomsResponse { - rooms: rooms__.unwrap_or_default(), + Ok(ListEgressResponse { + items: items__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ListRoomsResponse", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListEgressResponse", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for MuteRoomTrackRequest { +impl serde::Serialize for ListIngressRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -9184,54 +9530,39 @@ impl serde::Serialize for MuteRoomTrackRequest { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.room.is_empty() { - len += 1; - } - if !self.identity.is_empty() { - len += 1; - } - if !self.track_sid.is_empty() { + if !self.room_name.is_empty() { len += 1; } - if self.muted { + if !self.ingress_id.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.MuteRoomTrackRequest", len)?; - if !self.room.is_empty() { - struct_ser.serialize_field("room", &self.room)?; - } - if !self.identity.is_empty() { - struct_ser.serialize_field("identity", &self.identity)?; - } - if !self.track_sid.is_empty() { - struct_ser.serialize_field("trackSid", &self.track_sid)?; + let mut struct_ser = serializer.serialize_struct("livekit.ListIngressRequest", len)?; + if !self.room_name.is_empty() { + struct_ser.serialize_field("roomName", &self.room_name)?; } - if self.muted { - struct_ser.serialize_field("muted", &self.muted)?; + if !self.ingress_id.is_empty() { + struct_ser.serialize_field("ingressId", &self.ingress_id)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for MuteRoomTrackRequest { +impl<'de> serde::Deserialize<'de> for ListIngressRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "room", - "identity", - "track_sid", - "trackSid", - "muted", + "room_name", + "roomName", + "ingress_id", + "ingressId", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Room, - Identity, - TrackSid, - Muted, + RoomName, + IngressId, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -9254,10 +9585,8 @@ impl<'de> serde::Deserialize<'de> for MuteRoomTrackRequest { E: serde::de::Error, { match value { - "room" => Ok(GeneratedField::Room), - "identity" => Ok(GeneratedField::Identity), - "trackSid" | "track_sid" => Ok(GeneratedField::TrackSid), - "muted" => Ok(GeneratedField::Muted), + "roomName" | "room_name" => Ok(GeneratedField::RoomName), + "ingressId" | "ingress_id" => Ok(GeneratedField::IngressId), _ => Ok(GeneratedField::__SkipField__), } } @@ -9267,63 +9596,47 @@ impl<'de> serde::Deserialize<'de> for MuteRoomTrackRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = MuteRoomTrackRequest; + type Value = ListIngressRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.MuteRoomTrackRequest") + formatter.write_str("struct livekit.ListIngressRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut room__ = None; - let mut identity__ = None; - let mut track_sid__ = None; - let mut muted__ = None; + let mut room_name__ = None; + let mut ingress_id__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Room => { - if room__.is_some() { - return Err(serde::de::Error::duplicate_field("room")); - } - room__ = Some(map_.next_value()?); - } - GeneratedField::Identity => { - if identity__.is_some() { - return Err(serde::de::Error::duplicate_field("identity")); - } - identity__ = Some(map_.next_value()?); - } - GeneratedField::TrackSid => { - if track_sid__.is_some() { - return Err(serde::de::Error::duplicate_field("trackSid")); + GeneratedField::RoomName => { + if room_name__.is_some() { + return Err(serde::de::Error::duplicate_field("roomName")); } - track_sid__ = Some(map_.next_value()?); + room_name__ = Some(map_.next_value()?); } - GeneratedField::Muted => { - if muted__.is_some() { - return Err(serde::de::Error::duplicate_field("muted")); + GeneratedField::IngressId => { + if ingress_id__.is_some() { + return Err(serde::de::Error::duplicate_field("ingressId")); } - muted__ = Some(map_.next_value()?); + ingress_id__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(MuteRoomTrackRequest { - room: room__.unwrap_or_default(), - identity: identity__.unwrap_or_default(), - track_sid: track_sid__.unwrap_or_default(), - muted: muted__.unwrap_or_default(), + Ok(ListIngressRequest { + room_name: room_name__.unwrap_or_default(), + ingress_id: ingress_id__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.MuteRoomTrackRequest", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListIngressRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for MuteRoomTrackResponse { +impl serde::Serialize for ListIngressResponse { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -9331,29 +9644,29 @@ impl serde::Serialize for MuteRoomTrackResponse { { use serde::ser::SerializeStruct; let mut len = 0; - if self.track.is_some() { + if !self.items.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.MuteRoomTrackResponse", len)?; - if let Some(v) = self.track.as_ref() { - struct_ser.serialize_field("track", v)?; + let mut struct_ser = serializer.serialize_struct("livekit.ListIngressResponse", len)?; + if !self.items.is_empty() { + struct_ser.serialize_field("items", &self.items)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for MuteRoomTrackResponse { +impl<'de> serde::Deserialize<'de> for ListIngressResponse { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "track", + "items", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Track, + Items, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -9376,7 +9689,7 @@ impl<'de> serde::Deserialize<'de> for MuteRoomTrackResponse { E: serde::de::Error, { match value { - "track" => Ok(GeneratedField::Track), + "items" => Ok(GeneratedField::Items), _ => Ok(GeneratedField::__SkipField__), } } @@ -9386,39 +9699,39 @@ impl<'de> serde::Deserialize<'de> for MuteRoomTrackResponse { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = MuteRoomTrackResponse; + type Value = ListIngressResponse; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.MuteRoomTrackResponse") + formatter.write_str("struct livekit.ListIngressResponse") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut track__ = None; + let mut items__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Track => { - if track__.is_some() { - return Err(serde::de::Error::duplicate_field("track")); + GeneratedField::Items => { + if items__.is_some() { + return Err(serde::de::Error::duplicate_field("items")); } - track__ = map_.next_value()?; + items__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(MuteRoomTrackResponse { - track: track__, + Ok(ListIngressResponse { + items: items__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.MuteRoomTrackResponse", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListIngressResponse", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for MuteTrackRequest { +impl serde::Serialize for ListParticipantsRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -9426,37 +9739,29 @@ impl serde::Serialize for MuteTrackRequest { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.sid.is_empty() { - len += 1; - } - if self.muted { + if !self.room.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.MuteTrackRequest", len)?; - if !self.sid.is_empty() { - struct_ser.serialize_field("sid", &self.sid)?; - } - if self.muted { - struct_ser.serialize_field("muted", &self.muted)?; + let mut struct_ser = serializer.serialize_struct("livekit.ListParticipantsRequest", len)?; + if !self.room.is_empty() { + struct_ser.serialize_field("room", &self.room)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for MuteTrackRequest { +impl<'de> serde::Deserialize<'de> for ListParticipantsRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "sid", - "muted", + "room", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Sid, - Muted, + Room, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -9479,8 +9784,7 @@ impl<'de> serde::Deserialize<'de> for MuteTrackRequest { E: serde::de::Error, { match value { - "sid" => Ok(GeneratedField::Sid), - "muted" => Ok(GeneratedField::Muted), + "room" => Ok(GeneratedField::Room), _ => Ok(GeneratedField::__SkipField__), } } @@ -9490,47 +9794,39 @@ impl<'de> serde::Deserialize<'de> for MuteTrackRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = MuteTrackRequest; + type Value = ListParticipantsRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.MuteTrackRequest") + formatter.write_str("struct livekit.ListParticipantsRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut sid__ = None; - let mut muted__ = None; + let mut room__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Sid => { - if sid__.is_some() { - return Err(serde::de::Error::duplicate_field("sid")); - } - sid__ = Some(map_.next_value()?); - } - GeneratedField::Muted => { - if muted__.is_some() { - return Err(serde::de::Error::duplicate_field("muted")); + GeneratedField::Room => { + if room__.is_some() { + return Err(serde::de::Error::duplicate_field("room")); } - muted__ = Some(map_.next_value()?); + room__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(MuteTrackRequest { - sid: sid__.unwrap_or_default(), - muted: muted__.unwrap_or_default(), + Ok(ListParticipantsRequest { + room: room__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.MuteTrackRequest", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListParticipantsRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ParticipantEgressRequest { +impl serde::Serialize for ListParticipantsResponse { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -9538,102 +9834,29 @@ impl serde::Serialize for ParticipantEgressRequest { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.room_name.is_empty() { - len += 1; - } - if !self.identity.is_empty() { - len += 1; - } - if self.screen_share { - len += 1; - } - if !self.file_outputs.is_empty() { - len += 1; - } - if !self.stream_outputs.is_empty() { - len += 1; - } - if !self.segment_outputs.is_empty() { - len += 1; - } - if !self.image_outputs.is_empty() { - len += 1; - } - if self.options.is_some() { + if !self.participants.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ParticipantEgressRequest", len)?; - if !self.room_name.is_empty() { - struct_ser.serialize_field("roomName", &self.room_name)?; - } - if !self.identity.is_empty() { - struct_ser.serialize_field("identity", &self.identity)?; - } - if self.screen_share { - struct_ser.serialize_field("screenShare", &self.screen_share)?; - } - if !self.file_outputs.is_empty() { - struct_ser.serialize_field("fileOutputs", &self.file_outputs)?; - } - if !self.stream_outputs.is_empty() { - struct_ser.serialize_field("streamOutputs", &self.stream_outputs)?; - } - if !self.segment_outputs.is_empty() { - struct_ser.serialize_field("segmentOutputs", &self.segment_outputs)?; - } - if !self.image_outputs.is_empty() { - struct_ser.serialize_field("imageOutputs", &self.image_outputs)?; - } - if let Some(v) = self.options.as_ref() { - match v { - participant_egress_request::Options::Preset(v) => { - let v = EncodingOptionsPreset::try_from(*v) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("preset", &v)?; - } - participant_egress_request::Options::Advanced(v) => { - struct_ser.serialize_field("advanced", v)?; - } - } + let mut struct_ser = serializer.serialize_struct("livekit.ListParticipantsResponse", len)?; + if !self.participants.is_empty() { + struct_ser.serialize_field("participants", &self.participants)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ParticipantEgressRequest { +impl<'de> serde::Deserialize<'de> for ListParticipantsResponse { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "room_name", - "roomName", - "identity", - "screen_share", - "screenShare", - "file_outputs", - "fileOutputs", - "stream_outputs", - "streamOutputs", - "segment_outputs", - "segmentOutputs", - "image_outputs", - "imageOutputs", - "preset", - "advanced", + "participants", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - RoomName, - Identity, - ScreenShare, - FileOutputs, - StreamOutputs, - SegmentOutputs, - ImageOutputs, - Preset, - Advanced, + Participants, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -9656,15 +9879,7 @@ impl<'de> serde::Deserialize<'de> for ParticipantEgressRequest { E: serde::de::Error, { match value { - "roomName" | "room_name" => Ok(GeneratedField::RoomName), - "identity" => Ok(GeneratedField::Identity), - "screenShare" | "screen_share" => Ok(GeneratedField::ScreenShare), - "fileOutputs" | "file_outputs" => Ok(GeneratedField::FileOutputs), - "streamOutputs" | "stream_outputs" => Ok(GeneratedField::StreamOutputs), - "segmentOutputs" | "segment_outputs" => Ok(GeneratedField::SegmentOutputs), - "imageOutputs" | "image_outputs" => Ok(GeneratedField::ImageOutputs), - "preset" => Ok(GeneratedField::Preset), - "advanced" => Ok(GeneratedField::Advanced), + "participants" => Ok(GeneratedField::Participants), _ => Ok(GeneratedField::__SkipField__), } } @@ -9674,102 +9889,39 @@ impl<'de> serde::Deserialize<'de> for ParticipantEgressRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ParticipantEgressRequest; + type Value = ListParticipantsResponse; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ParticipantEgressRequest") + formatter.write_str("struct livekit.ListParticipantsResponse") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut room_name__ = None; - let mut identity__ = None; - let mut screen_share__ = None; - let mut file_outputs__ = None; - let mut stream_outputs__ = None; - let mut segment_outputs__ = None; - let mut image_outputs__ = None; - let mut options__ = None; + let mut participants__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::RoomName => { - if room_name__.is_some() { - return Err(serde::de::Error::duplicate_field("roomName")); - } - room_name__ = Some(map_.next_value()?); - } - GeneratedField::Identity => { - if identity__.is_some() { - return Err(serde::de::Error::duplicate_field("identity")); - } - identity__ = Some(map_.next_value()?); - } - GeneratedField::ScreenShare => { - if screen_share__.is_some() { - return Err(serde::de::Error::duplicate_field("screenShare")); - } - screen_share__ = Some(map_.next_value()?); - } - GeneratedField::FileOutputs => { - if file_outputs__.is_some() { - return Err(serde::de::Error::duplicate_field("fileOutputs")); - } - file_outputs__ = Some(map_.next_value()?); - } - GeneratedField::StreamOutputs => { - if stream_outputs__.is_some() { - return Err(serde::de::Error::duplicate_field("streamOutputs")); - } - stream_outputs__ = Some(map_.next_value()?); - } - GeneratedField::SegmentOutputs => { - if segment_outputs__.is_some() { - return Err(serde::de::Error::duplicate_field("segmentOutputs")); - } - segment_outputs__ = Some(map_.next_value()?); - } - GeneratedField::ImageOutputs => { - if image_outputs__.is_some() { - return Err(serde::de::Error::duplicate_field("imageOutputs")); - } - image_outputs__ = Some(map_.next_value()?); - } - GeneratedField::Preset => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("preset")); - } - options__ = map_.next_value::<::std::option::Option>()?.map(|x| participant_egress_request::Options::Preset(x as i32)); - } - GeneratedField::Advanced => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("advanced")); + GeneratedField::Participants => { + if participants__.is_some() { + return Err(serde::de::Error::duplicate_field("participants")); } - options__ = map_.next_value::<::std::option::Option<_>>()?.map(participant_egress_request::Options::Advanced) -; + participants__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ParticipantEgressRequest { - room_name: room_name__.unwrap_or_default(), - identity: identity__.unwrap_or_default(), - screen_share: screen_share__.unwrap_or_default(), - file_outputs: file_outputs__.unwrap_or_default(), - stream_outputs: stream_outputs__.unwrap_or_default(), - segment_outputs: segment_outputs__.unwrap_or_default(), - image_outputs: image_outputs__.unwrap_or_default(), - options: options__, + Ok(ListParticipantsResponse { + participants: participants__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ParticipantEgressRequest", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListParticipantsResponse", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ParticipantInfo { +impl serde::Serialize for ListRoomsRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -9777,124 +9929,124 @@ impl serde::Serialize for ParticipantInfo { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.sid.is_empty() { - len += 1; - } - if !self.identity.is_empty() { - len += 1; - } - if self.state != 0 { - len += 1; - } - if !self.tracks.is_empty() { - len += 1; - } - if !self.metadata.is_empty() { - len += 1; - } - if self.joined_at != 0 { + if !self.names.is_empty() { len += 1; } - if !self.name.is_empty() { - len += 1; + let mut struct_ser = serializer.serialize_struct("livekit.ListRoomsRequest", len)?; + if !self.names.is_empty() { + struct_ser.serialize_field("names", &self.names)?; } - if self.version != 0 { - len += 1; + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ListRoomsRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "names", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Names, + __SkipField__, } - if self.permission.is_some() { - len += 1; + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "names" => Ok(GeneratedField::Names), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } } - if !self.region.is_empty() { - len += 1; - } - if self.is_publisher { - len += 1; + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ListRoomsRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.ListRoomsRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut names__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Names => { + if names__.is_some() { + return Err(serde::de::Error::duplicate_field("names")); + } + names__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ListRoomsRequest { + names: names__.unwrap_or_default(), + }) + } } - if self.kind != 0 { + deserializer.deserialize_struct("livekit.ListRoomsRequest", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ListRoomsResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.rooms.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ParticipantInfo", len)?; - if !self.sid.is_empty() { - struct_ser.serialize_field("sid", &self.sid)?; - } - if !self.identity.is_empty() { - struct_ser.serialize_field("identity", &self.identity)?; - } - if self.state != 0 { - let v = participant_info::State::try_from(self.state) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.state)))?; - struct_ser.serialize_field("state", &v)?; - } - if !self.tracks.is_empty() { - struct_ser.serialize_field("tracks", &self.tracks)?; - } - if !self.metadata.is_empty() { - struct_ser.serialize_field("metadata", &self.metadata)?; - } - if self.joined_at != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("joinedAt", ToString::to_string(&self.joined_at).as_str())?; - } - if !self.name.is_empty() { - struct_ser.serialize_field("name", &self.name)?; - } - if self.version != 0 { - struct_ser.serialize_field("version", &self.version)?; - } - if let Some(v) = self.permission.as_ref() { - struct_ser.serialize_field("permission", v)?; - } - if !self.region.is_empty() { - struct_ser.serialize_field("region", &self.region)?; - } - if self.is_publisher { - struct_ser.serialize_field("isPublisher", &self.is_publisher)?; - } - if self.kind != 0 { - let v = participant_info::Kind::try_from(self.kind) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.kind)))?; - struct_ser.serialize_field("kind", &v)?; + let mut struct_ser = serializer.serialize_struct("livekit.ListRoomsResponse", len)?; + if !self.rooms.is_empty() { + struct_ser.serialize_field("rooms", &self.rooms)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ParticipantInfo { +impl<'de> serde::Deserialize<'de> for ListRoomsResponse { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "sid", - "identity", - "state", - "tracks", - "metadata", - "joined_at", - "joinedAt", - "name", - "version", - "permission", - "region", - "is_publisher", - "isPublisher", - "kind", + "rooms", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Sid, - Identity, - State, - Tracks, - Metadata, - JoinedAt, - Name, - Version, - Permission, - Region, - IsPublisher, - Kind, + Rooms, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -9917,18 +10069,7 @@ impl<'de> serde::Deserialize<'de> for ParticipantInfo { E: serde::de::Error, { match value { - "sid" => Ok(GeneratedField::Sid), - "identity" => Ok(GeneratedField::Identity), - "state" => Ok(GeneratedField::State), - "tracks" => Ok(GeneratedField::Tracks), - "metadata" => Ok(GeneratedField::Metadata), - "joinedAt" | "joined_at" => Ok(GeneratedField::JoinedAt), - "name" => Ok(GeneratedField::Name), - "version" => Ok(GeneratedField::Version), - "permission" => Ok(GeneratedField::Permission), - "region" => Ok(GeneratedField::Region), - "isPublisher" | "is_publisher" => Ok(GeneratedField::IsPublisher), - "kind" => Ok(GeneratedField::Kind), + "rooms" => Ok(GeneratedField::Rooms), _ => Ok(GeneratedField::__SkipField__), } } @@ -9938,288 +10079,111 @@ impl<'de> serde::Deserialize<'de> for ParticipantInfo { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ParticipantInfo; + type Value = ListRoomsResponse; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ParticipantInfo") + formatter.write_str("struct livekit.ListRoomsResponse") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut sid__ = None; - let mut identity__ = None; - let mut state__ = None; - let mut tracks__ = None; - let mut metadata__ = None; - let mut joined_at__ = None; - let mut name__ = None; - let mut version__ = None; - let mut permission__ = None; - let mut region__ = None; - let mut is_publisher__ = None; - let mut kind__ = None; + let mut rooms__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Sid => { - if sid__.is_some() { - return Err(serde::de::Error::duplicate_field("sid")); - } - sid__ = Some(map_.next_value()?); - } - GeneratedField::Identity => { - if identity__.is_some() { - return Err(serde::de::Error::duplicate_field("identity")); - } - identity__ = Some(map_.next_value()?); - } - GeneratedField::State => { - if state__.is_some() { - return Err(serde::de::Error::duplicate_field("state")); - } - state__ = Some(map_.next_value::()? as i32); - } - GeneratedField::Tracks => { - if tracks__.is_some() { - return Err(serde::de::Error::duplicate_field("tracks")); - } - tracks__ = Some(map_.next_value()?); - } - GeneratedField::Metadata => { - if metadata__.is_some() { - return Err(serde::de::Error::duplicate_field("metadata")); - } - metadata__ = Some(map_.next_value()?); - } - GeneratedField::JoinedAt => { - if joined_at__.is_some() { - return Err(serde::de::Error::duplicate_field("joinedAt")); - } - joined_at__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = Some(map_.next_value()?); - } - GeneratedField::Version => { - if version__.is_some() { - return Err(serde::de::Error::duplicate_field("version")); - } - version__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Permission => { - if permission__.is_some() { - return Err(serde::de::Error::duplicate_field("permission")); - } - permission__ = map_.next_value()?; - } - GeneratedField::Region => { - if region__.is_some() { - return Err(serde::de::Error::duplicate_field("region")); - } - region__ = Some(map_.next_value()?); - } - GeneratedField::IsPublisher => { - if is_publisher__.is_some() { - return Err(serde::de::Error::duplicate_field("isPublisher")); - } - is_publisher__ = Some(map_.next_value()?); - } - GeneratedField::Kind => { - if kind__.is_some() { - return Err(serde::de::Error::duplicate_field("kind")); + GeneratedField::Rooms => { + if rooms__.is_some() { + return Err(serde::de::Error::duplicate_field("rooms")); } - kind__ = Some(map_.next_value::()? as i32); + rooms__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ParticipantInfo { - sid: sid__.unwrap_or_default(), - identity: identity__.unwrap_or_default(), - state: state__.unwrap_or_default(), - tracks: tracks__.unwrap_or_default(), - metadata: metadata__.unwrap_or_default(), - joined_at: joined_at__.unwrap_or_default(), - name: name__.unwrap_or_default(), - version: version__.unwrap_or_default(), - permission: permission__, - region: region__.unwrap_or_default(), - is_publisher: is_publisher__.unwrap_or_default(), - kind: kind__.unwrap_or_default(), + Ok(ListRoomsResponse { + rooms: rooms__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ParticipantInfo", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListRoomsResponse", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for participant_info::Kind { +impl serde::Serialize for ListSipDispatchRuleRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { - let variant = match self { - Self::Standard => "STANDARD", - Self::Ingress => "INGRESS", - Self::Egress => "EGRESS", - Self::Sip => "SIP", - Self::Agent => "AGENT", - }; - serializer.serialize_str(variant) + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("livekit.ListSIPDispatchRuleRequest", len)?; + struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for participant_info::Kind { +impl<'de> serde::Deserialize<'de> for ListSipDispatchRuleRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "STANDARD", - "INGRESS", - "EGRESS", - "SIP", - "AGENT", ]; - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = participant_info::Kind; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result where - E: serde::de::Error, + D: serde::Deserializer<'de>, { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } + struct GeneratedVisitor; - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "STANDARD" => Ok(participant_info::Kind::Standard), - "INGRESS" => Ok(participant_info::Kind::Ingress), - "EGRESS" => Ok(participant_info::Kind::Egress), - "SIP" => Ok(participant_info::Kind::Sip), - "AGENT" => Ok(participant_info::Kind::Agent), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Ok(GeneratedField::__SkipField__) + } } + deserializer.deserialize_identifier(GeneratedVisitor) } } - deserializer.deserialize_any(GeneratedVisitor) - } -} -impl serde::Serialize for participant_info::State { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::Joining => "JOINING", - Self::Joined => "JOINED", - Self::Active => "ACTIVE", - Self::Disconnected => "DISCONNECTED", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for participant_info::State { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "JOINING", - "JOINED", - "ACTIVE", - "DISCONNECTED", - ]; - struct GeneratedVisitor; - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = participant_info::State; + type Value = ListSipDispatchRuleRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) + formatter.write_str("struct livekit.ListSIPDispatchRuleRequest") } - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, { - match value { - "JOINING" => Ok(participant_info::State::Joining), - "JOINED" => Ok(participant_info::State::Joined), - "ACTIVE" => Ok(participant_info::State::Active), - "DISCONNECTED" => Ok(participant_info::State::Disconnected), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; } + Ok(ListSipDispatchRuleRequest { + }) } } - deserializer.deserialize_any(GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListSIPDispatchRuleRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ParticipantPermission { +impl serde::Serialize for ListSipDispatchRuleResponse { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -10227,94 +10191,29 @@ impl serde::Serialize for ParticipantPermission { { use serde::ser::SerializeStruct; let mut len = 0; - if self.can_subscribe { - len += 1; - } - if self.can_publish { - len += 1; - } - if self.can_publish_data { - len += 1; - } - if !self.can_publish_sources.is_empty() { - len += 1; - } - if self.hidden { - len += 1; - } - if self.recorder { - len += 1; - } - if self.can_update_metadata { - len += 1; - } - if self.agent { + if !self.items.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ParticipantPermission", len)?; - if self.can_subscribe { - struct_ser.serialize_field("canSubscribe", &self.can_subscribe)?; - } - if self.can_publish { - struct_ser.serialize_field("canPublish", &self.can_publish)?; - } - if self.can_publish_data { - struct_ser.serialize_field("canPublishData", &self.can_publish_data)?; - } - if !self.can_publish_sources.is_empty() { - let v = self.can_publish_sources.iter().cloned().map(|v| { - TrackSource::try_from(v) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", v))) - }).collect::, _>>()?; - struct_ser.serialize_field("canPublishSources", &v)?; - } - if self.hidden { - struct_ser.serialize_field("hidden", &self.hidden)?; - } - if self.recorder { - struct_ser.serialize_field("recorder", &self.recorder)?; - } - if self.can_update_metadata { - struct_ser.serialize_field("canUpdateMetadata", &self.can_update_metadata)?; - } - if self.agent { - struct_ser.serialize_field("agent", &self.agent)?; + let mut struct_ser = serializer.serialize_struct("livekit.ListSIPDispatchRuleResponse", len)?; + if !self.items.is_empty() { + struct_ser.serialize_field("items", &self.items)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ParticipantPermission { +impl<'de> serde::Deserialize<'de> for ListSipDispatchRuleResponse { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "can_subscribe", - "canSubscribe", - "can_publish", - "canPublish", - "can_publish_data", - "canPublishData", - "can_publish_sources", - "canPublishSources", - "hidden", - "recorder", - "can_update_metadata", - "canUpdateMetadata", - "agent", + "items", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - CanSubscribe, - CanPublish, - CanPublishData, - CanPublishSources, - Hidden, - Recorder, - CanUpdateMetadata, - Agent, + Items, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -10337,14 +10236,7 @@ impl<'de> serde::Deserialize<'de> for ParticipantPermission { E: serde::de::Error, { match value { - "canSubscribe" | "can_subscribe" => Ok(GeneratedField::CanSubscribe), - "canPublish" | "can_publish" => Ok(GeneratedField::CanPublish), - "canPublishData" | "can_publish_data" => Ok(GeneratedField::CanPublishData), - "canPublishSources" | "can_publish_sources" => Ok(GeneratedField::CanPublishSources), - "hidden" => Ok(GeneratedField::Hidden), - "recorder" => Ok(GeneratedField::Recorder), - "canUpdateMetadata" | "can_update_metadata" => Ok(GeneratedField::CanUpdateMetadata), - "agent" => Ok(GeneratedField::Agent), + "items" => Ok(GeneratedField::Items), _ => Ok(GeneratedField::__SkipField__), } } @@ -10354,135 +10246,61 @@ impl<'de> serde::Deserialize<'de> for ParticipantPermission { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ParticipantPermission; + type Value = ListSipDispatchRuleResponse; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ParticipantPermission") + formatter.write_str("struct livekit.ListSIPDispatchRuleResponse") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut can_subscribe__ = None; - let mut can_publish__ = None; - let mut can_publish_data__ = None; - let mut can_publish_sources__ = None; - let mut hidden__ = None; - let mut recorder__ = None; - let mut can_update_metadata__ = None; - let mut agent__ = None; + let mut items__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::CanSubscribe => { - if can_subscribe__.is_some() { - return Err(serde::de::Error::duplicate_field("canSubscribe")); + GeneratedField::Items => { + if items__.is_some() { + return Err(serde::de::Error::duplicate_field("items")); } - can_subscribe__ = Some(map_.next_value()?); - } - GeneratedField::CanPublish => { - if can_publish__.is_some() { - return Err(serde::de::Error::duplicate_field("canPublish")); - } - can_publish__ = Some(map_.next_value()?); - } - GeneratedField::CanPublishData => { - if can_publish_data__.is_some() { - return Err(serde::de::Error::duplicate_field("canPublishData")); - } - can_publish_data__ = Some(map_.next_value()?); - } - GeneratedField::CanPublishSources => { - if can_publish_sources__.is_some() { - return Err(serde::de::Error::duplicate_field("canPublishSources")); - } - can_publish_sources__ = Some(map_.next_value::>()?.into_iter().map(|x| x as i32).collect()); - } - GeneratedField::Hidden => { - if hidden__.is_some() { - return Err(serde::de::Error::duplicate_field("hidden")); - } - hidden__ = Some(map_.next_value()?); - } - GeneratedField::Recorder => { - if recorder__.is_some() { - return Err(serde::de::Error::duplicate_field("recorder")); - } - recorder__ = Some(map_.next_value()?); - } - GeneratedField::CanUpdateMetadata => { - if can_update_metadata__.is_some() { - return Err(serde::de::Error::duplicate_field("canUpdateMetadata")); - } - can_update_metadata__ = Some(map_.next_value()?); - } - GeneratedField::Agent => { - if agent__.is_some() { - return Err(serde::de::Error::duplicate_field("agent")); - } - agent__ = Some(map_.next_value()?); + items__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ParticipantPermission { - can_subscribe: can_subscribe__.unwrap_or_default(), - can_publish: can_publish__.unwrap_or_default(), - can_publish_data: can_publish_data__.unwrap_or_default(), - can_publish_sources: can_publish_sources__.unwrap_or_default(), - hidden: hidden__.unwrap_or_default(), - recorder: recorder__.unwrap_or_default(), - can_update_metadata: can_update_metadata__.unwrap_or_default(), - agent: agent__.unwrap_or_default(), + Ok(ListSipDispatchRuleResponse { + items: items__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ParticipantPermission", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListSIPDispatchRuleResponse", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ParticipantTracks { +impl serde::Serialize for ListSipTrunkRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; - let mut len = 0; - if !self.participant_sid.is_empty() { - len += 1; - } - if !self.track_sids.is_empty() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("livekit.ParticipantTracks", len)?; - if !self.participant_sid.is_empty() { - struct_ser.serialize_field("participantSid", &self.participant_sid)?; - } - if !self.track_sids.is_empty() { - struct_ser.serialize_field("trackSids", &self.track_sids)?; - } + let len = 0; + let struct_ser = serializer.serialize_struct("livekit.ListSIPTrunkRequest", len)?; struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ParticipantTracks { +impl<'de> serde::Deserialize<'de> for ListSipTrunkRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "participant_sid", - "participantSid", - "track_sids", - "trackSids", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - ParticipantSid, - TrackSids, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -10504,11 +10322,7 @@ impl<'de> serde::Deserialize<'de> for ParticipantTracks { where E: serde::de::Error, { - match value { - "participantSid" | "participant_sid" => Ok(GeneratedField::ParticipantSid), - "trackSids" | "track_sids" => Ok(GeneratedField::TrackSids), - _ => Ok(GeneratedField::__SkipField__), - } + Ok(GeneratedField::__SkipField__) } } deserializer.deserialize_identifier(GeneratedVisitor) @@ -10516,47 +10330,27 @@ impl<'de> serde::Deserialize<'de> for ParticipantTracks { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ParticipantTracks; + type Value = ListSipTrunkRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ParticipantTracks") + formatter.write_str("struct livekit.ListSIPTrunkRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut participant_sid__ = None; - let mut track_sids__ = None; - while let Some(k) = map_.next_key()? { - match k { - GeneratedField::ParticipantSid => { - if participant_sid__.is_some() { - return Err(serde::de::Error::duplicate_field("participantSid")); - } - participant_sid__ = Some(map_.next_value()?); - } - GeneratedField::TrackSids => { - if track_sids__.is_some() { - return Err(serde::de::Error::duplicate_field("trackSids")); - } - track_sids__ = Some(map_.next_value()?); - } - GeneratedField::__SkipField__ => { - let _ = map_.next_value::()?; - } - } + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; } - Ok(ParticipantTracks { - participant_sid: participant_sid__.unwrap_or_default(), - track_sids: track_sids__.unwrap_or_default(), + Ok(ListSipTrunkRequest { }) } } - deserializer.deserialize_struct("livekit.ParticipantTracks", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListSIPTrunkRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ParticipantUpdate { +impl serde::Serialize for ListSipTrunkResponse { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -10564,29 +10358,29 @@ impl serde::Serialize for ParticipantUpdate { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.participants.is_empty() { + if !self.items.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ParticipantUpdate", len)?; - if !self.participants.is_empty() { - struct_ser.serialize_field("participants", &self.participants)?; + let mut struct_ser = serializer.serialize_struct("livekit.ListSIPTrunkResponse", len)?; + if !self.items.is_empty() { + struct_ser.serialize_field("items", &self.items)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ParticipantUpdate { +impl<'de> serde::Deserialize<'de> for ListSipTrunkResponse { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "participants", + "items", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Participants, + Items, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -10609,7 +10403,7 @@ impl<'de> serde::Deserialize<'de> for ParticipantUpdate { E: serde::de::Error, { match value { - "participants" => Ok(GeneratedField::Participants), + "items" => Ok(GeneratedField::Items), _ => Ok(GeneratedField::__SkipField__), } } @@ -10619,39 +10413,39 @@ impl<'de> serde::Deserialize<'de> for ParticipantUpdate { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ParticipantUpdate; + type Value = ListSipTrunkResponse; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ParticipantUpdate") + formatter.write_str("struct livekit.ListSIPTrunkResponse") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut participants__ = None; + let mut items__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Participants => { - if participants__.is_some() { - return Err(serde::de::Error::duplicate_field("participants")); + GeneratedField::Items => { + if items__.is_some() { + return Err(serde::de::Error::duplicate_field("items")); } - participants__ = Some(map_.next_value()?); + items__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ParticipantUpdate { - participants: participants__.unwrap_or_default(), + Ok(ListSipTrunkResponse { + items: items__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.ParticipantUpdate", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ListSIPTrunkResponse", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for Ping { +impl serde::Serialize for MuteRoomTrackRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -10659,39 +10453,54 @@ impl serde::Serialize for Ping { { use serde::ser::SerializeStruct; let mut len = 0; - if self.timestamp != 0 { + if !self.room.is_empty() { len += 1; } - if self.rtt != 0 { + if !self.identity.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.Ping", len)?; - if self.timestamp != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?; + if !self.track_sid.is_empty() { + len += 1; } - if self.rtt != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("rtt", ToString::to_string(&self.rtt).as_str())?; + if self.muted { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.MuteRoomTrackRequest", len)?; + if !self.room.is_empty() { + struct_ser.serialize_field("room", &self.room)?; + } + if !self.identity.is_empty() { + struct_ser.serialize_field("identity", &self.identity)?; + } + if !self.track_sid.is_empty() { + struct_ser.serialize_field("trackSid", &self.track_sid)?; + } + if self.muted { + struct_ser.serialize_field("muted", &self.muted)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for Ping { +impl<'de> serde::Deserialize<'de> for MuteRoomTrackRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "timestamp", - "rtt", + "room", + "identity", + "track_sid", + "trackSid", + "muted", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Timestamp, - Rtt, + Room, + Identity, + TrackSid, + Muted, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -10714,8 +10523,10 @@ impl<'de> serde::Deserialize<'de> for Ping { E: serde::de::Error, { match value { - "timestamp" => Ok(GeneratedField::Timestamp), - "rtt" => Ok(GeneratedField::Rtt), + "room" => Ok(GeneratedField::Room), + "identity" => Ok(GeneratedField::Identity), + "trackSid" | "track_sid" => Ok(GeneratedField::TrackSid), + "muted" => Ok(GeneratedField::Muted), _ => Ok(GeneratedField::__SkipField__), } } @@ -10725,51 +10536,63 @@ impl<'de> serde::Deserialize<'de> for Ping { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = Ping; + type Value = MuteRoomTrackRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.Ping") + formatter.write_str("struct livekit.MuteRoomTrackRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut timestamp__ = None; - let mut rtt__ = None; + let mut room__ = None; + let mut identity__ = None; + let mut track_sid__ = None; + let mut muted__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Timestamp => { - if timestamp__.is_some() { - return Err(serde::de::Error::duplicate_field("timestamp")); + GeneratedField::Room => { + if room__.is_some() { + return Err(serde::de::Error::duplicate_field("room")); } - timestamp__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + room__ = Some(map_.next_value()?); } - GeneratedField::Rtt => { - if rtt__.is_some() { - return Err(serde::de::Error::duplicate_field("rtt")); + GeneratedField::Identity => { + if identity__.is_some() { + return Err(serde::de::Error::duplicate_field("identity")); } - rtt__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + identity__ = Some(map_.next_value()?); + } + GeneratedField::TrackSid => { + if track_sid__.is_some() { + return Err(serde::de::Error::duplicate_field("trackSid")); + } + track_sid__ = Some(map_.next_value()?); + } + GeneratedField::Muted => { + if muted__.is_some() { + return Err(serde::de::Error::duplicate_field("muted")); + } + muted__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(Ping { - timestamp: timestamp__.unwrap_or_default(), - rtt: rtt__.unwrap_or_default(), + Ok(MuteRoomTrackRequest { + room: room__.unwrap_or_default(), + identity: identity__.unwrap_or_default(), + track_sid: track_sid__.unwrap_or_default(), + muted: muted__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.Ping", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.MuteRoomTrackRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for PlayoutDelay { +impl serde::Serialize for MuteRoomTrackResponse { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -10777,45 +10600,29 @@ impl serde::Serialize for PlayoutDelay { { use serde::ser::SerializeStruct; let mut len = 0; - if self.enabled { - len += 1; - } - if self.min != 0 { + if self.track.is_some() { len += 1; } - if self.max != 0 { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("livekit.PlayoutDelay", len)?; - if self.enabled { - struct_ser.serialize_field("enabled", &self.enabled)?; - } - if self.min != 0 { - struct_ser.serialize_field("min", &self.min)?; - } - if self.max != 0 { - struct_ser.serialize_field("max", &self.max)?; + let mut struct_ser = serializer.serialize_struct("livekit.MuteRoomTrackResponse", len)?; + if let Some(v) = self.track.as_ref() { + struct_ser.serialize_field("track", v)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for PlayoutDelay { +impl<'de> serde::Deserialize<'de> for MuteRoomTrackResponse { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "enabled", - "min", - "max", + "track", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Enabled, - Min, - Max, + Track, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -10838,9 +10645,7 @@ impl<'de> serde::Deserialize<'de> for PlayoutDelay { E: serde::de::Error, { match value { - "enabled" => Ok(GeneratedField::Enabled), - "min" => Ok(GeneratedField::Min), - "max" => Ok(GeneratedField::Max), + "track" => Ok(GeneratedField::Track), _ => Ok(GeneratedField::__SkipField__), } } @@ -10850,59 +10655,39 @@ impl<'de> serde::Deserialize<'de> for PlayoutDelay { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = PlayoutDelay; + type Value = MuteRoomTrackResponse; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.PlayoutDelay") + formatter.write_str("struct livekit.MuteRoomTrackResponse") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut enabled__ = None; - let mut min__ = None; - let mut max__ = None; + let mut track__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Enabled => { - if enabled__.is_some() { - return Err(serde::de::Error::duplicate_field("enabled")); - } - enabled__ = Some(map_.next_value()?); - } - GeneratedField::Min => { - if min__.is_some() { - return Err(serde::de::Error::duplicate_field("min")); - } - min__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Max => { - if max__.is_some() { - return Err(serde::de::Error::duplicate_field("max")); + GeneratedField::Track => { + if track__.is_some() { + return Err(serde::de::Error::duplicate_field("track")); } - max__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + track__ = map_.next_value()?; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(PlayoutDelay { - enabled: enabled__.unwrap_or_default(), - min: min__.unwrap_or_default(), - max: max__.unwrap_or_default(), + Ok(MuteRoomTrackResponse { + track: track__, }) } } - deserializer.deserialize_struct("livekit.PlayoutDelay", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.MuteRoomTrackResponse", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for Pong { +impl serde::Serialize for MuteTrackRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -10910,40 +10695,37 @@ impl serde::Serialize for Pong { { use serde::ser::SerializeStruct; let mut len = 0; - if self.last_ping_timestamp != 0 { + if !self.sid.is_empty() { len += 1; } - if self.timestamp != 0 { + if self.muted { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.Pong", len)?; - if self.last_ping_timestamp != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("lastPingTimestamp", ToString::to_string(&self.last_ping_timestamp).as_str())?; + let mut struct_ser = serializer.serialize_struct("livekit.MuteTrackRequest", len)?; + if !self.sid.is_empty() { + struct_ser.serialize_field("sid", &self.sid)?; } - if self.timestamp != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?; + if self.muted { + struct_ser.serialize_field("muted", &self.muted)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for Pong { +impl<'de> serde::Deserialize<'de> for MuteTrackRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "last_ping_timestamp", - "lastPingTimestamp", - "timestamp", + "sid", + "muted", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - LastPingTimestamp, - Timestamp, + Sid, + Muted, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -10966,8 +10748,8 @@ impl<'de> serde::Deserialize<'de> for Pong { E: serde::de::Error, { match value { - "lastPingTimestamp" | "last_ping_timestamp" => Ok(GeneratedField::LastPingTimestamp), - "timestamp" => Ok(GeneratedField::Timestamp), + "sid" => Ok(GeneratedField::Sid), + "muted" => Ok(GeneratedField::Muted), _ => Ok(GeneratedField::__SkipField__), } } @@ -10977,51 +10759,47 @@ impl<'de> serde::Deserialize<'de> for Pong { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = Pong; + type Value = MuteTrackRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.Pong") + formatter.write_str("struct livekit.MuteTrackRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut last_ping_timestamp__ = None; - let mut timestamp__ = None; + let mut sid__ = None; + let mut muted__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::LastPingTimestamp => { - if last_ping_timestamp__.is_some() { - return Err(serde::de::Error::duplicate_field("lastPingTimestamp")); + GeneratedField::Sid => { + if sid__.is_some() { + return Err(serde::de::Error::duplicate_field("sid")); } - last_ping_timestamp__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + sid__ = Some(map_.next_value()?); } - GeneratedField::Timestamp => { - if timestamp__.is_some() { - return Err(serde::de::Error::duplicate_field("timestamp")); + GeneratedField::Muted => { + if muted__.is_some() { + return Err(serde::de::Error::duplicate_field("muted")); } - timestamp__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + muted__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(Pong { - last_ping_timestamp: last_ping_timestamp__.unwrap_or_default(), - timestamp: timestamp__.unwrap_or_default(), + Ok(MuteTrackRequest { + sid: sid__.unwrap_or_default(), + muted: muted__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.Pong", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.MuteTrackRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for RtpDrift { +impl serde::Serialize for ParticipantEgressRequest { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -11029,110 +10807,107 @@ impl serde::Serialize for RtpDrift { { use serde::ser::SerializeStruct; let mut len = 0; - if self.start_time.is_some() { - len += 1; - } - if self.end_time.is_some() { + if !self.room_name.is_empty() { len += 1; } - if self.duration != 0. { + if !self.identity.is_empty() { len += 1; } - if self.start_timestamp != 0 { + if self.screen_share { len += 1; } - if self.end_timestamp != 0 { + if !self.file_outputs.is_empty() { len += 1; } - if self.rtp_clock_ticks != 0 { + if !self.stream_outputs.is_empty() { len += 1; } - if self.drift_samples != 0 { + if !self.segment_outputs.is_empty() { len += 1; } - if self.drift_ms != 0. { + if !self.image_outputs.is_empty() { len += 1; } - if self.clock_rate != 0. { + if self.options.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.RTPDrift", len)?; - if let Some(v) = self.start_time.as_ref() { - struct_ser.serialize_field("startTime", v)?; - } - if let Some(v) = self.end_time.as_ref() { - struct_ser.serialize_field("endTime", v)?; + let mut struct_ser = serializer.serialize_struct("livekit.ParticipantEgressRequest", len)?; + if !self.room_name.is_empty() { + struct_ser.serialize_field("roomName", &self.room_name)?; } - if self.duration != 0. { - struct_ser.serialize_field("duration", &self.duration)?; + if !self.identity.is_empty() { + struct_ser.serialize_field("identity", &self.identity)?; } - if self.start_timestamp != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("startTimestamp", ToString::to_string(&self.start_timestamp).as_str())?; + if self.screen_share { + struct_ser.serialize_field("screenShare", &self.screen_share)?; } - if self.end_timestamp != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("endTimestamp", ToString::to_string(&self.end_timestamp).as_str())?; + if !self.file_outputs.is_empty() { + struct_ser.serialize_field("fileOutputs", &self.file_outputs)?; } - if self.rtp_clock_ticks != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("rtpClockTicks", ToString::to_string(&self.rtp_clock_ticks).as_str())?; + if !self.stream_outputs.is_empty() { + struct_ser.serialize_field("streamOutputs", &self.stream_outputs)?; } - if self.drift_samples != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("driftSamples", ToString::to_string(&self.drift_samples).as_str())?; + if !self.segment_outputs.is_empty() { + struct_ser.serialize_field("segmentOutputs", &self.segment_outputs)?; } - if self.drift_ms != 0. { - struct_ser.serialize_field("driftMs", &self.drift_ms)?; + if !self.image_outputs.is_empty() { + struct_ser.serialize_field("imageOutputs", &self.image_outputs)?; } - if self.clock_rate != 0. { - struct_ser.serialize_field("clockRate", &self.clock_rate)?; + if let Some(v) = self.options.as_ref() { + match v { + participant_egress_request::Options::Preset(v) => { + let v = EncodingOptionsPreset::try_from(*v) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?; + struct_ser.serialize_field("preset", &v)?; + } + participant_egress_request::Options::Advanced(v) => { + struct_ser.serialize_field("advanced", v)?; + } + } } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for RtpDrift { +impl<'de> serde::Deserialize<'de> for ParticipantEgressRequest { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "start_time", - "startTime", - "end_time", - "endTime", - "duration", - "start_timestamp", - "startTimestamp", - "end_timestamp", - "endTimestamp", - "rtp_clock_ticks", - "rtpClockTicks", - "drift_samples", - "driftSamples", - "drift_ms", - "driftMs", - "clock_rate", - "clockRate", + "room_name", + "roomName", + "identity", + "screen_share", + "screenShare", + "file_outputs", + "fileOutputs", + "stream_outputs", + "streamOutputs", + "segment_outputs", + "segmentOutputs", + "image_outputs", + "imageOutputs", + "preset", + "advanced", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - StartTime, - EndTime, - Duration, - StartTimestamp, - EndTimestamp, - RtpClockTicks, - DriftSamples, - DriftMs, - ClockRate, - __SkipField__, - } - impl<'de> serde::Deserialize<'de> for GeneratedField { - fn deserialize(deserializer: D) -> std::result::Result - where + RoomName, + Identity, + ScreenShare, + FileOutputs, + StreamOutputs, + SegmentOutputs, + ImageOutputs, + Preset, + Advanced, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where D: serde::Deserializer<'de>, { struct GeneratedVisitor; @@ -11150,15 +10925,15 @@ impl<'de> serde::Deserialize<'de> for RtpDrift { E: serde::de::Error, { match value { - "startTime" | "start_time" => Ok(GeneratedField::StartTime), - "endTime" | "end_time" => Ok(GeneratedField::EndTime), - "duration" => Ok(GeneratedField::Duration), - "startTimestamp" | "start_timestamp" => Ok(GeneratedField::StartTimestamp), - "endTimestamp" | "end_timestamp" => Ok(GeneratedField::EndTimestamp), - "rtpClockTicks" | "rtp_clock_ticks" => Ok(GeneratedField::RtpClockTicks), - "driftSamples" | "drift_samples" => Ok(GeneratedField::DriftSamples), - "driftMs" | "drift_ms" => Ok(GeneratedField::DriftMs), - "clockRate" | "clock_rate" => Ok(GeneratedField::ClockRate), + "roomName" | "room_name" => Ok(GeneratedField::RoomName), + "identity" => Ok(GeneratedField::Identity), + "screenShare" | "screen_share" => Ok(GeneratedField::ScreenShare), + "fileOutputs" | "file_outputs" => Ok(GeneratedField::FileOutputs), + "streamOutputs" | "stream_outputs" => Ok(GeneratedField::StreamOutputs), + "segmentOutputs" | "segment_outputs" => Ok(GeneratedField::SegmentOutputs), + "imageOutputs" | "image_outputs" => Ok(GeneratedField::ImageOutputs), + "preset" => Ok(GeneratedField::Preset), + "advanced" => Ok(GeneratedField::Advanced), _ => Ok(GeneratedField::__SkipField__), } } @@ -11168,117 +10943,102 @@ impl<'de> serde::Deserialize<'de> for RtpDrift { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = RtpDrift; + type Value = ParticipantEgressRequest; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.RTPDrift") + formatter.write_str("struct livekit.ParticipantEgressRequest") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut start_time__ = None; - let mut end_time__ = None; - let mut duration__ = None; - let mut start_timestamp__ = None; - let mut end_timestamp__ = None; - let mut rtp_clock_ticks__ = None; - let mut drift_samples__ = None; - let mut drift_ms__ = None; - let mut clock_rate__ = None; + let mut room_name__ = None; + let mut identity__ = None; + let mut screen_share__ = None; + let mut file_outputs__ = None; + let mut stream_outputs__ = None; + let mut segment_outputs__ = None; + let mut image_outputs__ = None; + let mut options__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::StartTime => { - if start_time__.is_some() { - return Err(serde::de::Error::duplicate_field("startTime")); + GeneratedField::RoomName => { + if room_name__.is_some() { + return Err(serde::de::Error::duplicate_field("roomName")); } - start_time__ = map_.next_value()?; + room_name__ = Some(map_.next_value()?); } - GeneratedField::EndTime => { - if end_time__.is_some() { - return Err(serde::de::Error::duplicate_field("endTime")); + GeneratedField::Identity => { + if identity__.is_some() { + return Err(serde::de::Error::duplicate_field("identity")); } - end_time__ = map_.next_value()?; + identity__ = Some(map_.next_value()?); } - GeneratedField::Duration => { - if duration__.is_some() { - return Err(serde::de::Error::duplicate_field("duration")); + GeneratedField::ScreenShare => { + if screen_share__.is_some() { + return Err(serde::de::Error::duplicate_field("screenShare")); } - duration__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + screen_share__ = Some(map_.next_value()?); } - GeneratedField::StartTimestamp => { - if start_timestamp__.is_some() { - return Err(serde::de::Error::duplicate_field("startTimestamp")); + GeneratedField::FileOutputs => { + if file_outputs__.is_some() { + return Err(serde::de::Error::duplicate_field("fileOutputs")); } - start_timestamp__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + file_outputs__ = Some(map_.next_value()?); } - GeneratedField::EndTimestamp => { - if end_timestamp__.is_some() { - return Err(serde::de::Error::duplicate_field("endTimestamp")); + GeneratedField::StreamOutputs => { + if stream_outputs__.is_some() { + return Err(serde::de::Error::duplicate_field("streamOutputs")); } - end_timestamp__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + stream_outputs__ = Some(map_.next_value()?); } - GeneratedField::RtpClockTicks => { - if rtp_clock_ticks__.is_some() { - return Err(serde::de::Error::duplicate_field("rtpClockTicks")); + GeneratedField::SegmentOutputs => { + if segment_outputs__.is_some() { + return Err(serde::de::Error::duplicate_field("segmentOutputs")); } - rtp_clock_ticks__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + segment_outputs__ = Some(map_.next_value()?); } - GeneratedField::DriftSamples => { - if drift_samples__.is_some() { - return Err(serde::de::Error::duplicate_field("driftSamples")); + GeneratedField::ImageOutputs => { + if image_outputs__.is_some() { + return Err(serde::de::Error::duplicate_field("imageOutputs")); } - drift_samples__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + image_outputs__ = Some(map_.next_value()?); } - GeneratedField::DriftMs => { - if drift_ms__.is_some() { - return Err(serde::de::Error::duplicate_field("driftMs")); + GeneratedField::Preset => { + if options__.is_some() { + return Err(serde::de::Error::duplicate_field("preset")); } - drift_ms__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + options__ = map_.next_value::<::std::option::Option>()?.map(|x| participant_egress_request::Options::Preset(x as i32)); } - GeneratedField::ClockRate => { - if clock_rate__.is_some() { - return Err(serde::de::Error::duplicate_field("clockRate")); + GeneratedField::Advanced => { + if options__.is_some() { + return Err(serde::de::Error::duplicate_field("advanced")); } - clock_rate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + options__ = map_.next_value::<::std::option::Option<_>>()?.map(participant_egress_request::Options::Advanced) +; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(RtpDrift { - start_time: start_time__, - end_time: end_time__, - duration: duration__.unwrap_or_default(), - start_timestamp: start_timestamp__.unwrap_or_default(), - end_timestamp: end_timestamp__.unwrap_or_default(), - rtp_clock_ticks: rtp_clock_ticks__.unwrap_or_default(), - drift_samples: drift_samples__.unwrap_or_default(), - drift_ms: drift_ms__.unwrap_or_default(), - clock_rate: clock_rate__.unwrap_or_default(), + Ok(ParticipantEgressRequest { + room_name: room_name__.unwrap_or_default(), + identity: identity__.unwrap_or_default(), + screen_share: screen_share__.unwrap_or_default(), + file_outputs: file_outputs__.unwrap_or_default(), + stream_outputs: stream_outputs__.unwrap_or_default(), + segment_outputs: segment_outputs__.unwrap_or_default(), + image_outputs: image_outputs__.unwrap_or_default(), + options: options__, }) } } - deserializer.deserialize_struct("livekit.RTPDrift", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.ParticipantEgressRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for RtpStats { +impl serde::Serialize for ParticipantInfo { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -11286,406 +11046,124 @@ impl serde::Serialize for RtpStats { { use serde::ser::SerializeStruct; let mut len = 0; - if self.start_time.is_some() { - len += 1; - } - if self.end_time.is_some() { - len += 1; - } - if self.duration != 0. { - len += 1; - } - if self.packets != 0 { - len += 1; - } - if self.packet_rate != 0. { + if !self.sid.is_empty() { len += 1; } - if self.bytes != 0 { + if !self.identity.is_empty() { len += 1; } - if self.header_bytes != 0 { + if self.state != 0 { len += 1; } - if self.bitrate != 0. { + if !self.tracks.is_empty() { len += 1; } - if self.packets_lost != 0 { + if !self.metadata.is_empty() { len += 1; } - if self.packet_loss_rate != 0. { + if self.joined_at != 0 { len += 1; } - if self.packet_loss_percentage != 0. { + if !self.name.is_empty() { len += 1; } - if self.packets_duplicate != 0 { + if self.version != 0 { len += 1; } - if self.packet_duplicate_rate != 0. { + if self.permission.is_some() { len += 1; } - if self.bytes_duplicate != 0 { + if !self.region.is_empty() { len += 1; } - if self.header_bytes_duplicate != 0 { + if self.is_publisher { len += 1; } - if self.bitrate_duplicate != 0. { + if self.kind != 0 { len += 1; } - if self.packets_padding != 0 { - len += 1; + let mut struct_ser = serializer.serialize_struct("livekit.ParticipantInfo", len)?; + if !self.sid.is_empty() { + struct_ser.serialize_field("sid", &self.sid)?; } - if self.packet_padding_rate != 0. { - len += 1; + if !self.identity.is_empty() { + struct_ser.serialize_field("identity", &self.identity)?; } - if self.bytes_padding != 0 { - len += 1; + if self.state != 0 { + let v = participant_info::State::try_from(self.state) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.state)))?; + struct_ser.serialize_field("state", &v)?; } - if self.header_bytes_padding != 0 { - len += 1; + if !self.tracks.is_empty() { + struct_ser.serialize_field("tracks", &self.tracks)?; } - if self.bitrate_padding != 0. { - len += 1; + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; } - if self.packets_out_of_order != 0 { - len += 1; + if self.joined_at != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("joinedAt", ToString::to_string(&self.joined_at).as_str())?; } - if self.frames != 0 { - len += 1; + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; } - if self.frame_rate != 0. { - len += 1; + if self.version != 0 { + struct_ser.serialize_field("version", &self.version)?; } - if self.jitter_current != 0. { - len += 1; + if let Some(v) = self.permission.as_ref() { + struct_ser.serialize_field("permission", v)?; } - if self.jitter_max != 0. { - len += 1; + if !self.region.is_empty() { + struct_ser.serialize_field("region", &self.region)?; } - if !self.gap_histogram.is_empty() { - len += 1; + if self.is_publisher { + struct_ser.serialize_field("isPublisher", &self.is_publisher)?; } - if self.nacks != 0 { - len += 1; - } - if self.nack_acks != 0 { - len += 1; - } - if self.nack_misses != 0 { - len += 1; - } - if self.nack_repeated != 0 { - len += 1; - } - if self.plis != 0 { - len += 1; - } - if self.last_pli.is_some() { - len += 1; - } - if self.firs != 0 { - len += 1; - } - if self.last_fir.is_some() { - len += 1; - } - if self.rtt_current != 0 { - len += 1; - } - if self.rtt_max != 0 { - len += 1; - } - if self.key_frames != 0 { - len += 1; - } - if self.last_key_frame.is_some() { - len += 1; - } - if self.layer_lock_plis != 0 { - len += 1; - } - if self.last_layer_lock_pli.is_some() { - len += 1; - } - if self.packet_drift.is_some() { - len += 1; - } - if self.report_drift.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("livekit.RTPStats", len)?; - if let Some(v) = self.start_time.as_ref() { - struct_ser.serialize_field("startTime", v)?; - } - if let Some(v) = self.end_time.as_ref() { - struct_ser.serialize_field("endTime", v)?; - } - if self.duration != 0. { - struct_ser.serialize_field("duration", &self.duration)?; - } - if self.packets != 0 { - struct_ser.serialize_field("packets", &self.packets)?; - } - if self.packet_rate != 0. { - struct_ser.serialize_field("packetRate", &self.packet_rate)?; - } - if self.bytes != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("bytes", ToString::to_string(&self.bytes).as_str())?; - } - if self.header_bytes != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("headerBytes", ToString::to_string(&self.header_bytes).as_str())?; - } - if self.bitrate != 0. { - struct_ser.serialize_field("bitrate", &self.bitrate)?; - } - if self.packets_lost != 0 { - struct_ser.serialize_field("packetsLost", &self.packets_lost)?; - } - if self.packet_loss_rate != 0. { - struct_ser.serialize_field("packetLossRate", &self.packet_loss_rate)?; - } - if self.packet_loss_percentage != 0. { - struct_ser.serialize_field("packetLossPercentage", &self.packet_loss_percentage)?; - } - if self.packets_duplicate != 0 { - struct_ser.serialize_field("packetsDuplicate", &self.packets_duplicate)?; - } - if self.packet_duplicate_rate != 0. { - struct_ser.serialize_field("packetDuplicateRate", &self.packet_duplicate_rate)?; - } - if self.bytes_duplicate != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("bytesDuplicate", ToString::to_string(&self.bytes_duplicate).as_str())?; - } - if self.header_bytes_duplicate != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("headerBytesDuplicate", ToString::to_string(&self.header_bytes_duplicate).as_str())?; - } - if self.bitrate_duplicate != 0. { - struct_ser.serialize_field("bitrateDuplicate", &self.bitrate_duplicate)?; - } - if self.packets_padding != 0 { - struct_ser.serialize_field("packetsPadding", &self.packets_padding)?; - } - if self.packet_padding_rate != 0. { - struct_ser.serialize_field("packetPaddingRate", &self.packet_padding_rate)?; - } - if self.bytes_padding != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("bytesPadding", ToString::to_string(&self.bytes_padding).as_str())?; - } - if self.header_bytes_padding != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("headerBytesPadding", ToString::to_string(&self.header_bytes_padding).as_str())?; - } - if self.bitrate_padding != 0. { - struct_ser.serialize_field("bitratePadding", &self.bitrate_padding)?; - } - if self.packets_out_of_order != 0 { - struct_ser.serialize_field("packetsOutOfOrder", &self.packets_out_of_order)?; - } - if self.frames != 0 { - struct_ser.serialize_field("frames", &self.frames)?; - } - if self.frame_rate != 0. { - struct_ser.serialize_field("frameRate", &self.frame_rate)?; - } - if self.jitter_current != 0. { - struct_ser.serialize_field("jitterCurrent", &self.jitter_current)?; - } - if self.jitter_max != 0. { - struct_ser.serialize_field("jitterMax", &self.jitter_max)?; - } - if !self.gap_histogram.is_empty() { - struct_ser.serialize_field("gapHistogram", &self.gap_histogram)?; - } - if self.nacks != 0 { - struct_ser.serialize_field("nacks", &self.nacks)?; - } - if self.nack_acks != 0 { - struct_ser.serialize_field("nackAcks", &self.nack_acks)?; - } - if self.nack_misses != 0 { - struct_ser.serialize_field("nackMisses", &self.nack_misses)?; - } - if self.nack_repeated != 0 { - struct_ser.serialize_field("nackRepeated", &self.nack_repeated)?; - } - if self.plis != 0 { - struct_ser.serialize_field("plis", &self.plis)?; - } - if let Some(v) = self.last_pli.as_ref() { - struct_ser.serialize_field("lastPli", v)?; - } - if self.firs != 0 { - struct_ser.serialize_field("firs", &self.firs)?; - } - if let Some(v) = self.last_fir.as_ref() { - struct_ser.serialize_field("lastFir", v)?; - } - if self.rtt_current != 0 { - struct_ser.serialize_field("rttCurrent", &self.rtt_current)?; - } - if self.rtt_max != 0 { - struct_ser.serialize_field("rttMax", &self.rtt_max)?; - } - if self.key_frames != 0 { - struct_ser.serialize_field("keyFrames", &self.key_frames)?; - } - if let Some(v) = self.last_key_frame.as_ref() { - struct_ser.serialize_field("lastKeyFrame", v)?; - } - if self.layer_lock_plis != 0 { - struct_ser.serialize_field("layerLockPlis", &self.layer_lock_plis)?; - } - if let Some(v) = self.last_layer_lock_pli.as_ref() { - struct_ser.serialize_field("lastLayerLockPli", v)?; - } - if let Some(v) = self.packet_drift.as_ref() { - struct_ser.serialize_field("packetDrift", v)?; - } - if let Some(v) = self.report_drift.as_ref() { - struct_ser.serialize_field("reportDrift", v)?; + if self.kind != 0 { + let v = participant_info::Kind::try_from(self.kind) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", self.kind)))?; + struct_ser.serialize_field("kind", &v)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for RtpStats { +impl<'de> serde::Deserialize<'de> for ParticipantInfo { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "start_time", - "startTime", - "end_time", - "endTime", - "duration", - "packets", - "packet_rate", - "packetRate", - "bytes", - "header_bytes", - "headerBytes", - "bitrate", - "packets_lost", - "packetsLost", - "packet_loss_rate", - "packetLossRate", - "packet_loss_percentage", - "packetLossPercentage", - "packets_duplicate", - "packetsDuplicate", - "packet_duplicate_rate", - "packetDuplicateRate", - "bytes_duplicate", - "bytesDuplicate", - "header_bytes_duplicate", - "headerBytesDuplicate", - "bitrate_duplicate", - "bitrateDuplicate", - "packets_padding", - "packetsPadding", - "packet_padding_rate", - "packetPaddingRate", - "bytes_padding", - "bytesPadding", - "header_bytes_padding", - "headerBytesPadding", - "bitrate_padding", - "bitratePadding", - "packets_out_of_order", - "packetsOutOfOrder", - "frames", - "frame_rate", - "frameRate", - "jitter_current", - "jitterCurrent", - "jitter_max", - "jitterMax", - "gap_histogram", - "gapHistogram", - "nacks", - "nack_acks", - "nackAcks", - "nack_misses", - "nackMisses", - "nack_repeated", - "nackRepeated", - "plis", - "last_pli", - "lastPli", - "firs", - "last_fir", - "lastFir", - "rtt_current", - "rttCurrent", - "rtt_max", - "rttMax", - "key_frames", - "keyFrames", - "last_key_frame", - "lastKeyFrame", - "layer_lock_plis", - "layerLockPlis", - "last_layer_lock_pli", - "lastLayerLockPli", - "packet_drift", - "packetDrift", - "report_drift", - "reportDrift", + "sid", + "identity", + "state", + "tracks", + "metadata", + "joined_at", + "joinedAt", + "name", + "version", + "permission", + "region", + "is_publisher", + "isPublisher", + "kind", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - StartTime, - EndTime, - Duration, - Packets, - PacketRate, - Bytes, - HeaderBytes, - Bitrate, - PacketsLost, - PacketLossRate, - PacketLossPercentage, - PacketsDuplicate, - PacketDuplicateRate, - BytesDuplicate, - HeaderBytesDuplicate, - BitrateDuplicate, - PacketsPadding, - PacketPaddingRate, - BytesPadding, - HeaderBytesPadding, - BitratePadding, - PacketsOutOfOrder, - Frames, - FrameRate, - JitterCurrent, - JitterMax, - GapHistogram, - Nacks, - NackAcks, - NackMisses, - NackRepeated, - Plis, - LastPli, - Firs, - LastFir, - RttCurrent, - RttMax, - KeyFrames, - LastKeyFrame, - LayerLockPlis, - LastLayerLockPli, - PacketDrift, - ReportDrift, + Sid, + Identity, + State, + Tracks, + Metadata, + JoinedAt, + Name, + Version, + Permission, + Region, + IsPublisher, + Kind, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -11708,49 +11186,18 @@ impl<'de> serde::Deserialize<'de> for RtpStats { E: serde::de::Error, { match value { - "startTime" | "start_time" => Ok(GeneratedField::StartTime), - "endTime" | "end_time" => Ok(GeneratedField::EndTime), - "duration" => Ok(GeneratedField::Duration), - "packets" => Ok(GeneratedField::Packets), - "packetRate" | "packet_rate" => Ok(GeneratedField::PacketRate), - "bytes" => Ok(GeneratedField::Bytes), - "headerBytes" | "header_bytes" => Ok(GeneratedField::HeaderBytes), - "bitrate" => Ok(GeneratedField::Bitrate), - "packetsLost" | "packets_lost" => Ok(GeneratedField::PacketsLost), - "packetLossRate" | "packet_loss_rate" => Ok(GeneratedField::PacketLossRate), - "packetLossPercentage" | "packet_loss_percentage" => Ok(GeneratedField::PacketLossPercentage), - "packetsDuplicate" | "packets_duplicate" => Ok(GeneratedField::PacketsDuplicate), - "packetDuplicateRate" | "packet_duplicate_rate" => Ok(GeneratedField::PacketDuplicateRate), - "bytesDuplicate" | "bytes_duplicate" => Ok(GeneratedField::BytesDuplicate), - "headerBytesDuplicate" | "header_bytes_duplicate" => Ok(GeneratedField::HeaderBytesDuplicate), - "bitrateDuplicate" | "bitrate_duplicate" => Ok(GeneratedField::BitrateDuplicate), - "packetsPadding" | "packets_padding" => Ok(GeneratedField::PacketsPadding), - "packetPaddingRate" | "packet_padding_rate" => Ok(GeneratedField::PacketPaddingRate), - "bytesPadding" | "bytes_padding" => Ok(GeneratedField::BytesPadding), - "headerBytesPadding" | "header_bytes_padding" => Ok(GeneratedField::HeaderBytesPadding), - "bitratePadding" | "bitrate_padding" => Ok(GeneratedField::BitratePadding), - "packetsOutOfOrder" | "packets_out_of_order" => Ok(GeneratedField::PacketsOutOfOrder), - "frames" => Ok(GeneratedField::Frames), - "frameRate" | "frame_rate" => Ok(GeneratedField::FrameRate), - "jitterCurrent" | "jitter_current" => Ok(GeneratedField::JitterCurrent), - "jitterMax" | "jitter_max" => Ok(GeneratedField::JitterMax), - "gapHistogram" | "gap_histogram" => Ok(GeneratedField::GapHistogram), - "nacks" => Ok(GeneratedField::Nacks), - "nackAcks" | "nack_acks" => Ok(GeneratedField::NackAcks), - "nackMisses" | "nack_misses" => Ok(GeneratedField::NackMisses), - "nackRepeated" | "nack_repeated" => Ok(GeneratedField::NackRepeated), - "plis" => Ok(GeneratedField::Plis), - "lastPli" | "last_pli" => Ok(GeneratedField::LastPli), - "firs" => Ok(GeneratedField::Firs), - "lastFir" | "last_fir" => Ok(GeneratedField::LastFir), - "rttCurrent" | "rtt_current" => Ok(GeneratedField::RttCurrent), - "rttMax" | "rtt_max" => Ok(GeneratedField::RttMax), - "keyFrames" | "key_frames" => Ok(GeneratedField::KeyFrames), - "lastKeyFrame" | "last_key_frame" => Ok(GeneratedField::LastKeyFrame), - "layerLockPlis" | "layer_lock_plis" => Ok(GeneratedField::LayerLockPlis), - "lastLayerLockPli" | "last_layer_lock_pli" => Ok(GeneratedField::LastLayerLockPli), - "packetDrift" | "packet_drift" => Ok(GeneratedField::PacketDrift), - "reportDrift" | "report_drift" => Ok(GeneratedField::ReportDrift), + "sid" => Ok(GeneratedField::Sid), + "identity" => Ok(GeneratedField::Identity), + "state" => Ok(GeneratedField::State), + "tracks" => Ok(GeneratedField::Tracks), + "metadata" => Ok(GeneratedField::Metadata), + "joinedAt" | "joined_at" => Ok(GeneratedField::JoinedAt), + "name" => Ok(GeneratedField::Name), + "version" => Ok(GeneratedField::Version), + "permission" => Ok(GeneratedField::Permission), + "region" => Ok(GeneratedField::Region), + "isPublisher" | "is_publisher" => Ok(GeneratedField::IsPublisher), + "kind" => Ok(GeneratedField::Kind), _ => Ok(GeneratedField::__SkipField__), } } @@ -11760,526 +11207,3552 @@ impl<'de> serde::Deserialize<'de> for RtpStats { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = RtpStats; + type Value = ParticipantInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.RTPStats") + formatter.write_str("struct livekit.ParticipantInfo") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut start_time__ = None; - let mut end_time__ = None; - let mut duration__ = None; - let mut packets__ = None; - let mut packet_rate__ = None; - let mut bytes__ = None; - let mut header_bytes__ = None; - let mut bitrate__ = None; - let mut packets_lost__ = None; - let mut packet_loss_rate__ = None; - let mut packet_loss_percentage__ = None; - let mut packets_duplicate__ = None; - let mut packet_duplicate_rate__ = None; - let mut bytes_duplicate__ = None; - let mut header_bytes_duplicate__ = None; - let mut bitrate_duplicate__ = None; - let mut packets_padding__ = None; - let mut packet_padding_rate__ = None; - let mut bytes_padding__ = None; - let mut header_bytes_padding__ = None; - let mut bitrate_padding__ = None; - let mut packets_out_of_order__ = None; - let mut frames__ = None; - let mut frame_rate__ = None; - let mut jitter_current__ = None; - let mut jitter_max__ = None; - let mut gap_histogram__ = None; - let mut nacks__ = None; - let mut nack_acks__ = None; - let mut nack_misses__ = None; - let mut nack_repeated__ = None; - let mut plis__ = None; - let mut last_pli__ = None; - let mut firs__ = None; - let mut last_fir__ = None; - let mut rtt_current__ = None; - let mut rtt_max__ = None; - let mut key_frames__ = None; - let mut last_key_frame__ = None; - let mut layer_lock_plis__ = None; - let mut last_layer_lock_pli__ = None; - let mut packet_drift__ = None; - let mut report_drift__ = None; + let mut sid__ = None; + let mut identity__ = None; + let mut state__ = None; + let mut tracks__ = None; + let mut metadata__ = None; + let mut joined_at__ = None; + let mut name__ = None; + let mut version__ = None; + let mut permission__ = None; + let mut region__ = None; + let mut is_publisher__ = None; + let mut kind__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::StartTime => { - if start_time__.is_some() { - return Err(serde::de::Error::duplicate_field("startTime")); + GeneratedField::Sid => { + if sid__.is_some() { + return Err(serde::de::Error::duplicate_field("sid")); } - start_time__ = map_.next_value()?; + sid__ = Some(map_.next_value()?); } - GeneratedField::EndTime => { - if end_time__.is_some() { - return Err(serde::de::Error::duplicate_field("endTime")); + GeneratedField::Identity => { + if identity__.is_some() { + return Err(serde::de::Error::duplicate_field("identity")); } - end_time__ = map_.next_value()?; + identity__ = Some(map_.next_value()?); } - GeneratedField::Duration => { - if duration__.is_some() { - return Err(serde::de::Error::duplicate_field("duration")); + GeneratedField::State => { + if state__.is_some() { + return Err(serde::de::Error::duplicate_field("state")); } - duration__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + state__ = Some(map_.next_value::()? as i32); } - GeneratedField::Packets => { - if packets__.is_some() { - return Err(serde::de::Error::duplicate_field("packets")); + GeneratedField::Tracks => { + if tracks__.is_some() { + return Err(serde::de::Error::duplicate_field("tracks")); } - packets__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + tracks__ = Some(map_.next_value()?); } - GeneratedField::PacketRate => { - if packet_rate__.is_some() { - return Err(serde::de::Error::duplicate_field("packetRate")); + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); } - packet_rate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + metadata__ = Some(map_.next_value()?); } - GeneratedField::Bytes => { - if bytes__.is_some() { - return Err(serde::de::Error::duplicate_field("bytes")); + GeneratedField::JoinedAt => { + if joined_at__.is_some() { + return Err(serde::de::Error::duplicate_field("joinedAt")); } - bytes__ = + joined_at__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } - GeneratedField::HeaderBytes => { - if header_bytes__.is_some() { - return Err(serde::de::Error::duplicate_field("headerBytes")); + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); } - header_bytes__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + name__ = Some(map_.next_value()?); } - GeneratedField::Bitrate => { - if bitrate__.is_some() { - return Err(serde::de::Error::duplicate_field("bitrate")); - } - bitrate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::PacketsLost => { - if packets_lost__.is_some() { - return Err(serde::de::Error::duplicate_field("packetsLost")); - } - packets_lost__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::PacketLossRate => { - if packet_loss_rate__.is_some() { - return Err(serde::de::Error::duplicate_field("packetLossRate")); - } - packet_loss_rate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::PacketLossPercentage => { - if packet_loss_percentage__.is_some() { - return Err(serde::de::Error::duplicate_field("packetLossPercentage")); - } - packet_loss_percentage__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::PacketsDuplicate => { - if packets_duplicate__.is_some() { - return Err(serde::de::Error::duplicate_field("packetsDuplicate")); - } - packets_duplicate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::PacketDuplicateRate => { - if packet_duplicate_rate__.is_some() { - return Err(serde::de::Error::duplicate_field("packetDuplicateRate")); - } - packet_duplicate_rate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::BytesDuplicate => { - if bytes_duplicate__.is_some() { - return Err(serde::de::Error::duplicate_field("bytesDuplicate")); - } - bytes_duplicate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::HeaderBytesDuplicate => { - if header_bytes_duplicate__.is_some() { - return Err(serde::de::Error::duplicate_field("headerBytesDuplicate")); - } - header_bytes_duplicate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::BitrateDuplicate => { - if bitrate_duplicate__.is_some() { - return Err(serde::de::Error::duplicate_field("bitrateDuplicate")); - } - bitrate_duplicate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::PacketsPadding => { - if packets_padding__.is_some() { - return Err(serde::de::Error::duplicate_field("packetsPadding")); - } - packets_padding__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::PacketPaddingRate => { - if packet_padding_rate__.is_some() { - return Err(serde::de::Error::duplicate_field("packetPaddingRate")); - } - packet_padding_rate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::BytesPadding => { - if bytes_padding__.is_some() { - return Err(serde::de::Error::duplicate_field("bytesPadding")); - } - bytes_padding__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::HeaderBytesPadding => { - if header_bytes_padding__.is_some() { - return Err(serde::de::Error::duplicate_field("headerBytesPadding")); - } - header_bytes_padding__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::BitratePadding => { - if bitrate_padding__.is_some() { - return Err(serde::de::Error::duplicate_field("bitratePadding")); - } - bitrate_padding__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::PacketsOutOfOrder => { - if packets_out_of_order__.is_some() { - return Err(serde::de::Error::duplicate_field("packetsOutOfOrder")); - } - packets_out_of_order__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::Frames => { - if frames__.is_some() { - return Err(serde::de::Error::duplicate_field("frames")); - } - frames__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::FrameRate => { - if frame_rate__.is_some() { - return Err(serde::de::Error::duplicate_field("frameRate")); - } - frame_rate__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::JitterCurrent => { - if jitter_current__.is_some() { - return Err(serde::de::Error::duplicate_field("jitterCurrent")); - } - jitter_current__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::JitterMax => { - if jitter_max__.is_some() { - return Err(serde::de::Error::duplicate_field("jitterMax")); + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); } - jitter_max__ = + version__ = Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) ; } - GeneratedField::GapHistogram => { - if gap_histogram__.is_some() { - return Err(serde::de::Error::duplicate_field("gapHistogram")); - } - gap_histogram__ = Some( - map_.next_value::, ::pbjson::private::NumberDeserialize>>()? - .into_iter().map(|(k,v)| (k.0, v.0)).collect() - ); - } - GeneratedField::Nacks => { - if nacks__.is_some() { - return Err(serde::de::Error::duplicate_field("nacks")); + GeneratedField::Permission => { + if permission__.is_some() { + return Err(serde::de::Error::duplicate_field("permission")); } - nacks__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + permission__ = map_.next_value()?; } - GeneratedField::NackAcks => { - if nack_acks__.is_some() { - return Err(serde::de::Error::duplicate_field("nackAcks")); + GeneratedField::Region => { + if region__.is_some() { + return Err(serde::de::Error::duplicate_field("region")); } - nack_acks__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + region__ = Some(map_.next_value()?); } - GeneratedField::NackMisses => { - if nack_misses__.is_some() { - return Err(serde::de::Error::duplicate_field("nackMisses")); + GeneratedField::IsPublisher => { + if is_publisher__.is_some() { + return Err(serde::de::Error::duplicate_field("isPublisher")); } - nack_misses__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + is_publisher__ = Some(map_.next_value()?); } - GeneratedField::NackRepeated => { - if nack_repeated__.is_some() { - return Err(serde::de::Error::duplicate_field("nackRepeated")); + GeneratedField::Kind => { + if kind__.is_some() { + return Err(serde::de::Error::duplicate_field("kind")); } - nack_repeated__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + kind__ = Some(map_.next_value::()? as i32); } - GeneratedField::Plis => { - if plis__.is_some() { - return Err(serde::de::Error::duplicate_field("plis")); - } - plis__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; } - GeneratedField::LastPli => { - if last_pli__.is_some() { - return Err(serde::de::Error::duplicate_field("lastPli")); + } + } + Ok(ParticipantInfo { + sid: sid__.unwrap_or_default(), + identity: identity__.unwrap_or_default(), + state: state__.unwrap_or_default(), + tracks: tracks__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + joined_at: joined_at__.unwrap_or_default(), + name: name__.unwrap_or_default(), + version: version__.unwrap_or_default(), + permission: permission__, + region: region__.unwrap_or_default(), + is_publisher: is_publisher__.unwrap_or_default(), + kind: kind__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.ParticipantInfo", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for participant_info::Kind { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Standard => "STANDARD", + Self::Ingress => "INGRESS", + Self::Egress => "EGRESS", + Self::Sip => "SIP", + Self::Agent => "AGENT", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for participant_info::Kind { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "STANDARD", + "INGRESS", + "EGRESS", + "SIP", + "AGENT", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = participant_info::Kind; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "STANDARD" => Ok(participant_info::Kind::Standard), + "INGRESS" => Ok(participant_info::Kind::Ingress), + "EGRESS" => Ok(participant_info::Kind::Egress), + "SIP" => Ok(participant_info::Kind::Sip), + "AGENT" => Ok(participant_info::Kind::Agent), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +impl serde::Serialize for participant_info::State { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::Joining => "JOINING", + Self::Joined => "JOINED", + Self::Active => "ACTIVE", + Self::Disconnected => "DISCONNECTED", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for participant_info::State { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "JOINING", + "JOINED", + "ACTIVE", + "DISCONNECTED", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = participant_info::State; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "JOINING" => Ok(participant_info::State::Joining), + "JOINED" => Ok(participant_info::State::Joined), + "ACTIVE" => Ok(participant_info::State::Active), + "DISCONNECTED" => Ok(participant_info::State::Disconnected), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +impl serde::Serialize for ParticipantPermission { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.can_subscribe { + len += 1; + } + if self.can_publish { + len += 1; + } + if self.can_publish_data { + len += 1; + } + if !self.can_publish_sources.is_empty() { + len += 1; + } + if self.hidden { + len += 1; + } + if self.recorder { + len += 1; + } + if self.can_update_metadata { + len += 1; + } + if self.agent { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.ParticipantPermission", len)?; + if self.can_subscribe { + struct_ser.serialize_field("canSubscribe", &self.can_subscribe)?; + } + if self.can_publish { + struct_ser.serialize_field("canPublish", &self.can_publish)?; + } + if self.can_publish_data { + struct_ser.serialize_field("canPublishData", &self.can_publish_data)?; + } + if !self.can_publish_sources.is_empty() { + let v = self.can_publish_sources.iter().cloned().map(|v| { + TrackSource::try_from(v) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", v))) + }).collect::, _>>()?; + struct_ser.serialize_field("canPublishSources", &v)?; + } + if self.hidden { + struct_ser.serialize_field("hidden", &self.hidden)?; + } + if self.recorder { + struct_ser.serialize_field("recorder", &self.recorder)?; + } + if self.can_update_metadata { + struct_ser.serialize_field("canUpdateMetadata", &self.can_update_metadata)?; + } + if self.agent { + struct_ser.serialize_field("agent", &self.agent)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ParticipantPermission { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "can_subscribe", + "canSubscribe", + "can_publish", + "canPublish", + "can_publish_data", + "canPublishData", + "can_publish_sources", + "canPublishSources", + "hidden", + "recorder", + "can_update_metadata", + "canUpdateMetadata", + "agent", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + CanSubscribe, + CanPublish, + CanPublishData, + CanPublishSources, + Hidden, + Recorder, + CanUpdateMetadata, + Agent, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "canSubscribe" | "can_subscribe" => Ok(GeneratedField::CanSubscribe), + "canPublish" | "can_publish" => Ok(GeneratedField::CanPublish), + "canPublishData" | "can_publish_data" => Ok(GeneratedField::CanPublishData), + "canPublishSources" | "can_publish_sources" => Ok(GeneratedField::CanPublishSources), + "hidden" => Ok(GeneratedField::Hidden), + "recorder" => Ok(GeneratedField::Recorder), + "canUpdateMetadata" | "can_update_metadata" => Ok(GeneratedField::CanUpdateMetadata), + "agent" => Ok(GeneratedField::Agent), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ParticipantPermission; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.ParticipantPermission") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut can_subscribe__ = None; + let mut can_publish__ = None; + let mut can_publish_data__ = None; + let mut can_publish_sources__ = None; + let mut hidden__ = None; + let mut recorder__ = None; + let mut can_update_metadata__ = None; + let mut agent__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::CanSubscribe => { + if can_subscribe__.is_some() { + return Err(serde::de::Error::duplicate_field("canSubscribe")); + } + can_subscribe__ = Some(map_.next_value()?); + } + GeneratedField::CanPublish => { + if can_publish__.is_some() { + return Err(serde::de::Error::duplicate_field("canPublish")); + } + can_publish__ = Some(map_.next_value()?); + } + GeneratedField::CanPublishData => { + if can_publish_data__.is_some() { + return Err(serde::de::Error::duplicate_field("canPublishData")); + } + can_publish_data__ = Some(map_.next_value()?); + } + GeneratedField::CanPublishSources => { + if can_publish_sources__.is_some() { + return Err(serde::de::Error::duplicate_field("canPublishSources")); + } + can_publish_sources__ = Some(map_.next_value::>()?.into_iter().map(|x| x as i32).collect()); + } + GeneratedField::Hidden => { + if hidden__.is_some() { + return Err(serde::de::Error::duplicate_field("hidden")); + } + hidden__ = Some(map_.next_value()?); + } + GeneratedField::Recorder => { + if recorder__.is_some() { + return Err(serde::de::Error::duplicate_field("recorder")); + } + recorder__ = Some(map_.next_value()?); + } + GeneratedField::CanUpdateMetadata => { + if can_update_metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("canUpdateMetadata")); + } + can_update_metadata__ = Some(map_.next_value()?); + } + GeneratedField::Agent => { + if agent__.is_some() { + return Err(serde::de::Error::duplicate_field("agent")); + } + agent__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ParticipantPermission { + can_subscribe: can_subscribe__.unwrap_or_default(), + can_publish: can_publish__.unwrap_or_default(), + can_publish_data: can_publish_data__.unwrap_or_default(), + can_publish_sources: can_publish_sources__.unwrap_or_default(), + hidden: hidden__.unwrap_or_default(), + recorder: recorder__.unwrap_or_default(), + can_update_metadata: can_update_metadata__.unwrap_or_default(), + agent: agent__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.ParticipantPermission", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ParticipantTracks { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.participant_sid.is_empty() { + len += 1; + } + if !self.track_sids.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.ParticipantTracks", len)?; + if !self.participant_sid.is_empty() { + struct_ser.serialize_field("participantSid", &self.participant_sid)?; + } + if !self.track_sids.is_empty() { + struct_ser.serialize_field("trackSids", &self.track_sids)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ParticipantTracks { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "participant_sid", + "participantSid", + "track_sids", + "trackSids", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + ParticipantSid, + TrackSids, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "participantSid" | "participant_sid" => Ok(GeneratedField::ParticipantSid), + "trackSids" | "track_sids" => Ok(GeneratedField::TrackSids), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ParticipantTracks; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.ParticipantTracks") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut participant_sid__ = None; + let mut track_sids__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::ParticipantSid => { + if participant_sid__.is_some() { + return Err(serde::de::Error::duplicate_field("participantSid")); + } + participant_sid__ = Some(map_.next_value()?); + } + GeneratedField::TrackSids => { + if track_sids__.is_some() { + return Err(serde::de::Error::duplicate_field("trackSids")); + } + track_sids__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ParticipantTracks { + participant_sid: participant_sid__.unwrap_or_default(), + track_sids: track_sids__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.ParticipantTracks", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ParticipantUpdate { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.participants.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.ParticipantUpdate", len)?; + if !self.participants.is_empty() { + struct_ser.serialize_field("participants", &self.participants)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ParticipantUpdate { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "participants", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Participants, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "participants" => Ok(GeneratedField::Participants), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ParticipantUpdate; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.ParticipantUpdate") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut participants__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Participants => { + if participants__.is_some() { + return Err(serde::de::Error::duplicate_field("participants")); + } + participants__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ParticipantUpdate { + participants: participants__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.ParticipantUpdate", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for Ping { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.timestamp != 0 { + len += 1; + } + if self.rtt != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.Ping", len)?; + if self.timestamp != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?; + } + if self.rtt != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("rtt", ToString::to_string(&self.rtt).as_str())?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for Ping { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "timestamp", + "rtt", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Timestamp, + Rtt, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "timestamp" => Ok(GeneratedField::Timestamp), + "rtt" => Ok(GeneratedField::Rtt), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Ping; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.Ping") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut timestamp__ = None; + let mut rtt__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Timestamp => { + if timestamp__.is_some() { + return Err(serde::de::Error::duplicate_field("timestamp")); + } + timestamp__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Rtt => { + if rtt__.is_some() { + return Err(serde::de::Error::duplicate_field("rtt")); + } + rtt__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(Ping { + timestamp: timestamp__.unwrap_or_default(), + rtt: rtt__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.Ping", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for PlayoutDelay { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.enabled { + len += 1; + } + if self.min != 0 { + len += 1; + } + if self.max != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.PlayoutDelay", len)?; + if self.enabled { + struct_ser.serialize_field("enabled", &self.enabled)?; + } + if self.min != 0 { + struct_ser.serialize_field("min", &self.min)?; + } + if self.max != 0 { + struct_ser.serialize_field("max", &self.max)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for PlayoutDelay { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "enabled", + "min", + "max", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Enabled, + Min, + Max, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "enabled" => Ok(GeneratedField::Enabled), + "min" => Ok(GeneratedField::Min), + "max" => Ok(GeneratedField::Max), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = PlayoutDelay; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.PlayoutDelay") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut enabled__ = None; + let mut min__ = None; + let mut max__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Enabled => { + if enabled__.is_some() { + return Err(serde::de::Error::duplicate_field("enabled")); + } + enabled__ = Some(map_.next_value()?); + } + GeneratedField::Min => { + if min__.is_some() { + return Err(serde::de::Error::duplicate_field("min")); + } + min__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Max => { + if max__.is_some() { + return Err(serde::de::Error::duplicate_field("max")); + } + max__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(PlayoutDelay { + enabled: enabled__.unwrap_or_default(), + min: min__.unwrap_or_default(), + max: max__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.PlayoutDelay", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for Pong { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.last_ping_timestamp != 0 { + len += 1; + } + if self.timestamp != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.Pong", len)?; + if self.last_ping_timestamp != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("lastPingTimestamp", ToString::to_string(&self.last_ping_timestamp).as_str())?; + } + if self.timestamp != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("timestamp", ToString::to_string(&self.timestamp).as_str())?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for Pong { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "last_ping_timestamp", + "lastPingTimestamp", + "timestamp", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + LastPingTimestamp, + Timestamp, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "lastPingTimestamp" | "last_ping_timestamp" => Ok(GeneratedField::LastPingTimestamp), + "timestamp" => Ok(GeneratedField::Timestamp), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Pong; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.Pong") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut last_ping_timestamp__ = None; + let mut timestamp__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::LastPingTimestamp => { + if last_ping_timestamp__.is_some() { + return Err(serde::de::Error::duplicate_field("lastPingTimestamp")); + } + last_ping_timestamp__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Timestamp => { + if timestamp__.is_some() { + return Err(serde::de::Error::duplicate_field("timestamp")); + } + timestamp__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(Pong { + last_ping_timestamp: last_ping_timestamp__.unwrap_or_default(), + timestamp: timestamp__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.Pong", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ProxyConfig { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.url.is_empty() { + len += 1; + } + if !self.username.is_empty() { + len += 1; + } + if !self.password.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.ProxyConfig", len)?; + if !self.url.is_empty() { + struct_ser.serialize_field("url", &self.url)?; + } + if !self.username.is_empty() { + struct_ser.serialize_field("username", &self.username)?; + } + if !self.password.is_empty() { + struct_ser.serialize_field("password", &self.password)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ProxyConfig { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "url", + "username", + "password", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Url, + Username, + Password, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "url" => Ok(GeneratedField::Url), + "username" => Ok(GeneratedField::Username), + "password" => Ok(GeneratedField::Password), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ProxyConfig; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.ProxyConfig") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut url__ = None; + let mut username__ = None; + let mut password__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Url => { + if url__.is_some() { + return Err(serde::de::Error::duplicate_field("url")); + } + url__ = Some(map_.next_value()?); + } + GeneratedField::Username => { + if username__.is_some() { + return Err(serde::de::Error::duplicate_field("username")); + } + username__ = Some(map_.next_value()?); + } + GeneratedField::Password => { + if password__.is_some() { + return Err(serde::de::Error::duplicate_field("password")); + } + password__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ProxyConfig { + url: url__.unwrap_or_default(), + username: username__.unwrap_or_default(), + password: password__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.ProxyConfig", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for RtpDrift { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.start_time.is_some() { + len += 1; + } + if self.end_time.is_some() { + len += 1; + } + if self.duration != 0. { + len += 1; + } + if self.start_timestamp != 0 { + len += 1; + } + if self.end_timestamp != 0 { + len += 1; + } + if self.rtp_clock_ticks != 0 { + len += 1; + } + if self.drift_samples != 0 { + len += 1; + } + if self.drift_ms != 0. { + len += 1; + } + if self.clock_rate != 0. { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.RTPDrift", len)?; + if let Some(v) = self.start_time.as_ref() { + struct_ser.serialize_field("startTime", v)?; + } + if let Some(v) = self.end_time.as_ref() { + struct_ser.serialize_field("endTime", v)?; + } + if self.duration != 0. { + struct_ser.serialize_field("duration", &self.duration)?; + } + if self.start_timestamp != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("startTimestamp", ToString::to_string(&self.start_timestamp).as_str())?; + } + if self.end_timestamp != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("endTimestamp", ToString::to_string(&self.end_timestamp).as_str())?; + } + if self.rtp_clock_ticks != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("rtpClockTicks", ToString::to_string(&self.rtp_clock_ticks).as_str())?; + } + if self.drift_samples != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("driftSamples", ToString::to_string(&self.drift_samples).as_str())?; + } + if self.drift_ms != 0. { + struct_ser.serialize_field("driftMs", &self.drift_ms)?; + } + if self.clock_rate != 0. { + struct_ser.serialize_field("clockRate", &self.clock_rate)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for RtpDrift { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "start_time", + "startTime", + "end_time", + "endTime", + "duration", + "start_timestamp", + "startTimestamp", + "end_timestamp", + "endTimestamp", + "rtp_clock_ticks", + "rtpClockTicks", + "drift_samples", + "driftSamples", + "drift_ms", + "driftMs", + "clock_rate", + "clockRate", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + StartTime, + EndTime, + Duration, + StartTimestamp, + EndTimestamp, + RtpClockTicks, + DriftSamples, + DriftMs, + ClockRate, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "startTime" | "start_time" => Ok(GeneratedField::StartTime), + "endTime" | "end_time" => Ok(GeneratedField::EndTime), + "duration" => Ok(GeneratedField::Duration), + "startTimestamp" | "start_timestamp" => Ok(GeneratedField::StartTimestamp), + "endTimestamp" | "end_timestamp" => Ok(GeneratedField::EndTimestamp), + "rtpClockTicks" | "rtp_clock_ticks" => Ok(GeneratedField::RtpClockTicks), + "driftSamples" | "drift_samples" => Ok(GeneratedField::DriftSamples), + "driftMs" | "drift_ms" => Ok(GeneratedField::DriftMs), + "clockRate" | "clock_rate" => Ok(GeneratedField::ClockRate), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = RtpDrift; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.RTPDrift") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut start_time__ = None; + let mut end_time__ = None; + let mut duration__ = None; + let mut start_timestamp__ = None; + let mut end_timestamp__ = None; + let mut rtp_clock_ticks__ = None; + let mut drift_samples__ = None; + let mut drift_ms__ = None; + let mut clock_rate__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::StartTime => { + if start_time__.is_some() { + return Err(serde::de::Error::duplicate_field("startTime")); + } + start_time__ = map_.next_value()?; + } + GeneratedField::EndTime => { + if end_time__.is_some() { + return Err(serde::de::Error::duplicate_field("endTime")); + } + end_time__ = map_.next_value()?; + } + GeneratedField::Duration => { + if duration__.is_some() { + return Err(serde::de::Error::duplicate_field("duration")); + } + duration__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::StartTimestamp => { + if start_timestamp__.is_some() { + return Err(serde::de::Error::duplicate_field("startTimestamp")); + } + start_timestamp__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::EndTimestamp => { + if end_timestamp__.is_some() { + return Err(serde::de::Error::duplicate_field("endTimestamp")); + } + end_timestamp__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::RtpClockTicks => { + if rtp_clock_ticks__.is_some() { + return Err(serde::de::Error::duplicate_field("rtpClockTicks")); + } + rtp_clock_ticks__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::DriftSamples => { + if drift_samples__.is_some() { + return Err(serde::de::Error::duplicate_field("driftSamples")); + } + drift_samples__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::DriftMs => { + if drift_ms__.is_some() { + return Err(serde::de::Error::duplicate_field("driftMs")); + } + drift_ms__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::ClockRate => { + if clock_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("clockRate")); + } + clock_rate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(RtpDrift { + start_time: start_time__, + end_time: end_time__, + duration: duration__.unwrap_or_default(), + start_timestamp: start_timestamp__.unwrap_or_default(), + end_timestamp: end_timestamp__.unwrap_or_default(), + rtp_clock_ticks: rtp_clock_ticks__.unwrap_or_default(), + drift_samples: drift_samples__.unwrap_or_default(), + drift_ms: drift_ms__.unwrap_or_default(), + clock_rate: clock_rate__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.RTPDrift", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for RtpStats { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.start_time.is_some() { + len += 1; + } + if self.end_time.is_some() { + len += 1; + } + if self.duration != 0. { + len += 1; + } + if self.packets != 0 { + len += 1; + } + if self.packet_rate != 0. { + len += 1; + } + if self.bytes != 0 { + len += 1; + } + if self.header_bytes != 0 { + len += 1; + } + if self.bitrate != 0. { + len += 1; + } + if self.packets_lost != 0 { + len += 1; + } + if self.packet_loss_rate != 0. { + len += 1; + } + if self.packet_loss_percentage != 0. { + len += 1; + } + if self.packets_duplicate != 0 { + len += 1; + } + if self.packet_duplicate_rate != 0. { + len += 1; + } + if self.bytes_duplicate != 0 { + len += 1; + } + if self.header_bytes_duplicate != 0 { + len += 1; + } + if self.bitrate_duplicate != 0. { + len += 1; + } + if self.packets_padding != 0 { + len += 1; + } + if self.packet_padding_rate != 0. { + len += 1; + } + if self.bytes_padding != 0 { + len += 1; + } + if self.header_bytes_padding != 0 { + len += 1; + } + if self.bitrate_padding != 0. { + len += 1; + } + if self.packets_out_of_order != 0 { + len += 1; + } + if self.frames != 0 { + len += 1; + } + if self.frame_rate != 0. { + len += 1; + } + if self.jitter_current != 0. { + len += 1; + } + if self.jitter_max != 0. { + len += 1; + } + if !self.gap_histogram.is_empty() { + len += 1; + } + if self.nacks != 0 { + len += 1; + } + if self.nack_acks != 0 { + len += 1; + } + if self.nack_misses != 0 { + len += 1; + } + if self.nack_repeated != 0 { + len += 1; + } + if self.plis != 0 { + len += 1; + } + if self.last_pli.is_some() { + len += 1; + } + if self.firs != 0 { + len += 1; + } + if self.last_fir.is_some() { + len += 1; + } + if self.rtt_current != 0 { + len += 1; + } + if self.rtt_max != 0 { + len += 1; + } + if self.key_frames != 0 { + len += 1; + } + if self.last_key_frame.is_some() { + len += 1; + } + if self.layer_lock_plis != 0 { + len += 1; + } + if self.last_layer_lock_pli.is_some() { + len += 1; + } + if self.packet_drift.is_some() { + len += 1; + } + if self.report_drift.is_some() { + len += 1; + } + if self.rebased_report_drift.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.RTPStats", len)?; + if let Some(v) = self.start_time.as_ref() { + struct_ser.serialize_field("startTime", v)?; + } + if let Some(v) = self.end_time.as_ref() { + struct_ser.serialize_field("endTime", v)?; + } + if self.duration != 0. { + struct_ser.serialize_field("duration", &self.duration)?; + } + if self.packets != 0 { + struct_ser.serialize_field("packets", &self.packets)?; + } + if self.packet_rate != 0. { + struct_ser.serialize_field("packetRate", &self.packet_rate)?; + } + if self.bytes != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("bytes", ToString::to_string(&self.bytes).as_str())?; + } + if self.header_bytes != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("headerBytes", ToString::to_string(&self.header_bytes).as_str())?; + } + if self.bitrate != 0. { + struct_ser.serialize_field("bitrate", &self.bitrate)?; + } + if self.packets_lost != 0 { + struct_ser.serialize_field("packetsLost", &self.packets_lost)?; + } + if self.packet_loss_rate != 0. { + struct_ser.serialize_field("packetLossRate", &self.packet_loss_rate)?; + } + if self.packet_loss_percentage != 0. { + struct_ser.serialize_field("packetLossPercentage", &self.packet_loss_percentage)?; + } + if self.packets_duplicate != 0 { + struct_ser.serialize_field("packetsDuplicate", &self.packets_duplicate)?; + } + if self.packet_duplicate_rate != 0. { + struct_ser.serialize_field("packetDuplicateRate", &self.packet_duplicate_rate)?; + } + if self.bytes_duplicate != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("bytesDuplicate", ToString::to_string(&self.bytes_duplicate).as_str())?; + } + if self.header_bytes_duplicate != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("headerBytesDuplicate", ToString::to_string(&self.header_bytes_duplicate).as_str())?; + } + if self.bitrate_duplicate != 0. { + struct_ser.serialize_field("bitrateDuplicate", &self.bitrate_duplicate)?; + } + if self.packets_padding != 0 { + struct_ser.serialize_field("packetsPadding", &self.packets_padding)?; + } + if self.packet_padding_rate != 0. { + struct_ser.serialize_field("packetPaddingRate", &self.packet_padding_rate)?; + } + if self.bytes_padding != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("bytesPadding", ToString::to_string(&self.bytes_padding).as_str())?; + } + if self.header_bytes_padding != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("headerBytesPadding", ToString::to_string(&self.header_bytes_padding).as_str())?; + } + if self.bitrate_padding != 0. { + struct_ser.serialize_field("bitratePadding", &self.bitrate_padding)?; + } + if self.packets_out_of_order != 0 { + struct_ser.serialize_field("packetsOutOfOrder", &self.packets_out_of_order)?; + } + if self.frames != 0 { + struct_ser.serialize_field("frames", &self.frames)?; + } + if self.frame_rate != 0. { + struct_ser.serialize_field("frameRate", &self.frame_rate)?; + } + if self.jitter_current != 0. { + struct_ser.serialize_field("jitterCurrent", &self.jitter_current)?; + } + if self.jitter_max != 0. { + struct_ser.serialize_field("jitterMax", &self.jitter_max)?; + } + if !self.gap_histogram.is_empty() { + struct_ser.serialize_field("gapHistogram", &self.gap_histogram)?; + } + if self.nacks != 0 { + struct_ser.serialize_field("nacks", &self.nacks)?; + } + if self.nack_acks != 0 { + struct_ser.serialize_field("nackAcks", &self.nack_acks)?; + } + if self.nack_misses != 0 { + struct_ser.serialize_field("nackMisses", &self.nack_misses)?; + } + if self.nack_repeated != 0 { + struct_ser.serialize_field("nackRepeated", &self.nack_repeated)?; + } + if self.plis != 0 { + struct_ser.serialize_field("plis", &self.plis)?; + } + if let Some(v) = self.last_pli.as_ref() { + struct_ser.serialize_field("lastPli", v)?; + } + if self.firs != 0 { + struct_ser.serialize_field("firs", &self.firs)?; + } + if let Some(v) = self.last_fir.as_ref() { + struct_ser.serialize_field("lastFir", v)?; + } + if self.rtt_current != 0 { + struct_ser.serialize_field("rttCurrent", &self.rtt_current)?; + } + if self.rtt_max != 0 { + struct_ser.serialize_field("rttMax", &self.rtt_max)?; + } + if self.key_frames != 0 { + struct_ser.serialize_field("keyFrames", &self.key_frames)?; + } + if let Some(v) = self.last_key_frame.as_ref() { + struct_ser.serialize_field("lastKeyFrame", v)?; + } + if self.layer_lock_plis != 0 { + struct_ser.serialize_field("layerLockPlis", &self.layer_lock_plis)?; + } + if let Some(v) = self.last_layer_lock_pli.as_ref() { + struct_ser.serialize_field("lastLayerLockPli", v)?; + } + if let Some(v) = self.packet_drift.as_ref() { + struct_ser.serialize_field("packetDrift", v)?; + } + if let Some(v) = self.report_drift.as_ref() { + struct_ser.serialize_field("reportDrift", v)?; + } + if let Some(v) = self.rebased_report_drift.as_ref() { + struct_ser.serialize_field("rebasedReportDrift", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for RtpStats { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "start_time", + "startTime", + "end_time", + "endTime", + "duration", + "packets", + "packet_rate", + "packetRate", + "bytes", + "header_bytes", + "headerBytes", + "bitrate", + "packets_lost", + "packetsLost", + "packet_loss_rate", + "packetLossRate", + "packet_loss_percentage", + "packetLossPercentage", + "packets_duplicate", + "packetsDuplicate", + "packet_duplicate_rate", + "packetDuplicateRate", + "bytes_duplicate", + "bytesDuplicate", + "header_bytes_duplicate", + "headerBytesDuplicate", + "bitrate_duplicate", + "bitrateDuplicate", + "packets_padding", + "packetsPadding", + "packet_padding_rate", + "packetPaddingRate", + "bytes_padding", + "bytesPadding", + "header_bytes_padding", + "headerBytesPadding", + "bitrate_padding", + "bitratePadding", + "packets_out_of_order", + "packetsOutOfOrder", + "frames", + "frame_rate", + "frameRate", + "jitter_current", + "jitterCurrent", + "jitter_max", + "jitterMax", + "gap_histogram", + "gapHistogram", + "nacks", + "nack_acks", + "nackAcks", + "nack_misses", + "nackMisses", + "nack_repeated", + "nackRepeated", + "plis", + "last_pli", + "lastPli", + "firs", + "last_fir", + "lastFir", + "rtt_current", + "rttCurrent", + "rtt_max", + "rttMax", + "key_frames", + "keyFrames", + "last_key_frame", + "lastKeyFrame", + "layer_lock_plis", + "layerLockPlis", + "last_layer_lock_pli", + "lastLayerLockPli", + "packet_drift", + "packetDrift", + "report_drift", + "reportDrift", + "rebased_report_drift", + "rebasedReportDrift", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + StartTime, + EndTime, + Duration, + Packets, + PacketRate, + Bytes, + HeaderBytes, + Bitrate, + PacketsLost, + PacketLossRate, + PacketLossPercentage, + PacketsDuplicate, + PacketDuplicateRate, + BytesDuplicate, + HeaderBytesDuplicate, + BitrateDuplicate, + PacketsPadding, + PacketPaddingRate, + BytesPadding, + HeaderBytesPadding, + BitratePadding, + PacketsOutOfOrder, + Frames, + FrameRate, + JitterCurrent, + JitterMax, + GapHistogram, + Nacks, + NackAcks, + NackMisses, + NackRepeated, + Plis, + LastPli, + Firs, + LastFir, + RttCurrent, + RttMax, + KeyFrames, + LastKeyFrame, + LayerLockPlis, + LastLayerLockPli, + PacketDrift, + ReportDrift, + RebasedReportDrift, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "startTime" | "start_time" => Ok(GeneratedField::StartTime), + "endTime" | "end_time" => Ok(GeneratedField::EndTime), + "duration" => Ok(GeneratedField::Duration), + "packets" => Ok(GeneratedField::Packets), + "packetRate" | "packet_rate" => Ok(GeneratedField::PacketRate), + "bytes" => Ok(GeneratedField::Bytes), + "headerBytes" | "header_bytes" => Ok(GeneratedField::HeaderBytes), + "bitrate" => Ok(GeneratedField::Bitrate), + "packetsLost" | "packets_lost" => Ok(GeneratedField::PacketsLost), + "packetLossRate" | "packet_loss_rate" => Ok(GeneratedField::PacketLossRate), + "packetLossPercentage" | "packet_loss_percentage" => Ok(GeneratedField::PacketLossPercentage), + "packetsDuplicate" | "packets_duplicate" => Ok(GeneratedField::PacketsDuplicate), + "packetDuplicateRate" | "packet_duplicate_rate" => Ok(GeneratedField::PacketDuplicateRate), + "bytesDuplicate" | "bytes_duplicate" => Ok(GeneratedField::BytesDuplicate), + "headerBytesDuplicate" | "header_bytes_duplicate" => Ok(GeneratedField::HeaderBytesDuplicate), + "bitrateDuplicate" | "bitrate_duplicate" => Ok(GeneratedField::BitrateDuplicate), + "packetsPadding" | "packets_padding" => Ok(GeneratedField::PacketsPadding), + "packetPaddingRate" | "packet_padding_rate" => Ok(GeneratedField::PacketPaddingRate), + "bytesPadding" | "bytes_padding" => Ok(GeneratedField::BytesPadding), + "headerBytesPadding" | "header_bytes_padding" => Ok(GeneratedField::HeaderBytesPadding), + "bitratePadding" | "bitrate_padding" => Ok(GeneratedField::BitratePadding), + "packetsOutOfOrder" | "packets_out_of_order" => Ok(GeneratedField::PacketsOutOfOrder), + "frames" => Ok(GeneratedField::Frames), + "frameRate" | "frame_rate" => Ok(GeneratedField::FrameRate), + "jitterCurrent" | "jitter_current" => Ok(GeneratedField::JitterCurrent), + "jitterMax" | "jitter_max" => Ok(GeneratedField::JitterMax), + "gapHistogram" | "gap_histogram" => Ok(GeneratedField::GapHistogram), + "nacks" => Ok(GeneratedField::Nacks), + "nackAcks" | "nack_acks" => Ok(GeneratedField::NackAcks), + "nackMisses" | "nack_misses" => Ok(GeneratedField::NackMisses), + "nackRepeated" | "nack_repeated" => Ok(GeneratedField::NackRepeated), + "plis" => Ok(GeneratedField::Plis), + "lastPli" | "last_pli" => Ok(GeneratedField::LastPli), + "firs" => Ok(GeneratedField::Firs), + "lastFir" | "last_fir" => Ok(GeneratedField::LastFir), + "rttCurrent" | "rtt_current" => Ok(GeneratedField::RttCurrent), + "rttMax" | "rtt_max" => Ok(GeneratedField::RttMax), + "keyFrames" | "key_frames" => Ok(GeneratedField::KeyFrames), + "lastKeyFrame" | "last_key_frame" => Ok(GeneratedField::LastKeyFrame), + "layerLockPlis" | "layer_lock_plis" => Ok(GeneratedField::LayerLockPlis), + "lastLayerLockPli" | "last_layer_lock_pli" => Ok(GeneratedField::LastLayerLockPli), + "packetDrift" | "packet_drift" => Ok(GeneratedField::PacketDrift), + "reportDrift" | "report_drift" => Ok(GeneratedField::ReportDrift), + "rebasedReportDrift" | "rebased_report_drift" => Ok(GeneratedField::RebasedReportDrift), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = RtpStats; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.RTPStats") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut start_time__ = None; + let mut end_time__ = None; + let mut duration__ = None; + let mut packets__ = None; + let mut packet_rate__ = None; + let mut bytes__ = None; + let mut header_bytes__ = None; + let mut bitrate__ = None; + let mut packets_lost__ = None; + let mut packet_loss_rate__ = None; + let mut packet_loss_percentage__ = None; + let mut packets_duplicate__ = None; + let mut packet_duplicate_rate__ = None; + let mut bytes_duplicate__ = None; + let mut header_bytes_duplicate__ = None; + let mut bitrate_duplicate__ = None; + let mut packets_padding__ = None; + let mut packet_padding_rate__ = None; + let mut bytes_padding__ = None; + let mut header_bytes_padding__ = None; + let mut bitrate_padding__ = None; + let mut packets_out_of_order__ = None; + let mut frames__ = None; + let mut frame_rate__ = None; + let mut jitter_current__ = None; + let mut jitter_max__ = None; + let mut gap_histogram__ = None; + let mut nacks__ = None; + let mut nack_acks__ = None; + let mut nack_misses__ = None; + let mut nack_repeated__ = None; + let mut plis__ = None; + let mut last_pli__ = None; + let mut firs__ = None; + let mut last_fir__ = None; + let mut rtt_current__ = None; + let mut rtt_max__ = None; + let mut key_frames__ = None; + let mut last_key_frame__ = None; + let mut layer_lock_plis__ = None; + let mut last_layer_lock_pli__ = None; + let mut packet_drift__ = None; + let mut report_drift__ = None; + let mut rebased_report_drift__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::StartTime => { + if start_time__.is_some() { + return Err(serde::de::Error::duplicate_field("startTime")); + } + start_time__ = map_.next_value()?; + } + GeneratedField::EndTime => { + if end_time__.is_some() { + return Err(serde::de::Error::duplicate_field("endTime")); + } + end_time__ = map_.next_value()?; + } + GeneratedField::Duration => { + if duration__.is_some() { + return Err(serde::de::Error::duplicate_field("duration")); + } + duration__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Packets => { + if packets__.is_some() { + return Err(serde::de::Error::duplicate_field("packets")); + } + packets__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PacketRate => { + if packet_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("packetRate")); + } + packet_rate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Bytes => { + if bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("bytes")); + } + bytes__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::HeaderBytes => { + if header_bytes__.is_some() { + return Err(serde::de::Error::duplicate_field("headerBytes")); + } + header_bytes__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Bitrate => { + if bitrate__.is_some() { + return Err(serde::de::Error::duplicate_field("bitrate")); + } + bitrate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PacketsLost => { + if packets_lost__.is_some() { + return Err(serde::de::Error::duplicate_field("packetsLost")); + } + packets_lost__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PacketLossRate => { + if packet_loss_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("packetLossRate")); + } + packet_loss_rate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PacketLossPercentage => { + if packet_loss_percentage__.is_some() { + return Err(serde::de::Error::duplicate_field("packetLossPercentage")); + } + packet_loss_percentage__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PacketsDuplicate => { + if packets_duplicate__.is_some() { + return Err(serde::de::Error::duplicate_field("packetsDuplicate")); + } + packets_duplicate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PacketDuplicateRate => { + if packet_duplicate_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("packetDuplicateRate")); + } + packet_duplicate_rate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::BytesDuplicate => { + if bytes_duplicate__.is_some() { + return Err(serde::de::Error::duplicate_field("bytesDuplicate")); + } + bytes_duplicate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::HeaderBytesDuplicate => { + if header_bytes_duplicate__.is_some() { + return Err(serde::de::Error::duplicate_field("headerBytesDuplicate")); + } + header_bytes_duplicate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::BitrateDuplicate => { + if bitrate_duplicate__.is_some() { + return Err(serde::de::Error::duplicate_field("bitrateDuplicate")); + } + bitrate_duplicate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PacketsPadding => { + if packets_padding__.is_some() { + return Err(serde::de::Error::duplicate_field("packetsPadding")); + } + packets_padding__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PacketPaddingRate => { + if packet_padding_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("packetPaddingRate")); + } + packet_padding_rate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::BytesPadding => { + if bytes_padding__.is_some() { + return Err(serde::de::Error::duplicate_field("bytesPadding")); + } + bytes_padding__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::HeaderBytesPadding => { + if header_bytes_padding__.is_some() { + return Err(serde::de::Error::duplicate_field("headerBytesPadding")); + } + header_bytes_padding__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::BitratePadding => { + if bitrate_padding__.is_some() { + return Err(serde::de::Error::duplicate_field("bitratePadding")); + } + bitrate_padding__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::PacketsOutOfOrder => { + if packets_out_of_order__.is_some() { + return Err(serde::de::Error::duplicate_field("packetsOutOfOrder")); + } + packets_out_of_order__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Frames => { + if frames__.is_some() { + return Err(serde::de::Error::duplicate_field("frames")); + } + frames__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::FrameRate => { + if frame_rate__.is_some() { + return Err(serde::de::Error::duplicate_field("frameRate")); + } + frame_rate__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::JitterCurrent => { + if jitter_current__.is_some() { + return Err(serde::de::Error::duplicate_field("jitterCurrent")); + } + jitter_current__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::JitterMax => { + if jitter_max__.is_some() { + return Err(serde::de::Error::duplicate_field("jitterMax")); + } + jitter_max__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::GapHistogram => { + if gap_histogram__.is_some() { + return Err(serde::de::Error::duplicate_field("gapHistogram")); + } + gap_histogram__ = Some( + map_.next_value::, ::pbjson::private::NumberDeserialize>>()? + .into_iter().map(|(k,v)| (k.0, v.0)).collect() + ); + } + GeneratedField::Nacks => { + if nacks__.is_some() { + return Err(serde::de::Error::duplicate_field("nacks")); + } + nacks__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::NackAcks => { + if nack_acks__.is_some() { + return Err(serde::de::Error::duplicate_field("nackAcks")); + } + nack_acks__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::NackMisses => { + if nack_misses__.is_some() { + return Err(serde::de::Error::duplicate_field("nackMisses")); + } + nack_misses__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::NackRepeated => { + if nack_repeated__.is_some() { + return Err(serde::de::Error::duplicate_field("nackRepeated")); + } + nack_repeated__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Plis => { + if plis__.is_some() { + return Err(serde::de::Error::duplicate_field("plis")); + } + plis__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::LastPli => { + if last_pli__.is_some() { + return Err(serde::de::Error::duplicate_field("lastPli")); + } + last_pli__ = map_.next_value()?; + } + GeneratedField::Firs => { + if firs__.is_some() { + return Err(serde::de::Error::duplicate_field("firs")); + } + firs__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::LastFir => { + if last_fir__.is_some() { + return Err(serde::de::Error::duplicate_field("lastFir")); + } + last_fir__ = map_.next_value()?; + } + GeneratedField::RttCurrent => { + if rtt_current__.is_some() { + return Err(serde::de::Error::duplicate_field("rttCurrent")); + } + rtt_current__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::RttMax => { + if rtt_max__.is_some() { + return Err(serde::de::Error::duplicate_field("rttMax")); + } + rtt_max__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::KeyFrames => { + if key_frames__.is_some() { + return Err(serde::de::Error::duplicate_field("keyFrames")); + } + key_frames__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::LastKeyFrame => { + if last_key_frame__.is_some() { + return Err(serde::de::Error::duplicate_field("lastKeyFrame")); + } + last_key_frame__ = map_.next_value()?; + } + GeneratedField::LayerLockPlis => { + if layer_lock_plis__.is_some() { + return Err(serde::de::Error::duplicate_field("layerLockPlis")); + } + layer_lock_plis__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::LastLayerLockPli => { + if last_layer_lock_pli__.is_some() { + return Err(serde::de::Error::duplicate_field("lastLayerLockPli")); + } + last_layer_lock_pli__ = map_.next_value()?; + } + GeneratedField::PacketDrift => { + if packet_drift__.is_some() { + return Err(serde::de::Error::duplicate_field("packetDrift")); + } + packet_drift__ = map_.next_value()?; + } + GeneratedField::ReportDrift => { + if report_drift__.is_some() { + return Err(serde::de::Error::duplicate_field("reportDrift")); + } + report_drift__ = map_.next_value()?; + } + GeneratedField::RebasedReportDrift => { + if rebased_report_drift__.is_some() { + return Err(serde::de::Error::duplicate_field("rebasedReportDrift")); + } + rebased_report_drift__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(RtpStats { + start_time: start_time__, + end_time: end_time__, + duration: duration__.unwrap_or_default(), + packets: packets__.unwrap_or_default(), + packet_rate: packet_rate__.unwrap_or_default(), + bytes: bytes__.unwrap_or_default(), + header_bytes: header_bytes__.unwrap_or_default(), + bitrate: bitrate__.unwrap_or_default(), + packets_lost: packets_lost__.unwrap_or_default(), + packet_loss_rate: packet_loss_rate__.unwrap_or_default(), + packet_loss_percentage: packet_loss_percentage__.unwrap_or_default(), + packets_duplicate: packets_duplicate__.unwrap_or_default(), + packet_duplicate_rate: packet_duplicate_rate__.unwrap_or_default(), + bytes_duplicate: bytes_duplicate__.unwrap_or_default(), + header_bytes_duplicate: header_bytes_duplicate__.unwrap_or_default(), + bitrate_duplicate: bitrate_duplicate__.unwrap_or_default(), + packets_padding: packets_padding__.unwrap_or_default(), + packet_padding_rate: packet_padding_rate__.unwrap_or_default(), + bytes_padding: bytes_padding__.unwrap_or_default(), + header_bytes_padding: header_bytes_padding__.unwrap_or_default(), + bitrate_padding: bitrate_padding__.unwrap_or_default(), + packets_out_of_order: packets_out_of_order__.unwrap_or_default(), + frames: frames__.unwrap_or_default(), + frame_rate: frame_rate__.unwrap_or_default(), + jitter_current: jitter_current__.unwrap_or_default(), + jitter_max: jitter_max__.unwrap_or_default(), + gap_histogram: gap_histogram__.unwrap_or_default(), + nacks: nacks__.unwrap_or_default(), + nack_acks: nack_acks__.unwrap_or_default(), + nack_misses: nack_misses__.unwrap_or_default(), + nack_repeated: nack_repeated__.unwrap_or_default(), + plis: plis__.unwrap_or_default(), + last_pli: last_pli__, + firs: firs__.unwrap_or_default(), + last_fir: last_fir__, + rtt_current: rtt_current__.unwrap_or_default(), + rtt_max: rtt_max__.unwrap_or_default(), + key_frames: key_frames__.unwrap_or_default(), + last_key_frame: last_key_frame__, + layer_lock_plis: layer_lock_plis__.unwrap_or_default(), + last_layer_lock_pli: last_layer_lock_pli__, + packet_drift: packet_drift__, + report_drift: report_drift__, + rebased_report_drift: rebased_report_drift__, + }) + } + } + deserializer.deserialize_struct("livekit.RTPStats", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for ReconnectReason { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + let variant = match self { + Self::RrUnknown => "RR_UNKNOWN", + Self::RrSignalDisconnected => "RR_SIGNAL_DISCONNECTED", + Self::RrPublisherFailed => "RR_PUBLISHER_FAILED", + Self::RrSubscriberFailed => "RR_SUBSCRIBER_FAILED", + Self::RrSwitchCandidate => "RR_SWITCH_CANDIDATE", + }; + serializer.serialize_str(variant) + } +} +impl<'de> serde::Deserialize<'de> for ReconnectReason { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "RR_UNKNOWN", + "RR_SIGNAL_DISCONNECTED", + "RR_PUBLISHER_FAILED", + "RR_SUBSCRIBER_FAILED", + "RR_SWITCH_CANDIDATE", + ]; + + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ReconnectReason; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + fn visit_i64(self, v: i64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) + }) + } + + fn visit_u64(self, v: u64) -> std::result::Result + where + E: serde::de::Error, + { + i32::try_from(v) + .ok() + .and_then(|x| x.try_into().ok()) + .ok_or_else(|| { + serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) + }) + } + + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "RR_UNKNOWN" => Ok(ReconnectReason::RrUnknown), + "RR_SIGNAL_DISCONNECTED" => Ok(ReconnectReason::RrSignalDisconnected), + "RR_PUBLISHER_FAILED" => Ok(ReconnectReason::RrPublisherFailed), + "RR_SUBSCRIBER_FAILED" => Ok(ReconnectReason::RrSubscriberFailed), + "RR_SWITCH_CANDIDATE" => Ok(ReconnectReason::RrSwitchCandidate), + _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), + } + } + } + deserializer.deserialize_any(GeneratedVisitor) + } +} +impl serde::Serialize for ReconnectResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.ice_servers.is_empty() { + len += 1; + } + if self.client_configuration.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.ReconnectResponse", len)?; + if !self.ice_servers.is_empty() { + struct_ser.serialize_field("iceServers", &self.ice_servers)?; + } + if let Some(v) = self.client_configuration.as_ref() { + struct_ser.serialize_field("clientConfiguration", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for ReconnectResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "ice_servers", + "iceServers", + "client_configuration", + "clientConfiguration", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + IceServers, + ClientConfiguration, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "iceServers" | "ice_servers" => Ok(GeneratedField::IceServers), + "clientConfiguration" | "client_configuration" => Ok(GeneratedField::ClientConfiguration), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = ReconnectResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.ReconnectResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut ice_servers__ = None; + let mut client_configuration__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::IceServers => { + if ice_servers__.is_some() { + return Err(serde::de::Error::duplicate_field("iceServers")); + } + ice_servers__ = Some(map_.next_value()?); + } + GeneratedField::ClientConfiguration => { + if client_configuration__.is_some() { + return Err(serde::de::Error::duplicate_field("clientConfiguration")); + } + client_configuration__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(ReconnectResponse { + ice_servers: ice_servers__.unwrap_or_default(), + client_configuration: client_configuration__, + }) + } + } + deserializer.deserialize_struct("livekit.ReconnectResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for RegionInfo { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.region.is_empty() { + len += 1; + } + if !self.url.is_empty() { + len += 1; + } + if self.distance != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.RegionInfo", len)?; + if !self.region.is_empty() { + struct_ser.serialize_field("region", &self.region)?; + } + if !self.url.is_empty() { + struct_ser.serialize_field("url", &self.url)?; + } + if self.distance != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("distance", ToString::to_string(&self.distance).as_str())?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for RegionInfo { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "region", + "url", + "distance", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Region, + Url, + Distance, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "region" => Ok(GeneratedField::Region), + "url" => Ok(GeneratedField::Url), + "distance" => Ok(GeneratedField::Distance), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = RegionInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.RegionInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut region__ = None; + let mut url__ = None; + let mut distance__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Region => { + if region__.is_some() { + return Err(serde::de::Error::duplicate_field("region")); + } + region__ = Some(map_.next_value()?); + } + GeneratedField::Url => { + if url__.is_some() { + return Err(serde::de::Error::duplicate_field("url")); + } + url__ = Some(map_.next_value()?); + } + GeneratedField::Distance => { + if distance__.is_some() { + return Err(serde::de::Error::duplicate_field("distance")); + } + distance__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(RegionInfo { + region: region__.unwrap_or_default(), + url: url__.unwrap_or_default(), + distance: distance__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.RegionInfo", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for RegionSettings { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.regions.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.RegionSettings", len)?; + if !self.regions.is_empty() { + struct_ser.serialize_field("regions", &self.regions)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for RegionSettings { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "regions", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Regions, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "regions" => Ok(GeneratedField::Regions), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = RegionSettings; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.RegionSettings") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut regions__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Regions => { + if regions__.is_some() { + return Err(serde::de::Error::duplicate_field("regions")); + } + regions__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(RegionSettings { + regions: regions__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.RegionSettings", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for RemoveParticipantResponse { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let len = 0; + let struct_ser = serializer.serialize_struct("livekit.RemoveParticipantResponse", len)?; + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for RemoveParticipantResponse { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + Ok(GeneratedField::__SkipField__) + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = RemoveParticipantResponse; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.RemoveParticipantResponse") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + while map_.next_key::()?.is_some() { + let _ = map_.next_value::()?; + } + Ok(RemoveParticipantResponse { + }) + } + } + deserializer.deserialize_struct("livekit.RemoveParticipantResponse", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for Room { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.sid.is_empty() { + len += 1; + } + if !self.name.is_empty() { + len += 1; + } + if self.empty_timeout != 0 { + len += 1; + } + if self.departure_timeout != 0 { + len += 1; + } + if self.max_participants != 0 { + len += 1; + } + if self.creation_time != 0 { + len += 1; + } + if !self.turn_password.is_empty() { + len += 1; + } + if !self.enabled_codecs.is_empty() { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if self.num_participants != 0 { + len += 1; + } + if self.num_publishers != 0 { + len += 1; + } + if self.active_recording { + len += 1; + } + if self.version.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.Room", len)?; + if !self.sid.is_empty() { + struct_ser.serialize_field("sid", &self.sid)?; + } + if !self.name.is_empty() { + struct_ser.serialize_field("name", &self.name)?; + } + if self.empty_timeout != 0 { + struct_ser.serialize_field("emptyTimeout", &self.empty_timeout)?; + } + if self.departure_timeout != 0 { + struct_ser.serialize_field("departureTimeout", &self.departure_timeout)?; + } + if self.max_participants != 0 { + struct_ser.serialize_field("maxParticipants", &self.max_participants)?; + } + if self.creation_time != 0 { + #[allow(clippy::needless_borrow)] + struct_ser.serialize_field("creationTime", ToString::to_string(&self.creation_time).as_str())?; + } + if !self.turn_password.is_empty() { + struct_ser.serialize_field("turnPassword", &self.turn_password)?; + } + if !self.enabled_codecs.is_empty() { + struct_ser.serialize_field("enabledCodecs", &self.enabled_codecs)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if self.num_participants != 0 { + struct_ser.serialize_field("numParticipants", &self.num_participants)?; + } + if self.num_publishers != 0 { + struct_ser.serialize_field("numPublishers", &self.num_publishers)?; + } + if self.active_recording { + struct_ser.serialize_field("activeRecording", &self.active_recording)?; + } + if let Some(v) = self.version.as_ref() { + struct_ser.serialize_field("version", v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for Room { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "sid", + "name", + "empty_timeout", + "emptyTimeout", + "departure_timeout", + "departureTimeout", + "max_participants", + "maxParticipants", + "creation_time", + "creationTime", + "turn_password", + "turnPassword", + "enabled_codecs", + "enabledCodecs", + "metadata", + "num_participants", + "numParticipants", + "num_publishers", + "numPublishers", + "active_recording", + "activeRecording", + "version", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Sid, + Name, + EmptyTimeout, + DepartureTimeout, + MaxParticipants, + CreationTime, + TurnPassword, + EnabledCodecs, + Metadata, + NumParticipants, + NumPublishers, + ActiveRecording, + Version, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "sid" => Ok(GeneratedField::Sid), + "name" => Ok(GeneratedField::Name), + "emptyTimeout" | "empty_timeout" => Ok(GeneratedField::EmptyTimeout), + "departureTimeout" | "departure_timeout" => Ok(GeneratedField::DepartureTimeout), + "maxParticipants" | "max_participants" => Ok(GeneratedField::MaxParticipants), + "creationTime" | "creation_time" => Ok(GeneratedField::CreationTime), + "turnPassword" | "turn_password" => Ok(GeneratedField::TurnPassword), + "enabledCodecs" | "enabled_codecs" => Ok(GeneratedField::EnabledCodecs), + "metadata" => Ok(GeneratedField::Metadata), + "numParticipants" | "num_participants" => Ok(GeneratedField::NumParticipants), + "numPublishers" | "num_publishers" => Ok(GeneratedField::NumPublishers), + "activeRecording" | "active_recording" => Ok(GeneratedField::ActiveRecording), + "version" => Ok(GeneratedField::Version), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = Room; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.Room") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut sid__ = None; + let mut name__ = None; + let mut empty_timeout__ = None; + let mut departure_timeout__ = None; + let mut max_participants__ = None; + let mut creation_time__ = None; + let mut turn_password__ = None; + let mut enabled_codecs__ = None; + let mut metadata__ = None; + let mut num_participants__ = None; + let mut num_publishers__ = None; + let mut active_recording__ = None; + let mut version__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::Sid => { + if sid__.is_some() { + return Err(serde::de::Error::duplicate_field("sid")); + } + sid__ = Some(map_.next_value()?); + } + GeneratedField::Name => { + if name__.is_some() { + return Err(serde::de::Error::duplicate_field("name")); + } + name__ = Some(map_.next_value()?); + } + GeneratedField::EmptyTimeout => { + if empty_timeout__.is_some() { + return Err(serde::de::Error::duplicate_field("emptyTimeout")); + } + empty_timeout__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::DepartureTimeout => { + if departure_timeout__.is_some() { + return Err(serde::de::Error::duplicate_field("departureTimeout")); + } + departure_timeout__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::MaxParticipants => { + if max_participants__.is_some() { + return Err(serde::de::Error::duplicate_field("maxParticipants")); + } + max_participants__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::CreationTime => { + if creation_time__.is_some() { + return Err(serde::de::Error::duplicate_field("creationTime")); + } + creation_time__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::TurnPassword => { + if turn_password__.is_some() { + return Err(serde::de::Error::duplicate_field("turnPassword")); + } + turn_password__ = Some(map_.next_value()?); + } + GeneratedField::EnabledCodecs => { + if enabled_codecs__.is_some() { + return Err(serde::de::Error::duplicate_field("enabledCodecs")); + } + enabled_codecs__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some(map_.next_value()?); + } + GeneratedField::NumParticipants => { + if num_participants__.is_some() { + return Err(serde::de::Error::duplicate_field("numParticipants")); + } + num_participants__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::NumPublishers => { + if num_publishers__.is_some() { + return Err(serde::de::Error::duplicate_field("numPublishers")); + } + num_publishers__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::ActiveRecording => { + if active_recording__.is_some() { + return Err(serde::de::Error::duplicate_field("activeRecording")); + } + active_recording__ = Some(map_.next_value()?); + } + GeneratedField::Version => { + if version__.is_some() { + return Err(serde::de::Error::duplicate_field("version")); + } + version__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(Room { + sid: sid__.unwrap_or_default(), + name: name__.unwrap_or_default(), + empty_timeout: empty_timeout__.unwrap_or_default(), + departure_timeout: departure_timeout__.unwrap_or_default(), + max_participants: max_participants__.unwrap_or_default(), + creation_time: creation_time__.unwrap_or_default(), + turn_password: turn_password__.unwrap_or_default(), + enabled_codecs: enabled_codecs__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + num_participants: num_participants__.unwrap_or_default(), + num_publishers: num_publishers__.unwrap_or_default(), + active_recording: active_recording__.unwrap_or_default(), + version: version__, + }) + } + } + deserializer.deserialize_struct("livekit.Room", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for RoomCompositeEgressRequest { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.room_name.is_empty() { + len += 1; + } + if !self.layout.is_empty() { + len += 1; + } + if self.audio_only { + len += 1; + } + if self.video_only { + len += 1; + } + if !self.custom_base_url.is_empty() { + len += 1; + } + if !self.file_outputs.is_empty() { + len += 1; + } + if !self.stream_outputs.is_empty() { + len += 1; + } + if !self.segment_outputs.is_empty() { + len += 1; + } + if !self.image_outputs.is_empty() { + len += 1; + } + if self.output.is_some() { + len += 1; + } + if self.options.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.RoomCompositeEgressRequest", len)?; + if !self.room_name.is_empty() { + struct_ser.serialize_field("roomName", &self.room_name)?; + } + if !self.layout.is_empty() { + struct_ser.serialize_field("layout", &self.layout)?; + } + if self.audio_only { + struct_ser.serialize_field("audioOnly", &self.audio_only)?; + } + if self.video_only { + struct_ser.serialize_field("videoOnly", &self.video_only)?; + } + if !self.custom_base_url.is_empty() { + struct_ser.serialize_field("customBaseUrl", &self.custom_base_url)?; + } + if !self.file_outputs.is_empty() { + struct_ser.serialize_field("fileOutputs", &self.file_outputs)?; + } + if !self.stream_outputs.is_empty() { + struct_ser.serialize_field("streamOutputs", &self.stream_outputs)?; + } + if !self.segment_outputs.is_empty() { + struct_ser.serialize_field("segmentOutputs", &self.segment_outputs)?; + } + if !self.image_outputs.is_empty() { + struct_ser.serialize_field("imageOutputs", &self.image_outputs)?; + } + if let Some(v) = self.output.as_ref() { + match v { + room_composite_egress_request::Output::File(v) => { + struct_ser.serialize_field("file", v)?; + } + room_composite_egress_request::Output::Stream(v) => { + struct_ser.serialize_field("stream", v)?; + } + room_composite_egress_request::Output::Segments(v) => { + struct_ser.serialize_field("segments", v)?; + } + } + } + if let Some(v) = self.options.as_ref() { + match v { + room_composite_egress_request::Options::Preset(v) => { + let v = EncodingOptionsPreset::try_from(*v) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?; + struct_ser.serialize_field("preset", &v)?; + } + room_composite_egress_request::Options::Advanced(v) => { + struct_ser.serialize_field("advanced", v)?; + } + } + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for RoomCompositeEgressRequest { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "room_name", + "roomName", + "layout", + "audio_only", + "audioOnly", + "video_only", + "videoOnly", + "custom_base_url", + "customBaseUrl", + "file_outputs", + "fileOutputs", + "stream_outputs", + "streamOutputs", + "segment_outputs", + "segmentOutputs", + "image_outputs", + "imageOutputs", + "file", + "stream", + "segments", + "preset", + "advanced", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + RoomName, + Layout, + AudioOnly, + VideoOnly, + CustomBaseUrl, + FileOutputs, + StreamOutputs, + SegmentOutputs, + ImageOutputs, + File, + Stream, + Segments, + Preset, + Advanced, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "roomName" | "room_name" => Ok(GeneratedField::RoomName), + "layout" => Ok(GeneratedField::Layout), + "audioOnly" | "audio_only" => Ok(GeneratedField::AudioOnly), + "videoOnly" | "video_only" => Ok(GeneratedField::VideoOnly), + "customBaseUrl" | "custom_base_url" => Ok(GeneratedField::CustomBaseUrl), + "fileOutputs" | "file_outputs" => Ok(GeneratedField::FileOutputs), + "streamOutputs" | "stream_outputs" => Ok(GeneratedField::StreamOutputs), + "segmentOutputs" | "segment_outputs" => Ok(GeneratedField::SegmentOutputs), + "imageOutputs" | "image_outputs" => Ok(GeneratedField::ImageOutputs), + "file" => Ok(GeneratedField::File), + "stream" => Ok(GeneratedField::Stream), + "segments" => Ok(GeneratedField::Segments), + "preset" => Ok(GeneratedField::Preset), + "advanced" => Ok(GeneratedField::Advanced), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = RoomCompositeEgressRequest; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.RoomCompositeEgressRequest") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut room_name__ = None; + let mut layout__ = None; + let mut audio_only__ = None; + let mut video_only__ = None; + let mut custom_base_url__ = None; + let mut file_outputs__ = None; + let mut stream_outputs__ = None; + let mut segment_outputs__ = None; + let mut image_outputs__ = None; + let mut output__ = None; + let mut options__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::RoomName => { + if room_name__.is_some() { + return Err(serde::de::Error::duplicate_field("roomName")); + } + room_name__ = Some(map_.next_value()?); + } + GeneratedField::Layout => { + if layout__.is_some() { + return Err(serde::de::Error::duplicate_field("layout")); + } + layout__ = Some(map_.next_value()?); + } + GeneratedField::AudioOnly => { + if audio_only__.is_some() { + return Err(serde::de::Error::duplicate_field("audioOnly")); + } + audio_only__ = Some(map_.next_value()?); + } + GeneratedField::VideoOnly => { + if video_only__.is_some() { + return Err(serde::de::Error::duplicate_field("videoOnly")); } - last_pli__ = map_.next_value()?; + video_only__ = Some(map_.next_value()?); } - GeneratedField::Firs => { - if firs__.is_some() { - return Err(serde::de::Error::duplicate_field("firs")); + GeneratedField::CustomBaseUrl => { + if custom_base_url__.is_some() { + return Err(serde::de::Error::duplicate_field("customBaseUrl")); } - firs__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + custom_base_url__ = Some(map_.next_value()?); } - GeneratedField::LastFir => { - if last_fir__.is_some() { - return Err(serde::de::Error::duplicate_field("lastFir")); + GeneratedField::FileOutputs => { + if file_outputs__.is_some() { + return Err(serde::de::Error::duplicate_field("fileOutputs")); } - last_fir__ = map_.next_value()?; + file_outputs__ = Some(map_.next_value()?); } - GeneratedField::RttCurrent => { - if rtt_current__.is_some() { - return Err(serde::de::Error::duplicate_field("rttCurrent")); + GeneratedField::StreamOutputs => { + if stream_outputs__.is_some() { + return Err(serde::de::Error::duplicate_field("streamOutputs")); } - rtt_current__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + stream_outputs__ = Some(map_.next_value()?); } - GeneratedField::RttMax => { - if rtt_max__.is_some() { - return Err(serde::de::Error::duplicate_field("rttMax")); + GeneratedField::SegmentOutputs => { + if segment_outputs__.is_some() { + return Err(serde::de::Error::duplicate_field("segmentOutputs")); } - rtt_max__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + segment_outputs__ = Some(map_.next_value()?); } - GeneratedField::KeyFrames => { - if key_frames__.is_some() { - return Err(serde::de::Error::duplicate_field("keyFrames")); + GeneratedField::ImageOutputs => { + if image_outputs__.is_some() { + return Err(serde::de::Error::duplicate_field("imageOutputs")); } - key_frames__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + image_outputs__ = Some(map_.next_value()?); } - GeneratedField::LastKeyFrame => { - if last_key_frame__.is_some() { - return Err(serde::de::Error::duplicate_field("lastKeyFrame")); + GeneratedField::File => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("file")); } - last_key_frame__ = map_.next_value()?; + output__ = map_.next_value::<::std::option::Option<_>>()?.map(room_composite_egress_request::Output::File) +; } - GeneratedField::LayerLockPlis => { - if layer_lock_plis__.is_some() { - return Err(serde::de::Error::duplicate_field("layerLockPlis")); + GeneratedField::Stream => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("stream")); } - layer_lock_plis__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + output__ = map_.next_value::<::std::option::Option<_>>()?.map(room_composite_egress_request::Output::Stream) +; } - GeneratedField::LastLayerLockPli => { - if last_layer_lock_pli__.is_some() { - return Err(serde::de::Error::duplicate_field("lastLayerLockPli")); + GeneratedField::Segments => { + if output__.is_some() { + return Err(serde::de::Error::duplicate_field("segments")); } - last_layer_lock_pli__ = map_.next_value()?; + output__ = map_.next_value::<::std::option::Option<_>>()?.map(room_composite_egress_request::Output::Segments) +; } - GeneratedField::PacketDrift => { - if packet_drift__.is_some() { - return Err(serde::de::Error::duplicate_field("packetDrift")); + GeneratedField::Preset => { + if options__.is_some() { + return Err(serde::de::Error::duplicate_field("preset")); } - packet_drift__ = map_.next_value()?; + options__ = map_.next_value::<::std::option::Option>()?.map(|x| room_composite_egress_request::Options::Preset(x as i32)); } - GeneratedField::ReportDrift => { - if report_drift__.is_some() { - return Err(serde::de::Error::duplicate_field("reportDrift")); + GeneratedField::Advanced => { + if options__.is_some() { + return Err(serde::de::Error::duplicate_field("advanced")); } - report_drift__ = map_.next_value()?; + options__ = map_.next_value::<::std::option::Option<_>>()?.map(room_composite_egress_request::Options::Advanced) +; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(RtpStats { - start_time: start_time__, - end_time: end_time__, - duration: duration__.unwrap_or_default(), - packets: packets__.unwrap_or_default(), - packet_rate: packet_rate__.unwrap_or_default(), - bytes: bytes__.unwrap_or_default(), - header_bytes: header_bytes__.unwrap_or_default(), - bitrate: bitrate__.unwrap_or_default(), - packets_lost: packets_lost__.unwrap_or_default(), - packet_loss_rate: packet_loss_rate__.unwrap_or_default(), - packet_loss_percentage: packet_loss_percentage__.unwrap_or_default(), - packets_duplicate: packets_duplicate__.unwrap_or_default(), - packet_duplicate_rate: packet_duplicate_rate__.unwrap_or_default(), - bytes_duplicate: bytes_duplicate__.unwrap_or_default(), - header_bytes_duplicate: header_bytes_duplicate__.unwrap_or_default(), - bitrate_duplicate: bitrate_duplicate__.unwrap_or_default(), - packets_padding: packets_padding__.unwrap_or_default(), - packet_padding_rate: packet_padding_rate__.unwrap_or_default(), - bytes_padding: bytes_padding__.unwrap_or_default(), - header_bytes_padding: header_bytes_padding__.unwrap_or_default(), - bitrate_padding: bitrate_padding__.unwrap_or_default(), - packets_out_of_order: packets_out_of_order__.unwrap_or_default(), - frames: frames__.unwrap_or_default(), - frame_rate: frame_rate__.unwrap_or_default(), - jitter_current: jitter_current__.unwrap_or_default(), - jitter_max: jitter_max__.unwrap_or_default(), - gap_histogram: gap_histogram__.unwrap_or_default(), - nacks: nacks__.unwrap_or_default(), - nack_acks: nack_acks__.unwrap_or_default(), - nack_misses: nack_misses__.unwrap_or_default(), - nack_repeated: nack_repeated__.unwrap_or_default(), - plis: plis__.unwrap_or_default(), - last_pli: last_pli__, - firs: firs__.unwrap_or_default(), - last_fir: last_fir__, - rtt_current: rtt_current__.unwrap_or_default(), - rtt_max: rtt_max__.unwrap_or_default(), - key_frames: key_frames__.unwrap_or_default(), - last_key_frame: last_key_frame__, - layer_lock_plis: layer_lock_plis__.unwrap_or_default(), - last_layer_lock_pli: last_layer_lock_pli__, - packet_drift: packet_drift__, - report_drift: report_drift__, + Ok(RoomCompositeEgressRequest { + room_name: room_name__.unwrap_or_default(), + layout: layout__.unwrap_or_default(), + audio_only: audio_only__.unwrap_or_default(), + video_only: video_only__.unwrap_or_default(), + custom_base_url: custom_base_url__.unwrap_or_default(), + file_outputs: file_outputs__.unwrap_or_default(), + stream_outputs: stream_outputs__.unwrap_or_default(), + segment_outputs: segment_outputs__.unwrap_or_default(), + image_outputs: image_outputs__.unwrap_or_default(), + output: output__, + options: options__, }) } } - deserializer.deserialize_struct("livekit.RTPStats", FIELDS, GeneratedVisitor) - } -} -impl serde::Serialize for ReconnectReason { - #[allow(deprecated)] - fn serialize(&self, serializer: S) -> std::result::Result - where - S: serde::Serializer, - { - let variant = match self { - Self::RrUnknown => "RR_UNKNOWN", - Self::RrSignalDisconnected => "RR_SIGNAL_DISCONNECTED", - Self::RrPublisherFailed => "RR_PUBLISHER_FAILED", - Self::RrSubscriberFailed => "RR_SUBSCRIBER_FAILED", - Self::RrSwitchCandidate => "RR_SWITCH_CANDIDATE", - }; - serializer.serialize_str(variant) - } -} -impl<'de> serde::Deserialize<'de> for ReconnectReason { - #[allow(deprecated)] - fn deserialize(deserializer: D) -> std::result::Result - where - D: serde::Deserializer<'de>, - { - const FIELDS: &[&str] = &[ - "RR_UNKNOWN", - "RR_SIGNAL_DISCONNECTED", - "RR_PUBLISHER_FAILED", - "RR_SUBSCRIBER_FAILED", - "RR_SWITCH_CANDIDATE", - ]; - - struct GeneratedVisitor; - - impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ReconnectReason; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - fn visit_i64(self, v: i64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Signed(v), &self) - }) - } - - fn visit_u64(self, v: u64) -> std::result::Result - where - E: serde::de::Error, - { - i32::try_from(v) - .ok() - .and_then(|x| x.try_into().ok()) - .ok_or_else(|| { - serde::de::Error::invalid_value(serde::de::Unexpected::Unsigned(v), &self) - }) - } - - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "RR_UNKNOWN" => Ok(ReconnectReason::RrUnknown), - "RR_SIGNAL_DISCONNECTED" => Ok(ReconnectReason::RrSignalDisconnected), - "RR_PUBLISHER_FAILED" => Ok(ReconnectReason::RrPublisherFailed), - "RR_SUBSCRIBER_FAILED" => Ok(ReconnectReason::RrSubscriberFailed), - "RR_SWITCH_CANDIDATE" => Ok(ReconnectReason::RrSwitchCandidate), - _ => Err(serde::de::Error::unknown_variant(value, FIELDS)), - } - } - } - deserializer.deserialize_any(GeneratedVisitor) + deserializer.deserialize_struct("livekit.RoomCompositeEgressRequest", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for ReconnectResponse { +impl serde::Serialize for RoomEgress { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -12287,39 +14760,45 @@ impl serde::Serialize for ReconnectResponse { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.ice_servers.is_empty() { + if self.room.is_some() { len += 1; } - if self.client_configuration.is_some() { + if self.participant.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.ReconnectResponse", len)?; - if !self.ice_servers.is_empty() { - struct_ser.serialize_field("iceServers", &self.ice_servers)?; + if self.tracks.is_some() { + len += 1; } - if let Some(v) = self.client_configuration.as_ref() { - struct_ser.serialize_field("clientConfiguration", v)?; + let mut struct_ser = serializer.serialize_struct("livekit.RoomEgress", len)?; + if let Some(v) = self.room.as_ref() { + struct_ser.serialize_field("room", v)?; + } + if let Some(v) = self.participant.as_ref() { + struct_ser.serialize_field("participant", v)?; + } + if let Some(v) = self.tracks.as_ref() { + struct_ser.serialize_field("tracks", v)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for ReconnectResponse { +impl<'de> serde::Deserialize<'de> for RoomEgress { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "ice_servers", - "iceServers", - "client_configuration", - "clientConfiguration", + "room", + "participant", + "tracks", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - IceServers, - ClientConfiguration, + Room, + Participant, + Tracks, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -12342,8 +14821,9 @@ impl<'de> serde::Deserialize<'de> for ReconnectResponse { E: serde::de::Error, { match value { - "iceServers" | "ice_servers" => Ok(GeneratedField::IceServers), - "clientConfiguration" | "client_configuration" => Ok(GeneratedField::ClientConfiguration), + "room" => Ok(GeneratedField::Room), + "participant" => Ok(GeneratedField::Participant), + "tracks" => Ok(GeneratedField::Tracks), _ => Ok(GeneratedField::__SkipField__), } } @@ -12353,47 +14833,55 @@ impl<'de> serde::Deserialize<'de> for ReconnectResponse { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = ReconnectResponse; + type Value = RoomEgress; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.ReconnectResponse") + formatter.write_str("struct livekit.RoomEgress") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut ice_servers__ = None; - let mut client_configuration__ = None; + let mut room__ = None; + let mut participant__ = None; + let mut tracks__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::IceServers => { - if ice_servers__.is_some() { - return Err(serde::de::Error::duplicate_field("iceServers")); + GeneratedField::Room => { + if room__.is_some() { + return Err(serde::de::Error::duplicate_field("room")); } - ice_servers__ = Some(map_.next_value()?); + room__ = map_.next_value()?; } - GeneratedField::ClientConfiguration => { - if client_configuration__.is_some() { - return Err(serde::de::Error::duplicate_field("clientConfiguration")); + GeneratedField::Participant => { + if participant__.is_some() { + return Err(serde::de::Error::duplicate_field("participant")); } - client_configuration__ = map_.next_value()?; + participant__ = map_.next_value()?; + } + GeneratedField::Tracks => { + if tracks__.is_some() { + return Err(serde::de::Error::duplicate_field("tracks")); + } + tracks__ = map_.next_value()?; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(ReconnectResponse { - ice_servers: ice_servers__.unwrap_or_default(), - client_configuration: client_configuration__, + Ok(RoomEgress { + room: room__, + participant: participant__, + tracks: tracks__, }) } } - deserializer.deserialize_struct("livekit.ReconnectResponse", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.RoomEgress", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for RegionInfo { +impl serde::Serialize for RoomParticipantIdentity { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -12401,46 +14889,37 @@ impl serde::Serialize for RegionInfo { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.region.is_empty() { - len += 1; - } - if !self.url.is_empty() { + if !self.room.is_empty() { len += 1; } - if self.distance != 0 { + if !self.identity.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.RegionInfo", len)?; - if !self.region.is_empty() { - struct_ser.serialize_field("region", &self.region)?; - } - if !self.url.is_empty() { - struct_ser.serialize_field("url", &self.url)?; + let mut struct_ser = serializer.serialize_struct("livekit.RoomParticipantIdentity", len)?; + if !self.room.is_empty() { + struct_ser.serialize_field("room", &self.room)?; } - if self.distance != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("distance", ToString::to_string(&self.distance).as_str())?; + if !self.identity.is_empty() { + struct_ser.serialize_field("identity", &self.identity)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for RegionInfo { +impl<'de> serde::Deserialize<'de> for RoomParticipantIdentity { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "region", - "url", - "distance", + "room", + "identity", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Region, - Url, - Distance, + Room, + Identity, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -12463,9 +14942,8 @@ impl<'de> serde::Deserialize<'de> for RegionInfo { E: serde::de::Error, { match value { - "region" => Ok(GeneratedField::Region), - "url" => Ok(GeneratedField::Url), - "distance" => Ok(GeneratedField::Distance), + "room" => Ok(GeneratedField::Room), + "identity" => Ok(GeneratedField::Identity), _ => Ok(GeneratedField::__SkipField__), } } @@ -12475,57 +14953,47 @@ impl<'de> serde::Deserialize<'de> for RegionInfo { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = RegionInfo; + type Value = RoomParticipantIdentity; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.RegionInfo") + formatter.write_str("struct livekit.RoomParticipantIdentity") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut region__ = None; - let mut url__ = None; - let mut distance__ = None; + let mut room__ = None; + let mut identity__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Region => { - if region__.is_some() { - return Err(serde::de::Error::duplicate_field("region")); - } - region__ = Some(map_.next_value()?); - } - GeneratedField::Url => { - if url__.is_some() { - return Err(serde::de::Error::duplicate_field("url")); + GeneratedField::Room => { + if room__.is_some() { + return Err(serde::de::Error::duplicate_field("room")); } - url__ = Some(map_.next_value()?); + room__ = Some(map_.next_value()?); } - GeneratedField::Distance => { - if distance__.is_some() { - return Err(serde::de::Error::duplicate_field("distance")); + GeneratedField::Identity => { + if identity__.is_some() { + return Err(serde::de::Error::duplicate_field("identity")); } - distance__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; + identity__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(RegionInfo { - region: region__.unwrap_or_default(), - url: url__.unwrap_or_default(), - distance: distance__.unwrap_or_default(), + Ok(RoomParticipantIdentity { + room: room__.unwrap_or_default(), + identity: identity__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.RegionInfo", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.RoomParticipantIdentity", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for RegionSettings { +impl serde::Serialize for RoomUpdate { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -12533,29 +15001,29 @@ impl serde::Serialize for RegionSettings { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.regions.is_empty() { + if self.room.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.RegionSettings", len)?; - if !self.regions.is_empty() { - struct_ser.serialize_field("regions", &self.regions)?; + let mut struct_ser = serializer.serialize_struct("livekit.RoomUpdate", len)?; + if let Some(v) = self.room.as_ref() { + struct_ser.serialize_field("room", v)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for RegionSettings { +impl<'de> serde::Deserialize<'de> for RoomUpdate { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "regions", + "room", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Regions, + Room, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -12578,7 +15046,7 @@ impl<'de> serde::Deserialize<'de> for RegionSettings { E: serde::de::Error, { match value { - "regions" => Ok(GeneratedField::Regions), + "room" => Ok(GeneratedField::Room), _ => Ok(GeneratedField::__SkipField__), } } @@ -12588,61 +15056,144 @@ impl<'de> serde::Deserialize<'de> for RegionSettings { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = RegionSettings; + type Value = RoomUpdate; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.RegionSettings") + formatter.write_str("struct livekit.RoomUpdate") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut regions__ = None; + let mut room__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Regions => { - if regions__.is_some() { - return Err(serde::de::Error::duplicate_field("regions")); + GeneratedField::Room => { + if room__.is_some() { + return Err(serde::de::Error::duplicate_field("room")); } - regions__ = Some(map_.next_value()?); + room__ = map_.next_value()?; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(RegionSettings { - regions: regions__.unwrap_or_default(), + Ok(RoomUpdate { + room: room__, }) } } - deserializer.deserialize_struct("livekit.RegionSettings", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.RoomUpdate", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for RemoveParticipantResponse { +impl serde::Serialize for S3Upload { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where S: serde::Serializer, { use serde::ser::SerializeStruct; - let len = 0; - let struct_ser = serializer.serialize_struct("livekit.RemoveParticipantResponse", len)?; + let mut len = 0; + if !self.access_key.is_empty() { + len += 1; + } + if !self.secret.is_empty() { + len += 1; + } + if !self.region.is_empty() { + len += 1; + } + if !self.endpoint.is_empty() { + len += 1; + } + if !self.bucket.is_empty() { + len += 1; + } + if self.force_path_style { + len += 1; + } + if !self.metadata.is_empty() { + len += 1; + } + if !self.tagging.is_empty() { + len += 1; + } + if !self.content_disposition.is_empty() { + len += 1; + } + if self.proxy.is_some() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.S3Upload", len)?; + if !self.access_key.is_empty() { + struct_ser.serialize_field("accessKey", &self.access_key)?; + } + if !self.secret.is_empty() { + struct_ser.serialize_field("secret", &self.secret)?; + } + if !self.region.is_empty() { + struct_ser.serialize_field("region", &self.region)?; + } + if !self.endpoint.is_empty() { + struct_ser.serialize_field("endpoint", &self.endpoint)?; + } + if !self.bucket.is_empty() { + struct_ser.serialize_field("bucket", &self.bucket)?; + } + if self.force_path_style { + struct_ser.serialize_field("forcePathStyle", &self.force_path_style)?; + } + if !self.metadata.is_empty() { + struct_ser.serialize_field("metadata", &self.metadata)?; + } + if !self.tagging.is_empty() { + struct_ser.serialize_field("tagging", &self.tagging)?; + } + if !self.content_disposition.is_empty() { + struct_ser.serialize_field("contentDisposition", &self.content_disposition)?; + } + if let Some(v) = self.proxy.as_ref() { + struct_ser.serialize_field("proxy", v)?; + } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for RemoveParticipantResponse { +impl<'de> serde::Deserialize<'de> for S3Upload { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ + "access_key", + "accessKey", + "secret", + "region", + "endpoint", + "bucket", + "force_path_style", + "forcePathStyle", + "metadata", + "tagging", + "content_disposition", + "contentDisposition", + "proxy", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { + AccessKey, + Secret, + Region, + Endpoint, + Bucket, + ForcePathStyle, + Metadata, + Tagging, + ContentDisposition, + Proxy, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -12664,7 +15215,19 @@ impl<'de> serde::Deserialize<'de> for RemoveParticipantResponse { where E: serde::de::Error, { - Ok(GeneratedField::__SkipField__) + match value { + "accessKey" | "access_key" => Ok(GeneratedField::AccessKey), + "secret" => Ok(GeneratedField::Secret), + "region" => Ok(GeneratedField::Region), + "endpoint" => Ok(GeneratedField::Endpoint), + "bucket" => Ok(GeneratedField::Bucket), + "forcePathStyle" | "force_path_style" => Ok(GeneratedField::ForcePathStyle), + "metadata" => Ok(GeneratedField::Metadata), + "tagging" => Ok(GeneratedField::Tagging), + "contentDisposition" | "content_disposition" => Ok(GeneratedField::ContentDisposition), + "proxy" => Ok(GeneratedField::Proxy), + _ => Ok(GeneratedField::__SkipField__), + } } } deserializer.deserialize_identifier(GeneratedVisitor) @@ -12672,27 +15235,113 @@ impl<'de> serde::Deserialize<'de> for RemoveParticipantResponse { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = RemoveParticipantResponse; + type Value = S3Upload; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.RemoveParticipantResponse") + formatter.write_str("struct livekit.S3Upload") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - while map_.next_key::()?.is_some() { - let _ = map_.next_value::()?; + let mut access_key__ = None; + let mut secret__ = None; + let mut region__ = None; + let mut endpoint__ = None; + let mut bucket__ = None; + let mut force_path_style__ = None; + let mut metadata__ = None; + let mut tagging__ = None; + let mut content_disposition__ = None; + let mut proxy__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::AccessKey => { + if access_key__.is_some() { + return Err(serde::de::Error::duplicate_field("accessKey")); + } + access_key__ = Some(map_.next_value()?); + } + GeneratedField::Secret => { + if secret__.is_some() { + return Err(serde::de::Error::duplicate_field("secret")); + } + secret__ = Some(map_.next_value()?); + } + GeneratedField::Region => { + if region__.is_some() { + return Err(serde::de::Error::duplicate_field("region")); + } + region__ = Some(map_.next_value()?); + } + GeneratedField::Endpoint => { + if endpoint__.is_some() { + return Err(serde::de::Error::duplicate_field("endpoint")); + } + endpoint__ = Some(map_.next_value()?); + } + GeneratedField::Bucket => { + if bucket__.is_some() { + return Err(serde::de::Error::duplicate_field("bucket")); + } + bucket__ = Some(map_.next_value()?); + } + GeneratedField::ForcePathStyle => { + if force_path_style__.is_some() { + return Err(serde::de::Error::duplicate_field("forcePathStyle")); + } + force_path_style__ = Some(map_.next_value()?); + } + GeneratedField::Metadata => { + if metadata__.is_some() { + return Err(serde::de::Error::duplicate_field("metadata")); + } + metadata__ = Some( + map_.next_value::>()? + ); + } + GeneratedField::Tagging => { + if tagging__.is_some() { + return Err(serde::de::Error::duplicate_field("tagging")); + } + tagging__ = Some(map_.next_value()?); + } + GeneratedField::ContentDisposition => { + if content_disposition__.is_some() { + return Err(serde::de::Error::duplicate_field("contentDisposition")); + } + content_disposition__ = Some(map_.next_value()?); + } + GeneratedField::Proxy => { + if proxy__.is_some() { + return Err(serde::de::Error::duplicate_field("proxy")); + } + proxy__ = map_.next_value()?; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } } - Ok(RemoveParticipantResponse { + Ok(S3Upload { + access_key: access_key__.unwrap_or_default(), + secret: secret__.unwrap_or_default(), + region: region__.unwrap_or_default(), + endpoint: endpoint__.unwrap_or_default(), + bucket: bucket__.unwrap_or_default(), + force_path_style: force_path_style__.unwrap_or_default(), + metadata: metadata__.unwrap_or_default(), + tagging: tagging__.unwrap_or_default(), + content_disposition: content_disposition__.unwrap_or_default(), + proxy: proxy__, }) } } - deserializer.deserialize_struct("livekit.RemoveParticipantResponse", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.S3Upload", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for Room { +impl serde::Serialize for SipDispatchRule { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -12700,126 +15349,40 @@ impl serde::Serialize for Room { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.sid.is_empty() { - len += 1; - } - if !self.name.is_empty() { - len += 1; - } - if self.empty_timeout != 0 { - len += 1; - } - if self.max_participants != 0 { - len += 1; - } - if self.creation_time != 0 { - len += 1; - } - if !self.turn_password.is_empty() { - len += 1; - } - if !self.enabled_codecs.is_empty() { + if self.rule.is_some() { len += 1; } - if !self.metadata.is_empty() { - len += 1; - } - if self.num_participants != 0 { - len += 1; - } - if self.num_publishers != 0 { - len += 1; - } - if self.active_recording { - len += 1; - } - if self.version.is_some() { - len += 1; - } - let mut struct_ser = serializer.serialize_struct("livekit.Room", len)?; - if !self.sid.is_empty() { - struct_ser.serialize_field("sid", &self.sid)?; - } - if !self.name.is_empty() { - struct_ser.serialize_field("name", &self.name)?; - } - if self.empty_timeout != 0 { - struct_ser.serialize_field("emptyTimeout", &self.empty_timeout)?; - } - if self.max_participants != 0 { - struct_ser.serialize_field("maxParticipants", &self.max_participants)?; - } - if self.creation_time != 0 { - #[allow(clippy::needless_borrow)] - struct_ser.serialize_field("creationTime", ToString::to_string(&self.creation_time).as_str())?; - } - if !self.turn_password.is_empty() { - struct_ser.serialize_field("turnPassword", &self.turn_password)?; - } - if !self.enabled_codecs.is_empty() { - struct_ser.serialize_field("enabledCodecs", &self.enabled_codecs)?; - } - if !self.metadata.is_empty() { - struct_ser.serialize_field("metadata", &self.metadata)?; - } - if self.num_participants != 0 { - struct_ser.serialize_field("numParticipants", &self.num_participants)?; - } - if self.num_publishers != 0 { - struct_ser.serialize_field("numPublishers", &self.num_publishers)?; - } - if self.active_recording { - struct_ser.serialize_field("activeRecording", &self.active_recording)?; - } - if let Some(v) = self.version.as_ref() { - struct_ser.serialize_field("version", v)?; + let mut struct_ser = serializer.serialize_struct("livekit.SIPDispatchRule", len)?; + if let Some(v) = self.rule.as_ref() { + match v { + sip_dispatch_rule::Rule::DispatchRuleDirect(v) => { + struct_ser.serialize_field("dispatchRuleDirect", v)?; + } + sip_dispatch_rule::Rule::DispatchRuleIndividual(v) => { + struct_ser.serialize_field("dispatchRuleIndividual", v)?; + } + } } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for Room { +impl<'de> serde::Deserialize<'de> for SipDispatchRule { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "sid", - "name", - "empty_timeout", - "emptyTimeout", - "max_participants", - "maxParticipants", - "creation_time", - "creationTime", - "turn_password", - "turnPassword", - "enabled_codecs", - "enabledCodecs", - "metadata", - "num_participants", - "numParticipants", - "num_publishers", - "numPublishers", - "active_recording", - "activeRecording", - "version", + "dispatch_rule_direct", + "dispatchRuleDirect", + "dispatch_rule_individual", + "dispatchRuleIndividual", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Sid, - Name, - EmptyTimeout, - MaxParticipants, - CreationTime, - TurnPassword, - EnabledCodecs, - Metadata, - NumParticipants, - NumPublishers, - ActiveRecording, - Version, + DispatchRuleDirect, + DispatchRuleIndividual, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -12831,29 +15394,19 @@ impl<'de> serde::Deserialize<'de> for Room { impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = GeneratedField; - - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "sid" => Ok(GeneratedField::Sid), - "name" => Ok(GeneratedField::Name), - "emptyTimeout" | "empty_timeout" => Ok(GeneratedField::EmptyTimeout), - "maxParticipants" | "max_participants" => Ok(GeneratedField::MaxParticipants), - "creationTime" | "creation_time" => Ok(GeneratedField::CreationTime), - "turnPassword" | "turn_password" => Ok(GeneratedField::TurnPassword), - "enabledCodecs" | "enabled_codecs" => Ok(GeneratedField::EnabledCodecs), - "metadata" => Ok(GeneratedField::Metadata), - "numParticipants" | "num_participants" => Ok(GeneratedField::NumParticipants), - "numPublishers" | "num_publishers" => Ok(GeneratedField::NumPublishers), - "activeRecording" | "active_recording" => Ok(GeneratedField::ActiveRecording), - "version" => Ok(GeneratedField::Version), + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "dispatchRuleDirect" | "dispatch_rule_direct" => Ok(GeneratedField::DispatchRuleDirect), + "dispatchRuleIndividual" | "dispatch_rule_individual" => Ok(GeneratedField::DispatchRuleIndividual), _ => Ok(GeneratedField::__SkipField__), } } @@ -12863,137 +15416,47 @@ impl<'de> serde::Deserialize<'de> for Room { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = Room; + type Value = SipDispatchRule; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.Room") + formatter.write_str("struct livekit.SIPDispatchRule") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut sid__ = None; - let mut name__ = None; - let mut empty_timeout__ = None; - let mut max_participants__ = None; - let mut creation_time__ = None; - let mut turn_password__ = None; - let mut enabled_codecs__ = None; - let mut metadata__ = None; - let mut num_participants__ = None; - let mut num_publishers__ = None; - let mut active_recording__ = None; - let mut version__ = None; + let mut rule__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Sid => { - if sid__.is_some() { - return Err(serde::de::Error::duplicate_field("sid")); - } - sid__ = Some(map_.next_value()?); - } - GeneratedField::Name => { - if name__.is_some() { - return Err(serde::de::Error::duplicate_field("name")); - } - name__ = Some(map_.next_value()?); - } - GeneratedField::EmptyTimeout => { - if empty_timeout__.is_some() { - return Err(serde::de::Error::duplicate_field("emptyTimeout")); - } - empty_timeout__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::MaxParticipants => { - if max_participants__.is_some() { - return Err(serde::de::Error::duplicate_field("maxParticipants")); - } - max_participants__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::CreationTime => { - if creation_time__.is_some() { - return Err(serde::de::Error::duplicate_field("creationTime")); - } - creation_time__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::TurnPassword => { - if turn_password__.is_some() { - return Err(serde::de::Error::duplicate_field("turnPassword")); - } - turn_password__ = Some(map_.next_value()?); - } - GeneratedField::EnabledCodecs => { - if enabled_codecs__.is_some() { - return Err(serde::de::Error::duplicate_field("enabledCodecs")); - } - enabled_codecs__ = Some(map_.next_value()?); - } - GeneratedField::Metadata => { - if metadata__.is_some() { - return Err(serde::de::Error::duplicate_field("metadata")); - } - metadata__ = Some(map_.next_value()?); - } - GeneratedField::NumParticipants => { - if num_participants__.is_some() { - return Err(serde::de::Error::duplicate_field("numParticipants")); - } - num_participants__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::NumPublishers => { - if num_publishers__.is_some() { - return Err(serde::de::Error::duplicate_field("numPublishers")); - } - num_publishers__ = - Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) - ; - } - GeneratedField::ActiveRecording => { - if active_recording__.is_some() { - return Err(serde::de::Error::duplicate_field("activeRecording")); + GeneratedField::DispatchRuleDirect => { + if rule__.is_some() { + return Err(serde::de::Error::duplicate_field("dispatchRuleDirect")); } - active_recording__ = Some(map_.next_value()?); + rule__ = map_.next_value::<::std::option::Option<_>>()?.map(sip_dispatch_rule::Rule::DispatchRuleDirect) +; } - GeneratedField::Version => { - if version__.is_some() { - return Err(serde::de::Error::duplicate_field("version")); + GeneratedField::DispatchRuleIndividual => { + if rule__.is_some() { + return Err(serde::de::Error::duplicate_field("dispatchRuleIndividual")); } - version__ = map_.next_value()?; + rule__ = map_.next_value::<::std::option::Option<_>>()?.map(sip_dispatch_rule::Rule::DispatchRuleIndividual) +; } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(Room { - sid: sid__.unwrap_or_default(), - name: name__.unwrap_or_default(), - empty_timeout: empty_timeout__.unwrap_or_default(), - max_participants: max_participants__.unwrap_or_default(), - creation_time: creation_time__.unwrap_or_default(), - turn_password: turn_password__.unwrap_or_default(), - enabled_codecs: enabled_codecs__.unwrap_or_default(), - metadata: metadata__.unwrap_or_default(), - num_participants: num_participants__.unwrap_or_default(), - num_publishers: num_publishers__.unwrap_or_default(), - active_recording: active_recording__.unwrap_or_default(), - version: version__, + Ok(SipDispatchRule { + rule: rule__, }) } } - deserializer.deserialize_struct("livekit.Room", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.SIPDispatchRule", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for RoomCompositeEgressRequest { +impl serde::Serialize for SipDispatchRuleDirect { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -13004,93 +15467,20 @@ impl serde::Serialize for RoomCompositeEgressRequest { if !self.room_name.is_empty() { len += 1; } - if !self.layout.is_empty() { - len += 1; - } - if self.audio_only { - len += 1; - } - if self.video_only { - len += 1; - } - if !self.custom_base_url.is_empty() { - len += 1; - } - if !self.file_outputs.is_empty() { - len += 1; - } - if !self.stream_outputs.is_empty() { - len += 1; - } - if !self.segment_outputs.is_empty() { - len += 1; - } - if !self.image_outputs.is_empty() { - len += 1; - } - if self.output.is_some() { - len += 1; - } - if self.options.is_some() { + if !self.pin.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.RoomCompositeEgressRequest", len)?; + let mut struct_ser = serializer.serialize_struct("livekit.SIPDispatchRuleDirect", len)?; if !self.room_name.is_empty() { struct_ser.serialize_field("roomName", &self.room_name)?; } - if !self.layout.is_empty() { - struct_ser.serialize_field("layout", &self.layout)?; - } - if self.audio_only { - struct_ser.serialize_field("audioOnly", &self.audio_only)?; - } - if self.video_only { - struct_ser.serialize_field("videoOnly", &self.video_only)?; - } - if !self.custom_base_url.is_empty() { - struct_ser.serialize_field("customBaseUrl", &self.custom_base_url)?; - } - if !self.file_outputs.is_empty() { - struct_ser.serialize_field("fileOutputs", &self.file_outputs)?; - } - if !self.stream_outputs.is_empty() { - struct_ser.serialize_field("streamOutputs", &self.stream_outputs)?; - } - if !self.segment_outputs.is_empty() { - struct_ser.serialize_field("segmentOutputs", &self.segment_outputs)?; - } - if !self.image_outputs.is_empty() { - struct_ser.serialize_field("imageOutputs", &self.image_outputs)?; - } - if let Some(v) = self.output.as_ref() { - match v { - room_composite_egress_request::Output::File(v) => { - struct_ser.serialize_field("file", v)?; - } - room_composite_egress_request::Output::Stream(v) => { - struct_ser.serialize_field("stream", v)?; - } - room_composite_egress_request::Output::Segments(v) => { - struct_ser.serialize_field("segments", v)?; - } - } - } - if let Some(v) = self.options.as_ref() { - match v { - room_composite_egress_request::Options::Preset(v) => { - let v = EncodingOptionsPreset::try_from(*v) - .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", *v)))?; - struct_ser.serialize_field("preset", &v)?; - } - room_composite_egress_request::Options::Advanced(v) => { - struct_ser.serialize_field("advanced", v)?; - } - } + if !self.pin.is_empty() { + struct_ser.serialize_field("pin", &self.pin)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for RoomCompositeEgressRequest { +impl<'de> serde::Deserialize<'de> for SipDispatchRuleDirect { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where @@ -13099,44 +15489,13 @@ impl<'de> serde::Deserialize<'de> for RoomCompositeEgressRequest { const FIELDS: &[&str] = &[ "room_name", "roomName", - "layout", - "audio_only", - "audioOnly", - "video_only", - "videoOnly", - "custom_base_url", - "customBaseUrl", - "file_outputs", - "fileOutputs", - "stream_outputs", - "streamOutputs", - "segment_outputs", - "segmentOutputs", - "image_outputs", - "imageOutputs", - "file", - "stream", - "segments", - "preset", - "advanced", + "pin", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { RoomName, - Layout, - AudioOnly, - VideoOnly, - CustomBaseUrl, - FileOutputs, - StreamOutputs, - SegmentOutputs, - ImageOutputs, - File, - Stream, - Segments, - Preset, - Advanced, + Pin, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -13149,30 +15508,18 @@ impl<'de> serde::Deserialize<'de> for RoomCompositeEgressRequest { impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { type Value = GeneratedField; - fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(formatter, "expected one of: {:?}", &FIELDS) - } - - #[allow(unused_variables)] - fn visit_str(self, value: &str) -> std::result::Result - where - E: serde::de::Error, - { - match value { - "roomName" | "room_name" => Ok(GeneratedField::RoomName), - "layout" => Ok(GeneratedField::Layout), - "audioOnly" | "audio_only" => Ok(GeneratedField::AudioOnly), - "videoOnly" | "video_only" => Ok(GeneratedField::VideoOnly), - "customBaseUrl" | "custom_base_url" => Ok(GeneratedField::CustomBaseUrl), - "fileOutputs" | "file_outputs" => Ok(GeneratedField::FileOutputs), - "streamOutputs" | "stream_outputs" => Ok(GeneratedField::StreamOutputs), - "segmentOutputs" | "segment_outputs" => Ok(GeneratedField::SegmentOutputs), - "imageOutputs" | "image_outputs" => Ok(GeneratedField::ImageOutputs), - "file" => Ok(GeneratedField::File), - "stream" => Ok(GeneratedField::Stream), - "segments" => Ok(GeneratedField::Segments), - "preset" => Ok(GeneratedField::Preset), - "advanced" => Ok(GeneratedField::Advanced), + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "roomName" | "room_name" => Ok(GeneratedField::RoomName), + "pin" => Ok(GeneratedField::Pin), _ => Ok(GeneratedField::__SkipField__), } } @@ -13182,27 +15529,18 @@ impl<'de> serde::Deserialize<'de> for RoomCompositeEgressRequest { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = RoomCompositeEgressRequest; + type Value = SipDispatchRuleDirect; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.RoomCompositeEgressRequest") + formatter.write_str("struct livekit.SIPDispatchRuleDirect") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { let mut room_name__ = None; - let mut layout__ = None; - let mut audio_only__ = None; - let mut video_only__ = None; - let mut custom_base_url__ = None; - let mut file_outputs__ = None; - let mut stream_outputs__ = None; - let mut segment_outputs__ = None; - let mut image_outputs__ = None; - let mut output__ = None; - let mut options__ = None; + let mut pin__ = None; while let Some(k) = map_.next_key()? { match k { GeneratedField::RoomName => { @@ -13211,112 +15549,27 @@ impl<'de> serde::Deserialize<'de> for RoomCompositeEgressRequest { } room_name__ = Some(map_.next_value()?); } - GeneratedField::Layout => { - if layout__.is_some() { - return Err(serde::de::Error::duplicate_field("layout")); - } - layout__ = Some(map_.next_value()?); - } - GeneratedField::AudioOnly => { - if audio_only__.is_some() { - return Err(serde::de::Error::duplicate_field("audioOnly")); - } - audio_only__ = Some(map_.next_value()?); - } - GeneratedField::VideoOnly => { - if video_only__.is_some() { - return Err(serde::de::Error::duplicate_field("videoOnly")); - } - video_only__ = Some(map_.next_value()?); - } - GeneratedField::CustomBaseUrl => { - if custom_base_url__.is_some() { - return Err(serde::de::Error::duplicate_field("customBaseUrl")); - } - custom_base_url__ = Some(map_.next_value()?); - } - GeneratedField::FileOutputs => { - if file_outputs__.is_some() { - return Err(serde::de::Error::duplicate_field("fileOutputs")); - } - file_outputs__ = Some(map_.next_value()?); - } - GeneratedField::StreamOutputs => { - if stream_outputs__.is_some() { - return Err(serde::de::Error::duplicate_field("streamOutputs")); - } - stream_outputs__ = Some(map_.next_value()?); - } - GeneratedField::SegmentOutputs => { - if segment_outputs__.is_some() { - return Err(serde::de::Error::duplicate_field("segmentOutputs")); - } - segment_outputs__ = Some(map_.next_value()?); - } - GeneratedField::ImageOutputs => { - if image_outputs__.is_some() { - return Err(serde::de::Error::duplicate_field("imageOutputs")); - } - image_outputs__ = Some(map_.next_value()?); - } - GeneratedField::File => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("file")); - } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(room_composite_egress_request::Output::File) -; - } - GeneratedField::Stream => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("stream")); - } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(room_composite_egress_request::Output::Stream) -; - } - GeneratedField::Segments => { - if output__.is_some() { - return Err(serde::de::Error::duplicate_field("segments")); - } - output__ = map_.next_value::<::std::option::Option<_>>()?.map(room_composite_egress_request::Output::Segments) -; - } - GeneratedField::Preset => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("preset")); - } - options__ = map_.next_value::<::std::option::Option>()?.map(|x| room_composite_egress_request::Options::Preset(x as i32)); - } - GeneratedField::Advanced => { - if options__.is_some() { - return Err(serde::de::Error::duplicate_field("advanced")); + GeneratedField::Pin => { + if pin__.is_some() { + return Err(serde::de::Error::duplicate_field("pin")); } - options__ = map_.next_value::<::std::option::Option<_>>()?.map(room_composite_egress_request::Options::Advanced) -; + pin__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(RoomCompositeEgressRequest { + Ok(SipDispatchRuleDirect { room_name: room_name__.unwrap_or_default(), - layout: layout__.unwrap_or_default(), - audio_only: audio_only__.unwrap_or_default(), - video_only: video_only__.unwrap_or_default(), - custom_base_url: custom_base_url__.unwrap_or_default(), - file_outputs: file_outputs__.unwrap_or_default(), - stream_outputs: stream_outputs__.unwrap_or_default(), - segment_outputs: segment_outputs__.unwrap_or_default(), - image_outputs: image_outputs__.unwrap_or_default(), - output: output__, - options: options__, + pin: pin__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.RoomCompositeEgressRequest", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.SIPDispatchRuleDirect", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for RoomEgress { +impl serde::Serialize for SipDispatchRuleIndividual { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -13324,45 +15577,38 @@ impl serde::Serialize for RoomEgress { { use serde::ser::SerializeStruct; let mut len = 0; - if self.room.is_some() { - len += 1; - } - if self.participant.is_some() { + if !self.room_prefix.is_empty() { len += 1; } - if self.tracks.is_some() { + if !self.pin.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.RoomEgress", len)?; - if let Some(v) = self.room.as_ref() { - struct_ser.serialize_field("room", v)?; - } - if let Some(v) = self.participant.as_ref() { - struct_ser.serialize_field("participant", v)?; + let mut struct_ser = serializer.serialize_struct("livekit.SIPDispatchRuleIndividual", len)?; + if !self.room_prefix.is_empty() { + struct_ser.serialize_field("roomPrefix", &self.room_prefix)?; } - if let Some(v) = self.tracks.as_ref() { - struct_ser.serialize_field("tracks", v)?; + if !self.pin.is_empty() { + struct_ser.serialize_field("pin", &self.pin)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for RoomEgress { +impl<'de> serde::Deserialize<'de> for SipDispatchRuleIndividual { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "room", - "participant", - "tracks", + "room_prefix", + "roomPrefix", + "pin", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Room, - Participant, - Tracks, + RoomPrefix, + Pin, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -13385,9 +15631,8 @@ impl<'de> serde::Deserialize<'de> for RoomEgress { E: serde::de::Error, { match value { - "room" => Ok(GeneratedField::Room), - "participant" => Ok(GeneratedField::Participant), - "tracks" => Ok(GeneratedField::Tracks), + "roomPrefix" | "room_prefix" => Ok(GeneratedField::RoomPrefix), + "pin" => Ok(GeneratedField::Pin), _ => Ok(GeneratedField::__SkipField__), } } @@ -13397,55 +15642,47 @@ impl<'de> serde::Deserialize<'de> for RoomEgress { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = RoomEgress; + type Value = SipDispatchRuleIndividual; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.RoomEgress") + formatter.write_str("struct livekit.SIPDispatchRuleIndividual") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut room__ = None; - let mut participant__ = None; - let mut tracks__ = None; + let mut room_prefix__ = None; + let mut pin__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Room => { - if room__.is_some() { - return Err(serde::de::Error::duplicate_field("room")); - } - room__ = map_.next_value()?; - } - GeneratedField::Participant => { - if participant__.is_some() { - return Err(serde::de::Error::duplicate_field("participant")); + GeneratedField::RoomPrefix => { + if room_prefix__.is_some() { + return Err(serde::de::Error::duplicate_field("roomPrefix")); } - participant__ = map_.next_value()?; + room_prefix__ = Some(map_.next_value()?); } - GeneratedField::Tracks => { - if tracks__.is_some() { - return Err(serde::de::Error::duplicate_field("tracks")); + GeneratedField::Pin => { + if pin__.is_some() { + return Err(serde::de::Error::duplicate_field("pin")); } - tracks__ = map_.next_value()?; + pin__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(RoomEgress { - room: room__, - participant: participant__, - tracks: tracks__, + Ok(SipDispatchRuleIndividual { + room_prefix: room_prefix__.unwrap_or_default(), + pin: pin__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.RoomEgress", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.SIPDispatchRuleIndividual", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for RoomParticipantIdentity { +impl serde::Serialize for SipDispatchRuleInfo { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -13453,37 +15690,56 @@ impl serde::Serialize for RoomParticipantIdentity { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.room.is_empty() { + if !self.sip_dispatch_rule_id.is_empty() { len += 1; } - if !self.identity.is_empty() { + if self.rule.is_some() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.RoomParticipantIdentity", len)?; - if !self.room.is_empty() { - struct_ser.serialize_field("room", &self.room)?; + if !self.trunk_ids.is_empty() { + len += 1; } - if !self.identity.is_empty() { - struct_ser.serialize_field("identity", &self.identity)?; + if self.hide_phone_number { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.SIPDispatchRuleInfo", len)?; + if !self.sip_dispatch_rule_id.is_empty() { + struct_ser.serialize_field("sipDispatchRuleId", &self.sip_dispatch_rule_id)?; + } + if let Some(v) = self.rule.as_ref() { + struct_ser.serialize_field("rule", v)?; + } + if !self.trunk_ids.is_empty() { + struct_ser.serialize_field("trunkIds", &self.trunk_ids)?; + } + if self.hide_phone_number { + struct_ser.serialize_field("hidePhoneNumber", &self.hide_phone_number)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for RoomParticipantIdentity { +impl<'de> serde::Deserialize<'de> for SipDispatchRuleInfo { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "room", - "identity", + "sip_dispatch_rule_id", + "sipDispatchRuleId", + "rule", + "trunk_ids", + "trunkIds", + "hide_phone_number", + "hidePhoneNumber", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Room, - Identity, + SipDispatchRuleId, + Rule, + TrunkIds, + HidePhoneNumber, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -13506,8 +15762,10 @@ impl<'de> serde::Deserialize<'de> for RoomParticipantIdentity { E: serde::de::Error, { match value { - "room" => Ok(GeneratedField::Room), - "identity" => Ok(GeneratedField::Identity), + "sipDispatchRuleId" | "sip_dispatch_rule_id" => Ok(GeneratedField::SipDispatchRuleId), + "rule" => Ok(GeneratedField::Rule), + "trunkIds" | "trunk_ids" => Ok(GeneratedField::TrunkIds), + "hidePhoneNumber" | "hide_phone_number" => Ok(GeneratedField::HidePhoneNumber), _ => Ok(GeneratedField::__SkipField__), } } @@ -13517,47 +15775,63 @@ impl<'de> serde::Deserialize<'de> for RoomParticipantIdentity { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = RoomParticipantIdentity; + type Value = SipDispatchRuleInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.RoomParticipantIdentity") + formatter.write_str("struct livekit.SIPDispatchRuleInfo") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut room__ = None; - let mut identity__ = None; + let mut sip_dispatch_rule_id__ = None; + let mut rule__ = None; + let mut trunk_ids__ = None; + let mut hide_phone_number__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Room => { - if room__.is_some() { - return Err(serde::de::Error::duplicate_field("room")); + GeneratedField::SipDispatchRuleId => { + if sip_dispatch_rule_id__.is_some() { + return Err(serde::de::Error::duplicate_field("sipDispatchRuleId")); } - room__ = Some(map_.next_value()?); + sip_dispatch_rule_id__ = Some(map_.next_value()?); } - GeneratedField::Identity => { - if identity__.is_some() { - return Err(serde::de::Error::duplicate_field("identity")); + GeneratedField::Rule => { + if rule__.is_some() { + return Err(serde::de::Error::duplicate_field("rule")); } - identity__ = Some(map_.next_value()?); + rule__ = map_.next_value()?; + } + GeneratedField::TrunkIds => { + if trunk_ids__.is_some() { + return Err(serde::de::Error::duplicate_field("trunkIds")); + } + trunk_ids__ = Some(map_.next_value()?); + } + GeneratedField::HidePhoneNumber => { + if hide_phone_number__.is_some() { + return Err(serde::de::Error::duplicate_field("hidePhoneNumber")); + } + hide_phone_number__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(RoomParticipantIdentity { - room: room__.unwrap_or_default(), - identity: identity__.unwrap_or_default(), + Ok(SipDispatchRuleInfo { + sip_dispatch_rule_id: sip_dispatch_rule_id__.unwrap_or_default(), + rule: rule__, + trunk_ids: trunk_ids__.unwrap_or_default(), + hide_phone_number: hide_phone_number__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.RoomParticipantIdentity", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.SIPDispatchRuleInfo", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for RoomUpdate { +impl serde::Serialize for SipParticipantInfo { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -13565,29 +15839,48 @@ impl serde::Serialize for RoomUpdate { { use serde::ser::SerializeStruct; let mut len = 0; - if self.room.is_some() { + if !self.participant_id.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.RoomUpdate", len)?; - if let Some(v) = self.room.as_ref() { - struct_ser.serialize_field("room", v)?; + if !self.participant_identity.is_empty() { + len += 1; + } + if !self.room_name.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.SIPParticipantInfo", len)?; + if !self.participant_id.is_empty() { + struct_ser.serialize_field("participantId", &self.participant_id)?; + } + if !self.participant_identity.is_empty() { + struct_ser.serialize_field("participantIdentity", &self.participant_identity)?; + } + if !self.room_name.is_empty() { + struct_ser.serialize_field("roomName", &self.room_name)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for RoomUpdate { +impl<'de> serde::Deserialize<'de> for SipParticipantInfo { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "room", + "participant_id", + "participantId", + "participant_identity", + "participantIdentity", + "room_name", + "roomName", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - Room, + ParticipantId, + ParticipantIdentity, + RoomName, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -13610,7 +15903,9 @@ impl<'de> serde::Deserialize<'de> for RoomUpdate { E: serde::de::Error, { match value { - "room" => Ok(GeneratedField::Room), + "participantId" | "participant_id" => Ok(GeneratedField::ParticipantId), + "participantIdentity" | "participant_identity" => Ok(GeneratedField::ParticipantIdentity), + "roomName" | "room_name" => Ok(GeneratedField::RoomName), _ => Ok(GeneratedField::__SkipField__), } } @@ -13620,39 +15915,55 @@ impl<'de> serde::Deserialize<'de> for RoomUpdate { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = RoomUpdate; + type Value = SipParticipantInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.RoomUpdate") + formatter.write_str("struct livekit.SIPParticipantInfo") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut room__ = None; + let mut participant_id__ = None; + let mut participant_identity__ = None; + let mut room_name__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::Room => { - if room__.is_some() { - return Err(serde::de::Error::duplicate_field("room")); + GeneratedField::ParticipantId => { + if participant_id__.is_some() { + return Err(serde::de::Error::duplicate_field("participantId")); + } + participant_id__ = Some(map_.next_value()?); + } + GeneratedField::ParticipantIdentity => { + if participant_identity__.is_some() { + return Err(serde::de::Error::duplicate_field("participantIdentity")); + } + participant_identity__ = Some(map_.next_value()?); + } + GeneratedField::RoomName => { + if room_name__.is_some() { + return Err(serde::de::Error::duplicate_field("roomName")); } - room__ = map_.next_value()?; + room_name__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(RoomUpdate { - room: room__, + Ok(SipParticipantInfo { + participant_id: participant_id__.unwrap_or_default(), + participant_identity: participant_identity__.unwrap_or_default(), + room_name: room_name__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.RoomUpdate", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.SIPParticipantInfo", FIELDS, GeneratedVisitor) } } -impl serde::Serialize for S3Upload { +impl serde::Serialize for SipTrunkInfo { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result where @@ -13660,96 +15971,111 @@ impl serde::Serialize for S3Upload { { use serde::ser::SerializeStruct; let mut len = 0; - if !self.access_key.is_empty() { + if !self.sip_trunk_id.is_empty() { len += 1; } - if !self.secret.is_empty() { + if !self.inbound_addresses.is_empty() { len += 1; } - if !self.region.is_empty() { + if !self.outbound_address.is_empty() { len += 1; } - if !self.endpoint.is_empty() { + if !self.outbound_number.is_empty() { len += 1; } - if !self.bucket.is_empty() { + if !self.inbound_numbers_regex.is_empty() { len += 1; } - if self.force_path_style { + if !self.inbound_numbers.is_empty() { len += 1; } - if !self.metadata.is_empty() { + if !self.inbound_username.is_empty() { len += 1; } - if !self.tagging.is_empty() { + if !self.inbound_password.is_empty() { len += 1; } - if !self.content_disposition.is_empty() { + if !self.outbound_username.is_empty() { len += 1; } - let mut struct_ser = serializer.serialize_struct("livekit.S3Upload", len)?; - if !self.access_key.is_empty() { - struct_ser.serialize_field("accessKey", &self.access_key)?; + if !self.outbound_password.is_empty() { + len += 1; } - if !self.secret.is_empty() { - struct_ser.serialize_field("secret", &self.secret)?; + let mut struct_ser = serializer.serialize_struct("livekit.SIPTrunkInfo", len)?; + if !self.sip_trunk_id.is_empty() { + struct_ser.serialize_field("sipTrunkId", &self.sip_trunk_id)?; } - if !self.region.is_empty() { - struct_ser.serialize_field("region", &self.region)?; + if !self.inbound_addresses.is_empty() { + struct_ser.serialize_field("inboundAddresses", &self.inbound_addresses)?; } - if !self.endpoint.is_empty() { - struct_ser.serialize_field("endpoint", &self.endpoint)?; + if !self.outbound_address.is_empty() { + struct_ser.serialize_field("outboundAddress", &self.outbound_address)?; } - if !self.bucket.is_empty() { - struct_ser.serialize_field("bucket", &self.bucket)?; + if !self.outbound_number.is_empty() { + struct_ser.serialize_field("outboundNumber", &self.outbound_number)?; } - if self.force_path_style { - struct_ser.serialize_field("forcePathStyle", &self.force_path_style)?; + if !self.inbound_numbers_regex.is_empty() { + struct_ser.serialize_field("inboundNumbersRegex", &self.inbound_numbers_regex)?; } - if !self.metadata.is_empty() { - struct_ser.serialize_field("metadata", &self.metadata)?; + if !self.inbound_numbers.is_empty() { + struct_ser.serialize_field("inboundNumbers", &self.inbound_numbers)?; } - if !self.tagging.is_empty() { - struct_ser.serialize_field("tagging", &self.tagging)?; + if !self.inbound_username.is_empty() { + struct_ser.serialize_field("inboundUsername", &self.inbound_username)?; } - if !self.content_disposition.is_empty() { - struct_ser.serialize_field("contentDisposition", &self.content_disposition)?; + if !self.inbound_password.is_empty() { + struct_ser.serialize_field("inboundPassword", &self.inbound_password)?; + } + if !self.outbound_username.is_empty() { + struct_ser.serialize_field("outboundUsername", &self.outbound_username)?; + } + if !self.outbound_password.is_empty() { + struct_ser.serialize_field("outboundPassword", &self.outbound_password)?; } struct_ser.end() } } -impl<'de> serde::Deserialize<'de> for S3Upload { +impl<'de> serde::Deserialize<'de> for SipTrunkInfo { #[allow(deprecated)] fn deserialize(deserializer: D) -> std::result::Result where D: serde::Deserializer<'de>, { const FIELDS: &[&str] = &[ - "access_key", - "accessKey", - "secret", - "region", - "endpoint", - "bucket", - "force_path_style", - "forcePathStyle", - "metadata", - "tagging", - "content_disposition", - "contentDisposition", + "sip_trunk_id", + "sipTrunkId", + "inbound_addresses", + "inboundAddresses", + "outbound_address", + "outboundAddress", + "outbound_number", + "outboundNumber", + "inbound_numbers_regex", + "inboundNumbersRegex", + "inbound_numbers", + "inboundNumbers", + "inbound_username", + "inboundUsername", + "inbound_password", + "inboundPassword", + "outbound_username", + "outboundUsername", + "outbound_password", + "outboundPassword", ]; #[allow(clippy::enum_variant_names)] enum GeneratedField { - AccessKey, - Secret, - Region, - Endpoint, - Bucket, - ForcePathStyle, - Metadata, - Tagging, - ContentDisposition, + SipTrunkId, + InboundAddresses, + OutboundAddress, + OutboundNumber, + InboundNumbersRegex, + InboundNumbers, + InboundUsername, + InboundPassword, + OutboundUsername, + OutboundPassword, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -13772,15 +16098,16 @@ impl<'de> serde::Deserialize<'de> for S3Upload { E: serde::de::Error, { match value { - "accessKey" | "access_key" => Ok(GeneratedField::AccessKey), - "secret" => Ok(GeneratedField::Secret), - "region" => Ok(GeneratedField::Region), - "endpoint" => Ok(GeneratedField::Endpoint), - "bucket" => Ok(GeneratedField::Bucket), - "forcePathStyle" | "force_path_style" => Ok(GeneratedField::ForcePathStyle), - "metadata" => Ok(GeneratedField::Metadata), - "tagging" => Ok(GeneratedField::Tagging), - "contentDisposition" | "content_disposition" => Ok(GeneratedField::ContentDisposition), + "sipTrunkId" | "sip_trunk_id" => Ok(GeneratedField::SipTrunkId), + "inboundAddresses" | "inbound_addresses" => Ok(GeneratedField::InboundAddresses), + "outboundAddress" | "outbound_address" => Ok(GeneratedField::OutboundAddress), + "outboundNumber" | "outbound_number" => Ok(GeneratedField::OutboundNumber), + "inboundNumbersRegex" | "inbound_numbers_regex" => Ok(GeneratedField::InboundNumbersRegex), + "inboundNumbers" | "inbound_numbers" => Ok(GeneratedField::InboundNumbers), + "inboundUsername" | "inbound_username" => Ok(GeneratedField::InboundUsername), + "inboundPassword" | "inbound_password" => Ok(GeneratedField::InboundPassword), + "outboundUsername" | "outbound_username" => Ok(GeneratedField::OutboundUsername), + "outboundPassword" | "outbound_password" => Ok(GeneratedField::OutboundPassword), _ => Ok(GeneratedField::__SkipField__), } } @@ -13790,102 +16117,108 @@ impl<'de> serde::Deserialize<'de> for S3Upload { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = S3Upload; + type Value = SipTrunkInfo; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.S3Upload") + formatter.write_str("struct livekit.SIPTrunkInfo") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut access_key__ = None; - let mut secret__ = None; - let mut region__ = None; - let mut endpoint__ = None; - let mut bucket__ = None; - let mut force_path_style__ = None; - let mut metadata__ = None; - let mut tagging__ = None; - let mut content_disposition__ = None; + let mut sip_trunk_id__ = None; + let mut inbound_addresses__ = None; + let mut outbound_address__ = None; + let mut outbound_number__ = None; + let mut inbound_numbers_regex__ = None; + let mut inbound_numbers__ = None; + let mut inbound_username__ = None; + let mut inbound_password__ = None; + let mut outbound_username__ = None; + let mut outbound_password__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::AccessKey => { - if access_key__.is_some() { - return Err(serde::de::Error::duplicate_field("accessKey")); + GeneratedField::SipTrunkId => { + if sip_trunk_id__.is_some() { + return Err(serde::de::Error::duplicate_field("sipTrunkId")); } - access_key__ = Some(map_.next_value()?); + sip_trunk_id__ = Some(map_.next_value()?); } - GeneratedField::Secret => { - if secret__.is_some() { - return Err(serde::de::Error::duplicate_field("secret")); + GeneratedField::InboundAddresses => { + if inbound_addresses__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundAddresses")); } - secret__ = Some(map_.next_value()?); + inbound_addresses__ = Some(map_.next_value()?); } - GeneratedField::Region => { - if region__.is_some() { - return Err(serde::de::Error::duplicate_field("region")); + GeneratedField::OutboundAddress => { + if outbound_address__.is_some() { + return Err(serde::de::Error::duplicate_field("outboundAddress")); } - region__ = Some(map_.next_value()?); + outbound_address__ = Some(map_.next_value()?); } - GeneratedField::Endpoint => { - if endpoint__.is_some() { - return Err(serde::de::Error::duplicate_field("endpoint")); + GeneratedField::OutboundNumber => { + if outbound_number__.is_some() { + return Err(serde::de::Error::duplicate_field("outboundNumber")); } - endpoint__ = Some(map_.next_value()?); + outbound_number__ = Some(map_.next_value()?); } - GeneratedField::Bucket => { - if bucket__.is_some() { - return Err(serde::de::Error::duplicate_field("bucket")); + GeneratedField::InboundNumbersRegex => { + if inbound_numbers_regex__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundNumbersRegex")); } - bucket__ = Some(map_.next_value()?); + inbound_numbers_regex__ = Some(map_.next_value()?); } - GeneratedField::ForcePathStyle => { - if force_path_style__.is_some() { - return Err(serde::de::Error::duplicate_field("forcePathStyle")); + GeneratedField::InboundNumbers => { + if inbound_numbers__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundNumbers")); } - force_path_style__ = Some(map_.next_value()?); + inbound_numbers__ = Some(map_.next_value()?); } - GeneratedField::Metadata => { - if metadata__.is_some() { - return Err(serde::de::Error::duplicate_field("metadata")); + GeneratedField::InboundUsername => { + if inbound_username__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundUsername")); } - metadata__ = Some( - map_.next_value::>()? - ); + inbound_username__ = Some(map_.next_value()?); } - GeneratedField::Tagging => { - if tagging__.is_some() { - return Err(serde::de::Error::duplicate_field("tagging")); + GeneratedField::InboundPassword => { + if inbound_password__.is_some() { + return Err(serde::de::Error::duplicate_field("inboundPassword")); } - tagging__ = Some(map_.next_value()?); + inbound_password__ = Some(map_.next_value()?); } - GeneratedField::ContentDisposition => { - if content_disposition__.is_some() { - return Err(serde::de::Error::duplicate_field("contentDisposition")); + GeneratedField::OutboundUsername => { + if outbound_username__.is_some() { + return Err(serde::de::Error::duplicate_field("outboundUsername")); } - content_disposition__ = Some(map_.next_value()?); + outbound_username__ = Some(map_.next_value()?); + } + GeneratedField::OutboundPassword => { + if outbound_password__.is_some() { + return Err(serde::de::Error::duplicate_field("outboundPassword")); + } + outbound_password__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(S3Upload { - access_key: access_key__.unwrap_or_default(), - secret: secret__.unwrap_or_default(), - region: region__.unwrap_or_default(), - endpoint: endpoint__.unwrap_or_default(), - bucket: bucket__.unwrap_or_default(), - force_path_style: force_path_style__.unwrap_or_default(), - metadata: metadata__.unwrap_or_default(), - tagging: tagging__.unwrap_or_default(), - content_disposition: content_disposition__.unwrap_or_default(), + Ok(SipTrunkInfo { + sip_trunk_id: sip_trunk_id__.unwrap_or_default(), + inbound_addresses: inbound_addresses__.unwrap_or_default(), + outbound_address: outbound_address__.unwrap_or_default(), + outbound_number: outbound_number__.unwrap_or_default(), + inbound_numbers_regex: inbound_numbers_regex__.unwrap_or_default(), + inbound_numbers: inbound_numbers__.unwrap_or_default(), + inbound_username: inbound_username__.unwrap_or_default(), + inbound_password: inbound_password__.unwrap_or_default(), + outbound_username: outbound_username__.unwrap_or_default(), + outbound_password: outbound_password__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.S3Upload", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.SIPTrunkInfo", FIELDS, GeneratedVisitor) } } impl serde::Serialize for SegmentedFileOutput { @@ -15241,6 +17574,12 @@ impl serde::Serialize for SignalRequest { signal_request::Message::PingReq(v) => { struct_ser.serialize_field("pingReq", v)?; } + signal_request::Message::UpdateAudioTrack(v) => { + struct_ser.serialize_field("updateAudioTrack", v)?; + } + signal_request::Message::UpdateVideoTrack(v) => { + struct_ser.serialize_field("updateVideoTrack", v)?; + } } } struct_ser.end() @@ -15275,6 +17614,10 @@ impl<'de> serde::Deserialize<'de> for SignalRequest { "updateMetadata", "ping_req", "pingReq", + "update_audio_track", + "updateAudioTrack", + "update_video_track", + "updateVideoTrack", ]; #[allow(clippy::enum_variant_names)] @@ -15294,6 +17637,8 @@ impl<'de> serde::Deserialize<'de> for SignalRequest { Ping, UpdateMetadata, PingReq, + UpdateAudioTrack, + UpdateVideoTrack, __SkipField__, } impl<'de> serde::Deserialize<'de> for GeneratedField { @@ -15331,6 +17676,8 @@ impl<'de> serde::Deserialize<'de> for SignalRequest { "ping" => Ok(GeneratedField::Ping), "updateMetadata" | "update_metadata" => Ok(GeneratedField::UpdateMetadata), "pingReq" | "ping_req" => Ok(GeneratedField::PingReq), + "updateAudioTrack" | "update_audio_track" => Ok(GeneratedField::UpdateAudioTrack), + "updateVideoTrack" | "update_video_track" => Ok(GeneratedField::UpdateVideoTrack), _ => Ok(GeneratedField::__SkipField__), } } @@ -15455,6 +17802,20 @@ impl<'de> serde::Deserialize<'de> for SignalRequest { return Err(serde::de::Error::duplicate_field("pingReq")); } message__ = map_.next_value::<::std::option::Option<_>>()?.map(signal_request::Message::PingReq) +; + } + GeneratedField::UpdateAudioTrack => { + if message__.is_some() { + return Err(serde::de::Error::duplicate_field("updateAudioTrack")); + } + message__ = map_.next_value::<::std::option::Option<_>>()?.map(signal_request::Message::UpdateAudioTrack) +; + } + GeneratedField::UpdateVideoTrack => { + if message__.is_some() { + return Err(serde::de::Error::duplicate_field("updateVideoTrack")); + } + message__ = map_.next_value::<::std::option::Option<_>>()?.map(signal_request::Message::UpdateVideoTrack) ; } GeneratedField::__SkipField__ => { @@ -16294,60 +18655,174 @@ impl<'de> serde::Deserialize<'de> for SimulcastCodecInfo { } struct GeneratedVisitor; impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { - type Value = SimulcastCodecInfo; + type Value = SimulcastCodecInfo; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.SimulcastCodecInfo") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut mime_type__ = None; + let mut mid__ = None; + let mut cid__ = None; + let mut layers__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::MimeType => { + if mime_type__.is_some() { + return Err(serde::de::Error::duplicate_field("mimeType")); + } + mime_type__ = Some(map_.next_value()?); + } + GeneratedField::Mid => { + if mid__.is_some() { + return Err(serde::de::Error::duplicate_field("mid")); + } + mid__ = Some(map_.next_value()?); + } + GeneratedField::Cid => { + if cid__.is_some() { + return Err(serde::de::Error::duplicate_field("cid")); + } + cid__ = Some(map_.next_value()?); + } + GeneratedField::Layers => { + if layers__.is_some() { + return Err(serde::de::Error::duplicate_field("layers")); + } + layers__ = Some(map_.next_value()?); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(SimulcastCodecInfo { + mime_type: mime_type__.unwrap_or_default(), + mid: mid__.unwrap_or_default(), + cid: cid__.unwrap_or_default(), + layers: layers__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.SimulcastCodecInfo", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for SipDtmf { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if self.code != 0 { + len += 1; + } + if !self.digit.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.SipDTMF", len)?; + if self.code != 0 { + struct_ser.serialize_field("code", &self.code)?; + } + if !self.digit.is_empty() { + struct_ser.serialize_field("digit", &self.digit)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for SipDtmf { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "code", + "digit", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + Code, + Digit, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "code" => Ok(GeneratedField::Code), + "digit" => Ok(GeneratedField::Digit), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = SipDtmf; fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - formatter.write_str("struct livekit.SimulcastCodecInfo") + formatter.write_str("struct livekit.SipDTMF") } - fn visit_map(self, mut map_: V) -> std::result::Result + fn visit_map(self, mut map_: V) -> std::result::Result where V: serde::de::MapAccess<'de>, { - let mut mime_type__ = None; - let mut mid__ = None; - let mut cid__ = None; - let mut layers__ = None; + let mut code__ = None; + let mut digit__ = None; while let Some(k) = map_.next_key()? { match k { - GeneratedField::MimeType => { - if mime_type__.is_some() { - return Err(serde::de::Error::duplicate_field("mimeType")); - } - mime_type__ = Some(map_.next_value()?); - } - GeneratedField::Mid => { - if mid__.is_some() { - return Err(serde::de::Error::duplicate_field("mid")); + GeneratedField::Code => { + if code__.is_some() { + return Err(serde::de::Error::duplicate_field("code")); } - mid__ = Some(map_.next_value()?); - } - GeneratedField::Cid => { - if cid__.is_some() { - return Err(serde::de::Error::duplicate_field("cid")); - } - cid__ = Some(map_.next_value()?); + code__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; } - GeneratedField::Layers => { - if layers__.is_some() { - return Err(serde::de::Error::duplicate_field("layers")); + GeneratedField::Digit => { + if digit__.is_some() { + return Err(serde::de::Error::duplicate_field("digit")); } - layers__ = Some(map_.next_value()?); + digit__ = Some(map_.next_value()?); } GeneratedField::__SkipField__ => { let _ = map_.next_value::()?; } } } - Ok(SimulcastCodecInfo { - mime_type: mime_type__.unwrap_or_default(), - mid: mid__.unwrap_or_default(), - cid: cid__.unwrap_or_default(), - layers: layers__.unwrap_or_default(), + Ok(SipDtmf { + code: code__.unwrap_or_default(), + digit: digit__.unwrap_or_default(), }) } } - deserializer.deserialize_struct("livekit.SimulcastCodecInfo", FIELDS, GeneratedVisitor) + deserializer.deserialize_struct("livekit.SipDTMF", FIELDS, GeneratedVisitor) } } impl serde::Serialize for SpeakerInfo { @@ -20422,6 +22897,257 @@ impl<'de> serde::Deserialize<'de> for UpdateLayoutRequest { deserializer.deserialize_struct("livekit.UpdateLayoutRequest", FIELDS, GeneratedVisitor) } } +impl serde::Serialize for UpdateLocalAudioTrack { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.track_sid.is_empty() { + len += 1; + } + if !self.features.is_empty() { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.UpdateLocalAudioTrack", len)?; + if !self.track_sid.is_empty() { + struct_ser.serialize_field("trackSid", &self.track_sid)?; + } + if !self.features.is_empty() { + let v = self.features.iter().cloned().map(|v| { + AudioTrackFeature::try_from(v) + .map_err(|_| serde::ser::Error::custom(format!("Invalid variant {}", v))) + }).collect::, _>>()?; + struct_ser.serialize_field("features", &v)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for UpdateLocalAudioTrack { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "track_sid", + "trackSid", + "features", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + TrackSid, + Features, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "trackSid" | "track_sid" => Ok(GeneratedField::TrackSid), + "features" => Ok(GeneratedField::Features), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = UpdateLocalAudioTrack; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.UpdateLocalAudioTrack") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut track_sid__ = None; + let mut features__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::TrackSid => { + if track_sid__.is_some() { + return Err(serde::de::Error::duplicate_field("trackSid")); + } + track_sid__ = Some(map_.next_value()?); + } + GeneratedField::Features => { + if features__.is_some() { + return Err(serde::de::Error::duplicate_field("features")); + } + features__ = Some(map_.next_value::>()?.into_iter().map(|x| x as i32).collect()); + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(UpdateLocalAudioTrack { + track_sid: track_sid__.unwrap_or_default(), + features: features__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.UpdateLocalAudioTrack", FIELDS, GeneratedVisitor) + } +} +impl serde::Serialize for UpdateLocalVideoTrack { + #[allow(deprecated)] + fn serialize(&self, serializer: S) -> std::result::Result + where + S: serde::Serializer, + { + use serde::ser::SerializeStruct; + let mut len = 0; + if !self.track_sid.is_empty() { + len += 1; + } + if self.width != 0 { + len += 1; + } + if self.height != 0 { + len += 1; + } + let mut struct_ser = serializer.serialize_struct("livekit.UpdateLocalVideoTrack", len)?; + if !self.track_sid.is_empty() { + struct_ser.serialize_field("trackSid", &self.track_sid)?; + } + if self.width != 0 { + struct_ser.serialize_field("width", &self.width)?; + } + if self.height != 0 { + struct_ser.serialize_field("height", &self.height)?; + } + struct_ser.end() + } +} +impl<'de> serde::Deserialize<'de> for UpdateLocalVideoTrack { + #[allow(deprecated)] + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + const FIELDS: &[&str] = &[ + "track_sid", + "trackSid", + "width", + "height", + ]; + + #[allow(clippy::enum_variant_names)] + enum GeneratedField { + TrackSid, + Width, + Height, + __SkipField__, + } + impl<'de> serde::Deserialize<'de> for GeneratedField { + fn deserialize(deserializer: D) -> std::result::Result + where + D: serde::Deserializer<'de>, + { + struct GeneratedVisitor; + + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = GeneratedField; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(formatter, "expected one of: {:?}", &FIELDS) + } + + #[allow(unused_variables)] + fn visit_str(self, value: &str) -> std::result::Result + where + E: serde::de::Error, + { + match value { + "trackSid" | "track_sid" => Ok(GeneratedField::TrackSid), + "width" => Ok(GeneratedField::Width), + "height" => Ok(GeneratedField::Height), + _ => Ok(GeneratedField::__SkipField__), + } + } + } + deserializer.deserialize_identifier(GeneratedVisitor) + } + } + struct GeneratedVisitor; + impl<'de> serde::de::Visitor<'de> for GeneratedVisitor { + type Value = UpdateLocalVideoTrack; + + fn expecting(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + formatter.write_str("struct livekit.UpdateLocalVideoTrack") + } + + fn visit_map(self, mut map_: V) -> std::result::Result + where + V: serde::de::MapAccess<'de>, + { + let mut track_sid__ = None; + let mut width__ = None; + let mut height__ = None; + while let Some(k) = map_.next_key()? { + match k { + GeneratedField::TrackSid => { + if track_sid__.is_some() { + return Err(serde::de::Error::duplicate_field("trackSid")); + } + track_sid__ = Some(map_.next_value()?); + } + GeneratedField::Width => { + if width__.is_some() { + return Err(serde::de::Error::duplicate_field("width")); + } + width__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::Height => { + if height__.is_some() { + return Err(serde::de::Error::duplicate_field("height")); + } + height__ = + Some(map_.next_value::<::pbjson::private::NumberDeserialize<_>>()?.0) + ; + } + GeneratedField::__SkipField__ => { + let _ = map_.next_value::()?; + } + } + } + Ok(UpdateLocalVideoTrack { + track_sid: track_sid__.unwrap_or_default(), + width: width__.unwrap_or_default(), + height: height__.unwrap_or_default(), + }) + } + } + deserializer.deserialize_struct("livekit.UpdateLocalVideoTrack", FIELDS, GeneratedVisitor) + } +} impl serde::Serialize for UpdateParticipantMetadata { #[allow(deprecated)] fn serialize(&self, serializer: S) -> std::result::Result diff --git a/livekit/src/room/mod.rs b/livekit/src/room/mod.rs index d3c545288..9725aaa0e 100644 --- a/livekit/src/room/mod.rs +++ b/livekit/src/room/mod.rs @@ -139,6 +139,11 @@ pub enum RoomEvent { kind: DataPacketKind, participant: Option, }, + SipDTMFReceived { + code: u32, + digit: Option, + participant: Option, + }, E2eeStateChanged { participant: Participant, state: EncryptionState, @@ -176,6 +181,7 @@ pub struct DataPacket { pub topic: Option, pub kind: DataPacketKind, pub destination_sids: Vec, + pub destination_identities: Vec, } impl Default for DataPacket { @@ -185,6 +191,7 @@ impl Default for DataPacket { topic: None, kind: DataPacketKind::Reliable, destination_sids: Vec::new(), + destination_identities: Vec::new(), } } } @@ -560,8 +567,11 @@ impl RoomSession { self.handle_signal_restarted(join_response, tx) } EngineEvent::Disconnected { reason } => self.handle_disconnected(reason), - EngineEvent::Data { payload, topic, kind, participant_sid } => { - self.handle_data(payload, topic, kind, participant_sid); + EngineEvent::Data { payload, topic, kind, participant_sid, participant_identity } => { + self.handle_data(payload, topic, kind, participant_sid, participant_identity); + } + EngineEvent::SipDTMF { code, digit, participant_identity } => { + self.handle_dtmf(code, digit, participant_identity); } EngineEvent::SpeakersChanged { speakers } => self.handle_speakers_changed(speakers), EngineEvent::ConnectionQuality { updates } => { @@ -945,11 +955,21 @@ impl RoomSession { topic: Option, kind: DataPacketKind, participant_sid: Option, + participant_identity: Option, ) { - let participant = - participant_sid.as_ref().map(|sid| self.get_participant_by_sid(sid)).unwrap_or(None); + let mut participant = participant_identity + .as_ref() + .map(|identity| self.get_participant_by_identity(identity)) + .unwrap_or(None); + + if participant.is_none() { + participant = participant_sid + .as_ref() + .map(|sid| self.get_participant_by_sid(sid)) + .unwrap_or(None); + } - if participant.is_none() && participant_sid.is_some() { + if participant.is_none() && (participant_identity.is_some() || participant_sid.is_some()) { // We received a data packet from a participant that is not in the participants list return; } @@ -962,6 +982,25 @@ impl RoomSession { }); } + fn handle_dtmf( + &self, + code: u32, + digit: Option, + participant_identity: Option, + ) { + let participant = participant_identity + .as_ref() + .map(|identity| self.get_participant_by_identity(identity)) + .unwrap_or(None); + + if participant.is_none() && participant_identity.is_some() { + // We received a DTMF from a participant that is not in the participants list + return; + } + + self.dispatcher.dispatch(&RoomEvent::SipDTMFReceived { code, digit, participant }); + } + /// Create a new participant /// Also add it to the participants list fn create_participant( diff --git a/livekit/src/room/participant/local_participant.rs b/livekit/src/room/participant/local_participant.rs index 0b7bbab59..84c2b66af 100644 --- a/livekit/src/room/participant/local_participant.rs +++ b/livekit/src/room/participant/local_participant.rs @@ -271,14 +271,19 @@ impl LocalParticipant { } pub async fn publish_data(&self, packet: DataPacket) -> RoomResult<()> { + let destination_identities: Vec = + packet.destination_identities.into_iter().map(Into::into).collect(); let data = proto::DataPacket { kind: packet.kind as i32, + destination_identities: destination_identities.clone(), value: Some(proto::data_packet::Value::User(proto::UserPacket { payload: packet.payload, topic: packet.topic, destination_sids: packet.destination_sids.into_iter().map(Into::into).collect(), + destination_identities: destination_identities.clone(), ..Default::default() })), + ..Default::default() }; self.inner.rtc_engine.publish_data(&data, packet.kind).await.map_err(Into::into) diff --git a/livekit/src/rtc_engine/mod.rs b/livekit/src/rtc_engine/mod.rs index 1a15a9694..190d8cc71 100644 --- a/livekit/src/rtc_engine/mod.rs +++ b/livekit/src/rtc_engine/mod.rs @@ -26,6 +26,7 @@ use tokio::sync::{ }; pub use self::rtc_session::SessionStats; +use crate::prelude::ParticipantIdentity; use crate::{ id::ParticipantSid, options::TrackPublishOptions, @@ -92,10 +93,16 @@ pub enum EngineEvent { }, Data { participant_sid: Option, + participant_identity: Option, payload: Vec, topic: Option, kind: DataPacketKind, }, + SipDTMF { + participant_identity: Option, + code: u32, + digit: Option, + }, SpeakersChanged { speakers: Vec, }, @@ -387,14 +394,19 @@ impl EngineInner { }); } } - SessionEvent::Data { participant_sid, payload, topic, kind } => { + SessionEvent::Data { participant_sid, participant_identity, payload, topic, kind } => { let _ = self.engine_tx.send(EngineEvent::Data { participant_sid, + participant_identity, payload, topic, kind, }); } + SessionEvent::SipDTMF { participant_identity, code, digit } => { + let _ = + self.engine_tx.send(EngineEvent::SipDTMF { participant_identity, code, digit }); + } SessionEvent::MediaTrack { track, stream, transceiver } => { let _ = self.engine_tx.send(EngineEvent::MediaTrack { track, stream, transceiver }); } diff --git a/livekit/src/rtc_engine/rtc_session.rs b/livekit/src/rtc_engine/rtc_session.rs index 425eb44c7..b395d56f6 100644 --- a/livekit/src/rtc_engine/rtc_session.rs +++ b/livekit/src/rtc_engine/rtc_session.rs @@ -38,6 +38,7 @@ use serde::{Deserialize, Serialize}; use tokio::sync::{mpsc, oneshot, watch}; use super::{rtc_events, EngineError, EngineOptions, EngineResult, SimulateScenario}; +use crate::id::ParticipantIdentity; use crate::{ id::ParticipantSid, options::TrackPublishOptions, @@ -75,10 +76,17 @@ pub enum SessionEvent { Data { // None when the data comes from the ServerSDK (So no real participant) participant_sid: Option, + participant_identity: Option, payload: Vec, topic: Option, kind: DataPacketKind, }, + SipDTMF { + // None when the data comes from the ServerSDK (So no real participant) + participant_identity: Option, + code: u32, + digit: Option, + }, MediaTrack { track: MediaStreamTrack, stream: MediaStream, @@ -563,13 +571,38 @@ impl SessionInner { .not() .then_some(user.participant_sid.clone()); + let participant_identity = if !data.participant_identity.is_empty() { + Some(data.participant_identity.clone()) + } else if !user.participant_identity.is_empty() { + Some(user.participant_identity.clone()) + } else { + None + }; + let _ = self.emitter.send(SessionEvent::Data { kind: data.kind().into(), participant_sid: participant_sid.map(|s| s.try_into().unwrap()), + participant_identity: participant_identity + .map(|s| s.try_into().unwrap()), payload: user.payload.clone(), topic: user.topic.clone(), }); } + proto::data_packet::Value::SipDtmf(dtmf) => { + let participant_identity = data + .participant_identity + .is_empty() + .not() + .then_some(data.participant_identity.clone()); + let digit = dtmf.digit.is_empty().not().then_some(dtmf.digit.clone()); + + let _ = self.emitter.send(SessionEvent::SipDTMF { + participant_identity: participant_identity + .map(|s| s.try_into().unwrap()), + digit: digit.map(|s| s.try_into().unwrap()), + code: dtmf.code, + }); + } proto::data_packet::Value::Speaker(_) => {} } }