From 5d900ed07eb551ef779dbdebb9c27d199abac295 Mon Sep 17 00:00:00 2001 From: Joseph Post Date: Mon, 29 Jan 2024 11:53:40 -0500 Subject: [PATCH] Removing unnecessary duplicate urls --- src/api/query.rs | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/src/api/query.rs b/src/api/query.rs index 1095900..fa80122 100644 --- a/src/api/query.rs +++ b/src/api/query.rs @@ -256,7 +256,6 @@ impl Client { bucket: &str, days_ago: Option ) -> Result, RequestError> { - let req_url = self.url("/api/v2/query"); let query = Query::new(format!( r#"import "influxdata/influxdb/schema" @@ -266,8 +265,7 @@ schema.measurements(bucket: "{bucket}"{}) "#, None => { String::from("") } } )); - - self.exec_schema_query(&req_url, query).await + self.exec_schema_query(query).await } /// List a measurement's field keys @@ -277,7 +275,6 @@ schema.measurements(bucket: "{bucket}"{}) "#, measurement: &str, days_ago: Option ) -> Result, RequestError> { - let req_url = self.url("/api/v2/query"); let query = Query::new(format!( r#"import "influxdata/influxdb/schema" @@ -290,8 +287,7 @@ schema.measurements(bucket: "{bucket}"{}) "#, None => { String::from("") } } )); - - self.exec_schema_query(&req_url, query).await + self.exec_schema_query(query).await } /// List keys of measurement tag @@ -302,7 +298,6 @@ schema.measurements(bucket: "{bucket}"{}) "#, tag: &str, days_ago: Option ) -> Result, RequestError> { - let req_url = self.url("/api/v2/query"); let query = Query::new(format!( r#"import "influxdata/influxdb/schema" @@ -316,8 +311,7 @@ schema.measurements(bucket: "{bucket}"{}) "#, None => { String::from("") } } )); - - self.exec_schema_query(&req_url, query).await + self.exec_schema_query(query).await } /// List all tag values for measurement @@ -327,8 +321,6 @@ schema.measurements(bucket: "{bucket}"{}) "#, measurement: &str, days_ago: Option ) -> Result, RequestError> { - - let req_url = self.url("/api/v2/query"); let query = Query::new(format!( r#"import "influxdata/influxdb/schema" @@ -341,15 +333,14 @@ schema.measurements(bucket: "{bucket}"{}) "#, None => { String::from("") } } )); - self.exec_schema_query(&req_url, query).await + self.exec_schema_query(query).await } async fn exec_schema_query( - &self, - req_url: &str, + &self, query: Query ) -> Result, RequestError> { - + let req_url = self.url("/api/v2/query"); let body = serde_json::to_string(&query).context(Serializing)?; let response = self