Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

1.3 KB
Raw Blame
use crate::AuthServiceClient;
use crate::error::{AuthServiceClientError, GenericErrorResponse};

impl AuthServiceClient {
    /// Unlinks a user from an identity provider by idp name
    #[tracing::instrument(skip(self))]
    pub async fn remove_link(
        &self,
        fusionauth_user_id: &str,
        linked_email: &str,
        idp_name: &str,
    ) -> Result<(), AuthServiceClientError> {
        let res = self
            .client
            .delete(format!("{}/internal/remove_link", self.url))
            .query(&[("fusionauth_user_id", fusionauth_user_id)])
            .query(&[("linked_email", linked_email)])
            .query(&[("idp_name", idp_name)])
            .send()
            .await
            .map_err(|e| AuthServiceClientError::RequestBuildError {
                details: e.to_string(),
            })?;

        match res.status() {
            reqwest::StatusCode::OK => Ok(()),
            reqwest::StatusCode::NOT_MODIFIED => Ok(()),
            _ => Err(AuthServiceClientError::Generic(GenericErrorResponse {
                message: res.text().await.map_err(|e| {
                    AuthServiceClientError::Generic(GenericErrorResponse {
                        message: e.to_string(),
                    })
                })?,
            })),
        }
    }
}