3030import com .google .firebase .FirebaseApp ;
3131import com .google .firebase .FirebaseException ;
3232import com .google .firebase .ImplFirebaseTrampolines ;
33+ import com .google .firebase .auth .UserRecord .CreateRequest ;
34+ import com .google .firebase .auth .UserRecord .UpdateRequest ;
3335import com .google .firebase .auth .internal .FirebaseTokenFactory ;
3436import com .google .firebase .auth .internal .FirebaseTokenVerifier ;
3537import com .google .firebase .internal .FirebaseService ;
@@ -207,17 +209,17 @@ public FirebaseToken then(@NonNull Task<String> task) throws Exception {
207209 * Gets the user data corresponding to the specified user ID.
208210 *
209211 * @param uid A user ID string.
210- * @return A {@link Task} which will complete successfully with a {@link User } instance.
212+ * @return A {@link Task} which will complete successfully with a {@link UserRecord } instance.
211213 * If an error occurs while retrieving user data or if the specified user ID does not exist,
212214 * the task fails with a FirebaseAuthException.
213215 * @throws IllegalArgumentException If the user ID string is null or empty.
214216 */
215- public Task <User > getUser (final String uid ) {
217+ public Task <UserRecord > getUser (final String uid ) {
216218 checkArgument (!Strings .isNullOrEmpty (uid ), "uid must not be null or empty" );
217219 return ImplFirebaseTrampolines .getToken (firebaseApp , false ).continueWith (
218- new Continuation <GetTokenResult , User >() {
220+ new Continuation <GetTokenResult , UserRecord >() {
219221 @ Override
220- public User then (Task <GetTokenResult > task ) throws Exception {
222+ public UserRecord then (Task <GetTokenResult > task ) throws Exception {
221223 return userManager .getUserById (uid , task .getResult ().getToken ());
222224 }
223225 });
@@ -227,61 +229,62 @@ public User then(Task<GetTokenResult> task) throws Exception {
227229 * Gets the user data corresponding to the specified user email.
228230 *
229231 * @param email A user email address string.
230- * @return A {@link Task} which will complete successfully with a {@link User } instance.
232+ * @return A {@link Task} which will complete successfully with a {@link UserRecord } instance.
231233 * If an error occurs while retrieving user data or if the email address does not correspond
232234 * to a user, the task fails with a FirebaseAuthException.
233235 * @throws IllegalArgumentException If the email is null or empty.
234236 */
235- public Task <User > getUserByEmail (final String email ) {
237+ public Task <UserRecord > getUserByEmail (final String email ) {
236238 checkArgument (!Strings .isNullOrEmpty (email ), "email must not be null or empty" );
237239 return ImplFirebaseTrampolines .getToken (firebaseApp , false ).continueWith (
238- new Continuation <GetTokenResult , User >() {
240+ new Continuation <GetTokenResult , UserRecord >() {
239241 @ Override
240- public User then (Task <GetTokenResult > task ) throws Exception {
242+ public UserRecord then (Task <GetTokenResult > task ) throws Exception {
241243 return userManager .getUserByEmail (email , task .getResult ().getToken ());
242244 }
243245 });
244246 }
245247
246248 /**
247- * Creates a new user account with the attributes contained in the specified {@link User.Builder}.
249+ * Creates a new user account with the attributes contained in the specified
250+ * {@link CreateRequest}.
248251 *
249- * @param builder A non-null {@link User.Builder } instance.
250- * @return A {@link Task} which will complete successfully with a {@link User } instance
252+ * @param request A non-null {@link CreateRequest } instance.
253+ * @return A {@link Task} which will complete successfully with a {@link UserRecord } instance
251254 * corresponding to the newly created account. If an error occurs while creating the user
252255 * account, the task fails with a FirebaseAuthException.
253- * @throws NullPointerException if the provided builder is null.
256+ * @throws NullPointerException if the provided request is null.
254257 */
255- public Task <User > createUser (final User . Builder builder ) {
256- checkNotNull (builder , "builder must not be null" );
258+ public Task <UserRecord > createUser (final CreateRequest request ) {
259+ checkNotNull (request , "create request must not be null" );
257260 return ImplFirebaseTrampolines .getToken (firebaseApp , false ).continueWith (
258- new Continuation <GetTokenResult , User >() {
261+ new Continuation <GetTokenResult , UserRecord >() {
259262 @ Override
260- public User then (Task <GetTokenResult > task ) throws Exception {
261- String uid = userManager .createUser (builder , task .getResult ().getToken ());
263+ public UserRecord then (Task <GetTokenResult > task ) throws Exception {
264+ String uid = userManager .createUser (request , task .getResult ().getToken ());
262265 return userManager .getUserById (uid , task .getResult ().getToken ());
263266 }
264267 });
265268 }
266269
267270 /**
268271 * Updates an existing user account with the attributes contained in the specified
269- * {@link User.Updater }.
272+ * {@link UpdateRequest }.
270273 *
271- * @param updater A non-null {@link User.Updater } instance.
272- * @return A {@link Task} which will complete successfully with a {@link User } instance
274+ * @param request A non-null {@link UpdateRequest } instance.
275+ * @return A {@link Task} which will complete successfully with a {@link UserRecord } instance
273276 * corresponding to the updated user account. If an error occurs while updating the user
274277 * account, the task fails with a FirebaseAuthException.
275- * @throws NullPointerException if the provided updater is null.
278+ * @throws NullPointerException if the provided update request is null.
276279 */
277- public Task <User > updateUser (final User . Updater updater ) {
278- checkNotNull (updater , "updater must not be null" );
280+ public Task <UserRecord > updateUser (final UpdateRequest request ) {
281+ checkNotNull (request , "update request must not be null" );
279282 return ImplFirebaseTrampolines .getToken (firebaseApp , false ).continueWith (
280- new Continuation <GetTokenResult , User >() {
283+ new Continuation <GetTokenResult , UserRecord >() {
281284 @ Override
282- public User then (Task <GetTokenResult > task ) throws Exception {
283- userManager .updateUser (updater , task .getResult ().getToken ());
284- return userManager .getUserById (updater .getUid (), task .getResult ().getToken ());
285+ public UserRecord then (Task <GetTokenResult > task ) throws Exception {
286+ userManager .updateUser (request , task .getResult ().getToken ());
287+ return userManager .getUserById (request .getUid (), task .getResult ().getToken ());
285288 }
286289 });
287290 }
0 commit comments