FIRFunctions+Internal.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 "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. completion:(void (^)(FIRHTTPSCallableResult *_Nullable result,
  29. NSError *_Nullable error))completion;
  30. /**
  31. * Constructs the url for an http trigger. This is exposed only for testing.
  32. * @param name The name of the endpoint.
  33. */
  34. - (NSString *)URLWithName:(NSString *)name;
  35. /**
  36. * Sets the functions client to send requests to localhost instead of Firebase.
  37. * For testing only.
  38. */
  39. - (void)useLocalhost;
  40. /**
  41. * Internal initializer for the Cloud Functions client.
  42. * @param projectID The project ID for the Firebase project.
  43. * @param region The region for the http trigger, such as "us-central1".
  44. * @param auth The auth provider to use (optional).
  45. */
  46. - (id)initWithProjectID:(NSString *)projectID
  47. region:(NSString *)region
  48. auth:(nullable id<FIRAuthInterop>)auth;
  49. @end
  50. NS_ASSUME_NONNULL_END