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.

147 lines
5.7 KiB

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. };
  38. /** @enum FIRGetOOBConfirmationCodeRequest
  39. @brief Represents the parameters for the getOOBConfirmationCode endpoint.
  40. */
  41. @interface FIRGetOOBConfirmationCodeRequest : FIRIdentityToolkitRequest <FIRAuthRPCRequest>
  42. /** @property requestType
  43. @brief The types of OOB Confirmation Code to request.
  44. */
  45. @property(nonatomic, assign, readonly) FIRGetOOBConfirmationCodeRequestType requestType;
  46. /** @property email
  47. @brief The email of the user.
  48. @remarks For password reset.
  49. */
  50. @property(nonatomic, copy, nullable, readonly) NSString *email;
  51. /** @property accessToken
  52. @brief The STS Access Token of the authenticated user.
  53. @remarks For email change.
  54. */
  55. @property(nonatomic, copy, nullable, readonly) NSString *accessToken;
  56. /** @property continueURL
  57. @brief This URL represents the state/Continue URL in the form of a universal link.
  58. */
  59. @property(nonatomic, copy, nullable, readonly) NSString *continueURL;
  60. /** @property iOSBundleID
  61. @brief The iOS bundle Identifier, if available.
  62. */
  63. @property(nonatomic, copy, nullable, readonly) NSString *iOSBundleID;
  64. /** @property androidPackageName
  65. @brief The Android package name, if available.
  66. */
  67. @property(nonatomic, copy, nullable, readonly) NSString *androidPackageName;
  68. /** @property androidMinimumVersion
  69. @brief The minimum Android version supported, if available.
  70. */
  71. @property(nonatomic, copy, nullable, readonly) NSString *androidMinimumVersion;
  72. /** @property androidInstallIfNotAvailable
  73. @brief Indicates whether or not the Android app should be installed if not already available.
  74. */
  75. @property(nonatomic, assign, readonly) BOOL androidInstallApp;
  76. /** @property handleCodeInApp
  77. @brief Indicates whether the action code link will open the app directly or after being
  78. redirected from a Firebase owned web widget.
  79. */
  80. @property(assign, nonatomic) BOOL handleCodeInApp;
  81. /** @fn passwordResetRequestWithEmail:actionCodeSettings:requestConfiguration:
  82. @brief Creates a password reset request.
  83. @param email The user's email address.
  84. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  85. settings to be applied to the password reset request.
  86. @param requestConfiguration An object containing configurations to be added to the request.
  87. @return A password reset request.
  88. */
  89. + (nullable FIRGetOOBConfirmationCodeRequest *)
  90. passwordResetRequestWithEmail:(NSString *)email
  91. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  92. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  93. /** @fn verifyEmailRequestWithAccessToken:actionCodeSettings:requestConfiguration:
  94. @brief Creates a password reset request.
  95. @param accessToken The user's STS Access Token.
  96. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  97. settings to be applied to the email verification request.
  98. @param requestConfiguration An object containing configurations to be added to the request.
  99. @return A password reset request.
  100. */
  101. + (nullable FIRGetOOBConfirmationCodeRequest *)
  102. verifyEmailRequestWithAccessToken:(NSString *)accessToken
  103. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  104. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  105. /** @fn signInWithEmailLinkRequest:actionCodeSettings:requestConfiguration:
  106. @brief Creates a sign-in with email link.
  107. @param email The user's email address.
  108. @param actionCodeSettings An object of FIRActionCodeSettings which specifies action code
  109. settings to be applied to the email sign-in link.
  110. @param requestConfiguration An object containing configurations to be added to the request.
  111. @return An email sign-in link request.
  112. */
  113. + (nullable FIRGetOOBConfirmationCodeRequest *)
  114. signInWithEmailLinkRequest:(NSString *)email
  115. actionCodeSettings:(nullable FIRActionCodeSettings *)actionCodeSettings
  116. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration;
  117. /** @fn init
  118. @brief Please use a factory method.
  119. */
  120. - (nullable instancetype)initWithEndpoint:(NSString *)endpoint
  121. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration
  122. NS_UNAVAILABLE;
  123. @end
  124. NS_ASSUME_NONNULL_END