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

Method get_files

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

Source from the content-addressed store, hash-verified

231 }
232
233 async fn get_files(&mut self, username: &str) -> io::Result<GetFilesResponse> {
234 let mut builder = self
235 .client
236 .get(self.make_url(&format!("api/users/{}/files", username)))
237 .headers(self.default_headers());
238 if let Some(auth_data) = self.auth_data.borrow().as_ref() {
239 builder = builder.bearer_auth(auth_data.access_token.as_str());
240 }
241 let response = builder.send().await.map_err(reqwest_error_to_io_error)?;
242 match response.status() {
243 StatusCode::OK => {
244 let bytes = response.bytes().await.map_err(reqwest_error_to_io_error)?;
245 let response: GetFilesResponse = serde_json::from_reader(bytes.reader())?;
246 Ok(response)
247 }
248 _ => Err(http_response_to_io_error(response).await),
249 }
250 }
251
252 async fn get_file(&mut self, username: &str, filename: &str) -> io::Result<Vec<u8>> {
253 let mut builder = self

Callers 2

runFunction · 0.45
enumerateMethod · 0.45

Calls 6

make_urlMethod · 0.80
default_headersMethod · 0.80
as_strMethod · 0.80
bytesMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected