#[allow(unused_imports)]
use crate::{error::Result, models::*, Configuration};
pub struct Connect<'a> {
cfg: &'a Configuration,
}
impl<'a> Connect<'a> {
pub(super) fn new(cfg: &'a Configuration) -> Self {
Self { cfg }
}
pub async fn list_connected_accounts(
&self,
) -> Result<crate::models::ConnectedAccountsResponse> {
crate::request::Request::new(http1::Method::GET, "/api/v1/connected-accounts")
.execute(self.cfg)
.await
}
pub async fn create_connected_account(
&self,
create_connected_account_request: crate::models::CreateConnectedAccountRequest,
) -> Result<crate::models::ConnectedAccount> {
crate::request::Request::new(http1::Method::POST, "/api/v1/connected-accounts")
.with_body_param(create_connected_account_request)
.execute(self.cfg)
.await
}
pub async fn get_connected_account(
&self,
id: String,
) -> Result<crate::models::ConnectedAccount> {
crate::request::Request::new(http1::Method::GET, "/api/v1/connected-accounts/{id}")
.with_path_param("id", id)
.execute(self.cfg)
.await
}
pub async fn disconnect_account(&self, id: String) -> Result<()> {
crate::request::Request::new(http1::Method::DELETE, "/api/v1/connected-accounts/{id}")
.with_path_param("id", id)
.returns_nothing()
.execute(self.cfg)
.await
}
pub async fn create_onboarding_link(
&self,
id: String,
create_onboarding_link_request: crate::models::CreateOnboardingLinkRequest,
) -> Result<crate::models::OnboardingLinkResponse> {
crate::request::Request::new(
http1::Method::POST,
"/api/v1/connected-accounts/{id}/onboarding",
)
.with_path_param("id", id)
.with_body_param(create_onboarding_link_request)
.execute(self.cfg)
.await
}
}