|
|
@ -239,11 +239,15 @@ impl HydrusFile {
|
|
|
|
self.client.disassociate_urls(urls, vec![hash]).await
|
|
|
|
self.client.disassociate_urls(urls, vec![hash]).await
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns map mapping lists of tags to services
|
|
|
|
/// Returns map mapping lists of tags to services.
|
|
|
|
pub async fn services_with_tags(&mut self) -> Result<HashMap<ServiceName, Vec<Tag>>> {
|
|
|
|
///
|
|
|
|
|
|
|
|
/// Deprecation: Use [HydrusFile::services_with_tags] instead.
|
|
|
|
|
|
|
|
#[deprecated(note = "Deprecated in the official API. Use services_with_tags instead.")]
|
|
|
|
|
|
|
|
pub async fn service_names_with_tags(&mut self) -> Result<HashMap<ServiceName, Vec<Tag>>> {
|
|
|
|
let metadata = self.metadata().await?;
|
|
|
|
let metadata = self.metadata().await?;
|
|
|
|
let mut tag_mappings = HashMap::new();
|
|
|
|
let mut tag_mappings = HashMap::new();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#[allow(deprecated)]
|
|
|
|
for (service, status_tags) in &metadata.service_names_to_statuses_to_tags {
|
|
|
|
for (service, status_tags) in &metadata.service_names_to_statuses_to_tags {
|
|
|
|
let mut tag_list = Vec::new();
|
|
|
|
let mut tag_list = Vec::new();
|
|
|
|
|
|
|
|
|
|
|
@ -256,6 +260,23 @@ impl HydrusFile {
|
|
|
|
Ok(tag_mappings)
|
|
|
|
Ok(tag_mappings)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns a mapping with service ids mapped to tags
|
|
|
|
|
|
|
|
pub async fn services_with_tags(&mut self) -> Result<HashMap<ServiceIdentifier, Vec<Tag>>> {
|
|
|
|
|
|
|
|
let metadata = self.metadata().await?;
|
|
|
|
|
|
|
|
let mut tag_mappings = HashMap::new();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (service, status_tags) in &metadata.service_keys_to_statuses_to_tags {
|
|
|
|
|
|
|
|
let mut tag_list = Vec::new();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (_, tags) in status_tags {
|
|
|
|
|
|
|
|
tag_list.append(&mut tags.into_iter().map(|t| t.into()).collect())
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
tag_mappings.insert(ServiceIdentifier::Key(service.clone()), tag_list);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Ok(tag_mappings)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Returns a list of all tags assigned to the file
|
|
|
|
/// Returns a list of all tags assigned to the file
|
|
|
|
pub async fn tags(&mut self) -> Result<Vec<Tag>> {
|
|
|
|
pub async fn tags(&mut self) -> Result<Vec<Tag>> {
|
|
|
|
let mut tag_list = Vec::new();
|
|
|
|
let mut tag_list = Vec::new();
|
|
|
|