FIRFunctions+Internal.h 2.0 KB

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