pub fn new(
        base_url: impl AsRef<str>,
        timeout: Option<Duration>,
        upload_timeout: Option<Duration>,
        version: &str,
        use_preflight: bool,
    ) -> Result<Self> {
        // for the api client, the timeout applies for the entire duration
        // of the request, including the connection phase
        let client = reqwest::Client::builder();
        let client = if let Some(dur) = timeout {
            client.timeout(dur)
        } else {
            client
        }
        .build()
        .map_err(Error::TlsError)?;

        // for the cache client, the timeout applies only to the request
        // connection time, while the upload timeout applies to the entire
        // request
        let cache_client = reqwest::Client::builder();
        let cache_client = match (timeout, upload_timeout) {
            (Some(dur), Some(upload_dur)) => cache_client.connect_timeout(dur).timeout(upload_dur),
            (Some(dur), None) | (None, Some(dur)) => cache_client.timeout(dur),
            (None, None) => cache_client,
        }
        .build()
        .map_err(Error::TlsError)?;

        let user_agent = build_user_agent(version);
        Ok(APIClient {
            client,
            cache_client,
            base_url: base_url.as_ref().to_string(),
            user_agent,
            use_preflight,
        })
    }
Create a new APIClient.

# Arguments
`base_url` - The base URL for the API.
`timeout` - The timeout for requests.
`upload_timeout` - If specified, uploading files will use `timeout` for
the connection, and `upload_timeout` for the total.
Otherwise, `timeout` will be used for the total.
`version` - The version of the client.
`use_preflight` - If true, use the preflight API for all requests.
crates/turborepo-api-client/src/lib.rs