Struct libqaul::api::Contacts [−][src]
API scope type to access contact book functions
The contact book is a user local store of metadata, that can be
assigned for each Identity
, that a user is aware of on the
network. A contact entry is backed by an entry in the user store,
available via the users()
endpoint scope.
A ContactEntry
should be considered additional information a
user can keep on someone they interact with on the network,
independent of the UserProfile
, which is fetched from the remote
user themselves.
When assembling a complete view of a user, it’s important to
consider both their primary profile, as well as the contact
metadata stored via this API. Because of this, queries only return
the ContactEntry
structures, not the profile itself.
Furthermore, it is possible to query users via metadata set in a user’s local contact book, such as their nick, trust, location and more.
Implementations
impl<'qaul> Contacts<'qaul>
[src]
pub fn drop(&'qaul self) -> &'qaul Qaul
[src]
Drop this scope and return back to global Qaul
scope
pub fn modify<F>(
&self,
user: UserAuth,
contact: &Identity,
modify: F
) -> Result<()> where
F: FnOnce(&mut ContactEntry),
[src]
&self,
user: UserAuth,
contact: &Identity,
modify: F
) -> Result<()> where
F: FnOnce(&mut ContactEntry),
Modify a user’s contact entry in a user-local contact book
The modify
lambda allows a user to add personal metadata for
a contact, such as a nickname, or trust levels. Each contact
list is user local and it’s not possible to access other
user’s contact metadata.
If no contact entry existed before, a fresh one will be created before calling the passed-in lambda.
pub fn get(&self, user: UserAuth, contact: &Identity) -> Result<ContactEntry>
[src]
Get a single ContactEntry
from a user’s contact book
Considering that a ContactEntry
might contain large amounts
of data, this is the only way to return a reference to the
full object. When trying to query all data from all contact
entries, it’s advised to get a list of Identities via
Contacts::get_all
first, and then map this collection over
Contacts::get
afterwards.
pub fn query(
&self,
user: UserAuth,
query: ContactQuery
) -> Result<Vec<Identity>>
[src]
&self,
user: UserAuth,
query: ContactQuery
) -> Result<Vec<Identity>>
Query for a subset of users that have a ContactEntry
To get a list of all ContactEntry
objects, map the result of
this function over Contacts::get
.
# use libqaul::{Qaul, error::Result, contacts::ContactQuery};
# let qaul = Qaul::dummy();
# let user = qaul.users().create("abc").await.unwrap();
let contacts = qaul.contacts();
# (|| -> Result<()> {
contacts
.query(user.clone(), ContactQuery::Nick("buddy".to_string()))?
.into_iter()
.map(|i| contacts.get(user.clone(), &i));
# Ok(())
# })().unwrap();
pub fn all(&self, user: UserAuth) -> Result<Vec<Identity>>
[src]
Get all users that have a ContactEntry
for this user
Auto Trait Implementations
impl<'chain> !RefUnwindSafe for Contacts<'chain>
impl<'chain> Send for Contacts<'chain>
impl<'chain> Sync for Contacts<'chain>
impl<'chain> Unpin for Contacts<'chain>
impl<'chain> !UnwindSafe for Contacts<'chain>
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> 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> Same<T> for T
type Output = T
Should always be Self
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,