Skip to content

Commit 3a3d170

Browse files
committed
refactor: use create_simple_bucket
1 parent 8afe2a8 commit 3a3d170

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

src/main.rs

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use aw_client_rust::AwClient;
2-
use aw_models::{Bucket, Event};
2+
use aw_models::Event;
33
use chrono::{DateTime, TimeDelta, Utc};
44
use dirs::config_dir;
55
use env_logger::Env;
@@ -96,18 +96,7 @@ fn get_config_path() -> Option<std::path::PathBuf> {
9696

9797
async fn create_bucket(aw_client: &AwClient) -> Result<(), Box<dyn std::error::Error>> {
9898
let res = aw_client
99-
.create_bucket(&Bucket {
100-
id: "aw-watcher-lastfm".to_string(),
101-
bid: None,
102-
_type: "currently-playing".to_string(),
103-
data: Map::new(),
104-
metadata: Default::default(),
105-
last_updated: None,
106-
hostname: "".to_string(),
107-
client: "aw-watcher-lastfm-rust".to_string(),
108-
created: None,
109-
events: None,
110-
})
99+
.create_bucket_simple("aw-watcher-lastfm", "currently-playing")
111100
.await;
112101
match res {
113102
Ok(_) => Ok(()),
@@ -396,11 +385,11 @@ mod tests {
396385
assert_eq!(parse_time_string("7d"), Some(TimeDelta::days(7)));
397386
assert_eq!(parse_time_string("24h"), Some(TimeDelta::hours(24)));
398387
assert_eq!(parse_time_string("30m"), Some(TimeDelta::minutes(30)));
399-
388+
400389
// Test invalid inputs
401390
assert_eq!(parse_time_string(""), None);
402-
assert_eq!(parse_time_string("30s"), None); // Invalid unit
403-
assert_eq!(parse_time_string("abc"), None); // Invalid format
404-
assert_eq!(parse_time_string("-1d"), None); // Negative number
391+
assert_eq!(parse_time_string("30s"), None); // Invalid unit
392+
assert_eq!(parse_time_string("abc"), None); // Invalid format
393+
assert_eq!(parse_time_string("-1d"), None); // Negative number
405394
}
406395
}

0 commit comments

Comments
 (0)