Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: invalid text 'null' in request when no args given #29

Merged
merged 4 commits into from
Oct 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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<models::CurrentUser, Error<GetCurrentUserError>>/Result<models::EitherUserOrTwoFactor, Error<GetCurrentUserError>>/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
12 changes: 9 additions & 3 deletions src/apis/files_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;
Expand Down Expand Up @@ -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?;
Expand Down Expand Up @@ -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?;
Expand Down
Loading