Minor doc fixes
This commit is contained in:
parent
06ea17875f
commit
efc2fe2ba3
|
@ -3,8 +3,10 @@ use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Serialize, Default, Clone, PartialEq, Eq)]
|
||||||
/// The identify payload for the webrtc stream;
|
/// The identify payload for the webrtc stream;
|
||||||
|
///
|
||||||
/// Contains info to begin a webrtc connection;
|
/// Contains info to begin a webrtc connection;
|
||||||
/// See https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-identify-payload;
|
///
|
||||||
|
/// See <https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-identify-payload>
|
||||||
pub struct VoiceIdentify {
|
pub struct VoiceIdentify {
|
||||||
server_id: Snowflake,
|
server_id: Snowflake,
|
||||||
user_id: Snowflake,
|
user_id: Snowflake,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
use super::WebSocketEvent;
|
use super::WebSocketEvent;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use serde_json::{value::RawValue, Value};
|
||||||
|
|
||||||
pub use identify::*;
|
pub use identify::*;
|
||||||
pub use ready::*;
|
pub use ready::*;
|
||||||
|
@ -14,40 +15,38 @@ mod session_description;
|
||||||
mod speaking;
|
mod speaking;
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize, Clone)]
|
#[derive(Debug, Default, Serialize, Clone)]
|
||||||
/// The payload used for sending events to the webrtc gateway
|
/// The payload used for sending events to the webrtc gateway.
|
||||||
/// Not tha this is very similar to the regular gateway, except we no longer have a sequence number
|
|
||||||
///
|
///
|
||||||
/// Similar to [WebrtcReceivePayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue]
|
/// Similar to [VoiceGatewayReceivePayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue]
|
||||||
/// Also, we never need to send the event name
|
|
||||||
pub struct VoiceGatewaySendPayload {
|
pub struct VoiceGatewaySendPayload {
|
||||||
#[serde(rename = "op")]
|
#[serde(rename = "op")]
|
||||||
pub op_code: u8,
|
pub op_code: u8,
|
||||||
|
|
||||||
#[serde(rename = "d")]
|
#[serde(rename = "d")]
|
||||||
pub data: serde_json::Value,
|
pub data: Value,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl WebSocketEvent for VoiceGatewaySendPayload {}
|
impl WebSocketEvent for VoiceGatewaySendPayload {}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone)]
|
#[derive(Debug, Deserialize, Clone)]
|
||||||
/// The payload used for receiving events from the webrtc gateway
|
/// The payload used for receiving events from the webrtc gateway.
|
||||||
/// Note that this is very similar to the regular gateway, except we no longer have s or t
|
|
||||||
///
|
///
|
||||||
/// Similar to [WebrtcSendPayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue]
|
/// Note that this is similar to the regular gateway, except we no longer have s or t
|
||||||
/// Also, we never need to sent the event name
|
///
|
||||||
|
/// Similar to [VoiceGatewaySendPayload], except we send a [Value] for d whilst we receive a [serde_json::value::RawValue]
|
||||||
pub struct VoiceGatewayReceivePayload<'a> {
|
pub struct VoiceGatewayReceivePayload<'a> {
|
||||||
#[serde(rename = "op")]
|
#[serde(rename = "op")]
|
||||||
pub op_code: u8,
|
pub op_code: u8,
|
||||||
|
|
||||||
#[serde(borrow)]
|
#[serde(borrow)]
|
||||||
#[serde(rename = "d")]
|
#[serde(rename = "d")]
|
||||||
pub data: &'a serde_json::value::RawValue,
|
pub data: &'a RawValue,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> WebSocketEvent for VoiceGatewayReceivePayload<'a> {}
|
impl<'a> WebSocketEvent for VoiceGatewayReceivePayload<'a> {}
|
||||||
|
|
||||||
/// The modes of encryption available in webrtc connections;
|
/// The modes of encryption available in webrtc connections;
|
||||||
/// See https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-encryption-modes;
|
/// See <https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-encryption-modes>
|
||||||
#[derive(Debug, Default, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Default, Serialize, Deserialize, Clone, Copy, PartialEq, Eq)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum WebrtcEncryptionMode {
|
pub enum WebrtcEncryptionMode {
|
||||||
|
@ -68,9 +67,9 @@ pub const VOICE_HEARTBEAT_ACK: u8 = 6;
|
||||||
pub const VOICE_RESUME: u8 = 7;
|
pub const VOICE_RESUME: u8 = 7;
|
||||||
pub const VOICE_HELLO: u8 = 8;
|
pub const VOICE_HELLO: u8 = 8;
|
||||||
pub const VOICE_RESUMED: u8 = 9;
|
pub const VOICE_RESUMED: u8 = 9;
|
||||||
/// See https://discord-userdoccers.vercel.app/topics/opcodes-and-status-codes#voice-opcodes
|
/// See <https://discord-userdoccers.vercel.app/topics/opcodes-and-status-codes#voice-opcodes>
|
||||||
pub const VOICE_VIDEO: u8 = 12;
|
pub const VOICE_VIDEO: u8 = 12;
|
||||||
pub const VOICE_CLIENT_DISCONENCT: u8 = 13;
|
pub const VOICE_CLIENT_DISCONENCT: u8 = 13;
|
||||||
/// See https://discord-userdoccers.vercel.app/topics/opcodes-and-status-codes#voice-opcodes;
|
/// See <https://discord-userdoccers.vercel.app/topics/opcodes-and-status-codes#voice-opcodes>
|
||||||
/// Sent with empty data from the client, the server responds with the voice backend version;
|
/// Sent with empty data from the client, the server responds with the voice backend version;
|
||||||
pub const VOICE_BACKEND_VERSION: u8 = 16;
|
pub const VOICE_BACKEND_VERSION: u8 = 16;
|
||||||
|
|
|
@ -7,10 +7,12 @@ use super::WebrtcEncryptionMode;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Serialize, Clone, PartialEq, Eq)]
|
||||||
/// The ready event for the webrtc stream;
|
/// The ready event for the webrtc stream;
|
||||||
|
///
|
||||||
/// Used to give info after the identify event;
|
/// Used to give info after the identify event;
|
||||||
/// See https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-ready-payload;
|
///
|
||||||
|
/// See <https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-websocket-connection-example-voice-ready-payload>
|
||||||
pub struct VoiceReady {
|
pub struct VoiceReady {
|
||||||
/// See https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpStreamStats/ssrc
|
/// See <https://developer.mozilla.org/en-US/docs/Web/API/RTCRtpStreamStats/ssrc>
|
||||||
ssrc: i32,
|
ssrc: i32,
|
||||||
ip: Ipv4Addr,
|
ip: Ipv4Addr,
|
||||||
port: u32,
|
port: u32,
|
||||||
|
|
|
@ -6,15 +6,18 @@ use super::WebrtcEncryptionMode;
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
/// An event sent by the client to the webrtc server, detailing what protocol, address and encryption to use;
|
/// An event sent by the client to the webrtc server, detailing what protocol, address and encryption to use;
|
||||||
/// See https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload
|
///
|
||||||
|
/// See <https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload>
|
||||||
pub struct SelectProtocol {
|
pub struct SelectProtocol {
|
||||||
/// The protocol to use. The only option detailed in discord docs is "udp"
|
/// The protocol to use. The only option detailed in discord docs is "udp"
|
||||||
pub protocol: String,
|
pub protocol: String,
|
||||||
|
pub data: SelectProtocolData,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone)]
|
#[derive(Debug, Deserialize, Serialize, Clone)]
|
||||||
/// The data field of the SelectProtocol Event
|
/// The data field of the SelectProtocol Event
|
||||||
/// See https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload;
|
///
|
||||||
|
/// See <https://discord.com/developers/docs/topics/voice-connections#establishing-a-voice-udp-connection-example-select-protocol-payload>
|
||||||
pub struct SelectProtocolData {
|
pub struct SelectProtocolData {
|
||||||
/// Our external ip
|
/// Our external ip
|
||||||
pub address: Ipv4Addr,
|
pub address: Ipv4Addr,
|
||||||
|
|
|
@ -2,8 +2,10 @@ use bitflags::bitflags;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
/// Event that tells the server we are speaking;
|
/// Event that tells the server we are speaking;
|
||||||
/// Essentially, what allows us to send udp data and lights up the green circle around your avatar;
|
///
|
||||||
/// See https://discord.com/developers/docs/topics/voice-connections#speaking-example-speaking-payload
|
/// Essentially, what allows us to send udp data and lights up the green circle around your avatar.
|
||||||
|
///
|
||||||
|
/// See <https://discord.com/developers/docs/topics/voice-connections#speaking-example-speaking-payload>
|
||||||
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
#[derive(Debug, Deserialize, Serialize, Clone, Default)]
|
||||||
pub struct Speaking {
|
pub struct Speaking {
|
||||||
/// Data about the audio we're transmitting, its type
|
/// Data about the audio we're transmitting, its type
|
||||||
|
@ -15,7 +17,8 @@ pub struct Speaking {
|
||||||
|
|
||||||
bitflags! {
|
bitflags! {
|
||||||
/// Bitflags of speaking types;
|
/// Bitflags of speaking types;
|
||||||
/// See https://discord.com/developers/docs/topics/voice-connections#speaking;
|
///
|
||||||
|
/// See <https://discord.com/developers/docs/topics/voice-connections#speaking>
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Serialize, Deserialize)]
|
||||||
pub struct SpeakingBitflags: u8 {
|
pub struct SpeakingBitflags: u8 {
|
||||||
/// Whether we'll be transmitting normal voice audio
|
/// Whether we'll be transmitting normal voice audio
|
||||||
|
|
Loading…
Reference in New Issue