/*
 * File Response Test
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 * Generated by: https://openapi-generator.tech
 */


use reqwest;

use crate::apis::ResponseContent;
use super::{Error, configuration};


/// struct for typed errors of method `fileresponsetest`
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FileresponsetestError {
    UnknownValue(serde_json::Value),
}


pub fn fileresponsetest(configuration: &configuration::Configuration, ) -> Result<std::path::PathBuf, Error<FileresponsetestError>> {

    let client = &configuration.client;

    let uri_str = format!("{}/tests/fileResponse", configuration.base_path);
    let mut req_builder = client.get(uri_str.as_str());

    if let Some(ref user_agent) = configuration.user_agent {
        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
    }

    let req = req_builder.build()?;
    let mut resp = client.execute(req)?;

    let status = resp.status();
    let content = resp.text()?;

    if status.is_success() {
        serde_json::from_str(&content).map_err(Error::from)
    } else {
        let entity: Option<FileresponsetestError> = serde_json::from_str(&content).ok();
        let error = ResponseContent { status, content, entity };
        Err(Error::ResponseError(error))
    }
}

