1925 lines
80 KiB
Rust
1925 lines
80 KiB
Rust
// This file is @generated by prost-build.
|
|
/// Messages pour la gestion des streams
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct CreateStreamRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub title: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "StreamCategory", tag = "3")]
|
|
pub category: i32,
|
|
#[prost(enumeration = "StreamVisibility", tag = "4")]
|
|
pub visibility: i32,
|
|
#[prost(int64, tag = "5")]
|
|
pub streamer_id: i64,
|
|
#[prost(enumeration = "StreamQuality", tag = "6")]
|
|
pub default_quality: i32,
|
|
#[prost(string, tag = "7")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct CreateStreamResponse {
|
|
#[prost(message, optional, tag = "1")]
|
|
pub stream: ::core::option::Option<Stream>,
|
|
#[prost(string, tag = "2")]
|
|
pub stream_key: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub rtmp_url: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StartStreamRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub streamer_id: i64,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub config: ::core::option::Option<StreamConfig>,
|
|
#[prost(string, tag = "4")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StartStreamResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
#[prost(string, tag = "2")]
|
|
pub stream_url: ::prost::alloc::string::String,
|
|
/// URLs pour différentes qualités
|
|
#[prost(string, repeated, tag = "3")]
|
|
pub hls_urls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
|
|
#[prost(string, tag = "4")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StopStreamRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub streamer_id: i64,
|
|
#[prost(string, tag = "3")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StopStreamResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub summary: ::core::option::Option<StreamSummary>,
|
|
#[prost(string, tag = "3")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetStreamInfoRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListActiveStreamsRequest {
|
|
#[prost(enumeration = "StreamCategory", tag = "1")]
|
|
pub category: i32,
|
|
#[prost(int32, tag = "2")]
|
|
pub page: i32,
|
|
#[prost(int32, tag = "3")]
|
|
pub limit: i32,
|
|
#[prost(enumeration = "StreamSortBy", tag = "4")]
|
|
pub sort_by: i32,
|
|
#[prost(string, tag = "5")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListActiveStreamsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub streams: ::prost::alloc::vec::Vec<Stream>,
|
|
#[prost(int32, tag = "2")]
|
|
pub total: i32,
|
|
#[prost(string, tag = "3")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
/// Messages pour les auditeurs
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct JoinStreamRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub user_id: i64,
|
|
#[prost(enumeration = "StreamQuality", tag = "3")]
|
|
pub preferred_quality: i32,
|
|
#[prost(string, tag = "4")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct JoinStreamResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
#[prost(string, tag = "2")]
|
|
pub stream_url: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "StreamQuality", tag = "3")]
|
|
pub actual_quality: i32,
|
|
/// en millisecondes
|
|
#[prost(int32, tag = "4")]
|
|
pub buffer_duration: i32,
|
|
#[prost(string, tag = "5")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct LeaveStreamRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub user_id: i64,
|
|
#[prost(string, tag = "3")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct LeaveStreamResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
/// en secondes
|
|
#[prost(int64, tag = "2")]
|
|
pub listen_duration: i64,
|
|
#[prost(string, tag = "3")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetListenersRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetListenersResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub listeners: ::prost::alloc::vec::Vec<StreamListener>,
|
|
#[prost(int32, tag = "2")]
|
|
pub total_count: i32,
|
|
#[prost(string, tag = "3")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
/// Messages pour le contrôle audio
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ChangeQualityRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub user_id: i64,
|
|
#[prost(enumeration = "StreamQuality", tag = "3")]
|
|
pub quality: i32,
|
|
#[prost(string, tag = "4")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ChangeQualityResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
#[prost(string, tag = "2")]
|
|
pub new_stream_url: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetAudioMetricsRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct SetVolumeRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub user_id: i64,
|
|
/// 0-100
|
|
#[prost(int32, tag = "3")]
|
|
pub volume: i32,
|
|
#[prost(string, tag = "4")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct SetVolumeResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
#[prost(string, tag = "2")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
/// Messages pour le recording
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StartRecordingRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub streamer_id: i64,
|
|
#[prost(message, optional, tag = "3")]
|
|
pub config: ::core::option::Option<RecordingConfig>,
|
|
#[prost(string, tag = "4")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StartRecordingResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
#[prost(string, tag = "2")]
|
|
pub recording_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StopRecordingRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub recording_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "3")]
|
|
pub streamer_id: i64,
|
|
#[prost(string, tag = "4")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StopRecordingResponse {
|
|
#[prost(bool, tag = "1")]
|
|
pub success: bool,
|
|
#[prost(message, optional, tag = "2")]
|
|
pub recording: ::core::option::Option<Recording>,
|
|
#[prost(string, tag = "3")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetRecordingsRequest {
|
|
#[prost(int64, tag = "1")]
|
|
pub streamer_id: i64,
|
|
#[prost(int32, tag = "2")]
|
|
pub page: i32,
|
|
#[prost(int32, tag = "3")]
|
|
pub limit: i32,
|
|
#[prost(string, tag = "4")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetRecordingsResponse {
|
|
#[prost(message, repeated, tag = "1")]
|
|
pub recordings: ::prost::alloc::vec::Vec<Recording>,
|
|
#[prost(int32, tag = "2")]
|
|
pub total: i32,
|
|
#[prost(string, tag = "3")]
|
|
pub error: ::prost::alloc::string::String,
|
|
}
|
|
/// Messages pour les analytics
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetStreamAnalyticsRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub start_time: i64,
|
|
#[prost(int64, tag = "3")]
|
|
pub end_time: i64,
|
|
#[prost(string, tag = "4")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct GetUserListeningHistoryRequest {
|
|
#[prost(int64, tag = "1")]
|
|
pub user_id: i64,
|
|
#[prost(int32, tag = "2")]
|
|
pub limit: i32,
|
|
#[prost(string, tag = "3")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct SubscribeToStreamEventsRequest {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "StreamEventType", repeated, tag = "2")]
|
|
pub event_types: ::prost::alloc::vec::Vec<i32>,
|
|
#[prost(string, tag = "3")]
|
|
pub auth_token: ::prost::alloc::string::String,
|
|
}
|
|
/// Types de données
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct Stream {
|
|
#[prost(string, tag = "1")]
|
|
pub id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub title: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub description: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "StreamCategory", tag = "4")]
|
|
pub category: i32,
|
|
#[prost(enumeration = "StreamVisibility", tag = "5")]
|
|
pub visibility: i32,
|
|
#[prost(int64, tag = "6")]
|
|
pub streamer_id: i64,
|
|
#[prost(string, tag = "7")]
|
|
pub streamer_username: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "StreamStatus", tag = "8")]
|
|
pub status: i32,
|
|
#[prost(enumeration = "StreamQuality", tag = "9")]
|
|
pub current_quality: i32,
|
|
#[prost(int32, tag = "10")]
|
|
pub listener_count: i32,
|
|
#[prost(int64, tag = "11")]
|
|
pub created_at: i64,
|
|
#[prost(int64, tag = "12")]
|
|
pub started_at: i64,
|
|
/// en secondes
|
|
#[prost(int64, tag = "13")]
|
|
pub duration: i64,
|
|
#[prost(bool, tag = "14")]
|
|
pub is_recording: bool,
|
|
#[prost(message, optional, tag = "15")]
|
|
pub metadata: ::core::option::Option<StreamMetadata>,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StreamConfig {
|
|
#[prost(enumeration = "StreamQuality", tag = "1")]
|
|
pub quality: i32,
|
|
/// kbps
|
|
#[prost(int32, tag = "2")]
|
|
pub bitrate: i32,
|
|
/// Hz
|
|
#[prost(int32, tag = "3")]
|
|
pub sample_rate: i32,
|
|
#[prost(enumeration = "AudioCodec", tag = "4")]
|
|
pub codec: i32,
|
|
#[prost(bool, tag = "5")]
|
|
pub enable_recording: bool,
|
|
#[prost(bool, tag = "6")]
|
|
pub enable_chat: bool,
|
|
#[prost(int32, tag = "7")]
|
|
pub max_listeners: i32,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StreamListener {
|
|
#[prost(int64, tag = "1")]
|
|
pub user_id: i64,
|
|
#[prost(string, tag = "2")]
|
|
pub username: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "StreamQuality", tag = "3")]
|
|
pub current_quality: i32,
|
|
#[prost(int64, tag = "4")]
|
|
pub joined_at: i64,
|
|
#[prost(int64, tag = "5")]
|
|
pub listen_duration: i64,
|
|
#[prost(bool, tag = "6")]
|
|
pub is_active: bool,
|
|
/// géolocalisation
|
|
#[prost(string, tag = "7")]
|
|
pub location: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StreamSummary {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub total_duration: i64,
|
|
#[prost(int32, tag = "3")]
|
|
pub max_listeners: i32,
|
|
#[prost(int32, tag = "4")]
|
|
pub unique_listeners: i32,
|
|
#[prost(int64, tag = "5")]
|
|
pub total_listen_time: i64,
|
|
#[prost(float, tag = "6")]
|
|
pub average_listen_duration: f32,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct AudioMetrics {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int32, tag = "2")]
|
|
pub current_bitrate: i32,
|
|
/// %
|
|
#[prost(int32, tag = "3")]
|
|
pub buffer_health: i32,
|
|
/// millisecondes
|
|
#[prost(float, tag = "4")]
|
|
pub latency: f32,
|
|
#[prost(int32, tag = "5")]
|
|
pub dropped_frames: i32,
|
|
#[prost(message, optional, tag = "6")]
|
|
pub quality_stats: ::core::option::Option<QualityStats>,
|
|
#[prost(int64, tag = "7")]
|
|
pub measured_at: i64,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct QualityStats {
|
|
/// qualité -> nombre d'auditeurs
|
|
#[prost(map = "string, int32", tag = "1")]
|
|
pub quality_distribution: ::std::collections::HashMap<
|
|
::prost::alloc::string::String,
|
|
i32,
|
|
>,
|
|
#[prost(float, tag = "2")]
|
|
pub average_buffer_duration: f32,
|
|
#[prost(int32, tag = "3")]
|
|
pub rebuffer_events: i32,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct Recording {
|
|
#[prost(string, tag = "1")]
|
|
pub id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub title: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "4")]
|
|
pub duration: i64,
|
|
/// bytes
|
|
#[prost(int64, tag = "5")]
|
|
pub file_size: i64,
|
|
#[prost(enumeration = "StreamQuality", tag = "6")]
|
|
pub quality: i32,
|
|
#[prost(enumeration = "AudioCodec", tag = "7")]
|
|
pub codec: i32,
|
|
#[prost(string, tag = "8")]
|
|
pub file_url: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "9")]
|
|
pub thumbnail_url: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "10")]
|
|
pub created_at: i64,
|
|
#[prost(enumeration = "RecordingStatus", tag = "11")]
|
|
pub status: i32,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct RecordingConfig {
|
|
#[prost(enumeration = "StreamQuality", tag = "1")]
|
|
pub quality: i32,
|
|
#[prost(enumeration = "AudioCodec", tag = "2")]
|
|
pub codec: i32,
|
|
#[prost(bool, tag = "3")]
|
|
pub auto_upload: bool,
|
|
#[prost(string, tag = "4")]
|
|
pub title: ::prost::alloc::string::String,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StreamAnalytics {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "2")]
|
|
pub start_time: i64,
|
|
#[prost(int64, tag = "3")]
|
|
pub end_time: i64,
|
|
#[prost(int32, tag = "4")]
|
|
pub unique_listeners: i32,
|
|
#[prost(int32, tag = "5")]
|
|
pub max_concurrent: i32,
|
|
#[prost(int64, tag = "6")]
|
|
pub total_listen_time: i64,
|
|
#[prost(float, tag = "7")]
|
|
pub average_session_duration: f32,
|
|
#[prost(map = "string, int32", tag = "8")]
|
|
pub geographic_distribution: ::std::collections::HashMap<
|
|
::prost::alloc::string::String,
|
|
i32,
|
|
>,
|
|
#[prost(message, repeated, tag = "9")]
|
|
pub hourly_activity: ::prost::alloc::vec::Vec<ListenerActivity>,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListenerActivity {
|
|
#[prost(int64, tag = "1")]
|
|
pub timestamp: i64,
|
|
#[prost(int32, tag = "2")]
|
|
pub listener_count: i32,
|
|
#[prost(int32, tag = "3")]
|
|
pub new_listeners: i32,
|
|
#[prost(int32, tag = "4")]
|
|
pub listeners_left: i32,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct UserListeningHistory {
|
|
#[prost(int64, tag = "1")]
|
|
pub user_id: i64,
|
|
#[prost(message, repeated, tag = "2")]
|
|
pub sessions: ::prost::alloc::vec::Vec<ListeningSession>,
|
|
#[prost(int64, tag = "3")]
|
|
pub total_listen_time: i64,
|
|
#[prost(int32, tag = "4")]
|
|
pub streams_listened: i32,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct ListeningSession {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub stream_title: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub streamer_username: ::prost::alloc::string::String,
|
|
#[prost(int64, tag = "4")]
|
|
pub started_at: i64,
|
|
#[prost(int64, tag = "5")]
|
|
pub duration: i64,
|
|
#[prost(enumeration = "StreamQuality", tag = "6")]
|
|
pub quality: i32,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StreamMetadata {
|
|
#[prost(string, tag = "1")]
|
|
pub current_track: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "2")]
|
|
pub artist: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "3")]
|
|
pub album: ::prost::alloc::string::String,
|
|
#[prost(string, tag = "4")]
|
|
pub genre: ::prost::alloc::string::String,
|
|
#[prost(map = "string, string", tag = "5")]
|
|
pub custom_fields: ::std::collections::HashMap<
|
|
::prost::alloc::string::String,
|
|
::prost::alloc::string::String,
|
|
>,
|
|
}
|
|
#[allow(clippy::derive_partial_eq_without_eq)]
|
|
#[derive(Clone, PartialEq, ::prost::Message)]
|
|
pub struct StreamEvent {
|
|
#[prost(string, tag = "1")]
|
|
pub stream_id: ::prost::alloc::string::String,
|
|
#[prost(enumeration = "StreamEventType", tag = "2")]
|
|
pub r#type: i32,
|
|
#[prost(int64, tag = "3")]
|
|
pub timestamp: i64,
|
|
/// JSON data
|
|
#[prost(string, tag = "4")]
|
|
pub data: ::prost::alloc::string::String,
|
|
}
|
|
/// Énumérations
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum StreamCategory {
|
|
Music = 0,
|
|
Talk = 1,
|
|
Podcast = 2,
|
|
Gaming = 3,
|
|
News = 4,
|
|
Education = 5,
|
|
Entertainment = 6,
|
|
Other = 7,
|
|
}
|
|
impl StreamCategory {
|
|
/// 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 {
|
|
StreamCategory::Music => "MUSIC",
|
|
StreamCategory::Talk => "TALK",
|
|
StreamCategory::Podcast => "PODCAST",
|
|
StreamCategory::Gaming => "GAMING",
|
|
StreamCategory::News => "NEWS",
|
|
StreamCategory::Education => "EDUCATION",
|
|
StreamCategory::Entertainment => "ENTERTAINMENT",
|
|
StreamCategory::Other => "OTHER",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"MUSIC" => Some(Self::Music),
|
|
"TALK" => Some(Self::Talk),
|
|
"PODCAST" => Some(Self::Podcast),
|
|
"GAMING" => Some(Self::Gaming),
|
|
"NEWS" => Some(Self::News),
|
|
"EDUCATION" => Some(Self::Education),
|
|
"ENTERTAINMENT" => Some(Self::Entertainment),
|
|
"OTHER" => Some(Self::Other),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum StreamVisibility {
|
|
PublicStream = 0,
|
|
Unlisted = 1,
|
|
PrivateStream = 2,
|
|
PremiumOnly = 3,
|
|
}
|
|
impl StreamVisibility {
|
|
/// 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 {
|
|
StreamVisibility::PublicStream => "PUBLIC_STREAM",
|
|
StreamVisibility::Unlisted => "UNLISTED",
|
|
StreamVisibility::PrivateStream => "PRIVATE_STREAM",
|
|
StreamVisibility::PremiumOnly => "PREMIUM_ONLY",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"PUBLIC_STREAM" => Some(Self::PublicStream),
|
|
"UNLISTED" => Some(Self::Unlisted),
|
|
"PRIVATE_STREAM" => Some(Self::PrivateStream),
|
|
"PREMIUM_ONLY" => Some(Self::PremiumOnly),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum StreamStatus {
|
|
Created = 0,
|
|
Live = 1,
|
|
Paused = 2,
|
|
Ended = 3,
|
|
Error = 4,
|
|
}
|
|
impl StreamStatus {
|
|
/// 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 {
|
|
StreamStatus::Created => "CREATED",
|
|
StreamStatus::Live => "LIVE",
|
|
StreamStatus::Paused => "PAUSED",
|
|
StreamStatus::Ended => "ENDED",
|
|
StreamStatus::Error => "ERROR",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"CREATED" => Some(Self::Created),
|
|
"LIVE" => Some(Self::Live),
|
|
"PAUSED" => Some(Self::Paused),
|
|
"ENDED" => Some(Self::Ended),
|
|
"ERROR" => Some(Self::Error),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum StreamQuality {
|
|
Auto = 0,
|
|
/// 64 kbps
|
|
Low = 1,
|
|
/// 128 kbps
|
|
Medium = 2,
|
|
/// 256 kbps
|
|
High = 3,
|
|
/// 320 kbps
|
|
Ultra = 4,
|
|
}
|
|
impl StreamQuality {
|
|
/// 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 {
|
|
StreamQuality::Auto => "AUTO",
|
|
StreamQuality::Low => "LOW",
|
|
StreamQuality::Medium => "MEDIUM",
|
|
StreamQuality::High => "HIGH",
|
|
StreamQuality::Ultra => "ULTRA",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"AUTO" => Some(Self::Auto),
|
|
"LOW" => Some(Self::Low),
|
|
"MEDIUM" => Some(Self::Medium),
|
|
"HIGH" => Some(Self::High),
|
|
"ULTRA" => Some(Self::Ultra),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum AudioCodec {
|
|
Mp3 = 0,
|
|
Aac = 1,
|
|
Opus = 2,
|
|
Flac = 3,
|
|
}
|
|
impl AudioCodec {
|
|
/// 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 {
|
|
AudioCodec::Mp3 => "MP3",
|
|
AudioCodec::Aac => "AAC",
|
|
AudioCodec::Opus => "OPUS",
|
|
AudioCodec::Flac => "FLAC",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"MP3" => Some(Self::Mp3),
|
|
"AAC" => Some(Self::Aac),
|
|
"OPUS" => Some(Self::Opus),
|
|
"FLAC" => Some(Self::Flac),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum StreamSortBy {
|
|
Listeners = 0,
|
|
Recent = 1,
|
|
Popular = 2,
|
|
Title = 3,
|
|
}
|
|
impl StreamSortBy {
|
|
/// 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 {
|
|
StreamSortBy::Listeners => "LISTENERS",
|
|
StreamSortBy::Recent => "RECENT",
|
|
StreamSortBy::Popular => "POPULAR",
|
|
StreamSortBy::Title => "TITLE",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"LISTENERS" => Some(Self::Listeners),
|
|
"RECENT" => Some(Self::Recent),
|
|
"POPULAR" => Some(Self::Popular),
|
|
"TITLE" => Some(Self::Title),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum RecordingStatus {
|
|
Recording = 0,
|
|
Processing = 1,
|
|
Completed = 2,
|
|
Failed = 3,
|
|
}
|
|
impl RecordingStatus {
|
|
/// 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 {
|
|
RecordingStatus::Recording => "RECORDING",
|
|
RecordingStatus::Processing => "PROCESSING",
|
|
RecordingStatus::Completed => "COMPLETED",
|
|
RecordingStatus::Failed => "FAILED",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"RECORDING" => Some(Self::Recording),
|
|
"PROCESSING" => Some(Self::Processing),
|
|
"COMPLETED" => Some(Self::Completed),
|
|
"FAILED" => Some(Self::Failed),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
|
|
#[repr(i32)]
|
|
pub enum StreamEventType {
|
|
ListenerJoined = 0,
|
|
ListenerLeft = 1,
|
|
QualityChanged = 2,
|
|
MetadataUpdated = 3,
|
|
StreamPaused = 4,
|
|
StreamResumed = 5,
|
|
ErrorOccurred = 6,
|
|
}
|
|
impl StreamEventType {
|
|
/// 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 {
|
|
StreamEventType::ListenerJoined => "LISTENER_JOINED",
|
|
StreamEventType::ListenerLeft => "LISTENER_LEFT",
|
|
StreamEventType::QualityChanged => "QUALITY_CHANGED",
|
|
StreamEventType::MetadataUpdated => "METADATA_UPDATED",
|
|
StreamEventType::StreamPaused => "STREAM_PAUSED",
|
|
StreamEventType::StreamResumed => "STREAM_RESUMED",
|
|
StreamEventType::ErrorOccurred => "ERROR_OCCURRED",
|
|
}
|
|
}
|
|
/// Creates an enum from field names used in the ProtoBuf definition.
|
|
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
|
|
match value {
|
|
"LISTENER_JOINED" => Some(Self::ListenerJoined),
|
|
"LISTENER_LEFT" => Some(Self::ListenerLeft),
|
|
"QUALITY_CHANGED" => Some(Self::QualityChanged),
|
|
"METADATA_UPDATED" => Some(Self::MetadataUpdated),
|
|
"STREAM_PAUSED" => Some(Self::StreamPaused),
|
|
"STREAM_RESUMED" => Some(Self::StreamResumed),
|
|
"ERROR_OCCURRED" => Some(Self::ErrorOccurred),
|
|
_ => None,
|
|
}
|
|
}
|
|
}
|
|
/// Generated server implementations.
|
|
pub mod stream_service_server {
|
|
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
|
|
use tonic::codegen::*;
|
|
/// Generated trait containing gRPC methods that should be implemented for use with StreamServiceServer.
|
|
#[async_trait]
|
|
pub trait StreamService: Send + Sync + 'static {
|
|
/// Gestion des streams
|
|
async fn create_stream(
|
|
&self,
|
|
request: tonic::Request<super::CreateStreamRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::CreateStreamResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn start_stream(
|
|
&self,
|
|
request: tonic::Request<super::StartStreamRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::StartStreamResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn stop_stream(
|
|
&self,
|
|
request: tonic::Request<super::StopStreamRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::StopStreamResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_stream_info(
|
|
&self,
|
|
request: tonic::Request<super::GetStreamInfoRequest>,
|
|
) -> std::result::Result<tonic::Response<super::Stream>, tonic::Status>;
|
|
async fn list_active_streams(
|
|
&self,
|
|
request: tonic::Request<super::ListActiveStreamsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ListActiveStreamsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
/// Gestion des auditeurs
|
|
async fn join_stream(
|
|
&self,
|
|
request: tonic::Request<super::JoinStreamRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::JoinStreamResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn leave_stream(
|
|
&self,
|
|
request: tonic::Request<super::LeaveStreamRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::LeaveStreamResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_listeners(
|
|
&self,
|
|
request: tonic::Request<super::GetListenersRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetListenersResponse>,
|
|
tonic::Status,
|
|
>;
|
|
/// Contrôle audio
|
|
async fn change_quality(
|
|
&self,
|
|
request: tonic::Request<super::ChangeQualityRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::ChangeQualityResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_audio_metrics(
|
|
&self,
|
|
request: tonic::Request<super::GetAudioMetricsRequest>,
|
|
) -> std::result::Result<tonic::Response<super::AudioMetrics>, tonic::Status>;
|
|
async fn set_volume(
|
|
&self,
|
|
request: tonic::Request<super::SetVolumeRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::SetVolumeResponse>,
|
|
tonic::Status,
|
|
>;
|
|
/// Recording
|
|
async fn start_recording(
|
|
&self,
|
|
request: tonic::Request<super::StartRecordingRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::StartRecordingResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn stop_recording(
|
|
&self,
|
|
request: tonic::Request<super::StopRecordingRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::StopRecordingResponse>,
|
|
tonic::Status,
|
|
>;
|
|
async fn get_recordings(
|
|
&self,
|
|
request: tonic::Request<super::GetRecordingsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::GetRecordingsResponse>,
|
|
tonic::Status,
|
|
>;
|
|
/// Analytics
|
|
async fn get_stream_analytics(
|
|
&self,
|
|
request: tonic::Request<super::GetStreamAnalyticsRequest>,
|
|
) -> std::result::Result<tonic::Response<super::StreamAnalytics>, tonic::Status>;
|
|
async fn get_user_listening_history(
|
|
&self,
|
|
request: tonic::Request<super::GetUserListeningHistoryRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<super::UserListeningHistory>,
|
|
tonic::Status,
|
|
>;
|
|
/// Server streaming response type for the SubscribeToStreamEvents method.
|
|
type SubscribeToStreamEventsStream: tonic::codegen::tokio_stream::Stream<
|
|
Item = std::result::Result<super::StreamEvent, tonic::Status>,
|
|
>
|
|
+ Send
|
|
+ 'static;
|
|
/// Notifications temps réel
|
|
async fn subscribe_to_stream_events(
|
|
&self,
|
|
request: tonic::Request<super::SubscribeToStreamEventsRequest>,
|
|
) -> std::result::Result<
|
|
tonic::Response<Self::SubscribeToStreamEventsStream>,
|
|
tonic::Status,
|
|
>;
|
|
}
|
|
/// Service Stream pour communication avec le module Rust
|
|
#[derive(Debug)]
|
|
pub struct StreamServiceServer<T: StreamService> {
|
|
inner: _Inner<T>,
|
|
accept_compression_encodings: EnabledCompressionEncodings,
|
|
send_compression_encodings: EnabledCompressionEncodings,
|
|
max_decoding_message_size: Option<usize>,
|
|
max_encoding_message_size: Option<usize>,
|
|
}
|
|
struct _Inner<T>(Arc<T>);
|
|
impl<T: StreamService> StreamServiceServer<T> {
|
|
pub fn new(inner: T) -> Self {
|
|
Self::from_arc(Arc::new(inner))
|
|
}
|
|
pub fn from_arc(inner: Arc<T>) -> Self {
|
|
let inner = _Inner(inner);
|
|
Self {
|
|
inner,
|
|
accept_compression_encodings: Default::default(),
|
|
send_compression_encodings: Default::default(),
|
|
max_decoding_message_size: None,
|
|
max_encoding_message_size: None,
|
|
}
|
|
}
|
|
pub fn with_interceptor<F>(
|
|
inner: T,
|
|
interceptor: F,
|
|
) -> InterceptedService<Self, F>
|
|
where
|
|
F: tonic::service::Interceptor,
|
|
{
|
|
InterceptedService::new(Self::new(inner), interceptor)
|
|
}
|
|
/// Enable decompressing requests with the given encoding.
|
|
#[must_use]
|
|
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.accept_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Compress responses with the given encoding, if the client supports it.
|
|
#[must_use]
|
|
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
|
|
self.send_compression_encodings.enable(encoding);
|
|
self
|
|
}
|
|
/// Limits the maximum size of a decoded message.
|
|
///
|
|
/// Default: `4MB`
|
|
#[must_use]
|
|
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
|
|
self.max_decoding_message_size = Some(limit);
|
|
self
|
|
}
|
|
/// Limits the maximum size of an encoded message.
|
|
///
|
|
/// Default: `usize::MAX`
|
|
#[must_use]
|
|
pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
|
|
self.max_encoding_message_size = Some(limit);
|
|
self
|
|
}
|
|
}
|
|
impl<T, B> tonic::codegen::Service<http::Request<B>> for StreamServiceServer<T>
|
|
where
|
|
T: StreamService,
|
|
B: Body + Send + 'static,
|
|
B::Error: Into<StdError> + Send + 'static,
|
|
{
|
|
type Response = http::Response<tonic::body::BoxBody>;
|
|
type Error = std::convert::Infallible;
|
|
type Future = BoxFuture<Self::Response, Self::Error>;
|
|
fn poll_ready(
|
|
&mut self,
|
|
_cx: &mut Context<'_>,
|
|
) -> Poll<std::result::Result<(), Self::Error>> {
|
|
Poll::Ready(Ok(()))
|
|
}
|
|
fn call(&mut self, req: http::Request<B>) -> Self::Future {
|
|
let inner = self.inner.clone();
|
|
match req.uri().path() {
|
|
"/veza.stream.StreamService/CreateStream" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct CreateStreamSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::CreateStreamRequest>
|
|
for CreateStreamSvc<T> {
|
|
type Response = super::CreateStreamResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::CreateStreamRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::create_stream(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = CreateStreamSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/StartStream" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct StartStreamSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::StartStreamRequest>
|
|
for StartStreamSvc<T> {
|
|
type Response = super::StartStreamResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::StartStreamRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::start_stream(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = StartStreamSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/StopStream" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct StopStreamSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::StopStreamRequest>
|
|
for StopStreamSvc<T> {
|
|
type Response = super::StopStreamResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::StopStreamRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::stop_stream(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = StopStreamSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/GetStreamInfo" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetStreamInfoSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::GetStreamInfoRequest>
|
|
for GetStreamInfoSvc<T> {
|
|
type Response = super::Stream;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetStreamInfoRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::get_stream_info(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = GetStreamInfoSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/ListActiveStreams" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ListActiveStreamsSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::ListActiveStreamsRequest>
|
|
for ListActiveStreamsSvc<T> {
|
|
type Response = super::ListActiveStreamsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ListActiveStreamsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::list_active_streams(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = ListActiveStreamsSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/JoinStream" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct JoinStreamSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::JoinStreamRequest>
|
|
for JoinStreamSvc<T> {
|
|
type Response = super::JoinStreamResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::JoinStreamRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::join_stream(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = JoinStreamSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/LeaveStream" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct LeaveStreamSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::LeaveStreamRequest>
|
|
for LeaveStreamSvc<T> {
|
|
type Response = super::LeaveStreamResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::LeaveStreamRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::leave_stream(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = LeaveStreamSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/GetListeners" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetListenersSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::GetListenersRequest>
|
|
for GetListenersSvc<T> {
|
|
type Response = super::GetListenersResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetListenersRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::get_listeners(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = GetListenersSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/ChangeQuality" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct ChangeQualitySvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::ChangeQualityRequest>
|
|
for ChangeQualitySvc<T> {
|
|
type Response = super::ChangeQualityResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::ChangeQualityRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::change_quality(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = ChangeQualitySvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/GetAudioMetrics" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetAudioMetricsSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::GetAudioMetricsRequest>
|
|
for GetAudioMetricsSvc<T> {
|
|
type Response = super::AudioMetrics;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetAudioMetricsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::get_audio_metrics(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = GetAudioMetricsSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/SetVolume" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SetVolumeSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::SetVolumeRequest>
|
|
for SetVolumeSvc<T> {
|
|
type Response = super::SetVolumeResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::SetVolumeRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::set_volume(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = SetVolumeSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/StartRecording" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct StartRecordingSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::StartRecordingRequest>
|
|
for StartRecordingSvc<T> {
|
|
type Response = super::StartRecordingResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::StartRecordingRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::start_recording(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = StartRecordingSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/StopRecording" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct StopRecordingSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::StopRecordingRequest>
|
|
for StopRecordingSvc<T> {
|
|
type Response = super::StopRecordingResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::StopRecordingRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::stop_recording(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = StopRecordingSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/GetRecordings" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetRecordingsSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::GetRecordingsRequest>
|
|
for GetRecordingsSvc<T> {
|
|
type Response = super::GetRecordingsResponse;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetRecordingsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::get_recordings(&inner, request).await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = GetRecordingsSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/GetStreamAnalytics" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetStreamAnalyticsSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::GetStreamAnalyticsRequest>
|
|
for GetStreamAnalyticsSvc<T> {
|
|
type Response = super::StreamAnalytics;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<super::GetStreamAnalyticsRequest>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::get_stream_analytics(&inner, request)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = GetStreamAnalyticsSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/GetUserListeningHistory" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct GetUserListeningHistorySvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::UnaryService<super::GetUserListeningHistoryRequest>
|
|
for GetUserListeningHistorySvc<T> {
|
|
type Response = super::UserListeningHistory;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::Response>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<
|
|
super::GetUserListeningHistoryRequest,
|
|
>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::get_user_listening_history(
|
|
&inner,
|
|
request,
|
|
)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = GetUserListeningHistorySvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.unary(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
"/veza.stream.StreamService/SubscribeToStreamEvents" => {
|
|
#[allow(non_camel_case_types)]
|
|
struct SubscribeToStreamEventsSvc<T: StreamService>(pub Arc<T>);
|
|
impl<
|
|
T: StreamService,
|
|
> tonic::server::ServerStreamingService<
|
|
super::SubscribeToStreamEventsRequest,
|
|
> for SubscribeToStreamEventsSvc<T> {
|
|
type Response = super::StreamEvent;
|
|
type ResponseStream = T::SubscribeToStreamEventsStream;
|
|
type Future = BoxFuture<
|
|
tonic::Response<Self::ResponseStream>,
|
|
tonic::Status,
|
|
>;
|
|
fn call(
|
|
&mut self,
|
|
request: tonic::Request<
|
|
super::SubscribeToStreamEventsRequest,
|
|
>,
|
|
) -> Self::Future {
|
|
let inner = Arc::clone(&self.0);
|
|
let fut = async move {
|
|
<T as StreamService>::subscribe_to_stream_events(
|
|
&inner,
|
|
request,
|
|
)
|
|
.await
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
}
|
|
let accept_compression_encodings = self.accept_compression_encodings;
|
|
let send_compression_encodings = self.send_compression_encodings;
|
|
let max_decoding_message_size = self.max_decoding_message_size;
|
|
let max_encoding_message_size = self.max_encoding_message_size;
|
|
let inner = self.inner.clone();
|
|
let fut = async move {
|
|
let inner = inner.0;
|
|
let method = SubscribeToStreamEventsSvc(inner);
|
|
let codec = tonic::codec::ProstCodec::default();
|
|
let mut grpc = tonic::server::Grpc::new(codec)
|
|
.apply_compression_config(
|
|
accept_compression_encodings,
|
|
send_compression_encodings,
|
|
)
|
|
.apply_max_message_size_config(
|
|
max_decoding_message_size,
|
|
max_encoding_message_size,
|
|
);
|
|
let res = grpc.server_streaming(method, req).await;
|
|
Ok(res)
|
|
};
|
|
Box::pin(fut)
|
|
}
|
|
_ => {
|
|
Box::pin(async move {
|
|
Ok(
|
|
http::Response::builder()
|
|
.status(200)
|
|
.header("grpc-status", "12")
|
|
.header("content-type", "application/grpc")
|
|
.body(empty_body())
|
|
.unwrap(),
|
|
)
|
|
})
|
|
}
|
|
}
|
|
}
|
|
}
|
|
impl<T: StreamService> Clone for StreamServiceServer<T> {
|
|
fn clone(&self) -> Self {
|
|
let inner = self.inner.clone();
|
|
Self {
|
|
inner,
|
|
accept_compression_encodings: self.accept_compression_encodings,
|
|
send_compression_encodings: self.send_compression_encodings,
|
|
max_decoding_message_size: self.max_decoding_message_size,
|
|
max_encoding_message_size: self.max_encoding_message_size,
|
|
}
|
|
}
|
|
}
|
|
impl<T: StreamService> Clone for _Inner<T> {
|
|
fn clone(&self) -> Self {
|
|
Self(Arc::clone(&self.0))
|
|
}
|
|
}
|
|
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
|
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "{:?}", self.0)
|
|
}
|
|
}
|
|
impl<T: StreamService> tonic::server::NamedService for StreamServiceServer<T> {
|
|
const NAME: &'static str = "veza.stream.StreamService";
|
|
}
|
|
}
|