update: allow sheet unknown endpoint if provided
- feat: multi files commit Signed-off-by: Pakin <pakin.t@forth.co.th>
This commit is contained in:
parent
0f857445a4
commit
fa62d9d83f
6 changed files with 108 additions and 21 deletions
36
src/app.rs
36
src/app.rs
|
|
@ -349,6 +349,42 @@ pub async fn invoke_commit_request(
|
|||
Ok(())
|
||||
}
|
||||
|
||||
/// Invoke sending from server to server for committing case multiple files
|
||||
pub async fn invoke_commit_multiple_files_request(
|
||||
config: DevConfig,
|
||||
payloads: Vec<CommitPayload>,
|
||||
) -> Result<(), Box<dyn std::error::Error>> {
|
||||
let client = reqwest::Client::new();
|
||||
let commit_path = config.get_post_file_to_recipe_repo();
|
||||
let mut form = multipart::Form::new()
|
||||
.text("message", payloads.first().unwrap().message.clone())
|
||||
.text(
|
||||
"signature_username",
|
||||
payloads.first().unwrap().signature_username.clone(),
|
||||
)
|
||||
.text(
|
||||
"signature_email",
|
||||
payloads.first().unwrap().signature_email.clone(),
|
||||
);
|
||||
|
||||
for (index, payload) in payloads.iter().enumerate() {
|
||||
form = form
|
||||
.text(format!("path{index}"), payload.path.clone())
|
||||
.part(
|
||||
format!("file{index}"),
|
||||
multipart::Part::bytes(payload.file_bytes.clone())
|
||||
.mime_str("application/octet-stream")
|
||||
.unwrap(),
|
||||
);
|
||||
}
|
||||
|
||||
let response = client.post(commit_path).multipart(form).send().await?;
|
||||
|
||||
info!("commit status: {}", response.status());
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn invoke_push_request(config: DevConfig) -> Result<String, Box<dyn std::error::Error>> {
|
||||
let client = reqwest::Client::new();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue