pub struct Client(/* private fields */);
Expand description
A codemp
client handle.
It generates a new UUID and stores user credentials upon connecting.
A new Client
can be obtained with Client::connect
.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn connect(config: Config) -> ConnectionResult<Self>
pub async fn connect(config: Config) -> ConnectionResult<Self>
Connect to the server, authenticate and instantiate a new Client
.
Sourcepub async fn refresh(&self) -> RemoteResult<()>
pub async fn refresh(&self) -> RemoteResult<()>
Refresh session token.
Sourcepub async fn create_workspace(&self, name: impl AsRef<str>) -> RemoteResult<()>
pub async fn create_workspace(&self, name: impl AsRef<str>) -> RemoteResult<()>
Attempt to create a new workspace with given name.
Sourcepub async fn delete_workspace(&self, name: impl AsRef<str>) -> RemoteResult<()>
pub async fn delete_workspace(&self, name: impl AsRef<str>) -> RemoteResult<()>
Delete an existing workspace if possible.
Sourcepub async fn invite_to_workspace(
&self,
workspace_name: impl AsRef<str>,
user_name: impl AsRef<str>,
) -> RemoteResult<()>
pub async fn invite_to_workspace( &self, workspace_name: impl AsRef<str>, user_name: impl AsRef<str>, ) -> RemoteResult<()>
Invite user with given username to the given workspace, if possible.
Sourcepub async fn fetch_owned_workspaces(&self) -> RemoteResult<Vec<String>>
pub async fn fetch_owned_workspaces(&self) -> RemoteResult<Vec<String>>
Fetch the names of all workspaces owned by the current user.
Sourcepub async fn fetch_joined_workspaces(&self) -> RemoteResult<Vec<String>>
pub async fn fetch_joined_workspaces(&self) -> RemoteResult<Vec<String>>
Fetch the names of all workspaces the current user has joined.
Sourcepub async fn attach_workspace(
&self,
workspace: impl AsRef<str>,
) -> ConnectionResult<Workspace>
pub async fn attach_workspace( &self, workspace: impl AsRef<str>, ) -> ConnectionResult<Workspace>
Join and return a Workspace
.
Sourcepub fn leave_workspace(&self, id: &str) -> bool
pub fn leave_workspace(&self, id: &str) -> bool
Leave the Workspace
with the given name.
Sourcepub fn active_workspaces(&self) -> Vec<String>
pub fn active_workspaces(&self) -> Vec<String>
Get the names of all active Workspace
s.
Sourcepub fn current_user(&self) -> &User
pub fn current_user(&self) -> &User
Get the currently logged in user.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Client
impl !RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request