get_upload_info

Function get_upload_info 

Source
pub fn get_upload_info(
    file_size: usize,
    file_name: Option<String>,
    client: &Client,
    api_key: &str,
) -> Result<(String, String), Box<dyn Error>>
Expand description

Gets the presigned upload URL and file ID for uploading a file.

§Arguments

  • file_size - The size of the file to upload in bytes.
  • file_name - Optional custom file name. If provided, it will be used; otherwise, a random UUID will be generated by the server.
  • client - A preconfigured reqwest::blocking::Client.
  • api_key - Your CodeDefender API key.

§Returns

A Result<(String, String), Box<dyn Error>> containing the file ID and presigned upload URL on success.

§Errors

Returns an error if the request fails or if the server responds with a non-success status code.