MCPcopy Create free account
hub / github.com/apache/paimon-rust / get

Method get

crates/paimon/src/api/rest_client.rs:96–128  ·  view source on GitHub ↗

Perform a GET request with optional query parameters. # Arguments `path` - The path to append to the base URL. `params` - Optional query parameters as key-value pairs. # Returns The parsed JSON response.

(
        &self,
        path: &str,
        params: Option<&[(impl AsRef<str>, impl AsRef<str>)]>,
    )

Source from the content-addressed store, hash-verified

94 /// # Returns
95 /// The parsed JSON response.
96 pub async fn get<T: DeserializeOwned>(
97 &self,
98 path: &str,
99 params: Option<&[(impl AsRef<str>, impl AsRef<str>)]>,
100 ) -> Result<T> {
101 let url = self.request_url(path);
102
103 let params_map: HashMap<String, String> = match params {
104 Some(p) => p
105 .iter()
106 .map(|(k, v)| (k.as_ref().to_string(), v.as_ref().to_string()))
107 .collect(),
108 None => HashMap::new(),
109 };
110
111 let headers = self
112 .build_auth_headers("GET", path, None, params_map)
113 .await?;
114
115 let mut request = self.client.get(&url);
116 if let Some(p) = params {
117 for (key, value) in p {
118 request = request.query(&[(key.as_ref(), value.as_ref())]);
119 }
120 }
121
122 let request = Self::apply_headers(request, &headers);
123 let resp = request.send().await.map_err(|e| Error::UnexpectedError {
124 message: "http get failed".to_string(),
125 source: Some(Box::new(e)),
126 })?;
127 self.parse_response(resp).await
128 }
129
130 /// Perform a POST request with a JSON body.
131 ///

Callers 15

create_index_mappingFunction · 0.45
remap_predicateFunction · 0.45
entryMethod · 0.45
leaf_to_vortex_exprFunction · 0.45
get_field_atFunction · 0.45
min_valueMethod · 0.45
max_valueMethod · 0.45
newMethod · 0.45
list_databases_pagedMethod · 0.45

Calls 5

request_urlMethod · 0.80
build_auth_headersMethod · 0.80
queryMethod · 0.80
parse_responseMethod · 0.80
iterMethod · 0.45

Tested by

no test coverage detected