#[derive(Debug)]
pub struct DeploymentClient<'a> {
    base_client: &'a mut crate::core::base_client::BaseClient,
}
impl<'a> DeploymentClient<'a> {
    pub(crate) fn _new(
        base_client: &'a mut crate::core::base_client::BaseClient,
    ) -> Self {
        Self { base_client }
    }
    /// List deployments for a specific documentation project
    ///
    /// Retrieves all deployments for a doc project
    ///
    /// GET /doc_project/{doc_name}/deployment
    pub async fn list(
        &mut self,
        request: super::request_types::ListRequest,
    ) -> crate::SdkResult<Vec<crate::models::Deployment>> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/doc_project/{}/deployment", crate
                    ::core::params::format_string_param(& request.doc_name)
                ),
            );
        let mut builder = reqwest::Client::default().get(&url);
        let mut queries = crate::core::params::QueryParams::default();
        queries
            .add_option(
                "limit",
                &request.limit,
                crate::core::params::QueryStyle::Form,
                true,
            );
        queries
            .add_option(
                "target",
                &request.target,
                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::Deployment>>(response)
            .await
    }
    /// Get a specific deployment for a specific documentation project
    ///
    /// Retrieves single deployment
    ///
    /// GET /doc_project/{doc_name}/deployment/{deployment_id}
    pub async fn get(
        &mut self,
        request: super::request_types::GetRequest,
    ) -> crate::SdkResult<crate::models::Deployment> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/doc_project/{}/deployment/{}", crate
                    ::core::params::format_string_param(& request.doc_name), crate
                    ::core::params::format_string_param(& request.deployment_id)
                ),
            );
        let mut builder = reqwest::Client::default().get(&url);
        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::<crate::models::Deployment>(response).await
    }
    /// Deploy a new generated version of documentation with linked guides & APIs
    ///
    /// Deploys a new generated version of documentation with linked guides & APIs
    ///
    /// POST /doc_project/{doc_name}/deployment
    pub async fn trigger(
        &mut self,
        request: super::request_types::TriggerRequest,
    ) -> crate::SdkResult<crate::models::Deployment> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/doc_project/{}/deployment", crate
                    ::core::params::format_string_param(& request.doc_name)
                ),
            );
        let mut builder = reqwest::Client::default().post(&url);
        builder = builder.header("x-sideko-sdk-language", "rust");
        builder = builder.header("content-type", "application/json");
        builder = builder
            .json(
                &crate::models::NewDeployment {
                    doc_version_id: request.doc_version_id,
                    target: request.target,
                },
            );
        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?;
        crate::core::response::process_json::<crate::models::Deployment>(response).await
    }
}
