Add association function to urls

Signed-off-by: trivernis <trivernis@protonmail.com>
pull/1/head
trivernis 3 years ago
parent fe01a4ae5c
commit 188da6c4c1
Signed by: Trivernis
GPG Key ID: DFFFCC2C7A02DB45

@ -58,4 +58,18 @@ impl Url {
pub fn import(&mut self) -> UrlImportBuilder { pub fn import(&mut self) -> UrlImportBuilder {
UrlImportBuilder::new(self.client.clone(), &self.url) UrlImportBuilder::new(self.client.clone(), &self.url)
} }
/// Associates the url with a list of file hashes
pub async fn associate(&mut self, hashes: Vec<String>) -> Result<()> {
self.client
.associate_urls(vec![self.url.clone()], hashes)
.await
}
/// Disassociates the url with a list of file hashes
pub async fn disassociate(&mut self, hashes: Vec<String>) -> Result<()> {
self.client
.disassociate_urls(vec![self.url.clone()], hashes)
.await
}
} }

@ -23,3 +23,25 @@ async fn it_imports() {
.await .await
.unwrap(); .unwrap();
} }
#[tokio::test]
async fn it_associates() {
let mut url = get_url().await;
url.associate(vec![
"0000000000000000000000000000000000000000000000000000000000000000".to_string(),
])
.await
.unwrap();
}
#[tokio::test]
async fn it_disassociates() {
let mut url = get_url().await;
url.disassociate(vec![
"0000000000000000000000000000000000000000000000000000000000000000".to_string(),
])
.await
.unwrap();
}

Loading…
Cancel
Save