use crate::api::*;
use crate::{ApiError, ClientConfig, HttpClient, RequestOptions};
use reqwest::Method;
pub struct AccountLinksClient {
pub http_client: HttpClient,
}
impl AccountLinksClient {
pub fn new(config: ClientConfig) -> Result<Self, ApiError> {
Ok(Self {
http_client: HttpClient::new(config.clone())?,
})
}
pub async fn create(
&self,
request: &CreateAccountLinksRequest,
options: Option<RequestOptions>,
) -> Result<AccountLink, ApiError> {
let options = {
let mut o = options.unwrap_or_default();
o.additional_headers
.entry("Api-Version-Date".to_string())
.or_insert_with(|| "2026-08-21-1".to_string());
Some(o)
};
self.http_client
.execute_request(
Method::POST,
"account_links",
Some(serde_json::to_value(request).map_err(ApiError::Serialization)?),
None,
options,
)
.await
}
}