upload_data

Function upload_data 

Source
pub fn upload_data(
    data: Vec<u8>,
    filename: String,
    client: &Client,
    api_key: &str,
) -> Result<String, Box<dyn Error>>
Expand description

Uploads raw data bytes to CodeDefender with a specific filename and returns the file ID.

§Arguments

  • data - The raw bytes to upload.
  • filename - The specific filename to use for the upload.
  • client - A preconfigured reqwest::blocking::Client.
  • api_key - Your CodeDefender API key.

§Returns

A Result<String, Box<dyn Error>> containing the file ID on success.

§Errors

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