1#![cfg_attr(docsrs, feature(doc_cfg))]
22
23pub mod auth;
24pub mod channel;
25pub mod config;
26pub mod errors;
27pub mod events;
28pub mod history;
29pub mod presence_history;
30pub mod push;
31pub mod sockudo;
32pub mod token;
33pub mod util;
34pub mod webhook;
35
36#[macro_use]
37extern crate zeroize;
38
39pub use channel::{Channel, ChannelName, ChannelType};
40pub use config::{Config, ConfigBuilder};
41pub use errors::{RequestError, SockudoError, WebhookError};
42pub use sockudo::Sockudo;
43pub use token::Token;
44pub use webhook::{Webhook, WebhookEvent};
45
46pub type Result<T> = std::result::Result<T, SockudoError>;
48
49pub use auth::{SocketAuth, UserAuth};
51pub use events::{BatchEvent, Event, MessageExtras, TriggerParams, generate_idempotency_key};
52pub use history::{
53 AnnotationEventsParams, AnnotationEventsResponse, DeleteAnnotationResponse, GetMessageResponse,
54 HistoryBounds, HistoryContinuity, HistoryItem, HistoryPage, HistoryParams,
55 ListMessageVersionsResponse, MessageVersionsParams, MutationResponse, PublishAnnotationRequest,
56 PublishAnnotationResponse,
57};
58pub use presence_history::{
59 PresenceHistoryBounds, PresenceHistoryContinuity, PresenceHistoryItem, PresenceHistoryPage,
60 PresenceHistoryParams, PresenceSnapshot, PresenceSnapshotMember, PresenceSnapshotParams,
61};
62pub use push::{PushCursorParams, PushSubscriptionParams};
63
64pub const ENCRYPTION_AVAILABLE: bool = cfg!(feature = "encryption");
66
67pub struct BuildInfo;
69
70impl BuildInfo {
71 pub fn has_encryption() -> bool {
73 ENCRYPTION_AVAILABLE
74 }
75
76 pub fn tls_backend() -> &'static str {
78 if cfg!(feature = "rustls-tls") {
79 "rustls"
80 } else if cfg!(feature = "native-tls") {
81 "native-tls"
82 } else {
83 "none"
84 }
85 }
86
87 #[cfg(feature = "encryption")]
89 pub fn encryption_backend() -> &'static str {
90 "crypto_secretbox"
91 }
92}
93
94#[cfg(test)]
95mod tests {
96 use super::*;
97
98 #[test]
99 fn test_build_info() {
100 println!("Encryption available: {}", BuildInfo::has_encryption());
101 println!("TLS backend: {}", BuildInfo::tls_backend());
102
103 #[cfg(feature = "encryption")]
104 println!("Encryption backend: {}", BuildInfo::encryption_backend());
105 }
106}