FIRFunctions.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. NS_ASSUME_NONNULL_BEGIN
  16. @class FIRApp;
  17. @class FIRHTTPSCallable;
  18. /**
  19. * `FIRFunctions` is the client for Cloud Functions for a Firebase project.
  20. */
  21. NS_SWIFT_NAME(Functions)
  22. @interface FIRFunctions : NSObject
  23. /**
  24. * The current emulator origin, or nil if it is not set.
  25. */
  26. @property(nonatomic, readonly, nullable) NSString *emulatorOrigin;
  27. /** :nodoc: */
  28. - (id)init NS_UNAVAILABLE;
  29. /**
  30. * Creates a Cloud Functions client with the default app.
  31. */
  32. + (instancetype)functions NS_SWIFT_NAME(functions());
  33. /**
  34. * Creates a Cloud Functions client with the given app.
  35. * @param app The app for the Firebase project.
  36. */
  37. + (instancetype)functionsForApp:(FIRApp *)app NS_SWIFT_NAME(functions(app:));
  38. /**
  39. * Creates a Cloud Functions client with the default app and given region.
  40. * @param region The region for the http trigger, such as "us-central1".
  41. */
  42. + (instancetype)functionsForRegion:(NSString *)region NS_SWIFT_NAME(functions(region:));
  43. /**
  44. * Creates a Cloud Functions client with the default app and given custom domain.
  45. * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
  46. */
  47. + (instancetype)functionsForCustomDomain:(NSString *)customDomain
  48. NS_SWIFT_NAME(functions(customDomain:));
  49. /**
  50. * Creates a Cloud Functions client with the given app and region, or returns a pre-existing
  51. * instance if one already exists.
  52. * @param app The app for the Firebase project.
  53. * @param region The region for the http trigger, such as "us-central1".
  54. */
  55. + (instancetype)functionsForApp:(FIRApp *)app
  56. region:(NSString *)region NS_SWIFT_NAME(functions(app:region:));
  57. /**
  58. * Creates a Cloud Functions client with the given app and region, or returns a pre-existing
  59. * instance if one already exists.
  60. * @param app The app for the Firebase project.
  61. * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
  62. */
  63. + (instancetype)functionsForApp:(FIRApp *)app
  64. customDomain:(NSString *)customDomain
  65. NS_SWIFT_NAME(functions(app:customDomain:));
  66. /**
  67. * Creates a reference to the Callable HTTPS trigger with the given name.
  68. * @param name The name of the Callable HTTPS trigger.
  69. */
  70. - (FIRHTTPSCallable *)HTTPSCallableWithName:(NSString *)name NS_SWIFT_NAME(httpsCallable(_:));
  71. /**
  72. * Changes this instance to point to a Cloud Functions emulator running locally.
  73. * See https://firebase.google.com/docs/functions/local-emulator
  74. * @param origin The origin of the local emulator, such as "localhost:5005".
  75. */
  76. - (void)useFunctionsEmulatorOrigin:(NSString *)origin
  77. NS_SWIFT_NAME(useFunctionsEmulator(origin:))
  78. __attribute__((deprecated("Use useEmulator(host:port:) instead.")));
  79. /**
  80. * Changes this instance to point to a Cloud Functions emulator running locally.
  81. * See https://firebase.google.com/docs/functions/local-emulator
  82. * @param host The host of the local emulator, such as "localhost".
  83. * @param port The port of the local emulator, for example 5005.
  84. */
  85. - (void)useEmulatorWithHost:(NSString *)host port:(NSInteger)port;
  86. @end
  87. NS_ASSUME_NONNULL_END