FIRFunctions+Internal.h 2.2 KB

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