#![cfg(feature = "cloudflare_profile")]
#![allow(clippy::too_many_arguments, clippy::type_complexity)]
#![allow(
clippy::missing_errors_doc,
clippy::doc_markdown,
clippy::useless_format
)]
#![allow(unused_imports)]
use foundation_macros::JsonHash;
use foundation_netio::shared::client::http_client::HttpClient;
use foundation_netio::{DynNetClient, PreparedRequestBuilder};
use serde::{Deserialize, Serialize};
use super::shared::OrganizationsApiProfile;
use super::shared::ApiResponse;
#[derive(Debug, Clone, Default, Serialize, Deserialize, JsonHash)]
pub struct AccountsGetAccountProfileResponse {
pub errors: Vec<serde_json::Value>,
pub messages: Vec<OrganizationsApiV4Message>,
pub result: OrganizationsApiProfile,
pub success: bool,
}
pub type OrganizationsApiV4Message = super::shared::CodeMessageObject2;
pub type AccountsGetAccountProfileArgs = super::shared::AccountIdArgs;
#[derive(Debug, Clone, Default, Serialize, JsonHash)]
pub struct AccountsModifyAccountProfileArgs {
pub account_id: String,
pub body: OrganizationsApiProfile,
}
pub async fn accounts_get_account_profile_request<F>(
client: impl Into<super::shared::ApiClient>,
args: &AccountsGetAccountProfileArgs,
base_url: &str,
builder_mod: Option<F>,
) -> Result<ApiResponse<AccountsGetAccountProfileResponse>, super::shared::ApiError>
where
F: FnOnce(&mut PreparedRequestBuilder),
{
let path = format!("/accounts/{}/profile", args.account_id,);
let endpoint_url = format!("{}{}", base_url, path);
let mut builder = PreparedRequestBuilder::get(&endpoint_url)
.map_err(|e| super::shared::ApiError::RequestBuildFailed(e.to_string()))?;
if let Some(f) = builder_mod {
f(&mut builder);
}
super::shared::send_json(client.into(), builder.build()).await
}
pub async fn accounts_modify_account_profile_request<F>(
client: impl Into<super::shared::ApiClient>,
args: &AccountsModifyAccountProfileArgs,
base_url: &str,
builder_mod: Option<F>,
) -> Result<ApiResponse<()>, super::shared::ApiError>
where
F: FnOnce(&mut PreparedRequestBuilder),
{
let path = format!("/accounts/{}/profile", args.account_id,);
let endpoint_url = format!("{}{}", base_url, path);
let mut builder = PreparedRequestBuilder::put(&endpoint_url)
.map_err(|e| super::shared::ApiError::RequestBuildFailed(e.to_string()))?;
builder = builder
.body_json(&args.body)
.map_err(|e| super::shared::ApiError::RequestBuildFailed(e.to_string()))?;
if let Some(f) = builder_mod {
f(&mut builder);
}
super::shared::send_without_body(client.into(), builder.build()).await
}