Skip to main content

Appservice

Struct Appservice 

Source
pub struct Appservice {
    pub homeserver_token: String,
    pub appservice_token: String,
    pub client: MatrixClient,
    /* private fields */
}

Fields§

§homeserver_token: String§appservice_token: String§client: MatrixClient

Implementations§

Source§

impl Appservice

Source

pub fn new( homeserver_token: impl Into<String>, appservice_token: impl Into<String>, client: MatrixClient, ) -> Self

Source

pub fn with_appservice_id(self, appservice_id: impl Into<String>) -> Self

Source

pub fn with_homeserver_name(self, homeserver_name: impl Into<String>) -> Self

Source

pub fn with_user_prefix(self, user_prefix: impl Into<String>) -> Self

Source

pub fn with_alias_prefix(self, alias_prefix: impl Into<String>) -> Self

Source

pub fn with_user_namespace_regexes<I, S>(self, regexes: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Source

pub fn with_alias_namespace_regexes<I, S>(self, regexes: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Source

pub fn with_protocols<I, S>(self, protocols: I) -> Self
where I: IntoIterator<Item = S>, S: Into<String>,

Source

pub fn with_handler(self, handler: Arc<dyn AppserviceHandler>) -> Self

Source

pub fn get_intent(&self, localpart: &str) -> Intent

Source

pub fn get_user_id(&self, localpart: &str) -> String

Source

pub fn get_intent_for_suffix(&self, suffix: &str) -> Result<Intent>

Source

pub fn get_user_id_for_suffix(&self, suffix: &str) -> Result<String>

Source

pub fn get_intent_for_user_id(&self, user_id: &str) -> Intent

Source

pub fn get_suffix_for_user_id(&self, user_id: &str) -> Result<Option<String>>

Source

pub fn is_namespaced_user(&self, user_id: &str) -> bool

Source

pub fn get_alias(&self, localpart: &str) -> String

Source

pub fn get_alias_for_suffix(&self, suffix: &str) -> Result<String>

Source

pub fn get_alias_localpart_for_suffix(&self, suffix: &str) -> Result<String>

Source

pub fn get_suffix_for_alias(&self, alias: &str) -> Result<Option<String>>

Source

pub fn is_namespaced_alias(&self, alias: &str) -> bool

Source

pub async fn add_preprocessor(&self, preprocessor: Arc<dyn IPreprocessor>)

Source

pub async fn set_room_directory_visibility( &self, network_id: &str, room_id: &str, visibility: &str, ) -> Result<Value>

Source

pub fn router(&self) -> Router

Source

pub async fn begin(&self) -> Result<()>

Present for API parity with the TypeScript SDK where the appservice starts its own web server. In Rust, server startup is controlled by the host application using router().

Source

pub fn stop(&self)

Present for API parity with the TypeScript SDK.

Source

pub async fn expect_ping_transaction(&self, transaction_id: impl Into<String>)

Source

pub async fn expected_ping_transaction(&self) -> Option<String>

Source

pub async fn ping_homeserver(&self) -> Result<PingHomeserverResponse>

Trait Implementations§

Source§

impl Clone for Appservice

Source§

fn clone(&self) -> Appservice

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for Appservice

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl UnstableAppserviceApis for Appservice

Source§

fn unstable_ping<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn send_historical_event_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, room_id: &'life1 str, prev_event_id: &'life2 str, events: Vec<Value>, state_events_at_start: Vec<Value>, chunk_id: Option<String>, ) -> Pin<Box<dyn Future<Output = Result<MSC2716BatchSendResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send several historical events into a room (MSC2716).
Source§

fn send_event_with_timestamp<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, room_id: &'life1 str, event_type: &'life2 str, content: &'life3 Value, ts: u64, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Sends an event to the given room with a given timestamp.
Source§

fn send_state_event_with_timestamp<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, room_id: &'life1 str, event_type: &'life2 str, state_key: &'life3 str, content: &'life4 Value, ts: u64, ) -> Pin<Box<dyn Future<Output = Result<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Sends a state event to the given room with a given timestamp.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more