Skip to content

Commit

Permalink
Removing unnecessary duplicate urls
Browse files Browse the repository at this point in the history
  • Loading branch information
poster515 committed Jan 29, 2024
1 parent 1ffc061 commit 5d900ed
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions src/api/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ impl Client {
bucket: &str,
days_ago: Option<i64>
) -> Result<Vec<String>, RequestError> {
let req_url = self.url("/api/v2/query");
let query = Query::new(format!(
r#"import "influxdata/influxdb/schema"
Expand All @@ -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
Expand All @@ -277,7 +275,6 @@ schema.measurements(bucket: "{bucket}"{}) "#,
measurement: &str,
days_ago: Option<i64>
) -> Result<Vec<String>, RequestError> {
let req_url = self.url("/api/v2/query");
let query = Query::new(format!(
r#"import "influxdata/influxdb/schema"
Expand All @@ -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
Expand All @@ -302,7 +298,6 @@ schema.measurements(bucket: "{bucket}"{}) "#,
tag: &str,
days_ago: Option<i64>
) -> Result<Vec<String>, RequestError> {
let req_url = self.url("/api/v2/query");
let query = Query::new(format!(
r#"import "influxdata/influxdb/schema"
Expand All @@ -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
Expand All @@ -327,8 +321,6 @@ schema.measurements(bucket: "{bucket}"{}) "#,
measurement: &str,
days_ago: Option<i64>
) -> Result<Vec<String>, RequestError> {

let req_url = self.url("/api/v2/query");
let query = Query::new(format!(
r#"import "influxdata/influxdb/schema"
Expand All @@ -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<Vec<String>, RequestError> {

let req_url = self.url("/api/v2/query");
let body = serde_json::to_string(&query).context(Serializing)?;

let response = self
Expand Down

0 comments on commit 5d900ed

Please sign in to comment.