diff --git a/src/models/url.rs b/src/models/url.rs index 71363d0..5e124e3 100644 --- a/src/models/url.rs +++ b/src/models/url.rs @@ -58,4 +58,18 @@ impl Url { pub fn import(&mut self) -> UrlImportBuilder { UrlImportBuilder::new(self.client.clone(), &self.url) } + + /// Associates the url with a list of file hashes + pub async fn associate(&mut self, hashes: Vec) -> 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) -> Result<()> { + self.client + .disassociate_urls(vec![self.url.clone()], hashes) + .await + } } diff --git a/tests/wrapper/test_url.rs b/tests/wrapper/test_url.rs index 89122f4..7df9806 100644 --- a/tests/wrapper/test_url.rs +++ b/tests/wrapper/test_url.rs @@ -23,3 +23,25 @@ async fn it_imports() { .await .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(); +}