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

Method patch_file_content

client/src/cloud.rs:305–328  ·  view source on GitHub ↗
(
        &mut self,
        username: &str,
        filename: &str,
        content: Vec<u8>,
    )

Source from the content-addressed store, hash-verified

303 }
304
305 async fn patch_file_content(
306 &mut self,
307 username: &str,
308 filename: &str,
309 content: Vec<u8>,
310 ) -> io::Result<()> {
311 let auth_data = self.auth_data.borrow();
312
313 let response = self
314 .client
315 .patch(self.make_url(&format!("api/users/{}/files/{}", username, filename)))
316 .headers(self.default_headers())
317 .header("Content-Type", "application/octet-stream")
318 .header("X-EndBASIC-PatchContent", "true")
319 .body(content)
320 .bearer_auth(Self::require_auth_data(auth_data.as_ref())?.access_token.as_str())
321 .send()
322 .await
323 .map_err(reqwest_error_to_io_error)?;
324 match response.status() {
325 StatusCode::OK | StatusCode::CREATED => Ok(()),
326 _ => Err(http_response_to_io_error(response).await),
327 }
328 }
329
330 async fn patch_file_acls(
331 &mut self,

Callers 3

runFunction · 0.45
putMethod · 0.45

Calls 6

patchMethod · 0.80
make_urlMethod · 0.80
default_headersMethod · 0.80
as_strMethod · 0.80
insertMethod · 0.45

Tested by

no test coverage detected