You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
use crate::tauri_plugin::commands::ApiAccess;
|
|
|
|
use crate::tauri_plugin::error::PluginResult;
|
|
|
|
use crate::types::tags::TagResponse;
|
|
|
|
|
|
|
|
#[tauri::command]
|
|
|
|
pub async fn get_all_tags(api_state: ApiAccess<'_>) -> PluginResult<Vec<TagResponse>> {
|
|
|
|
let api = api_state.api().await?;
|
|
|
|
let all_tags = api.tag.get_all_tags().await?;
|
|
|
|
|
|
|
|
Ok(all_tags)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[tauri::command]
|
|
|
|
pub async fn get_tags_for_file(
|
|
|
|
hash: String,
|
|
|
|
api_state: ApiAccess<'_>,
|
|
|
|
) -> PluginResult<Vec<TagResponse>> {
|
|
|
|
let api = api_state.api().await?;
|
|
|
|
let tags = api.tag.get_tags_for_file(hash).await?;
|
|
|
|
|
|
|
|
Ok(tags)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[tauri::command]
|
|
|
|
pub async fn get_tags_for_files(
|
|
|
|
hashes: Vec<String>,
|
|
|
|
api_state: ApiAccess<'_>,
|
|
|
|
) -> PluginResult<Vec<TagResponse>> {
|
|
|
|
let api = api_state.api().await?;
|
|
|
|
let tags = api.tag.get_tags_for_files(hashes).await?;
|
|
|
|
|
|
|
|
Ok(tags)
|
|
|
|
}
|