pub struct Client { /* private fields */ }Expand description
Defines the client itself, all Notification Server actions are done through an instance of this struct.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn new(server: &str, port: u16) -> Result<Self, SdkError>
pub async fn new(server: &str, port: u16) -> Result<Self, SdkError>
Connects to the server, defines the channels and returns a new instance.
Sourcepub fn add_event_handler_closure<F, R>(&self, f: F)
pub fn add_event_handler_closure<F, R>(&self, f: F)
Adds a handler closure. If you’re using this SDK with Rust, not through a foreign language binding, then this is the preferred method of receiving and handling events.
Sourcepub async fn login(
&self,
email: String,
password: &str,
nexus_url: &str,
client_name: &str,
version: &str,
) -> Result<Event, SdkError>
pub async fn login( &self, email: String, password: &str, nexus_url: &str, client_name: &str, version: &str, ) -> Result<Event, SdkError>
Does the MSNP authentication process. Also starts regular pings and the handler for Switchboard invitations.
§Events
If the server you’re connecting to implements a Dispatch Server, then this will return a RedirectedTo event. What follows is creating a new client instance with the server and port returned then logging in again, which will return an Authenticated event.
Sourcepub async fn set_presence(&self, presence: MsnpStatus) -> Result<(), SdkError>
pub async fn set_presence(&self, presence: MsnpStatus) -> Result<(), SdkError>
Sets the user’s presence status.
Sourcepub async fn set_personal_message(
&self,
personal_message: &PersonalMessage,
) -> Result<(), SdkError>
pub async fn set_personal_message( &self, personal_message: &PersonalMessage, ) -> Result<(), SdkError>
Sets the user’s personal message.
Sourcepub async fn set_display_name(&self, display_name: &str) -> Result<(), SdkError>
pub async fn set_display_name(&self, display_name: &str) -> Result<(), SdkError>
Sets the user’s display name.
Sourcepub async fn set_contact_display_name(
&self,
guid: &str,
display_name: &str,
) -> Result<(), ContactError>
pub async fn set_contact_display_name( &self, guid: &str, display_name: &str, ) -> Result<(), ContactError>
Sets a contact’s display name.
Sourcepub async fn add_contact(
&self,
email: &str,
display_name: &str,
list: MsnpList,
) -> Result<Event, ContactError>
pub async fn add_contact( &self, email: &str, display_name: &str, list: MsnpList, ) -> Result<Event, ContactError>
Adds a contact to a specified list, also setting its display name if applicable.
Sourcepub async fn remove_contact(
&self,
email: &str,
list: MsnpList,
) -> Result<(), ContactError>
pub async fn remove_contact( &self, email: &str, list: MsnpList, ) -> Result<(), ContactError>
Removes a contact from a specified list (except the forward list, which requires calling remove_contact_from_forward_list).
Sourcepub async fn remove_contact_from_forward_list(
&self,
guid: &str,
) -> Result<(), ContactError>
pub async fn remove_contact_from_forward_list( &self, guid: &str, ) -> Result<(), ContactError>
Removes a contact from the forward list.
Sourcepub async fn block_contact(&self, email: &str) -> Result<(), ContactError>
pub async fn block_contact(&self, email: &str) -> Result<(), ContactError>
Blocks a contact.
Sourcepub async fn unblock_contact(&self, email: &str) -> Result<(), ContactError>
pub async fn unblock_contact(&self, email: &str) -> Result<(), ContactError>
Unblocks a contact.
Sourcepub async fn create_group(&self, name: &str) -> Result<(), ContactError>
pub async fn create_group(&self, name: &str) -> Result<(), ContactError>
Creates a new contact group.
Sourcepub async fn delete_group(&self, guid: &str) -> Result<(), ContactError>
pub async fn delete_group(&self, guid: &str) -> Result<(), ContactError>
Deletes a contact group.
Sourcepub async fn rename_group(
&self,
guid: &str,
new_name: &str,
) -> Result<(), ContactError>
pub async fn rename_group( &self, guid: &str, new_name: &str, ) -> Result<(), ContactError>
Renames a contact group.
Sourcepub async fn add_contact_to_group(
&self,
guid: &str,
group_guid: &str,
) -> Result<(), ContactError>
pub async fn add_contact_to_group( &self, guid: &str, group_guid: &str, ) -> Result<(), ContactError>
Adds a contact to a group.
Sourcepub async fn remove_contact_from_group(
&self,
guid: &str,
group_guid: &str,
) -> Result<(), ContactError>
pub async fn remove_contact_from_group( &self, guid: &str, group_guid: &str, ) -> Result<(), ContactError>
Removes a contact from a group.
Sourcepub async fn set_gtc(&self, gtc: &str) -> Result<(), SdkError>
pub async fn set_gtc(&self, gtc: &str) -> Result<(), SdkError>
Sets the GTC value, which can be either A or N.
Sourcepub async fn set_blp(&self, blp: &str) -> Result<(), SdkError>
pub async fn set_blp(&self, blp: &str) -> Result<(), SdkError>
Sets the BLP value, which can be either AL or BL.
Sourcepub async fn create_session(&self, email: &str) -> Result<Switchboard, SdkError>
pub async fn create_session(&self, email: &str) -> Result<Switchboard, SdkError>
Creates a new Switchboard session and invites the specified contact to it.
Sourcepub async fn set_display_picture(
&self,
display_picture: Vec<u8>,
) -> Result<String, SdkError>
pub async fn set_display_picture( &self, display_picture: Vec<u8>, ) -> Result<String, SdkError>
Sets the user’s display picture, returning a standard base64 encoded hash of it. This method uses the picture’s binary data, and scaling down to a size like 200x200 beforehand is recommended.
Sourcepub async fn disconnect(&self) -> Result<(), SdkError>
pub async fn disconnect(&self) -> Result<(), SdkError>
Disconnects from the server.
Auto Trait Implementations§
impl !Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl !Unpin for Client
impl !UnsafeUnpin for Client
impl !UnwindSafe for Client
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
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.