Add check_qr function to jsonrpc

This commit is contained in:
flipsimon
2022-07-26 11:51:04 +02:00
parent 15019ce02b
commit 05629fe814
4 changed files with 231 additions and 1 deletions

View File

@@ -22,6 +22,7 @@ pub mod events;
pub mod types;
use crate::api::types::chat_list::{get_chat_list_item_by_id, ChatListItemFetchResult};
use crate::api::types::QrObject;
use types::account::Account;
use types::chat::FullChat;
@@ -202,6 +203,14 @@ impl CommandApi {
qr::set_config_from_qr(&ctx, &qr_content).await
}
async fn check_qr(&self, account_id: u32, qr_content: String) -> Result<QrObject> {
println!("HELLO FROM CHECK_QR");
let ctx = self.get_context(account_id).await?;
let qr = qr::check_qr(&ctx, &qr_content).await?;
let qr_object = QrObject::from(qr);
Ok(qr_object)
}
async fn get_config(&self, account_id: u32, key: String) -> Result<Option<String>> {
let ctx = self.get_context(account_id).await?;
get_config(&ctx, &key).await