docusign 0.3.1

A fully generated & opinionated API client for the DocuSign API.
Documentation
use anyhow::Result;

use crate::Client;

pub struct GroupBrands {
    pub client: Client,
}

impl GroupBrands {
    #[doc(hidden)]
    pub fn new(client: Client) -> Self {
        GroupBrands { client }
    }

    /**
     * Gets the brand information for a group.
     *
     * This function performs a `GET` to the `/v2.1/accounts/{accountId}/groups/{groupId}/brands` endpoint.
     *
     * This method returns information about the brands associated with a group.
     *
     * **Parameters:**
     *
     * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
     * * `group_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
     */
    pub async fn brands_get_group(
        &self,
        account_id: &str,
        group_id: &str,
    ) -> Result<crate::types::GroupBrands> {
        let url = format!(
            "/v2.1/accounts/{}/groups/{}/brands",
            crate::progenitor_support::encode_path(account_id),
            crate::progenitor_support::encode_path(group_id),
        );

        self.client.get(&url, None).await
    }

    /**
     * Adds an existing brand to a group.
     *
     * This function performs a `PUT` to the `/v2.1/accounts/{accountId}/groups/{groupId}/brands` endpoint.
     *
     * This method adds one or more existing brands to a group based on the `groupId`.
     *
     * **Parameters:**
     *
     * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
     * * `group_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
     */
    pub async fn brands_put_group(
        &self,
        account_id: &str,
        group_id: &str,
        body: &crate::types::BrandsRequest,
    ) -> Result<crate::types::GroupBrands> {
        let url = format!(
            "/v2.1/accounts/{}/groups/{}/brands",
            crate::progenitor_support::encode_path(account_id),
            crate::progenitor_support::encode_path(group_id),
        );

        self.client
            .put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
            .await
    }

    /**
     * Deletes brand information from a group.
     *
     * This function performs a `DELETE` to the `/v2.1/accounts/{accountId}/groups/{groupId}/brands` endpoint.
     *
     * This method deletes one or more brands from a group.
     *
     * **Parameters:**
     *
     * * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
     * * `group_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
     */
    pub async fn brands_delete_group(
        &self,
        account_id: &str,
        group_id: &str,
        body: &crate::types::BrandsRequest,
    ) -> Result<crate::types::GroupBrands> {
        let url = format!(
            "/v2.1/accounts/{}/groups/{}/brands",
            crate::progenitor_support::encode_path(account_id),
            crate::progenitor_support::encode_path(group_id),
        );

        self.client
            .delete(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
            .await
    }
}