ObjCAPITests.m 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Copyright 2022 Google LLC
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. #import <XCTest/XCTest.h>
  15. @import FirebaseCore;
  16. @import FirebaseFunctions;
  17. @interface ObjCAPICoverage : XCTestCase
  18. @end
  19. @implementation ObjCAPICoverage
  20. - (void)apis {
  21. #pragma mark - Functions
  22. FIRApp *app = [FIRApp defaultApp];
  23. FIRFunctions *func = [FIRFunctions functions];
  24. func = [FIRFunctions functionsForApp:app];
  25. func = [FIRFunctions functionsForRegion:@"my-region"];
  26. func = [FIRFunctions functionsForCustomDomain:@"my-domain"];
  27. func = [FIRFunctions functionsForApp:app region:@"my-region"];
  28. func = [FIRFunctions functionsForApp:app customDomain:@"my-domain"];
  29. FIRHTTPSCallable *callable = [func HTTPSCallableWithName:@"name"];
  30. [func useEmulatorWithHost:@"host" port:@"port"];
  31. #pragma mark - HTTPSCallable and HTTPSCallableResult
  32. [callable
  33. callWithCompletion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
  34. __unused id data = result.data;
  35. }];
  36. [callable callWithObject:nil
  37. completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
  38. [result data];
  39. }];
  40. callable.timeoutInterval = 60;
  41. [callable timeoutInterval];
  42. #pragma mark - FunctionsError
  43. // Deleted in Firebase 9
  44. //__unused NSString *str = FIRFunctionsErrorDomain;
  45. //__unused NSString *str2 = FIRFunctionsErrorDetailsKey;
  46. // Replaced in Firebase 9
  47. __unused NSString *str = FIRFunctionsErrorKeys.domain;
  48. __unused NSString *str2 = FIRFunctionsErrorKeys.errorDetailsKey;
  49. }
  50. - (FIRFunctionsErrorCode)errorCodes:(NSError *)error {
  51. switch (error.code) {
  52. case FIRFunctionsErrorCodeOK:
  53. case FIRFunctionsErrorCodeCancelled:
  54. case FIRFunctionsErrorCodeUnknown:
  55. case FIRFunctionsErrorCodeInvalidArgument:
  56. case FIRFunctionsErrorCodeDeadlineExceeded:
  57. case FIRFunctionsErrorCodeNotFound:
  58. case FIRFunctionsErrorCodeAlreadyExists:
  59. case FIRFunctionsErrorCodePermissionDenied:
  60. case FIRFunctionsErrorCodeResourceExhausted:
  61. case FIRFunctionsErrorCodeFailedPrecondition:
  62. case FIRFunctionsErrorCodeAborted:
  63. case FIRFunctionsErrorCodeOutOfRange:
  64. case FIRFunctionsErrorCodeUnimplemented:
  65. case FIRFunctionsErrorCodeInternal:
  66. case FIRFunctionsErrorCodeUnavailable:
  67. case FIRFunctionsErrorCodeDataLoss:
  68. case FIRFunctionsErrorCodeUnauthenticated:
  69. return error.code;
  70. }
  71. }
  72. @end