FIRGetOOBConfirmationCodeRequest.h 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import "FirebaseAuth/Sources/Backend/FIRAuthRPCRequest.h"
  18. #import "FirebaseAuth/Sources/Backend/FIRIdentityToolkitRequest.h"
  19. @class FIRActionCodeSettings;
  20. NS_ASSUME_NONNULL_BEGIN
  21. /** @enum FIRGetOOBConfirmationCodeRequestType
  22. @brief Types of OOB Confirmation Code requests.
  23. */
  24. typedef NS_ENUM(NSInteger, FIRGetOOBConfirmationCodeRequestType) {
  25. /** @var FIRGetOOBConfirmationCodeRequestTypePasswordReset
  26. @brief Requests a password reset code.
  27. */
  28. FIRGetOOBConfirmationCodeRequestTypePasswordReset,
  29. /** @var FIRGetOOBConfirmationCodeRequestTypeVerifyEmail
  30. @brief Requests an email verification code.
  31. */
  32. FIRGetOOBConfirmationCodeRequestTypeVerifyEmail,
  33. /** @var FIRGetOOBConfirmationCodeRequestTypeEmailLink
  34. @brief Requests an email sign-in link.
  35. */
  36. FIRGetOOBConfirmationCodeRequestTypeEmailLink,
  37. /** @var FIRGetOOBConfirmationCodeRequestTypeVerifyBeforeUpdateEmail
  38. @brief Requests an verify before update email.
  39. */
  40. FIRGetOOBConfirmationCodeRequestTypeVerifyBeforeUpdateEmail,
  41. };
  42. /** @enum FIRGetOOBConfirmationCodeRequest
  43. @brief Represents the parameters for the getOOBConfirmationCode endpoint.
  44. */
  45. @interface FIRGetOOBConfirmationCodeRequest : FIRIdentityToolkitRequest <FIRAuthRPCRequest>
  46. /** @property requestType
  47. @brief The types of OOB Confirmation Code to request.
  48. */
  49. @property(nonatomic, assign, readonly) FIRGetOOBConfirmationCodeRequestType requestType;
  50. /** @property email
  51. @brief The email of the user.
  52. @remarks For password reset.
  53. */
  54. @property(nonatomic, copy, nullable, readonly) NSString *email;
  55. /** @property updatedEmail
  56. @brief The new email to be updated.
  57. @remarks For verifyBeforeUpdateEmail.
  58. */
  59. @property(nonatomic, copy, nullable, readonly) NSString *updatedEmail;
  60. /** @property accessToken
  61. @brief The STS Access Token of the authenticated user.
  62. @remarks For email change.
  63. */
  64. @property(nonatomic, copy, nullable, readonly) NSString *accessToken;
  65. /** @property continueURL
  66. @brief This URL represents the state/Continue URL in the form of a universal link.
  67. */
  68. @property(nonatomic, copy, nullable, readonly) NSString *continueURL;
  69. /** @property iOSBundleID
  70. @brief The iOS bundle Identifier, if available.
  71. */
  72. @property(nonatomic, copy, nullable, readonly) NSString *iOSBundleID;
  73. /** @property androidPackageName
  74. @brief The Android package name, if available.
  75. */
  76. @property(nonatomic, copy, nullable, readonly) NSString *androidPackageName;
  77. /** @property androidMinimumVersion
  78. @brief The minimum Android version supported, if available.
  79. */
  80. @property(nonatomic, copy, nullable, readonly) NSString *androidMinimumVersion;
  81. /** @property androidInstallIfNotAvailable
  82. @brief Indicates whether or not the Android app should be installed if not already available.
  83. */
  84. @property(nonatomic, assign, readonly) BOOL androidInstallApp;
  85. /** @property handleCodeInApp
  86. @brief Indicates whether the action code link will open the app directly or after being
  87. redirected from a Firebase owned web widget.
  88. */
  89. @property(assign, nonatomic) BOOL handleCodeInApp;
  90. /** @property dynamicLinkDomain
  91. @brief The Firebase Dynamic Link domain used for out of band code flow.
  92. */
  93. @property(copy, nonatomic, nullable) NSString *dynamicLinkDomain;
  94. /** @property captchaResponse
  95. @brief Response to the captcha.
  96. */
  97. @property(nonatomic, copy, nullable) NSString *captchaResponse;
  98. /** @property captchaResponse
  99. @brief The reCAPTCHA version.
  100. */
  101. @property(nonatomic, copy, nullable) NSString *recaptchaVersion;
  102. /** @fn passwordResetRequestWithEmail:actionCodeSettings:requestConfiguration:
  103. @brief Creates a password reset request.
  104. @param email The user's email address.
  105. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  106. settings to be applied to the password reset request.
  107. @param requestConfiguration An object containing configurations to be added to the request.
  108. @return A password reset request.
  109. */
  110. + (nullable FIRGetOOBConfirmationCodeRequest *)
  111. passwordResetRequestWithEmail:(NSString *)email
  112. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  113. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  114. /** @fn verifyEmailRequestWithAccessToken:actionCodeSettings:requestConfiguration:
  115. @brief Creates a password reset request.
  116. @param accessToken The user's STS Access Token.
  117. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  118. settings to be applied to the email verification request.
  119. @param requestConfiguration An object containing configurations to be added to the request.
  120. @return A password reset request.
  121. */
  122. + (nullable FIRGetOOBConfirmationCodeRequest *)
  123. verifyEmailRequestWithAccessToken:(NSString *)accessToken
  124. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  125. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  126. /** @fn signInWithEmailLinkRequest:actionCodeSettings:requestConfiguration:
  127. @brief Creates a sign-in with email link.
  128. @param email The user's email address.
  129. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  130. settings to be applied to the email sign-in link.
  131. @param requestConfiguration An object containing configurations to be added to the request.
  132. @return An email sign-in link request.
  133. */
  134. + (nullable FIRGetOOBConfirmationCodeRequest *)
  135. signInWithEmailLinkRequest:(NSString *)email
  136. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  137. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  138. /** @fn verifyBeforeUpdateEmailWithAccessToken:newEmail:actionCodeSettings:requestConfiguration:
  139. @brief Creates a verifyBeforeUpdateEmail request.
  140. @param accessToken The user's STS Access Token.
  141. @param newEmail The user's email address to be updated.
  142. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  143. settings to be applied to the password reset request.
  144. @param requestConfiguration An object containing configurations to be added to the request.
  145. @return A verifyBeforeUpdateEmail request.
  146. */
  147. + (nullable FIRGetOOBConfirmationCodeRequest *)
  148. verifyBeforeUpdateEmailWithAccessToken:(NSString *)accessToken
  149. newEmail:(NSString *)newEmail
  150. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  151. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  152. /** @fn init
  153. @brief Please use a factory method.
  154. */
  155. - (nullable instancetype)initWithEndpoint:(NSString *)endpoint
  156. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration
  157. NS_UNAVAILABLE;
  158. @end
  159. NS_ASSUME_NONNULL_END