Add missing tauri commands

Signed-off-by: Trivernis <trivernis@protonmail.com>
pull/4/head
Trivernis 3 years ago
parent b9a0935631
commit 60140fcd97

@ -25,6 +25,15 @@ pub async fn get_all_files(api_state: ApiAccess<'_>) -> PluginResult<Vec<FileMet
Ok(all_files) Ok(all_files)
} }
#[tauri::command]
pub async fn get_files(api_state: ApiAccess<'_>, ids: Vec<i64>) -> PluginResult<Vec<FileMetadataResponse>> {
let api = api_state.api().await?;
let ids = ids.into_iter().map(|id| FileIdentifier::ID(id)).collect();
let files = api.file.get_files(ids).await?;
Ok(files)
}
#[tauri::command] #[tauri::command]
pub async fn add_local_file( pub async fn add_local_file(
api_state: ApiAccess<'_>, api_state: ApiAccess<'_>,

@ -1,7 +1,7 @@
use crate::tauri_plugin::commands::ApiAccess; use crate::tauri_plugin::commands::ApiAccess;
use crate::tauri_plugin::error::PluginResult; use crate::tauri_plugin::error::PluginResult;
use crate::types::identifier::FileIdentifier; use crate::types::identifier::FileIdentifier;
use crate::types::tags::TagResponse; use crate::types::tags::{NamespaceResponse, TagResponse};
#[tauri::command] #[tauri::command]
pub async fn get_all_tags(api_state: ApiAccess<'_>) -> PluginResult<Vec<TagResponse>> { pub async fn get_all_tags(api_state: ApiAccess<'_>) -> PluginResult<Vec<TagResponse>> {
@ -11,6 +11,14 @@ pub async fn get_all_tags(api_state: ApiAccess<'_>) -> PluginResult<Vec<TagRespo
Ok(all_tags) Ok(all_tags)
} }
#[tauri::command]
pub async fn get_all_namespaces(api_state: ApiAccess<'_>) -> PluginResult<Vec<NamespaceResponse>> {
let api = api_state.api().await?;
let all_namespaces = api.tag.get_all_namespaces().await?;
Ok(all_namespaces)
}
#[tauri::command] #[tauri::command]
pub async fn get_tags_for_file( pub async fn get_tags_for_file(
id: i64, id: i64,

@ -61,7 +61,9 @@ impl<R: Runtime> MediarepoPlugin<R> {
delete_repository, delete_repository,
has_executable, has_executable,
get_frontend_state, get_frontend_state,
set_frontend_state set_frontend_state,
get_all_namespaces,
get_files
]), ]),
} }
} }

Loading…
Cancel
Save