File tree Expand file tree Collapse file tree 5 files changed +59
-2
lines changed
firebase-auth-rest/core/src/main/java/com/anotherdev/firebase/auth Expand file tree Collapse file tree 5 files changed +59
-2
lines changed Original file line number Diff line number Diff line change 44import androidx .annotation .Nullable ;
55
66import com .anotherdev .firebase .auth .provider .IdpAuthCredential ;
7+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailRequest ;
8+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailResponse ;
79import com .google .firebase .FirebaseApp ;
810
911import io .reactivex .rxjava3 .annotations .CheckReturnValue ;
1012import io .reactivex .rxjava3 .core .Observable ;
1113import io .reactivex .rxjava3 .core .Single ;
14+ import retrofit2 .http .Body ;
1215
1316public interface FirebaseAuth {
1417
@@ -53,5 +56,9 @@ public interface FirebaseAuth {
5356 @ CheckReturnValue
5457 Single <SignInResponse > linkWithCredential (@ NonNull FirebaseUser user , @ NonNull IdpAuthCredential credential );
5558
59+ @ NonNull
60+ @ CheckReturnValue
61+ Single <SendPasswordResetEmailResponse > sendPasswordResetEmail (@ Body SendPasswordResetEmailRequest request );
62+
5663 void signOut ();
5764}
Original file line number Diff line number Diff line change 1414import com .anotherdev .firebase .auth .rest .api .RestAuthApi ;
1515import com .anotherdev .firebase .auth .rest .api .model .ExchangeTokenRequest ;
1616import com .anotherdev .firebase .auth .rest .api .model .ImmutableSignInWithIdpRequest ;
17+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailRequest ;
18+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailResponse ;
1719import com .anotherdev .firebase .auth .rest .api .model .SignInAnonymouslyRequest ;
1820import com .anotherdev .firebase .auth .rest .api .model .SignInWithCustomTokenRequest ;
1921import com .anotherdev .firebase .auth .rest .api .model .SignInWithEmailPasswordRequest ;
@@ -155,6 +157,12 @@ private Single<SignInResponse> performSignInWithCredential(ImmutableSignInWithId
155157 .map (this ::saveCurrentUser );
156158 }
157159
160+ @ NonNull
161+ @ Override
162+ public Single <SendPasswordResetEmailResponse > sendPasswordResetEmail (SendPasswordResetEmailRequest request ) {
163+ return RestAuthApi .auth ().sendPasswordResetEmail (request );
164+ }
165+
158166 @ Override
159167 public void signOut () {
160168 userStore .delete ();
Original file line number Diff line number Diff line change 55import com .anotherdev .firebase .auth .UserProfileChangeResponse ;
66import com .anotherdev .firebase .auth .rest .api .model .IdTokenRequest ;
77import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailRequest ;
8+ import com .anotherdev .firebase .auth .rest .api .model .SendPasswordResetEmailResponse ;
89import com .anotherdev .firebase .auth .rest .api .model .SignInRequest ;
910import com .anotherdev .firebase .auth .rest .api .model .SignInWithCustomTokenRequest ;
1011import com .anotherdev .firebase .auth .rest .api .model .SignInWithEmailPasswordRequest ;
@@ -37,9 +38,8 @@ public interface IdentityToolkitApi {
3738 @ POST ("v1/accounts:signInWithCustomToken" )
3839 Single <SignInResponse > signInWithCustomToken (@ Body SignInWithCustomTokenRequest request );
3940
40- // FIXME refactor to proper return type
4141 @ POST ("v1/accounts:sendOobCode" )
42- Single <JsonObject > sendPasswordResetEmail (@ Body SendPasswordResetEmailRequest request );
42+ Single <SendPasswordResetEmailResponse > sendPasswordResetEmail (@ Body SendPasswordResetEmailRequest request );
4343
4444 @ POST ("v1/accounts:lookup" )
4545 Single <JsonObject > getAccounts (@ Body IdTokenRequest request );
Original file line number Diff line number Diff line change 11package com .anotherdev .firebase .auth .rest .api .model ;
22
3+ import com .google .gson .annotations .SerializedName ;
4+
5+ import org .immutables .gson .Gson ;
6+ import org .immutables .value .Value ;
7+
8+ @ Value .Immutable
9+ @ Value .Style (strictBuilder = true )
10+ @ Gson .TypeAdapters
311public interface SendPasswordResetEmailRequest {
12+
13+ @ SerializedName ("email" )
14+ String getEmail ();
15+
16+ @ Value .Default
17+ @ SerializedName ("requestType" )
18+ default String getRequestType () {
19+ return "PASSWORD_RESET" ;
20+ }
21+
22+
23+ static ImmutableSendPasswordResetEmailRequest .Builder builder () {
24+ return ImmutableSendPasswordResetEmailRequest .builder ();
25+ }
426}
Original file line number Diff line number Diff line change 1+ package com .anotherdev .firebase .auth .rest .api .model ;
2+
3+ import com .google .gson .annotations .SerializedName ;
4+
5+ import org .immutables .gson .Gson ;
6+ import org .immutables .value .Value ;
7+
8+ @ Value .Immutable
9+ @ Value .Style (strictBuilder = true )
10+ @ Gson .TypeAdapters
11+ public interface SendPasswordResetEmailResponse {
12+
13+ @ SerializedName ("email" )
14+ String getEmail ();
15+
16+
17+ static ImmutableSendPasswordResetEmailResponse .Builder builder () {
18+ return ImmutableSendPasswordResetEmailResponse .builder ();
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments