FIRGetOOBConfirmationCodeRequest.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. NS_ASSUME_NONNULL_BEGIN
  20. /** @enum FIRGetOOBConfirmationCodeRequestType
  21. @brief Types of OOB Confirmation Code requests.
  22. */
  23. typedef NS_ENUM(NSInteger, FIRGetOOBConfirmationCodeRequestType) {
  24. /** @var FIRGetOOBConfirmationCodeRequestTypePasswordReset
  25. @brief Requests a password reset code.
  26. */
  27. FIRGetOOBConfirmationCodeRequestTypePasswordReset,
  28. /** @var FIRGetOOBConfirmationCodeRequestTypeVerifyEmail
  29. @brief Requests an email verification code.
  30. */
  31. FIRGetOOBConfirmationCodeRequestTypeVerifyEmail,
  32. };
  33. /** @enum FIRGetOOBConfirmationCodeRequest
  34. @brief Represents the parameters for the getOOBConfirmationCode endpoint.
  35. */
  36. @interface FIRGetOOBConfirmationCodeRequest : FIRIdentityToolkitRequest <FIRAuthRPCRequest>
  37. /** @property requestType
  38. @brief The types of OOB Confirmation Code to request.
  39. */
  40. @property(nonatomic, assign, readonly) FIRGetOOBConfirmationCodeRequestType requestType;
  41. /** @property email
  42. @brief The email of the user.
  43. @remarks For password reset.
  44. */
  45. @property(nonatomic, copy, nullable, readonly) NSString *email;
  46. /** @property accessToken
  47. @brief The STS Access Token of the authenticated user.
  48. @remarks For email change.
  49. */
  50. @property(nonatomic, copy, nullable, readonly) NSString *accessToken;
  51. /** @fn passwordResetRequestWithEmail:APIKey:
  52. @brief Creates a password reset request.
  53. @param email The user's email address.
  54. @param APIKey The client's API Key.
  55. @return A password reset request.
  56. */
  57. + (nullable FIRGetOOBConfirmationCodeRequest *)passwordResetRequestWithEmail:(NSString *)email
  58. APIKey:(NSString *)APIKey;
  59. /** @fn verifyEmailRequestWithAccessToken:APIKey:
  60. @brief Creates a password reset request.
  61. @param accessToken The user's STS Access Token.
  62. @param APIKey The client's API Key.
  63. @return A password reset request.
  64. */
  65. + (nullable FIRGetOOBConfirmationCodeRequest *)
  66. verifyEmailRequestWithAccessToken:(NSString *)accessToken APIKey:(NSString *)APIKey;
  67. /** @fn init
  68. @brief Please use a factory method.
  69. */
  70. - (nullable instancetype)initWithEndpoint:(NSString *)endpoint
  71. APIKey:(NSString *)APIKey NS_UNAVAILABLE;
  72. @end
  73. NS_ASSUME_NONNULL_END