feat: blocking api interfaces

This commit is contained in:
Calum H. (IMB11)
2026-07-28 15:47:21 +01:00
parent 82348fe40a
commit 90bfe88dac
8 changed files with 181 additions and 0 deletions
+14
View File
@@ -54,3 +54,17 @@ export async function patch_user(
): Promise<void> {
await invoke('plugin:users|patch_user', { userId, patch })
}
export async function block_user(userId: string): Promise<void> {
await invoke('plugin:users|block_user', { userId })
}
export async function unblock_user(userId: string): Promise<void> {
await invoke('plugin:users|unblock_user', { userId })
}
export async function get_blocked_users(): Promise<Labrinth.BlockedUsers.v3.BlockedUserId[]> {
return await invoke<Labrinth.BlockedUsers.v3.BlockedUserId[]>(
'plugin:users|get_blocked_users',
)
}
+3
View File
@@ -285,6 +285,9 @@ fn main() {
"get_user_organizations",
"get_user_collections",
"patch_user",
"block_user",
"unblock_user",
"get_blocked_users",
])
.default_permission(
DefaultPermissionRule::AllowAllCommands,
+18
View File
@@ -32,6 +32,21 @@ pub async fn patch_user(user_id: &str, patch: Value) -> Result<()> {
Ok(theseus::users::patch_user(user_id, patch).await?)
}
#[tauri::command]
pub async fn block_user(user_id: &str) -> Result<()> {
Ok(theseus::users::block_user(user_id).await?)
}
#[tauri::command]
pub async fn unblock_user(user_id: &str) -> Result<()> {
Ok(theseus::users::unblock_user(user_id).await?)
}
#[tauri::command]
pub async fn get_blocked_users() -> Result<Vec<String>> {
Ok(theseus::users::get_blocked_users().await?)
}
pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
tauri::plugin::Builder::new("users")
.invoke_handler(tauri::generate_handler![
@@ -41,6 +56,9 @@ pub fn init<R: tauri::Runtime>() -> tauri::plugin::TauriPlugin<R> {
get_user_organizations,
get_user_collections,
patch_user,
block_user,
unblock_user,
get_blocked_users,
])
.build()
}