@@ -115,8 +115,132 @@ public boolean isPreferImmediatelyAvailableCredentials() {
115115 return preferImmediatelyAvailableCredentials ;
116116 }
117117
118+ /**
119+ * Builder for {@link BeginSignInRequest}.
120+ */
118121 public static class Builder {
122+ private PasswordRequestOptions passwordRequestOptions ;
123+ private GoogleIdTokenRequestOptions googleIdTokenRequestOptions ;
124+ private String sessionId ;
125+ private boolean autoSelectEnabled ;
126+ private int theme ;
127+ private PasskeysRequestOptions passkeysRequestOptions ;
128+ private PasskeyJsonRequestOptions passkeyJsonRequestOptions ;
129+ private boolean preferImmediatelyAvailableCredentials ;
130+
131+ /**
132+ * Returns the built {@link BeginSignInRequest}.
133+ */
134+ @ NonNull
135+ public BeginSignInRequest build () {
136+ return new BeginSignInRequest (
137+ passwordRequestOptions ,
138+ googleIdTokenRequestOptions ,
139+ sessionId ,
140+ autoSelectEnabled ,
141+ theme ,
142+ passkeysRequestOptions ,
143+ passkeyJsonRequestOptions ,
144+ preferImmediatelyAvailableCredentials
145+ );
146+ }
119147
148+ /**
149+ * Sets whether to enable auto-select for the credential.
150+ * <p>
151+ * If enabled and only one credential is available, it will be automatically selected.
152+ *
153+ * @param autoSelectEnabled whether to enable auto-select
154+ */
155+ @ NonNull
156+ public Builder setAutoSelectEnabled (boolean autoSelectEnabled ) {
157+ this .autoSelectEnabled = autoSelectEnabled ;
158+ return this ;
159+ }
160+
161+ /**
162+ * Sets options for requesting Google ID token-backed credentials.
163+ *
164+ * @param googleIdTokenRequestOptions the Google ID token request options
165+ */
166+ @ NonNull
167+ public Builder setGoogleIdTokenRequestOptions (@ Nullable GoogleIdTokenRequestOptions googleIdTokenRequestOptions ) {
168+ this .googleIdTokenRequestOptions = googleIdTokenRequestOptions ;
169+ return this ;
170+ }
171+
172+ /**
173+ * Sets options for requesting passkey credentials using JSON format.
174+ *
175+ * @param passkeyJsonRequestOptions the passkey JSON request options
176+ */
177+ @ NonNull
178+ public Builder setPasskeyJsonRequestOptions (@ Nullable PasskeyJsonRequestOptions passkeyJsonRequestOptions ) {
179+ this .passkeyJsonRequestOptions = passkeyJsonRequestOptions ;
180+ return this ;
181+ }
182+
183+ /**
184+ * Sets options for requesting passkey credentials.
185+ *
186+ * @param passkeysRequestOptions the passkey request options
187+ * @deprecated Use {@link #setPasskeyJsonRequestOptions(PasskeyJsonRequestOptions)} instead
188+ */
189+ @ Deprecated
190+ @ NonNull
191+ public Builder setPasskeysRequestOptions (@ Nullable PasskeysRequestOptions passkeysRequestOptions ) {
192+ this .passkeysRequestOptions = passkeysRequestOptions ;
193+ return this ;
194+ }
195+
196+ /**
197+ * Sets options for requesting password-backed credentials.
198+ *
199+ * @param passwordRequestOptions the password request options
200+ */
201+ @ NonNull
202+ public Builder setPasswordRequestOptions (@ Nullable PasswordRequestOptions passwordRequestOptions ) {
203+ this .passwordRequestOptions = passwordRequestOptions ;
204+ return this ;
205+ }
206+
207+ /**
208+ * Sets whether to prefer immediately available credentials.
209+ * <p>
210+ * If true, the API will only return credentials that are immediately available
211+ * without requiring user interaction.
212+ *
213+ * @param preferImmediatelyAvailableCredentials whether to prefer immediately available credentials
214+ */
215+ @ NonNull
216+ public Builder setPreferImmediatelyAvailableCredentials (boolean preferImmediatelyAvailableCredentials ) {
217+ this .preferImmediatelyAvailableCredentials = preferImmediatelyAvailableCredentials ;
218+ return this ;
219+ }
220+
221+ /**
222+ * Sets the session ID for this sign-in request.
223+ *
224+ * @param sessionId the session ID
225+ */
226+ @ Hide
227+ @ NonNull
228+ public Builder setSessionId (@ Nullable String sessionId ) {
229+ this .sessionId = sessionId ;
230+ return this ;
231+ }
232+
233+ /**
234+ * Sets the theme for the sign-in UI.
235+ *
236+ * @param theme the theme resource ID
237+ */
238+ @ Hide
239+ @ NonNull
240+ public Builder setTheme (int theme ) {
241+ this .theme = theme ;
242+ return this ;
243+ }
120244 }
121245
122246 /**
0 commit comments