Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API method for listing user IDPs #9

Merged
merged 2 commits into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub use zitadel::api::zitadel::{
import_human_user_request::{Email, HashedPassword, Idp, Phone, Profile},
ImportHumanUserRequest,
},
user::v1::{user::Type, Gender},
user::v1::{user::Type as UserType, Gender},
};
use zitadel::{
api::zitadel::{
Expand All @@ -35,13 +35,15 @@ use zitadel::{
GetOrgByIdRequest, ListEventsRequest, ListOrgsRequest, ListOrgsResponse,
},
auth::v1::{auth_service_client::AuthServiceClient, GetMyUserRequest},
idp::v1::IdpUserLink,
management::v1::{
bulk_set_org_metadata_request::Metadata,
management_service_client::ManagementServiceClient, AddProjectMemberRequest,
AddProjectRequest, AddProjectRoleRequest, AddUserGrantRequest,
BulkAddProjectRolesRequest, BulkAddProjectRolesResponse, BulkSetOrgMetadataRequest,
GetMyOrgRequest, GetOrgMetadataRequest, GetUserByIdRequest,
GetUserByLoginNameGlobalRequest, GetUserMetadataRequest, ListOrgMetadataRequest,
GetUserByLoginNameGlobalRequest, GetUserMetadataRequest, ListHumanAuthFactorsRequest,
ListHumanAuthFactorsResponse, ListHumanLinkedIdPsRequest, ListOrgMetadataRequest,
ListOrgMetadataResponse, ListProjectRolesRequest, ListProjectRolesResponse,
ListUserGrantRequest, ListUserGrantResponse, ListUsersRequest, RemoveHumanPhoneRequest,
RemoveHumanPhoneResponse, RemoveOrgMetadataRequest, RemoveUserGrantRequest,
Expand Down Expand Up @@ -1214,6 +1216,21 @@ impl Zitadel {

Ok(response.into_inner().id)
}

/// List user IDPs [API
/// Docs](https://zitadel.com/docs/apis/resources/mgmt/management-service-list-human-linked-id-ps)
#[tracing::instrument(level = "debug", skip_all)]
tlater-famedly marked this conversation as resolved.
Show resolved Hide resolved
pub async fn list_user_idps(&self, user_id: String) -> Result<Vec<IdpUserLink>> {
let request = ListHumanLinkedIdPsRequest { user_id, query: None };

let response = self
.management_client
.clone()
.list_human_linked_id_ps(self.request_with_auth(request).await?)
.await?;

Ok(response.into_inner().result)
}
}

/// Check if the token is still valid and set the authorization header if it is.
Expand Down
Loading