#![cfg_attr(docsrs, feature(doc_cfg))]
pub mod auth;
pub mod channel;
pub mod config;
pub mod errors;
pub mod events;
pub mod history;
pub mod presence_history;
pub mod push;
pub mod sockudo;
pub mod token;
pub mod util;
pub mod webhook;
#[macro_use]
extern crate zeroize;
pub use channel::{Channel, ChannelName, ChannelType};
pub use config::{Config, ConfigBuilder};
pub use errors::{RequestError, SockudoError, WebhookError};
pub use sockudo::Sockudo;
pub use token::Token;
pub use webhook::{Webhook, WebhookEvent};
pub type Result<T> = std::result::Result<T, SockudoError>;
pub use auth::{SocketAuth, UserAuth};
pub use events::{BatchEvent, Event, MessageExtras, TriggerParams, generate_idempotency_key};
pub use history::{
AnnotationEventsParams, AnnotationEventsResponse, DeleteAnnotationResponse, GetMessageResponse,
HistoryBounds, HistoryContinuity, HistoryItem, HistoryPage, HistoryParams,
ListMessageVersionsResponse, MessageVersionsParams, MutationResponse, PublishAnnotationRequest,
PublishAnnotationResponse,
};
pub use presence_history::{
PresenceHistoryBounds, PresenceHistoryContinuity, PresenceHistoryItem, PresenceHistoryPage,
PresenceHistoryParams, PresenceSnapshot, PresenceSnapshotMember, PresenceSnapshotParams,
};
pub use push::{PushCursorParams, PushSubscriptionParams};
pub const ENCRYPTION_AVAILABLE: bool = cfg!(feature = "encryption");
pub struct BuildInfo;
impl BuildInfo {
pub fn has_encryption() -> bool {
ENCRYPTION_AVAILABLE
}
pub fn tls_backend() -> &'static str {
if cfg!(feature = "rustls-tls") {
"rustls"
} else if cfg!(feature = "native-tls") {
"native-tls"
} else {
"none"
}
}
#[cfg(feature = "encryption")]
pub fn encryption_backend() -> &'static str {
"crypto_secretbox"
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_build_info() {
println!("Encryption available: {}", BuildInfo::has_encryption());
println!("TLS backend: {}", BuildInfo::tls_backend());
#[cfg(feature = "encryption")]
println!("Encryption backend: {}", BuildInfo::encryption_backend());
}
}