/*
 * photon-indexer
 *
 * Solana indexer for general compression
 *
 * The version of the OpenAPI document: 0.50.0
 *
 * Generated by: https://openapi-generator.tech
 */

use reqwest;

use super::{configuration, Error};
use crate::{
    apis::{configuration::Configuration, ResponseContent},
    models,
};

/// struct for typed errors of method [`get_batch_address_update_info_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetBatchAddressUpdateInfoPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_account_balance_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedAccountBalancePostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_account_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedAccountPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_account_proof_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedAccountProofPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_account_proof_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedAccountProofV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_account_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedAccountV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_accounts_by_owner_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedAccountsByOwnerPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_accounts_by_owner_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedAccountsByOwnerV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_balance_by_owner_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedBalanceByOwnerPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_mint_token_holders_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedMintTokenHoldersPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_token_account_balance_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedTokenAccountBalancePostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_token_accounts_by_delegate_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedTokenAccountsByDelegatePostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_token_accounts_by_delegate_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedTokenAccountsByDelegateV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_token_accounts_by_owner_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedTokenAccountsByOwnerPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_token_accounts_by_owner_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedTokenAccountsByOwnerV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_token_balances_by_owner_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedTokenBalancesByOwnerPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compressed_token_balances_by_owner_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressedTokenBalancesByOwnerV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compression_signatures_for_account_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressionSignaturesForAccountPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compression_signatures_for_address_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressionSignaturesForAddressPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compression_signatures_for_owner_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressionSignaturesForOwnerPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_compression_signatures_for_token_owner_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCompressionSignaturesForTokenOwnerPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_indexer_health_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetIndexerHealthPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_indexer_slot_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetIndexerSlotPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_latest_compression_signatures_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetLatestCompressionSignaturesPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_latest_non_voting_signatures_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetLatestNonVotingSignaturesPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_multiple_compressed_account_proofs_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetMultipleCompressedAccountProofsPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_multiple_compressed_account_proofs_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetMultipleCompressedAccountProofsV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_multiple_compressed_accounts_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetMultipleCompressedAccountsPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_multiple_compressed_accounts_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetMultipleCompressedAccountsV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_multiple_new_address_proofs_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetMultipleNewAddressProofsPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_multiple_new_address_proofs_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetMultipleNewAddressProofsV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_queue_info_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetQueueInfoPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_queue_elements_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetQueueElementsPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_transaction_with_compression_info_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTransactionWithCompressionInfoPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_transaction_with_compression_info_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTransactionWithCompressionInfoV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_validity_proof_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetValidityProofPostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// struct for typed errors of method [`get_validity_proof_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetValidityProofV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

