118 lines
2.8 KiB
Rust
118 lines
2.8 KiB
Rust
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
use models::{ProjectId, RoomId, UserId};
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
|
#[serde(rename_all = "snake_case")]
|
|
pub enum VoiceEventType {
|
|
ChannelJoined,
|
|
ChannelLeft,
|
|
MuteUpdated,
|
|
DeafUpdated,
|
|
ScreenShareStarted,
|
|
ScreenShareStopped,
|
|
SpeakingStarted,
|
|
SpeakingStopped,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
#[serde(tag = "type", rename_all = "snake_case")]
|
|
pub enum VoiceEvent {
|
|
ChannelJoined(VoiceChannelJoinedService),
|
|
ChannelLeft(VoiceChannelLeftService),
|
|
MuteUpdated(VoiceMuteUpdatedService),
|
|
DeafUpdated(VoiceDeafUpdatedService),
|
|
ScreenShareStarted(ScreenShareStartedService),
|
|
ScreenShareStopped(ScreenShareStoppedService),
|
|
SpeakingStarted(SpeakingStartedService),
|
|
SpeakingStopped(SpeakingStoppedService),
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct VoiceChannelJoinedService {
|
|
pub room: RoomId,
|
|
pub project: ProjectId,
|
|
pub user: UserId,
|
|
pub muted: bool,
|
|
pub deafened: bool,
|
|
pub video: bool,
|
|
pub joined_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct VoiceChannelLeftService {
|
|
pub room: RoomId,
|
|
pub project: ProjectId,
|
|
pub user: UserId,
|
|
pub left_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct VoiceMuteUpdatedService {
|
|
pub room: RoomId,
|
|
pub user: UserId,
|
|
pub muted: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct VoiceDeafUpdatedService {
|
|
pub room: RoomId,
|
|
pub user: UserId,
|
|
pub deafened: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ScreenShareStartedService {
|
|
pub room: RoomId,
|
|
pub user: UserId,
|
|
pub started_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct ScreenShareStoppedService {
|
|
pub room: RoomId,
|
|
pub user: UserId,
|
|
pub stopped_at: DateTime<Utc>,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct SpeakingStartedService {
|
|
pub room: RoomId,
|
|
pub user: UserId,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
|
pub struct SpeakingStoppedService {
|
|
pub room: RoomId,
|
|
pub user: UserId,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct VoiceJoinClient {
|
|
pub room: RoomId,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct VoiceLeaveClient {
|
|
pub room: RoomId,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct VoiceMuteClient {
|
|
pub room: RoomId,
|
|
pub muted: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct VoiceDeafClient {
|
|
pub room: RoomId,
|
|
pub deafened: bool,
|
|
}
|
|
|
|
#[derive(Debug, Clone, Deserialize, Serialize)]
|
|
pub struct ScreenShareClient {
|
|
pub room: RoomId,
|
|
pub start: bool,
|
|
}
|