diff --git a/generate.sh b/generate.sh index 552f7fc..d0c6acf 100755 --- a/generate.sh +++ b/generate.sh @@ -39,6 +39,9 @@ cat patches/2FA_Current_User.rs >> src/models/current_user.rs sed -i 's/pub use self::current_user::CurrentUser;/pub use self::current_user::{EitherUserOrTwoFactor, CurrentUser};/g' src/models/mod.rs sed -i 's/Result>/Result>/g' src/apis/authentication_api.rs +# https://github.com/vrchatapi/vrchatapi-rust/pull/29 +sed -i "s/local_var_req_builder = local_var_req_builder.json(&\(.*\));/if let Some(\1) = \1 { \0 }/g" src/apis/files_api.rs + cargo fmt cargo build cargo test diff --git a/src/apis/files_api.rs b/src/apis/files_api.rs index 09646c8..7648f3d 100644 --- a/src/apis/files_api.rs +++ b/src/apis/files_api.rs @@ -104,7 +104,9 @@ pub async fn create_file( local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } - local_var_req_builder = local_var_req_builder.json(&create_file_request); + if let Some(create_file_request) = create_file_request { + local_var_req_builder = local_var_req_builder.json(&create_file_request); + } let local_var_req = local_var_req_builder.build()?; let local_var_resp = local_var_client.execute(local_var_req).await?; @@ -148,7 +150,9 @@ pub async fn create_file_version( local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } - local_var_req_builder = local_var_req_builder.json(&create_file_version_request); + if let Some(create_file_version_request) = create_file_version_request { + local_var_req_builder = local_var_req_builder.json(&create_file_version_request); + } let local_var_req = local_var_req_builder.build()?; let local_var_resp = local_var_client.execute(local_var_req).await?; @@ -326,7 +330,9 @@ pub async fn finish_file_data_upload( local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone()); } - local_var_req_builder = local_var_req_builder.json(&finish_file_data_upload_request); + if let Some(finish_file_data_upload_request) = finish_file_data_upload_request { + local_var_req_builder = local_var_req_builder.json(&finish_file_data_upload_request); + } let local_var_req = local_var_req_builder.build()?; let local_var_resp = local_var_client.execute(local_var_req).await?;