No Description

FIRVerifyClientRequest.m 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 "FIRVerifyClientRequest.h"
  17. NS_ASSUME_NONNULL_BEGIN
  18. /** @var kVerifyClientEndpoint
  19. @brief The endpoint for the verifyClient request.
  20. */
  21. static NSString *const kVerifyClientEndpoint = @"verifyClient";
  22. /** @var kAppTokenKey
  23. @brief The key for the appToken request paramenter.
  24. */
  25. static NSString *const kAPPTokenKey = @"appToken";
  26. /** @var kIsSandboxKey
  27. @brief The key for the isSandbox request parameter
  28. */
  29. static NSString *const kIsSandboxKey = @"isSandbox";
  30. @implementation FIRVerifyClientRequest
  31. - (nullable instancetype)initWithAppToken:(nullable NSString *)appToken
  32. isSandbox:(BOOL)isSandbox
  33. requestConfiguration:(FIRAuthRequestConfiguration *)requestConfiguration {
  34. self = [super initWithEndpoint:kVerifyClientEndpoint requestConfiguration:requestConfiguration];
  35. if (self) {
  36. _appToken = appToken;
  37. _isSandbox = isSandbox;
  38. }
  39. return self;
  40. }
  41. - (nullable id)unencodedHTTPRequestBodyWithError:(NSError *__autoreleasing _Nullable *)error {
  42. NSMutableDictionary *postBody = [NSMutableDictionary dictionary];
  43. if (_appToken) {
  44. postBody[kAPPTokenKey] = _appToken;
  45. }
  46. if (_isSandbox) {
  47. postBody[kIsSandboxKey] = @YES;
  48. }
  49. return postBody;
  50. }
  51. @end
  52. NS_ASSUME_NONNULL_END