@@ -16,10 +16,16 @@ export namespace admin.auth {
1616
1717 /**
1818 * The date the user was created, formatted as a UTC string.
19- *
2019 */
2120 creationTime : string ;
2221
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+
2329 /**
2430 * @return A JSON-serializable representation of this object.
2531 */
@@ -532,6 +538,19 @@ export namespace admin.auth {
532538 [ key : string ] : any ;
533539 }
534540
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+
535554 /**
536555 * Interface representing the object returned from a
537556 * {@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 {
645664 errors : _admin . FirebaseArrayIndexError [ ] ;
646665 }
647666
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+
648693 /**
649694 * User metadata to include when importing a user.
650695 */
@@ -659,6 +704,13 @@ export namespace admin.auth {
659704 * The date the user was created, formatted as a UTC string.
660705 */
661706 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 ;
662714 }
663715
664716 /**
@@ -1216,10 +1268,51 @@ export namespace admin.auth {
12161268 pageToken ?: string ;
12171269 }
12181270
1219-
12201271 type UpdateAuthProviderRequest =
12211272 admin . auth . SAMLUpdateAuthProviderRequest | admin . auth . OIDCUpdateAuthProviderRequest ;
12221273
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+
12231316 interface BaseAuth {
12241317
12251318 /**
@@ -1267,6 +1360,30 @@ export namespace admin.auth {
12671360 */
12681361 deleteUser ( uid : string ) : Promise < void > ;
12691362
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+
12701387 /**
12711388 * Gets the user data for the user corresponding to a given `uid`.
12721389 *
@@ -1309,6 +1426,23 @@ export namespace admin.auth {
13091426 */
13101427 getUserByPhoneNumber ( phoneNumber : string ) : Promise < admin . auth . UserRecord > ;
13111428
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+
13121446 /**
13131447 * Retrieves a list of users (single batch only) with a size of `maxResults`
13141448 * starting from the offset as specified by `pageToken`. This is used to
0 commit comments