#[derive(Debug)]
pub struct SdkClient<'a> {
    base_client: &'a mut crate::core::base_client::BaseClient,
}
impl<'a> SdkClient<'a> {
    pub(crate) fn _new(
        base_client: &'a mut crate::core::base_client::BaseClient,
    ) -> Self {
        Self { base_client }
    }
    pub fn config(
        &mut self,
    ) -> crate::resources::sdk::config::resource_client::ConfigClient {
        crate::resources::sdk::config::resource_client::ConfigClient::_new(
            self.base_client,
        )
    }
    /// List all managed SDKs
    ///
    /// GET /sdk
    pub async fn list(
        &mut self,
        request: super::request_types::ListRequest,
    ) -> crate::SdkResult<Vec<crate::models::SdkGeneration>> {
        let url = self.base_client.build_url("/sdk");
        let mut builder = reqwest::Client::default().get(&url);
        let mut queries = crate::core::params::QueryParams::default();
        queries
            .add_option(
                "api_name",
                &request.api_name,
                crate::core::params::QueryStyle::Form,
                true,
            );
        queries
            .add_option(
                "successful",
                &request.successful,
                crate::core::params::QueryStyle::Form,
                true,
            );
        builder = builder.query(&queries.params);
        builder = builder.header("x-sideko-sdk-language", "rust");
        builder = self
            .base_client
            .apply_auths_to_builder(builder, &["ApiKeyAuth", "CookieAuth"])
            .await?;
        let mut response = builder.send().await?;
        response = self.base_client.error_for_status("GET", response).await?;
        crate::core::response::process_json::<
            Vec<crate::models::SdkGeneration>,
        >(response)
            .await
    }
    /// Generate a new managed SDK from a Sideko configuration file
    ///
    /// POST /sdk
    pub async fn generate(
        &mut self,
        request: super::request_types::GenerateRequest,
    ) -> crate::SdkResult<crate::BinaryResponse> {
        let url = self.base_client.build_url("/sdk");
        let mut builder = reqwest::Client::default().post(&url);
        builder = builder.header("x-sideko-sdk-language", "rust");
        let mut form_data = reqwest::multipart::Form::new();
        if let Some(val) = &request.api_version {
            form_data = form_data
                .part(
                    "api_version",
                    reqwest::multipart::Part::text(
                        crate::core::params::format_string_param(&val),
                    ),
                );
        }
        if let Some(val) = &request.github_actions {
            form_data = form_data
                .part(
                    "github_actions",
                    reqwest::multipart::Part::text(
                        crate::core::params::format_string_param(&val),
                    ),
                );
        }
        if let Some(val) = &request.sdk_version {
            form_data = form_data
                .part(
                    "sdk_version",
                    reqwest::multipart::Part::text(
                        crate::core::params::format_string_param(&val),
                    ),
                );
        }
        form_data = form_data
            .part("config", reqwest::multipart::Part::from(&request.config));
        form_data = form_data
            .part(
                "language",
                reqwest::multipart::Part::text(
                    crate::core::params::format_string_param(&request.language),
                ),
            );
        builder = builder.multipart(form_data);
        builder = self
            .base_client
            .apply_auths_to_builder(builder, &["ApiKeyAuth", "CookieAuth"])
            .await?;
        let mut response = builder.send().await?;
        response = self.base_client.error_for_status("POST", response).await?;
        Ok(crate::BinaryResponse::new(response).await)
    }
    /// Update an SDK to reflect the latest state of the API
    ///
    /// POST /sdk/update
    pub async fn update(
        &mut self,
        request: super::request_types::UpdateRequest,
    ) -> crate::SdkResult<String> {
        let url = self.base_client.build_url("/sdk/update");
        let mut builder = reqwest::Client::default().post(&url);
        builder = builder.header("x-sideko-sdk-language", "rust");
        let mut form_data = reqwest::multipart::Form::new();
        if let Some(val) = &request.api_version {
            form_data = form_data
                .part(
                    "api_version",
                    reqwest::multipart::Part::text(
                        crate::core::params::format_string_param(&val),
                    ),
                );
        }
        form_data = form_data
            .part("config", reqwest::multipart::Part::from(&request.config));
        form_data = form_data
            .part("prev_sdk_git", reqwest::multipart::Part::from(&request.prev_sdk_git));
        form_data = form_data
            .part(
                "prev_sdk_id",
                reqwest::multipart::Part::text(
                    crate::core::params::format_string_param(&request.prev_sdk_id),
                ),
            );
        form_data = form_data
            .part(
                "sdk_version",
                reqwest::multipart::Part::text(
                    crate::core::params::format_string_param(&request.sdk_version),
                ),
            );
        builder = builder.multipart(form_data);
        builder = self
            .base_client
            .apply_auths_to_builder(builder, &["ApiKeyAuth", "CookieAuth"])
            .await?;
        let mut response = builder.send().await?;
        response = self.base_client.error_for_status("POST", response).await?;
        Ok(response.text().await.unwrap_or_default())
    }
}
