@@ -185,6 +185,30 @@ func getUserByPhone(ctx context.Context, client *auth.Client) *auth.UserRecord {
185185 return u
186186}
187187
188+ func bulkGetUsers (ctx context.Context , client * auth.Client ) {
189+ // [START bulk_get_users_golang]
190+ getUsersResult , err := client .GetUsers (ctx , []auth.UserIdentifier {
191+ auth.UIDIdentifier {UID : "uid1" },
192+ auth.
EmailIdentifier {
Email :
"[email protected] " },
193+ auth.PhoneIdentifier {PhoneNumber : "+15555551234" },
194+ auth.ProviderIdentifier {ProviderID : "google.com" , ProviderUID : "google_uid1" },
195+ })
196+ if err != nil {
197+ log .Fatalf ("error retriving multiple users: %v\n " , err )
198+ }
199+
200+ log .Printf ("Successfully fetched user data:" )
201+ for _ , u := range getUsersResult .Users {
202+ log .Printf ("%v" , u )
203+ }
204+
205+ log .Printf ("Unable to find users corresponding to these identifiers:" )
206+ for _ , id := range getUsersResult .NotFound {
207+ log .Printf ("%v" , id )
208+ }
209+ // [END bulk_get_users_golang]
210+ }
211+
188212func createUser (ctx context.Context , client * auth.Client ) * auth.UserRecord {
189213 // [START create_user_golang]
190214 params := (& auth.UserToCreate {}).
@@ -250,6 +274,21 @@ func deleteUser(ctx context.Context, client *auth.Client) {
250274 // [END delete_user_golang]
251275}
252276
277+ func bulkDeleteUsers (ctx context.Context , client * auth.Client ) {
278+ // [START bulk_delete_users_golang]
279+ deleteUsersResult , err := client .DeleteUsers (ctx , []string {"uid1" , "uid2" , "uid3" })
280+ if err != nil {
281+ log .Fatalf ("error deleting users: %v\n " , err )
282+ }
283+
284+ log .Printf ("Successfully deleted %d users" , deleteUsersResult .SuccessCount )
285+ log .Printf ("Failed to delete %d users" , deleteUsersResult .FailureCount )
286+ for _ , err := range deleteUsersResult .Errors {
287+ log .Printf ("%v" , err )
288+ }
289+ // [END bulk_delete_users_golang]
290+ }
291+
253292func customClaimsSet (ctx context.Context , app * firebase.App ) {
254293 uid := "uid"
255294 // [START set_custom_user_claims_golang]
0 commit comments