pub struct CloudClient { /* private fields */ }Expand description
Client of the Redseat cloud. Cheap to clone.
Implementations§
Source§impl CloudClient
impl CloudClient
Sourcepub fn new(transport: Arc<dyn Transport>) -> Self
pub fn new(transport: Arc<dyn Transport>) -> Self
A client that reaches the cloud through transport, whose base URL is the cloud.
Sourcepub fn http() -> Result<Self>
pub fn http() -> Result<Self>
A client of DEFAULT_CLOUD_URL over HTTP.
Sourcepub fn http_with_url(base_url: &str) -> Result<Self>
pub fn http_with_url(base_url: &str) -> Result<Self>
A client of the cloud at base_url over HTTP.
Sourcepub async fn sign_in_with_google_id_token(
&self,
id_token: &str,
) -> Result<CloudSession>
pub async fn sign_in_with_google_id_token( &self, id_token: &str, ) -> Result<CloudSession>
Exchanges a Google ID token for a cloud session. The token’s audience must be one of the cloud’s Google clients (web, TV or desktop).
Sourcepub async fn get_session(&self, token: &str) -> Result<Option<CloudSession>>
pub async fn get_session(&self, token: &str) -> Result<Option<CloudSession>>
The session of token, extended by the cloud when it is more than a day old.
None when the session expired or was revoked.
Sourcepub async fn list_servers(
&self,
session_token: &str,
) -> Result<Vec<CloudServer>>
pub async fn list_servers( &self, session_token: &str, ) -> Result<Vec<CloudServer>>
The servers of the user: owned, shared, and only saved.
Sourcepub async fn get_server(
&self,
server_id: &str,
session_token: &str,
) -> Result<CloudServer>
pub async fn get_server( &self, server_id: &str, session_token: &str, ) -> Result<CloudServer>
One server.
Sourcepub async fn fetch_server_token(
&self,
server_id: &str,
session_token: &str,
) -> Result<ServerToken>
pub async fn fetch_server_token( &self, server_id: &str, session_token: &str, ) -> Result<ServerToken>
A token for server_id, to send to that server as Authorization: Bearer.
Sourcepub async fn remove_saved_server(
&self,
server_id: &str,
session_token: &str,
) -> Result<()>
pub async fn remove_saved_server( &self, server_id: &str, session_token: &str, ) -> Result<()>
Takes server_id out of the user’s servers: a member leaves it, a saved one is
forgotten. The server itself stays registered.
Sourcepub async fn delete_server(
&self,
server_id: &str,
session_token: &str,
) -> Result<()>
pub async fn delete_server( &self, server_id: &str, session_token: &str, ) -> Result<()>
Unregisters server_id from the cloud, for every user it is shared with. Only
its owner may (CloudServer::owned_by); the media on the server stays.