pub struct ChannelManager { /* private fields */ }Expand description
Manages the lifecycle of all channels.
Implementations§
Source§impl ChannelManager
impl ChannelManager
pub fn new(db: Arc<Database>) -> Self
Sourcepub async fn start_channel(&self, id: &Uuid) -> CiabResult<()>
pub async fn start_channel(&self, id: &Uuid) -> CiabResult<()>
Start a channel by ID.
Sourcepub async fn stop_channel(&self, id: &Uuid) -> CiabResult<()>
pub async fn stop_channel(&self, id: &Uuid) -> CiabResult<()>
Stop a running channel.
Sourcepub async fn restart_channel(&self, id: &Uuid) -> CiabResult<()>
pub async fn restart_channel(&self, id: &Uuid) -> CiabResult<()>
Restart a channel (stop + start).
Sourcepub async fn channel_state(&self, id: &Uuid) -> CiabResult<ChannelState>
pub async fn channel_state(&self, id: &Uuid) -> CiabResult<ChannelState>
Get the current state of a channel.
Sourcepub async fn whatsapp_qr(&self, id: &Uuid) -> CiabResult<Option<String>>
pub async fn whatsapp_qr(&self, id: &Uuid) -> CiabResult<Option<String>>
Get QR code for WhatsApp pairing.
Sourcepub async fn start_all_active(&self) -> CiabResult<()>
pub async fn start_all_active(&self) -> CiabResult<()>
Start all channels that are in Connected state (for server restart).
Sourcepub async fn shutdown(&self) -> CiabResult<()>
pub async fn shutdown(&self) -> CiabResult<()>
Shutdown all running channels.
Auto Trait Implementations§
impl Freeze for ChannelManager
impl !RefUnwindSafe for ChannelManager
impl Send for ChannelManager
impl Sync for ChannelManager
impl Unpin for ChannelManager
impl UnsafeUnpin for ChannelManager
impl !UnwindSafe for ChannelManager
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more