#[derive(Debug)]
pub struct AssetClient<'a> {
    base_client: &'a mut crate::core::base_client::BaseClient,
}
impl<'a> AssetClient<'a> {
    pub(crate) fn _new(
        base_client: &'a mut crate::core::base_client::BaseClient,
    ) -> Self {
        Self { base_client }
    }
    /// Delete Asset
    ///
    /// Delete a media asset in your organization
    ///
    /// DELETE /organization/asset/{id}
    pub async fn delete(
        &mut self,
        request: super::request_types::DeleteRequest,
    ) -> crate::SdkResult<()> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/organization/asset/{}", 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 Assets
    ///
    /// Get all media assets for an organization
    ///
    /// GET /organization/asset
    pub async fn list(
        &mut self,
        request: super::request_types::ListRequest,
    ) -> crate::SdkResult<Vec<crate::models::ListAssetsPage>> {
        let url = self.base_client.build_url("/organization/asset");
        let mut builder = reqwest::Client::default().get(&url);
        let mut queries = crate::core::params::QueryParams::default();
        queries
            .add_option(
                "name",
                &request.name,
                crate::core::params::QueryStyle::Form,
                true,
            );
        queries
            .add_option(
                "page",
                &request.page,
                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::ListAssetsPage>,
        >(response)
            .await
    }
    /// Update Asset
    ///
    /// Update a media asset in your organization
    ///
    /// PATCH /organization/asset/{id}
    pub async fn patch(
        &mut self,
        request: super::request_types::PatchRequest,
    ) -> crate::SdkResult<crate::models::Asset> {
        let url = self
            .base_client
            .build_url(
                &format!(
                    "/organization/asset/{}", 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::UpdateAsset {
                    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("PATCH", response).await?;
        crate::core::response::process_json::<crate::models::Asset>(response).await
    }
    /// Upload Assets
    ///
    /// Add a media asset like logos or other media to an organization
    ///
    /// POST /organization/asset
    pub async fn create(
        &mut self,
        request: super::request_types::CreateRequest,
    ) -> crate::SdkResult<Vec<crate::models::Asset>> {
        let url = self.base_client.build_url("/organization/asset");
        let mut builder = reqwest::Client::default().post(&url);
        builder = builder.header("x-sideko-sdk-language", "rust");
        let mut form_data = reqwest::multipart::Form::new();
        form_data = form_data
            .part("file", reqwest::multipart::Part::from(&request.file));
        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?;
        crate::core::response::process_json::<Vec<crate::models::Asset>>(response).await
    }
}
