#[derive(Debug)]
pub struct GroupClient<'a> {
    base_client: &'a mut crate::core::base_client::BaseClient,
}
impl<'a> GroupClient<'a> {
    pub(crate) fn _new(
        base_client: &'a mut crate::core::base_client::BaseClient,
    ) -> Self {
        Self { base_client }
    }
    /// Deletes the api group and all its links
    ///
    /// DELETE /api_link_group/{id}
    pub async fn delete(
        &mut self,
        request: super::request_types::DeleteRequest,
    ) -> crate::SdkResult<()> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/api_link_group/{}", crate ::core::params::format_string_param(&
                    request.id)
                ),
            );
        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 API groups for doc version
    ///
    /// GET /api_link_group
    pub async fn list(
        &mut self,
        request: super::request_types::ListRequest,
    ) -> crate::SdkResult<Vec<crate::models::ApiLinkGroup>> {
        let url = self.base_client.build_url("/api_link_group");
        let mut builder = reqwest::Client::default().get(&url);
        let mut queries = crate::core::params::QueryParams::default();
        queries
            .add(
                "doc_name",
                &request.doc_name,
                crate::core::params::QueryStyle::Form,
                true,
            );
        queries
            .add(
                "doc_version",
                &request.doc_version,
                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::ApiLinkGroup>>(response)
            .await
    }
    /// Updates API link group
    ///
    /// PATCH /api_link_group/{id}
    pub async fn patch(
        &mut self,
        request: super::request_types::PatchRequest,
    ) -> crate::SdkResult<crate::models::ApiLinkGroup> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/api_link_group/{}", crate ::core::params::format_string_param(&
                    request.id)
                ),
            );
        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::UpdateApiLinkGroup {
                    nav_label: request.nav_label,
                    slug: request.slug,
                },
            );
        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::ApiLinkGroup>(response)
            .await
    }
    /// Create API group to organize API links
    ///
    /// POST /api_link_group
    pub async fn create(
        &mut self,
        request: super::request_types::CreateRequest,
    ) -> crate::SdkResult<crate::models::ApiLinkGroup> {
        let url = self.base_client.build_url("/api_link_group");
        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::NewApiLinkGroup {
                    doc_version_id: request.doc_version_id,
                    nav_label: request.nav_label,
                    slug: request.slug,
                },
            );
        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::ApiLinkGroup>(response)
            .await
    }
}
