pub struct Newsletter<'a> { /* private fields */ }Expand description
Feature handle for newsletter (channel) operations.
Implementations§
Source§impl<'a> Newsletter<'a>
impl<'a> Newsletter<'a>
Sourcepub async fn list_subscribed(&self) -> Result<Vec<NewsletterMetadata>, MexError>
pub async fn list_subscribed(&self) -> Result<Vec<NewsletterMetadata>, MexError>
List all newsletters the user is subscribed to.
Sourcepub async fn get_metadata(
&self,
jid: &Jid,
) -> Result<NewsletterMetadata, MexError>
pub async fn get_metadata( &self, jid: &Jid, ) -> Result<NewsletterMetadata, MexError>
Fetch metadata for a newsletter by its JID.
Sourcepub async fn create(
&self,
name: &str,
description: Option<&str>,
) -> Result<NewsletterMetadata, MexError>
pub async fn create( &self, name: &str, description: Option<&str>, ) -> Result<NewsletterMetadata, MexError>
Create a new newsletter.
Returns the metadata of the newly created newsletter.
Sourcepub async fn join(&self, jid: &Jid) -> Result<NewsletterMetadata, MexError>
pub async fn join(&self, jid: &Jid) -> Result<NewsletterMetadata, MexError>
Join (subscribe to) a newsletter.
Returns the newsletter metadata with the viewer’s role set to Subscriber.
Sourcepub async fn leave(&self, jid: &Jid) -> Result<(), MexError>
pub async fn leave(&self, jid: &Jid) -> Result<(), MexError>
Leave (unsubscribe from) a newsletter.
Sourcepub async fn update(
&self,
jid: &Jid,
name: Option<&str>,
description: Option<&str>,
) -> Result<NewsletterMetadata, MexError>
pub async fn update( &self, jid: &Jid, name: Option<&str>, description: Option<&str>, ) -> Result<NewsletterMetadata, MexError>
Update a newsletter’s name and/or description.
Sourcepub async fn get_metadata_by_invite(
&self,
invite_code: &str,
) -> Result<NewsletterMetadata, MexError>
pub async fn get_metadata_by_invite( &self, invite_code: &str, ) -> Result<NewsletterMetadata, MexError>
Fetch metadata for a newsletter by its invite code.
Sourcepub async fn subscribe_live_updates(&self, jid: &Jid) -> Result<u64, Error>
pub async fn subscribe_live_updates(&self, jid: &Jid) -> Result<u64, Error>
Subscribe to live updates for a newsletter (reaction counts, message changes).
The server will send <notification type="newsletter"> stanzas with
<live_updates> children, dispatched as Event::NewsletterLiveUpdate.
Returns the subscription duration in seconds.
Sourcepub async fn send_message(
&self,
jid: &Jid,
message: &Message,
) -> Result<String, Error>
pub async fn send_message( &self, jid: &Jid, message: &Message, ) -> Result<String, Error>
Send a message to a newsletter.
Newsletter messages are plaintext (no Signal E2E encryption). Returns the message ID assigned by the client.
Note: This sends the raw protobuf as plaintext. For media messages (images, videos, etc.), the media must be uploaded separately using the newsletter-specific upload endpoint first. Text messages work directly.
Sourcepub async fn send_reaction(
&self,
jid: &Jid,
server_id: u64,
reaction: &str,
) -> Result<(), Error>
pub async fn send_reaction( &self, jid: &Jid, server_id: u64, reaction: &str, ) -> Result<(), Error>
Send a reaction to a newsletter message.
server_id is the server-assigned ID of the message to react to.
reaction is the emoji code (e.g., “👍”, “❤️”), or empty to remove.
Sourcepub async fn get_messages(
&self,
jid: &Jid,
count: u32,
before: Option<u64>,
) -> Result<Vec<NewsletterMessage>, Error>
pub async fn get_messages( &self, jid: &Jid, count: u32, before: Option<u64>, ) -> Result<Vec<NewsletterMessage>, Error>
Fetch message history from a newsletter.
Returns up to count messages. Use before with a server_id from a previous
response to paginate backwards through history.
Auto Trait Implementations§
impl<'a> Freeze for Newsletter<'a>
impl<'a> !RefUnwindSafe for Newsletter<'a>
impl<'a> Send for Newsletter<'a>
impl<'a> Sync for Newsletter<'a>
impl<'a> Unpin for Newsletter<'a>
impl<'a> UnsafeUnpin for Newsletter<'a>
impl<'a> !UnwindSafe for Newsletter<'a>
Blanket Implementations§
Source§impl<T> AggregateExpressionMethods for T
impl<T> AggregateExpressionMethods for T
Source§fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
fn aggregate_distinct(self) -> Self::Outputwhere
Self: DistinctDsl,
DISTINCT modifier for aggregate functions Read moreSource§fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
fn aggregate_all(self) -> Self::Outputwhere
Self: AllDsl,
ALL modifier for aggregate functions Read moreSource§fn aggregate_filter<P>(self, f: P) -> Self::Output
fn aggregate_filter<P>(self, f: P) -> Self::Output
Source§fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
fn aggregate_order<O>(self, o: O) -> Self::Outputwhere
Self: OrderAggregateDsl<O>,
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§fn into_sql<T>(self) -> Self::Expression
fn into_sql<T>(self) -> Self::Expression
self to an expression for Diesel’s query builder. Read moreSource§fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
fn as_sql<'a, T>(&'a self) -> <&'a Self as AsExpression<T>>::Expression
&self to an expression for Diesel’s query builder. Read more