MCPcopy Index your code
hub / github.com/endbasic/endbasic / delete_file

Method delete_file

client/src/cloud.rs:365–381  ·  view source on GitHub ↗
(&mut self, username: &str, filename: &str)

Source from the content-addressed store, hash-verified

363 }
364
365 async fn delete_file(&mut self, username: &str, filename: &str) -> io::Result<()> {
366 let auth_data = self.auth_data.borrow();
367
368 let response = self
369 .client
370 .delete(self.make_url(&format!("api/users/{}/files/{}", username, filename)))
371 .headers(self.default_headers())
372 .header("Content-Length", 0)
373 .bearer_auth(Self::require_auth_data(auth_data.as_ref())?.access_token.as_str())
374 .send()
375 .await
376 .map_err(reqwest_error_to_io_error)?;
377 match response.status() {
378 StatusCode::OK => Ok(()),
379 _ => Err(http_response_to_io_error(response).await),
380 }
381 }
382}
383
384#[cfg(test)]

Callers 3

cleanupMethod · 0.45
runFunction · 0.45
deleteMethod · 0.45

Calls 6

make_urlMethod · 0.80
default_headersMethod · 0.80
as_strMethod · 0.80
removeMethod · 0.80
deleteMethod · 0.45

Tested by

no test coverage detected