pub struct TalkClient<'a, T: Transport, A: AuthProvider> { /* private fields */ }Expand description
Asynchronous client for Nextcloud Talk (Spreed) API.
Wraps an OcsClient by reference and provides high-level typed calls for:
- Listing conversations / rooms (
/ocs/v2.php/apps/spreed/api/v4/room) - Fetching conversation details by token (
/ocs/v2.php/apps/spreed/api/v4/room/{token}) - Creating conversations (
/ocs/v2.php/apps/spreed/api/v4/room) - Deleting conversations (
/ocs/v2.php/apps/spreed/api/v4/room/{token}) - Listing chat messages (
/ocs/v2.php/apps/spreed/api/v1/chat/{token}) - Sending chat messages (
/ocs/v2.php/apps/spreed/api/v1/chat/{token})
Implementations§
Source§impl<'a, T: Transport, A: AuthProvider> TalkClient<'a, T, A>
impl<'a, T: Transport, A: AuthProvider> TalkClient<'a, T, A>
Sourcepub const fn new(ocs: &'a OcsClient<T, A>) -> Self
pub const fn new(ocs: &'a OcsClient<T, A>) -> Self
Binds a talk client to an underlying OcsClient.
Sourcepub async fn list_rooms(&self) -> Result<Vec<Room>, Error>
pub async fn list_rooms(&self) -> Result<Vec<Room>, Error>
Lists all conversations the authenticated user belongs to.
Sends GET /ocs/v2.php/apps/spreed/api/v4/room.
Sourcepub async fn get_room(&self, token: &str) -> Result<Room, Error>
pub async fn get_room(&self, token: &str) -> Result<Room, Error>
Retrieves conversation details for a specific room token.
Sends GET /ocs/v2.php/apps/spreed/api/v4/room/{token}.
Sourcepub async fn create_room(
&self,
room_type: RoomType,
invite: Option<&str>,
name: Option<&str>,
) -> Result<Room, Error>
pub async fn create_room( &self, room_type: RoomType, invite: Option<&str>, name: Option<&str>, ) -> Result<Room, Error>
Creates a new conversation room.
Sends POST /ocs/v2.php/apps/spreed/api/v4/room.
Sourcepub async fn delete_room(&self, token: &str) -> Result<(), Error>
pub async fn delete_room(&self, token: &str) -> Result<(), Error>
Deletes a conversation room by its token.
Sends DELETE /ocs/v2.php/apps/spreed/api/v4/room/{token}.
Sourcepub async fn list_messages(
&self,
token: &str,
limit: Option<u32>,
) -> Result<Vec<ChatMessage>, Error>
pub async fn list_messages( &self, token: &str, limit: Option<u32>, ) -> Result<Vec<ChatMessage>, Error>
Lists chat messages in a conversation.
Sends GET /ocs/v2.php/apps/spreed/api/v1/chat/{token} with lookIntoFuture=0
and optional limit.
Sourcepub async fn send_message(
&self,
token: &str,
message: &str,
) -> Result<ChatMessage, Error>
pub async fn send_message( &self, token: &str, message: &str, ) -> Result<ChatMessage, Error>
Sends a new chat message to a conversation.
Sends POST /ocs/v2.php/apps/spreed/api/v1/chat/{token} with {"message": "..."}.