FIRFunctions+Internal.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // Copyright 2017 Google
  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 <Foundation/Foundation.h>
  15. #import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRFunctions.h"
  16. @protocol FIRAppCheckInterop;
  17. @protocol FIRAuthInterop;
  18. @protocol FIRMessagingInterop;
  19. @class FIRHTTPSCallableResult;
  20. NS_ASSUME_NONNULL_BEGIN
  21. @interface FIRFunctions (Internal)
  22. /**
  23. * Calls an http trigger endpoint.
  24. * @param name The name of the http trigger.
  25. * @param data Parameters to pass to the function. Can be anything encodable as JSON.
  26. * @param completion The block to call when the request is complete.
  27. */
  28. - (void)callFunction:(NSString *)name
  29. withObject:(nullable id)data
  30. timeout:(NSTimeInterval)timeout
  31. completion:(void (^)(FIRHTTPSCallableResult *_Nullable result,
  32. NSError *_Nullable error))completion;
  33. /**
  34. * Constructs the url for an http trigger. This is exposed only for testing.
  35. * @param name The name of the endpoint.
  36. */
  37. - (NSString *)URLWithName:(NSString *)name;
  38. /**
  39. * Sets the functions client to send requests to localhost instead of Firebase.
  40. * For testing only.
  41. */
  42. - (void)useLocalhost;
  43. /**
  44. * Internal initializer for the Cloud Functions client.
  45. * @param projectID The project ID for the Firebase project.
  46. * @param region The region for the http trigger, such as "us-central1".
  47. * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
  48. * @param auth The auth provider to use (optional).
  49. * @param messaging The messaging interop to use (optional).
  50. */
  51. - (instancetype)initWithProjectID:(NSString *)projectID
  52. region:(NSString *)region
  53. customDomain:(nullable NSString *)customDomain
  54. auth:(nullable id<FIRAuthInterop>)auth
  55. messaging:(nullable id<FIRMessagingInterop>)messaging
  56. appCheck:(nullable id<FIRAppCheckInterop>)appCheck;
  57. @end
  58. NS_ASSUME_NONNULL_END