Skip to content

Commit

Permalink
fix: improved return type for client query
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Apr 5, 2024
1 parent ae603a2 commit 4fa3a29
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aw-client-rust/src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl AwClient {
);
proxy_method!(
query,
serde_json::Value,
Vec<serde_json::Value>,
query: &str,
timeperiods: Vec<(DateTime<Utc>, DateTime<Utc>)>
);
Expand Down
3 changes: 2 additions & 1 deletion aw-client-rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ impl AwClient {
&self,
query: &str,
timeperiods: Vec<(DateTime<Utc>, DateTime<Utc>)>,
) -> Result<serde_json::Value, reqwest::Error> {
) -> Result<Vec<serde_json::Value>, reqwest::Error> {
let url = reqwest::Url::parse(format!("{}/api/0/query", self.baseurl).as_str()).unwrap();

// Format timeperiods as ISO8601 strings, separated by /
Expand All @@ -112,6 +112,7 @@ impl AwClient {
.map(|(start, stop)| format!("{}/{}", start, stop))
.collect();

// Result is a sequence, one element per timeperiod
self.client
.post(url)
.json(&json!({
Expand Down

0 comments on commit 4fa3a29

Please sign in to comment.