FirebaseFunctions Framework Reference

Functions

@objc(FIRFunctions)
open class Functions : NSObject

Functions is the client for Cloud Functions for a Firebase project.

  • The current emulator origin, or nil if it is not set.

    Declaration

    Swift

    open private(set) var emulatorOrigin: String? { get }
  • Creates a Cloud Functions client using the default or returns a pre-existing instance if it already exists.

    Declaration

    Swift

    @objc(functions)
    open class func functions() -> Functions

    Return Value

    A shared Functions instance initialized with the default FirebaseApp.

  • Creates a Cloud Functions client with the given app, or returns a pre-existing instance if one already exists.

    Declaration

    Swift

    @objc(functionsForApp:)
    open class func functions(app: FirebaseApp) -> Functions

    Parameters

    app

    The app for the Firebase project.

    Return Value

    A shared Functions instance initialized with the specified FirebaseApp.

  • Creates a Cloud Functions client with the default app and given region.

    Declaration

    Swift

    @objc(functionsForRegion:)
    open class func functions(region: String) -> Functions

    Parameters

    region

    The region for the HTTP trigger, such as us-central1.

    Return Value

    A shared Functions instance initialized with the default FirebaseApp and a custom region.

  • Creates a Cloud Functions client with the given custom domain or returns a pre-existing instance if one already exists.

    Declaration

    Swift

    @objc(functionsForCustomDomain:)
    open class func functions(customDomain: String) -> Functions

    Parameters

    customDomain

    A custom domain for the HTTP trigger, such as “https://mydomain.com”.

    Return Value

    A shared Functions instance initialized with the default FirebaseApp and a custom HTTP trigger domain.

  • Creates a Cloud Functions client with the given app and region, or returns a pre-existing instance if one already exists.

    Declaration

    Swift

    @objc(functionsForApp:region:)
    open class func functions(app: FirebaseApp,
                              region: String) -> Functions

    Parameters

    app

    The app for the Firebase project.

    region

    The region for the HTTP trigger, such as us-central1.

    Return Value

    An instance of Functions with a custom app and region.

  • Creates a Cloud Functions client with the given app and custom domain, or returns a pre-existing instance if one already exists.

    Declaration

    Swift

    @objc(functionsForApp:customDomain:)
    open class func functions(app: FirebaseApp,
                              customDomain: String)
      -> Functions

    Parameters

    app

    The app for the Firebase project.

    customDomain

    A custom domain for the HTTP trigger, such as https://mydomain.com.

    Return Value

    An instance of Functions with a custom app and HTTP trigger domain.

  • Creates a reference to the Callable HTTPS trigger with the given name.

    Declaration

    Swift

    @objc(HTTPSCallableWithName:)
    open func httpsCallable(_ name: String) -> HTTPSCallable

    Parameters

    name

    The name of the Callable HTTPS trigger.

    Return Value

    A reference to a Callable HTTPS trigger.

  • Creates a reference to the Callable HTTPS trigger with the given name and configuration options.

    Declaration

    Swift

    @objc(HTTPSCallableWithName:options:)
    public func httpsCallable(_ name: String,
                              options: HTTPSCallableOptions)
      -> HTTPSCallable

    Parameters

    name

    The name of the Callable HTTPS trigger.

    options

    The options with which to customize the Callable HTTPS trigger.

    Return Value

    A reference to a Callable HTTPS trigger.

  • Creates a reference to the Callable HTTPS trigger with the given name.

    Declaration

    Swift

    @objc(HTTPSCallableWithURL:)
    open func httpsCallable(_ url: URL) -> HTTPSCallable

    Parameters

    url

    The URL of the Callable HTTPS trigger.

    Return Value

    A reference to a Callable HTTPS trigger.

  • Creates a reference to the Callable HTTPS trigger with the given name and configuration options.

    Declaration

    Swift

    @objc(HTTPSCallableWithURL:options:)
    public func httpsCallable(_ url: URL,
                              options: HTTPSCallableOptions)
      -> HTTPSCallable

    Parameters

    url

    The URL of the Callable HTTPS trigger.

    options

    The options with which to customize the Callable HTTPS trigger.

    Return Value

    A reference to a Callable HTTPS trigger.

  • Creates a reference to the Callable HTTPS trigger with the given name, the type of an Encodable request and the type of a Decodable response.

    Declaration

    Swift

    open func httpsCallable<Request: Encodable,
      Response: Decodable>(_ name: String,
                           requestAs: Request.Type = Request.self,
                           responseAs: Response.Type = Response.self,
                           encoder: FirebaseDataEncoder = FirebaseDataEncoder(
                           ),
                           decoder: FirebaseDataDecoder = FirebaseDataDecoder(
                           ))
      -> Callable<Request, Response>

    Parameters

    name

    The name of the Callable HTTPS trigger

    requestAs

    The type of the Encodable entity to use for requests to this Callable

    responseAs

    The type of the Decodable entity to use for responses from this Callable

    encoder

    The encoder instance to use to perform encoding.

    decoder

    The decoder instance to use to perform decoding.

    Return Value

    A reference to an HTTPS-callable Cloud Function that can be used to make Cloud Functions invocations.

  • Creates a reference to the Callable HTTPS trigger with the given name, the type of an Encodable request and the type of a Decodable response.

    Declaration

    Swift

    open func httpsCallable<Request: Encodable,
      Response: Decodable>(_ name: String,
                           options: HTTPSCallableOptions,
                           requestAs: Request.Type = Request.self,
                           responseAs: Response.Type = Response.self,
                           encoder: FirebaseDataEncoder = FirebaseDataEncoder(
                           ),
                           decoder: FirebaseDataDecoder = FirebaseDataDecoder(
                           ))
      -> Callable<Request, Response>

    Parameters

    name

    The name of the Callable HTTPS trigger

    options

    The options with which to customize the Callable HTTPS trigger.

    requestAs

    The type of the Encodable entity to use for requests to this Callable

    responseAs

    The type of the Decodable entity to use for responses from this Callable

    encoder

    The encoder instance to use to perform encoding.

    decoder

    The decoder instance to use to perform decoding.

    Return Value

    A reference to an HTTPS-callable Cloud Function that can be used to make Cloud Functions invocations.

  • Creates a reference to the Callable HTTPS trigger with the given name, the type of an Encodable request and the type of a Decodable response.

    Declaration

    Swift

    open func httpsCallable<Request: Encodable,
      Response: Decodable>(_ url: URL,
                           requestAs: Request.Type = Request.self,
                           responseAs: Response.Type = Response.self,
                           encoder: FirebaseDataEncoder = FirebaseDataEncoder(
                           ),
                           decoder: FirebaseDataDecoder = FirebaseDataDecoder(
                           ))
      -> Callable<Request, Response>

    Parameters

    url

    The url of the Callable HTTPS trigger

    requestAs

    The type of the Encodable entity to use for requests to this Callable

    responseAs

    The type of the Decodable entity to use for responses from this Callable

    encoder

    The encoder instance to use to perform encoding.

    decoder

    The decoder instance to use to perform decoding.

    Return Value

    A reference to an HTTPS-callable Cloud Function that can be used to make Cloud Functions invocations.

  • Creates a reference to the Callable HTTPS trigger with the given name, the type of an Encodable request and the type of a Decodable response.

    Declaration

    Swift

    open func httpsCallable<Request: Encodable,
      Response: Decodable>(_ url: URL,
                           options: HTTPSCallableOptions,
                           requestAs: Request.Type = Request.self,
                           responseAs: Response.Type = Response.self,
                           encoder: FirebaseDataEncoder = FirebaseDataEncoder(
                           ),
                           decoder: FirebaseDataDecoder = FirebaseDataDecoder(
                           ))
      -> Callable<Request, Response>

    Parameters

    url

    The url of the Callable HTTPS trigger

    options

    The options with which to customize the Callable HTTPS trigger.

    requestAs

    The type of the Encodable entity to use for requests to this Callable

    responseAs

    The type of the Decodable entity to use for responses from this Callable

    encoder

    The encoder instance to use to perform encoding.

    decoder

    The decoder instance to use to perform decoding.

    Return Value

    A reference to an HTTPS-callable Cloud Function that can be used to make Cloud Functions invocations.

  • Changes this instance to point to a Cloud Functions emulator running locally. See https://firebase.google.com/docs/functions/local-emulator

    Declaration

    Swift

    @objc
    open func useEmulator(withHost host: String, port: Int)

    Parameters

    host

    The host of the local emulator, such as “localhost”.

    port

    The port of the local emulator, for example 5005.