Expose accept_invitation to UniFFI

This commit is contained in:
Alfonso Grillo
2023-04-18 12:45:30 +02:00
committed by GitHub
parent c5919e3e63
commit cfdc9b2a82
2 changed files with 19 additions and 1 deletions

View File

@@ -266,6 +266,9 @@ interface Room {
[Throws=ClientError]
void reject_invitation();
[Throws=ClientError]
void accept_invitation();
[Throws=ClientError]
void set_topic(string topic);

View File

@@ -488,7 +488,7 @@ impl Room {
})
}
/// Rejects invitation for the invited room.
/// Rejects the invitation for the invited room.
///
/// Will throw an error if used on an room that isn't in an invited state
pub fn reject_invitation(&self) -> Result<()> {
@@ -503,6 +503,21 @@ impl Room {
})
}
/// Accepts the invitation for the invited room.
///
/// Will throw an error if used on an room that isn't in an invited state
pub fn accept_invitation(&self) -> Result<()> {
let room = match &self.room {
SdkRoom::Invited(i) => i.clone(),
_ => bail!("Can't accept an invite for a room that isn't in invited state"),
};
RUNTIME.block_on(async move {
room.accept_invitation().await?;
Ok(())
})
}
/// Sets a new topic in the room.
pub fn set_topic(&self, topic: String) -> Result<()> {
let room = match &self.room {