Skip to content

Commit

Permalink
Support async file upload
Browse files Browse the repository at this point in the history
  • Loading branch information
vincent-herlemont committed Dec 4, 2024
1 parent cf78f10 commit 18590d3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,22 @@ pub {{#supportAsync}}async {{/supportAsync}}fn {{{operationId}}}(configuration:
{{/required}}
{{/supportAsync}}
{{#supportAsync}}
// TODO: support file upload for '{{{baseName}}}' parameter
{{#required}}
{{^isNullable}}
local_var_form = local_var_form.file("{{{baseName}}}", {{{paramName}}}).await?;
{{/isNullable}}
{{#isNullable}}
match {{{paramName}}} {
Some(local_var_param_value) => { local_var_form = local_var_form.file("{{{baseName}}}", local_var_param_value).await?; },
None => { unimplemented!("Required nullable form file param not supported"); },
}
{{/isNullable}}
{{/required}}
{{^required}}
if let Some(local_var_param_value) = {{{paramName}}} {
local_var_form = local_var_form.file("{{{baseName}}}", local_var_param_value).await?;
}
{{/required}}
{{/supportAsync}}
{{/isFile}}
{{^isFile}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U
if let Some(local_var_param_value) = additional_metadata {
local_var_form = local_var_form.text("additionalMetadata", local_var_param_value.to_string());
}
// TODO: support file upload for 'file' parameter
if let Some(local_var_param_value) = file {
local_var_form = local_var_form.file("file", local_var_param_value).await?;
}
local_var_req_builder = local_var_req_builder.multipart(local_var_form);

let local_var_req = local_var_req_builder.build()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,9 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U
if let Some(local_var_param_value) = additional_metadata {
local_var_form = local_var_form.text("additionalMetadata", local_var_param_value.to_string());
}
// TODO: support file upload for 'file' parameter
if let Some(local_var_param_value) = file {
local_var_form = local_var_form.file("file", local_var_param_value).await?;
}
local_var_req_builder = local_var_req_builder.multipart(local_var_form);

let local_var_req = local_var_req_builder.build()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U
if let Some(local_var_param_value) = additional_metadata {
local_var_form = local_var_form.text("additionalMetadata", local_var_param_value.to_string());
}
// TODO: support file upload for 'file' parameter
if let Some(local_var_param_value) = file {
local_var_form = local_var_form.file("file", local_var_param_value).await?;
}
local_var_req_builder = local_var_req_builder.multipart(local_var_form);

let local_var_req = local_var_req_builder.build()?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ pub async fn upload_file(configuration: &configuration::Configuration, params: U
if let Some(local_var_param_value) = additional_metadata {
local_var_form = local_var_form.text("additionalMetadata", local_var_param_value.to_string());
}
// TODO: support file upload for 'file' parameter
if let Some(local_var_param_value) = file {
local_var_form = local_var_form.file("file", local_var_param_value).await?;
}
local_var_req_builder = local_var_req_builder.multipart(local_var_form);

let local_var_req = local_var_req_builder.build()?;
Expand Down

0 comments on commit 18590d3

Please sign in to comment.