#[derive(Debug)]
pub struct DocClient<'a> {
    base_client: &'a mut crate::core::base_client::BaseClient,
}
impl<'a> DocClient<'a> {
    pub(crate) fn _new(
        base_client: &'a mut crate::core::base_client::BaseClient,
    ) -> Self {
        Self { base_client }
    }
    pub fn version(
        &mut self,
    ) -> crate::resources::doc::version::resource_client::VersionClient {
        crate::resources::doc::version::resource_client::VersionClient::_new(
            self.base_client,
        )
    }
    pub fn deployment(
        &mut self,
    ) -> crate::resources::doc::deployment::resource_client::DeploymentClient {
        crate::resources::doc::deployment::resource_client::DeploymentClient::_new(
            self.base_client,
        )
    }
    pub fn theme(
        &mut self,
    ) -> crate::resources::doc::theme::resource_client::ThemeClient {
        crate::resources::doc::theme::resource_client::ThemeClient::_new(
            self.base_client,
        )
    }
    /// Delete a specific Documentation Project
    ///
    /// DELETE /doc_project/{doc_name}
    pub async fn delete(
        &mut self,
        request: super::request_types::DeleteRequest,
    ) -> crate::SdkResult<()> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/doc_project/{}", crate ::core::params::format_string_param(&
                    request.doc_name)
                ),
            );
        let mut builder = reqwest::Client::default().delete(&url);
        builder = builder.header("x-sideko-sdk-language", "rust");
        builder = self
            .base_client
            .apply_auths_to_builder(builder, &["ApiKeyAuth", "CookieAuth"])
            .await?;
        let response = builder.send().await?;
        self.base_client.error_for_status("DELETE", response).await?;
        Ok(())
    }
    /// List Documentation Projects
    ///
    /// GET /doc_project
    pub async fn list(&mut self) -> crate::SdkResult<Vec<crate::models::DocProject>> {
        let url = self.base_client.build_url("/doc_project");
        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::<Vec<crate::models::DocProject>>(response)
            .await
    }
    /// Get a specific Documentation Project
    ///
    /// GET /doc_project/{doc_name}
    pub async fn get(
        &mut self,
        request: super::request_types::GetRequest,
    ) -> crate::SdkResult<crate::models::DocProject> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/doc_project/{}", crate ::core::params::format_string_param(&
                    request.doc_name)
                ),
            );
        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::DocProject>(response).await
    }
    /// A simple check to see if the requesting user has access to the preview doc project
    ///
    /// GET /doc_project/{doc_name}/preview
    pub async fn check_preview(
        &mut self,
        request: super::request_types::CheckPreviewRequest,
    ) -> crate::SdkResult<bool> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/doc_project/{}/preview", 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(
                "pathname",
                &request.pathname,
                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::<bool>(response).await
    }
    /// Update an existing Documentation Project
    ///
    /// PATCH /doc_project/{doc_name}
    pub async fn patch(
        &mut self,
        request: super::request_types::PatchRequest,
    ) -> crate::SdkResult<crate::models::DocProject> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/doc_project/{}", crate ::core::params::format_string_param(&
                    request.doc_name)
                ),
            );
        let mut builder = reqwest::Client::default().patch(&url);
        builder = builder.header("x-sideko-sdk-language", "rust");
        builder = builder.header("content-type", "application/json");
        builder = builder
            .json(
                &crate::models::UpdateDocProject {
                    logos: request.logos,
                    name: request.name,
                    settings: request.settings,
                },
            );
        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("PATCH", response).await?;
        crate::core::response::process_json::<crate::models::DocProject>(response).await
    }
    /// Create a new Documentation Project
    ///
    /// POST /doc_project
    pub async fn create(
        &mut self,
        request: super::request_types::CreateRequest,
    ) -> crate::SdkResult<crate::models::DocProject> {
        let url = self.base_client.build_url("/doc_project");
        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::NewDocProject {
                    name: request.name,
                },
            );
        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::DocProject>(response).await
    }
}
