You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

180 lines
7.1 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  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 "FIRAuthRPCRequest.h"
  18. #import "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. /** @fn passwordResetRequestWithEmail:actionCodeSettings:requestConfiguration:
  95. @brief Creates a password reset request.
  96. @param email The user's email address.
  97. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  98. settings to be applied to the password reset request.
  99. @param requestConfiguration An object containing configurations to be added to the request.
  100. @return A password reset request.
  101. */
  102. + (nullable FIRGetOOBConfirmationCodeRequest *)
  103. passwordResetRequestWithEmail:(NSString *)email
  104. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  105. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  106. /** @fn verifyEmailRequestWithAccessToken:actionCodeSettings:requestConfiguration:
  107. @brief Creates a password reset request.
  108. @param accessToken The user's STS Access Token.
  109. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  110. settings to be applied to the email verification request.
  111. @param requestConfiguration An object containing configurations to be added to the request.
  112. @return A password reset request.
  113. */
  114. + (nullable FIRGetOOBConfirmationCodeRequest *)
  115. verifyEmailRequestWithAccessToken:(NSString *)accessToken
  116. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  117. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  118. /** @fn signInWithEmailLinkRequest:actionCodeSettings:requestConfiguration:
  119. @brief Creates a sign-in with email link.
  120. @param email The user's email address.
  121. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  122. settings to be applied to the email sign-in link.
  123. @param requestConfiguration An object containing configurations to be added to the request.
  124. @return An email sign-in link request.
  125. */
  126. + (nullable FIRGetOOBConfirmationCodeRequest *)
  127. signInWithEmailLinkRequest:(NSString *)email
  128. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  129. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  130. /** @fn verifyBeforeUpdateEmailWithAccessToken:newEmail:actionCodeSettings:requestConfiguration:
  131. @brief Creates a verifyBeforeUpdateEmail request.
  132. @param accessToken The user's STS Access Token.
  133. @param newEmail The user's email address to be updated.
  134. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  135. settings to be applied to the password reset request.
  136. @param requestConfiguration An object containing configurations to be added to the request.
  137. @return A verifyBeforeUpdateEmail request.
  138. */
  139. + (nullable FIRGetOOBConfirmationCodeRequest *)
  140. verifyBeforeUpdateEmailWithAccessToken:(NSString *)accessToken
  141. newEmail:(NSString *)newEmail
  142. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  143. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  144. /** @fn init
  145. @brief Please use a factory method.
  146. */
  147. - (nullable instancetype)initWithEndpoint:(NSString *)endpoint
  148. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration
  149. NS_UNAVAILABLE;
  150. @end
  151. NS_ASSUME_NONNULL_END