Struct threema_gateway::SimpleApi [−][src]
Struct to talk to the simple API (without end-to-end encryption).
Implementations
impl SimpleApi
[src]
pub async fn send(
&self,
to: &Recipient<'_>,
text: &str
) -> Result<String, ApiError>
[src]
&self,
to: &Recipient<'_>,
text: &str
) -> Result<String, ApiError>
Send a message to the specified recipient in basic mode.
Note that this mode of sending messages does not provide end-to-end encryption, only transport encryption between your host and the Threema Gateway server.
Cost: 1 credit.
pub async fn lookup_pubkey(&self, id: &str) -> Result<PublicKey, ApiError>
[src]
Fetch the public key for the specified Threema ID.
For the end-to-end encrypted mode, you need the public key of the recipient in order to encrypt a message. While it’s best to obtain this directly from the recipient (extract it from the QR code), this may not be convenient, and therefore you can also look up the key associated with a given ID from the server.
It is strongly recommended that you cache the public keys to avoid querying the API for each message.
pub async fn lookup_id(
&self,
criterion: &LookupCriterion
) -> Result<String, ApiError>
[src]
&self,
criterion: &LookupCriterion
) -> Result<String, ApiError>
Look up a Threema ID in the directory.
An ID can be looked up either by a phone number or an e-mail
address, in plaintext or hashed form. You can specify one of those
criteria using the LookupCriterion
enum.
pub async fn lookup_capabilities(
&self,
id: &str
) -> Result<Capabilities, ApiError>
[src]
&self,
id: &str
) -> Result<Capabilities, ApiError>
Look up the capabilities of a certain Threema ID.
Before you send a file to a Threema ID using the blob upload (+file message), you may want to check whether the recipient uses a Threema version that supports receiving files. The receiver may be using an old version, or a platform where file reception is not supported.
pub async fn lookup_credits(&self) -> Result<i64, ApiError>
[src]
Look up a remaining gateway credits.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for SimpleApi
impl Send for SimpleApi
impl Sync for SimpleApi
impl Unpin for SimpleApi
impl !UnwindSafe for SimpleApi
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,