pub async fn get_batch_address_update_info_post(
    configuration: &configuration::Configuration,
    get_batch_address_update_info_post_request: models::GetBatchAddressUpdateInfoPostRequest,
) -> Result<
    models::GetBatchAddressUpdateInfoPost200Response,
    Error<GetBatchAddressUpdateInfoPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getBatchAddressUpdateInfo",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_batch_address_update_info_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetBatchAddressUpdateInfoPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_account_balance_post(
    configuration: &configuration::Configuration,
    get_compressed_account_balance_post_request: models::GetCompressedAccountBalancePostRequest,
) -> Result<
    models::GetCompressedAccountBalancePost200Response,
    Error<GetCompressedAccountBalancePostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedAccountBalance",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_account_balance_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedAccountBalancePostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_account_post(
    configuration: &configuration::Configuration,
    get_compressed_account_post_request: models::GetCompressedAccountPostRequest,
) -> Result<models::GetCompressedAccountPost200Response, Error<GetCompressedAccountPostError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/getCompressedAccount", local_var_configuration.base_path);
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_compressed_account_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedAccountPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_account_proof_post(
    configuration: &configuration::Configuration,
    get_compressed_account_proof_post_request: models::GetCompressedAccountProofPostRequest,
) -> Result<
    models::GetCompressedAccountProofPost200Response,
    Error<GetCompressedAccountProofPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedAccountProof",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_compressed_account_proof_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedAccountProofPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_account_proof_v2_post(
    configuration: &configuration::Configuration,
    get_compressed_account_proof_v2_post_request: models::GetCompressedAccountProofV2PostRequest,
) -> Result<
    models::GetCompressedAccountProofV2Post200Response,
    Error<GetCompressedAccountProofV2PostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedAccountProofV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_account_proof_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedAccountProofV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_account_v2_post(
    configuration: &configuration::Configuration,
    get_compressed_account_v2_post_request: models::GetCompressedAccountV2PostRequest,
) -> Result<models::GetCompressedAccountV2Post200Response, Error<GetCompressedAccountV2PostError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedAccountV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_compressed_account_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedAccountV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_accounts_by_owner_post(
    configuration: &configuration::Configuration,
    get_compressed_accounts_by_owner_post_request: models::GetCompressedAccountsByOwnerPostRequest,
) -> Result<
    models::GetCompressedAccountsByOwnerPost200Response,
    Error<GetCompressedAccountsByOwnerPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedAccountsByOwner",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_accounts_by_owner_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedAccountsByOwnerPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_accounts_by_owner_v2_post(
    configuration: &configuration::Configuration,
    get_compressed_accounts_by_owner_v2_post_request: models::GetCompressedAccountsByOwnerV2PostRequest,
) -> Result<
    models::GetCompressedAccountsByOwnerV2Post200Response,
    Error<GetCompressedAccountsByOwnerV2PostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedAccountsByOwnerV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_accounts_by_owner_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedAccountsByOwnerV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_balance_by_owner_post(
    configuration: &configuration::Configuration,
    get_compressed_balance_by_owner_post_request: models::GetCompressedBalanceByOwnerPostRequest,
) -> Result<
    models::GetCompressedAccountBalancePost200Response,
    Error<GetCompressedBalanceByOwnerPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedBalanceByOwner",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_balance_by_owner_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedBalanceByOwnerPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_mint_token_holders_post(
    configuration: &configuration::Configuration,
    get_compressed_mint_token_holders_post_request: models::GetCompressedMintTokenHoldersPostRequest,
) -> Result<
    models::GetCompressedMintTokenHoldersPost200Response,
    Error<GetCompressedMintTokenHoldersPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedMintTokenHolders",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_mint_token_holders_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedMintTokenHoldersPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_token_account_balance_post(
    configuration: &configuration::Configuration,
    get_compressed_token_account_balance_post_request: models::GetCompressedTokenAccountBalancePostRequest,
) -> Result<
    models::GetCompressedTokenAccountBalancePost200Response,
    Error<GetCompressedTokenAccountBalancePostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedTokenAccountBalance",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_token_account_balance_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedTokenAccountBalancePostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_token_accounts_by_delegate_post(
    configuration: &configuration::Configuration,
    get_compressed_token_accounts_by_delegate_post_request: models::GetCompressedTokenAccountsByDelegatePostRequest,
) -> Result<
    models::GetCompressedTokenAccountsByDelegatePost200Response,
    Error<GetCompressedTokenAccountsByDelegatePostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedTokenAccountsByDelegate",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_token_accounts_by_delegate_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedTokenAccountsByDelegatePostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_token_accounts_by_delegate_v2_post(
    configuration: &configuration::Configuration,
    get_compressed_token_accounts_by_delegate_v2_post_request: models::GetCompressedTokenAccountsByDelegateV2PostRequest,
) -> Result<
    models::GetCompressedTokenAccountsByDelegateV2Post200Response,
    Error<GetCompressedTokenAccountsByDelegateV2PostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedTokenAccountsByDelegateV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_token_accounts_by_delegate_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedTokenAccountsByDelegateV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_token_accounts_by_owner_post(
    configuration: &configuration::Configuration,
    get_compressed_token_accounts_by_owner_post_request: models::GetCompressedTokenAccountsByOwnerPostRequest,
) -> Result<
    models::GetCompressedTokenAccountsByDelegatePost200Response,
    Error<GetCompressedTokenAccountsByOwnerPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedTokenAccountsByOwner",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_token_accounts_by_owner_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedTokenAccountsByOwnerPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_token_accounts_by_owner_v2_post(
    configuration: &configuration::Configuration,
    get_compressed_token_accounts_by_owner_v2_post_request: models::GetCompressedTokenAccountsByOwnerV2PostRequest,
) -> Result<
    models::GetCompressedTokenAccountsByDelegateV2Post200Response,
    Error<GetCompressedTokenAccountsByOwnerV2PostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedTokenAccountsByOwnerV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_token_accounts_by_owner_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedTokenAccountsByOwnerV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_token_balances_by_owner_post(
    configuration: &configuration::Configuration,
    get_compressed_token_balances_by_owner_post_request: models::GetCompressedTokenBalancesByOwnerPostRequest,
) -> Result<
    models::GetCompressedTokenBalancesByOwnerPost200Response,
    Error<GetCompressedTokenBalancesByOwnerPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedTokenBalancesByOwner",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_token_balances_by_owner_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedTokenBalancesByOwnerPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compressed_token_balances_by_owner_v2_post(
    configuration: &configuration::Configuration,
    get_compressed_token_balances_by_owner_v2_post_request: models::GetCompressedTokenBalancesByOwnerV2PostRequest,
) -> Result<
    models::GetCompressedTokenBalancesByOwnerV2Post200Response,
    Error<GetCompressedTokenBalancesByOwnerV2PostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressedTokenBalancesByOwnerV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compressed_token_balances_by_owner_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressedTokenBalancesByOwnerV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compression_signatures_for_account_post(
    configuration: &configuration::Configuration,
    get_compression_signatures_for_account_post_request: models::GetCompressionSignaturesForAccountPostRequest,
) -> Result<
    models::GetCompressionSignaturesForAccountPost200Response,
    Error<GetCompressionSignaturesForAccountPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressionSignaturesForAccount",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compression_signatures_for_account_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressionSignaturesForAccountPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compression_signatures_for_address_post(
    configuration: &configuration::Configuration,
    get_compression_signatures_for_address_post_request: models::GetCompressionSignaturesForAddressPostRequest,
) -> Result<
    models::GetCompressionSignaturesForAddressPost200Response,
    Error<GetCompressionSignaturesForAddressPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressionSignaturesForAddress",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compression_signatures_for_address_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressionSignaturesForAddressPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compression_signatures_for_owner_post(
    configuration: &configuration::Configuration,
    get_compression_signatures_for_owner_post_request: models::GetCompressionSignaturesForOwnerPostRequest,
) -> Result<
    models::GetCompressionSignaturesForAddressPost200Response,
    Error<GetCompressionSignaturesForOwnerPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressionSignaturesForOwner",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compression_signatures_for_owner_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressionSignaturesForOwnerPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_compression_signatures_for_token_owner_post(
    configuration: &configuration::Configuration,
    get_compression_signatures_for_token_owner_post_request: models::GetCompressionSignaturesForTokenOwnerPostRequest,
) -> Result<
    models::GetCompressionSignaturesForAddressPost200Response,
    Error<GetCompressionSignaturesForTokenOwnerPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getCompressionSignaturesForTokenOwner",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_compression_signatures_for_token_owner_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetCompressionSignaturesForTokenOwnerPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_indexer_health_post(
    configuration: &configuration::Configuration,
    get_indexer_health_post_request: models::GetIndexerHealthPostRequest,
) -> Result<models::GetIndexerHealthPost200Response, Error<GetIndexerHealthPostError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/getIndexerHealth", local_var_configuration.base_path);
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_indexer_health_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetIndexerHealthPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_indexer_slot_post(
    configuration: &configuration::Configuration,
    get_indexer_slot_post_request: models::GetIndexerSlotPostRequest,
) -> Result<models::GetIndexerSlotPost200Response, Error<GetIndexerSlotPostError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/getIndexerSlot", local_var_configuration.base_path);
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_indexer_slot_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetIndexerSlotPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_latest_compression_signatures_post(
    configuration: &configuration::Configuration,
    get_latest_compression_signatures_post_request: models::GetLatestCompressionSignaturesPostRequest,
) -> Result<
    models::GetCompressionSignaturesForAddressPost200Response,
    Error<GetLatestCompressionSignaturesPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getLatestCompressionSignatures",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_latest_compression_signatures_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetLatestCompressionSignaturesPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_latest_non_voting_signatures_post(
    configuration: &configuration::Configuration,
    get_latest_non_voting_signatures_post_request: models::GetLatestNonVotingSignaturesPostRequest,
) -> Result<
    models::GetLatestNonVotingSignaturesPost200Response,
    Error<GetLatestNonVotingSignaturesPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getLatestNonVotingSignatures",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_latest_non_voting_signatures_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetLatestNonVotingSignaturesPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_multiple_compressed_account_proofs_post(
    configuration: &configuration::Configuration,
    get_multiple_compressed_account_proofs_post_request: models::GetMultipleCompressedAccountProofsPostRequest,
) -> Result<
    models::GetMultipleCompressedAccountProofsPost200Response,
    Error<GetMultipleCompressedAccountProofsPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getMultipleCompressedAccountProofs",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);

    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_multiple_compressed_account_proofs_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetMultipleCompressedAccountProofsPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_multiple_compressed_account_proofs_v2_post(
    configuration: &configuration::Configuration,
    get_multiple_compressed_account_proofs_v2_post_request: models::GetMultipleCompressedAccountProofsV2PostRequest,
) -> Result<
    models::GetMultipleCompressedAccountProofsV2Post200Response,
    Error<GetMultipleCompressedAccountProofsV2PostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getMultipleCompressedAccountProofsV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_multiple_compressed_account_proofs_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetMultipleCompressedAccountProofsV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_multiple_compressed_accounts_post(
    configuration: &configuration::Configuration,
    get_multiple_compressed_accounts_post_request: models::GetMultipleCompressedAccountsPostRequest,
) -> Result<
    models::GetMultipleCompressedAccountsPost200Response,
    Error<GetMultipleCompressedAccountsPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getMultipleCompressedAccounts",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_multiple_compressed_accounts_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetMultipleCompressedAccountsPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_multiple_compressed_accounts_v2_post(
    configuration: &configuration::Configuration,
    get_multiple_compressed_accounts_v2_post_request: models::GetMultipleCompressedAccountsV2PostRequest,
) -> Result<
    models::GetMultipleCompressedAccountsV2Post200Response,
    Error<GetMultipleCompressedAccountsV2PostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getMultipleCompressedAccountsV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_multiple_compressed_accounts_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetMultipleCompressedAccountsV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_multiple_new_address_proofs_post(
    configuration: &configuration::Configuration,
    get_multiple_new_address_proofs_post_request: models::GetMultipleNewAddressProofsPostRequest,
) -> Result<
    models::GetMultipleNewAddressProofsPost200Response,
    Error<GetMultipleNewAddressProofsPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getMultipleNewAddressProofs",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_multiple_new_address_proofs_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetMultipleNewAddressProofsPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_multiple_new_address_proofs_v2_post(
    configuration: &configuration::Configuration,
    get_multiple_new_address_proofs_v2_post_request: models::GetMultipleNewAddressProofsV2PostRequest,
) -> Result<
    models::GetMultipleNewAddressProofsPost200Response,
    Error<GetMultipleNewAddressProofsV2PostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getMultipleNewAddressProofsV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_multiple_new_address_proofs_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetMultipleNewAddressProofsV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_queue_info_post(
    configuration: &configuration::Configuration,
    get_queue_info_post_request: models::GetQueueInfoPostRequest,
) -> Result<models::GetQueueInfoPost200Response, Error<GetQueueInfoPostError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/getQueueInfo", local_var_configuration.base_path);
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_queue_info_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetQueueInfoPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_queue_elements_post(
    configuration: &configuration::Configuration,
    get_queue_elements_post_request: models::GetQueueElementsPostRequest,
) -> Result<models::GetQueueElementsPost200Response, Error<GetQueueElementsPostError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/getQueueElements", local_var_configuration.base_path);
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_queue_elements_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetQueueElementsPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_transaction_with_compression_info_post(
    configuration: &configuration::Configuration,
    get_transaction_with_compression_info_post_request: models::GetTransactionWithCompressionInfoPostRequest,
) -> Result<
    models::GetTransactionWithCompressionInfoPost200Response,
    Error<GetTransactionWithCompressionInfoPostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getTransactionWithCompressionInfo",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_transaction_with_compression_info_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetTransactionWithCompressionInfoPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_transaction_with_compression_info_v2_post(
    configuration: &configuration::Configuration,
    get_transaction_with_compression_info_v2_post_request: models::GetTransactionWithCompressionInfoV2PostRequest,
) -> Result<
    models::GetTransactionWithCompressionInfoV2Post200Response,
    Error<GetTransactionWithCompressionInfoV2PostError>,
> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!(
        "{}/getTransactionWithCompressionInfoV2",
        local_var_configuration.base_path
    );
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder =
        local_var_req_builder.json(&get_transaction_with_compression_info_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetTransactionWithCompressionInfoV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_validity_proof_post(
    configuration: &configuration::Configuration,
    get_validity_proof_post_request: models::GetValidityProofPostRequest,
) -> Result<models::GetValidityProofPost200Response, Error<GetValidityProofPostError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/getValidityProof", local_var_configuration.base_path);
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_validity_proof_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetValidityProofPostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

pub async fn get_validity_proof_v2_post(
    configuration: &configuration::Configuration,
    get_validity_proof_v2_post_request: models::GetValidityProofV2PostRequest,
) -> Result<models::GetValidityProofV2Post200Response, Error<GetValidityProofV2PostError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/getValidityProofV2", local_var_configuration.base_path);
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_validity_proof_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetValidityProofV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

/// struct for typed errors of method [`get_queue_elements_v2_post`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetQueueElementsV2PostError {
    Status429(models::GetBatchAddressUpdateInfoPost429Response),
    Status500(models::GetBatchAddressUpdateInfoPost429Response),
    UnknownValue(serde_json::Value),
}

/// V2: Get queue elements with deduplicated nodes
pub async fn get_queue_elements_v2_post(
    configuration: &configuration::Configuration,
    get_queue_elements_v2_post_request: models::GetQueueElementsV2PostRequest,
) -> Result<models::GetQueueElementsV2Post200Response, Error<GetQueueElementsV2PostError>> {
    let local_var_configuration = configuration;

    let local_var_client = &local_var_configuration.client;

    let local_var_uri_str = format!("{}/getQueueElementsV2", local_var_configuration.base_path);
    let local_var_uri_str = append_api_key(local_var_configuration, &local_var_uri_str);
    let mut local_var_req_builder =
        local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());

    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
        local_var_req_builder =
            local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
    }
    local_var_req_builder = local_var_req_builder.json(&get_queue_elements_v2_post_request);

    let local_var_req = local_var_req_builder.build()?;
    let local_var_resp = local_var_client.execute(local_var_req).await?;

    let local_var_status = local_var_resp.status();
    let local_var_content = local_var_resp.text().await?;

    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
        serde_json::from_str(&local_var_content).map_err(Error::from)
    } else {
        let local_var_entity: Option<GetQueueElementsV2PostError> =
            serde_json::from_str(&local_var_content).ok();
        let local_var_error = ResponseContent {
            status: local_var_status,
            content: local_var_content,
            entity: local_var_entity,
        };
        Err(Error::ResponseError(local_var_error))
    }
}

fn append_api_key(configuration: &Configuration, uri_str: &str) -> String {
    let mut uri_str = uri_str.to_string();
    if let Some(ref api_key) = configuration.api_key {
        let prefix = api_key.prefix.clone().unwrap_or("api-key".to_string());
        uri_str = format!("{}?{}={}", uri_str, prefix, api_key.key);
    }
    uri_str
}
