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

Method post

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

Perform a POST request with a JSON body. # Arguments `path` - The path to append to the base URL. `body` - The JSON body to send. # Returns The parsed JSON response.

(
        &self,
        path: &str,
        body: &B,
    )

Source from the content-addressed store, hash-verified

136 /// # Returns
137 /// The parsed JSON response.
138 pub async fn post<T: DeserializeOwned, B: serde::Serialize>(
139 &self,
140 path: &str,
141 body: &B,
142 ) -> Result<T> {
143 let url = self.request_url(path);
144 let body_str = serde_json::to_string(body).ok();
145 let headers = self
146 .build_auth_headers("POST", path, body_str.as_deref(), HashMap::new())
147 .await?;
148 let request = self.client.post(&url).json(body);
149 let request = Self::apply_headers(request, &headers);
150 let resp = request.send().await.map_err(|e| Error::UnexpectedError {
151 message: "http post failed".to_string(),
152 source: Some(Box::new(e)),
153 })?;
154 self.parse_response(resp).await
155 }
156
157 /// Perform a DELETE request with optional query parameters.
158 ///

Callers 9

create_databaseMethod · 0.80
alter_databaseMethod · 0.80
create_tableMethod · 0.80
rename_tableMethod · 0.80
commit_snapshotMethod · 0.80
rollback_to_snapshotMethod · 0.80
rollback_to_tagMethod · 0.80
start_mock_serverFunction · 0.80

Calls 3

request_urlMethod · 0.80
build_auth_headersMethod · 0.80
parse_responseMethod · 0.80

Tested by 2

start_mock_serverFunction · 0.64