@@ -16,10 +16,16 @@ export namespace admin.auth {
16
16
17
17
/**
18
18
* The date the user was created, formatted as a UTC string.
19
- *
20
19
*/
21
20
creationTime : string ;
22
21
22
+ /**
23
+ * The time at which the user was last active (ID token refreshed),
24
+ * formatted as a UTC Date string (eg 'Sat, 03 Feb 2001 04:05:06 GMT').
25
+ * Returns null if the user was never active.
26
+ */
27
+ lastRefreshTime : string | null ;
28
+
23
29
/**
24
30
* @return A JSON-serializable representation of this object.
25
31
*/
@@ -532,6 +538,19 @@ export namespace admin.auth {
532
538
[ key : string ] : any ;
533
539
}
534
540
541
+ /** Represents the result of the {@link admin.auth.getUsers()} API. */
542
+ interface GetUsersResult {
543
+ /**
544
+ * Set of user records, corresponding to the set of users that were
545
+ * requested. Only users that were found are listed here. The result set is
546
+ * unordered.
547
+ */
548
+ users : UserRecord [ ] ;
549
+
550
+ /** Set of identifiers that were requested, but not found. */
551
+ notFound : UserIdentifier [ ] ;
552
+ }
553
+
535
554
/**
536
555
* Interface representing the object returned from a
537
556
* {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#listUsers `listUsers()`} operation. Contains the list
@@ -645,6 +664,32 @@ export namespace admin.auth {
645
664
errors : _admin . FirebaseArrayIndexError [ ] ;
646
665
}
647
666
667
+ /**
668
+ * Represents the result of the
669
+ * {@link https://firebase.google.com/docs/reference/admin/node/admin.auth.Auth#deleteUsers `deleteUsers()`}
670
+ * API.
671
+ */
672
+ interface DeleteUsersResult {
673
+ /**
674
+ * The number of user records that failed to be deleted (possibly zero).
675
+ */
676
+ failureCount : number ;
677
+
678
+ /**
679
+ * The number of users that were deleted successfully (possibly zero).
680
+ * Users that did not exist prior to calling `deleteUsers()` are
681
+ * considered to be successfully deleted.
682
+ */
683
+ successCount : number ;
684
+
685
+ /**
686
+ * A list of `FirebaseArrayIndexError` instances describing the errors that
687
+ * were encountered during the deletion. Length of this list is equal to
688
+ * the return value of [`failureCount`](#failureCount).
689
+ */
690
+ errors : _admin . FirebaseArrayIndexError [ ] ;
691
+ }
692
+
648
693
/**
649
694
* User metadata to include when importing a user.
650
695
*/
@@ -659,6 +704,13 @@ export namespace admin.auth {
659
704
* The date the user was created, formatted as a UTC string.
660
705
*/
661
706
creationTime ?: string ;
707
+
708
+ /**
709
+ * The time at which the user was last active (ID token refreshed),
710
+ * formatted as a UTC Date string (eg 'Sat, 03 Feb 2001 04:05:06 GMT').
711
+ * Null implies the user was never active.
712
+ */
713
+ lastRefreshTime ?: string | null ;
662
714
}
663
715
664
716
/**
@@ -1216,10 +1268,51 @@ export namespace admin.auth {
1216
1268
pageToken ?: string ;
1217
1269
}
1218
1270
1219
-
1220
1271
type UpdateAuthProviderRequest =
1221
1272
admin . auth . SAMLUpdateAuthProviderRequest | admin . auth . OIDCUpdateAuthProviderRequest ;
1222
1273
1274
+ /**
1275
+ * Used for looking up an account by uid.
1276
+ *
1277
+ * See auth.getUsers()
1278
+ */
1279
+ interface UidIdentifier {
1280
+ uid : string ;
1281
+ }
1282
+
1283
+ /**
1284
+ * Used for looking up an account by email.
1285
+ *
1286
+ * See auth.getUsers()
1287
+ */
1288
+ interface EmailIdentifier {
1289
+ email : string ;
1290
+ }
1291
+
1292
+ /**
1293
+ * Used for looking up an account by phone number.
1294
+ *
1295
+ * See auth.getUsers()
1296
+ */
1297
+ interface PhoneIdentifier {
1298
+ phoneNumber : string ;
1299
+ }
1300
+
1301
+ /**
1302
+ * Used for looking up an account by federated provider.
1303
+ *
1304
+ * See auth.getUsers()
1305
+ */
1306
+ interface ProviderIdentifier {
1307
+ providerId : string ;
1308
+ providerUid : string ;
1309
+ }
1310
+
1311
+ /**
1312
+ * Identifies a user to be looked up.
1313
+ */
1314
+ type UserIdentifier = UidIdentifier | EmailIdentifier | PhoneIdentifier | ProviderIdentifier ;
1315
+
1223
1316
interface BaseAuth {
1224
1317
1225
1318
/**
@@ -1267,6 +1360,30 @@ export namespace admin.auth {
1267
1360
*/
1268
1361
deleteUser ( uid : string ) : Promise < void > ;
1269
1362
1363
+ /**
1364
+ * Deletes the users specified by the given uids.
1365
+ *
1366
+ * Deleting a non-existing user won't generate an error (i.e. this method
1367
+ * is idempotent.) Non-existing users are considered to be successfully
1368
+ * deleted, and are therefore counted in the
1369
+ * `DeleteUsersResult.successCount` value.
1370
+ *
1371
+ * Only a maximum of 1000 identifiers may be supplied. If more than 1000
1372
+ * identifiers are supplied, this method throws a FirebaseAuthError.
1373
+ *
1374
+ * This API is currently rate limited at the server to 1 QPS. If you exceed
1375
+ * this, you may get a quota exceeded error. Therefore, if you want to
1376
+ * delete more than 1000 users, you may need to add a delay to ensure you
1377
+ * don't go over this limit.
1378
+ *
1379
+ * @param uids The `uids` corresponding to the users to delete.
1380
+ *
1381
+ * @return A Promise that resolves to the total number of successful/failed
1382
+ * deletions, as well as the array of errors that corresponds to the
1383
+ * failed deletions.
1384
+ */
1385
+ deleteUsers ( uids : string [ ] ) : Promise < admin . auth . DeleteUsersResult > ;
1386
+
1270
1387
/**
1271
1388
* Gets the user data for the user corresponding to a given `uid`.
1272
1389
*
@@ -1309,6 +1426,23 @@ export namespace admin.auth {
1309
1426
*/
1310
1427
getUserByPhoneNumber ( phoneNumber : string ) : Promise < admin . auth . UserRecord > ;
1311
1428
1429
+ /**
1430
+ * Gets the user data corresponding to the specified identifiers.
1431
+ *
1432
+ * There are no ordering guarantees; in particular, the nth entry in the result list is not
1433
+ * guaranteed to correspond to the nth entry in the input parameters list.
1434
+ *
1435
+ * Only a maximum of 100 identifiers may be supplied. If more than 100 identifiers are supplied,
1436
+ * this method throws a FirebaseAuthError.
1437
+ *
1438
+ * @param identifiers The identifiers used to indicate which user records should be returned.
1439
+ * Must have <= 100 entries.
1440
+ * @return {Promise<GetUsersResult> } A promise that resolves to the corresponding user records.
1441
+ * @throws FirebaseAuthError If any of the identifiers are invalid or if more than 100
1442
+ * identifiers are specified.
1443
+ */
1444
+ getUsers ( identifiers : admin . auth . UserIdentifier [ ] ) : Promise < GetUsersResult > ;
1445
+
1312
1446
/**
1313
1447
* Retrieves a list of users (single batch only) with a size of `maxResults`
1314
1448
* starting from the offset as specified by `pageToken`. This is used to
0 commit comments