import type { ReactNativeFirebase } from '@react-native-firebase/app'; /** * Use for iOS, Android and web for https callable only. For streaming, this is for android and iOS only. * For web streaming, use `HttpsCallableStreamOptions` instead. **/ export interface HttpsCallableOptions { /** * Use for iOS, Android and web for https callable only. For streaming, this is for android and iOS only. * For web streaming, use `HttpsCallableStreamOptions` instead. * The timeout for the callable function or stream request. */ timeout?: number; /** * Use for iOS, Android and web for https callable only. For streaming, this is for android and iOS only. * For web streaming, use `HttpsCallableStreamOptions` instead. * If set to true, uses a limited-use App Check token for callable function or stream requests from this * instance of {@link Functions}. You must use limited-use tokens to call functions with * replay protection enabled. By default, this is false. */ limitedUseAppCheckTokens?: boolean; } /** * Use for web only, for iOS and Android specific options, use `HttpsCallableOptions`. **/ export interface HttpsCallableStreamOptions { /** * Web only. An `AbortSignal` that can be used to cancel the streaming response. When the signal is aborted, * the underlying HTTP connection will be terminated. `AbortSignal` is only available on React Native >= v0.82. */ signal?: AbortSignal; /** * Web only. If set to true, uses a limited-use App Check token for callable function requests from this * instance of {@link Functions}. You must use limited-use tokens to call functions with * replay protection enabled. By default, this is false. */ limitedUseAppCheckTokens?: boolean; } export interface HttpsCallableResult { readonly data: ResponseData; } export interface HttpsCallableStreamResult { readonly data: Promise; readonly stream: AsyncIterable; } export interface HttpsCallable { (data?: RequestData | null): Promise>; stream: (data?: RequestData | null, options?: HttpsCallableStreamOptions) => Promise>; } export type FunctionsErrorCode = 'ok' | 'cancelled' | 'unknown' | 'invalid-argument' | 'deadline-exceeded' | 'not-found' | 'already-exists' | 'permission-denied' | 'resource-exhausted' | 'failed-precondition' | 'aborted' | 'out-of-range' | 'unimplemented' | 'internal' | 'unavailable' | 'data-loss' | 'unauthenticated' | 'unsupported-type' | 'failed-to-parse-wrapped-number'; export interface HttpsErrorCode { OK: 'ok'; CANCELLED: 'cancelled'; UNKNOWN: 'unknown'; INVALID_ARGUMENT: 'invalid-argument'; DEADLINE_EXCEEDED: 'deadline-exceeded'; NOT_FOUND: 'not-found'; ALREADY_EXISTS: 'already-exists'; PERMISSION_DENIED: 'permission-denied'; UNAUTHENTICATED: 'unauthenticated'; RESOURCE_EXHAUSTED: 'resource-exhausted'; FAILED_PRECONDITION: 'failed-precondition'; ABORTED: 'aborted'; OUT_OF_RANGE: 'out-of-range'; UNIMPLEMENTED: 'unimplemented'; INTERNAL: 'internal'; UNAVAILABLE: 'unavailable'; DATA_LOSS: 'data-loss'; UNSUPPORTED_TYPE: 'unsupported-type'; FAILED_TO_PARSE_WRAPPED_NUMBER: 'failed-to-parse-wrapped-number'; } export interface HttpsError extends Error { readonly code: FunctionsErrorCode; readonly details?: unknown; } /** * Functions module instance - returned from firebase.functions() or firebase.app().functions() */ export interface Functions extends ReactNativeFirebase.FirebaseModule { /** The FirebaseApp this module is associated with */ app: ReactNativeFirebase.FirebaseApp; /** * Returns a reference to the callable HTTPS trigger with the given name. * * @param name The name of the trigger. * @param options Optional settings for the callable function. */ httpsCallable(name: string, options?: HttpsCallableOptions): HttpsCallable; /** * Returns a reference to the callable HTTPS trigger with the given URL. * * @param url The URL of the trigger. * @param options Optional settings for the callable function. */ httpsCallableFromUrl(url: string, options?: HttpsCallableOptions): HttpsCallable; /** * Changes this instance to point to a Cloud Functions emulator running locally. * * @deprecated Use useEmulator(host, port) instead. * @param origin The origin of the local emulator, e.g. "http://localhost:5001". */ useFunctionsEmulator(origin: string): void; /** * Changes this instance to point to a Cloud Functions emulator running locally. * * @param host The host of the emulator, e.g. "localhost" or "10.0.2.2" for Android. * @param port The port of the emulator, e.g. 5001. */ useEmulator(host: string, port: number): void; } /** * Static properties available on firebase.functions */ export interface FunctionsStatics { HttpsErrorCode: HttpsErrorCode; } /** * FirebaseApp type with functions() method. * @deprecated Import FirebaseApp from '@react-native-firebase/app' instead. * The functions() method is added via module augmentation. */ export type FirebaseApp = ReactNativeFirebase.FirebaseApp; declare module '@react-native-firebase/app' { namespace ReactNativeFirebase { interface Module { functions: FirebaseModuleWithStaticsAndApp; } interface FirebaseApp { functions(regionOrCustomDomain?: string): Functions; } } } type _HttpsCallableResult = HttpsCallableResult; type _HttpsCallableStreamResult = HttpsCallableStreamResult; type _HttpsCallable = HttpsCallable; type _HttpsCallableOptions = HttpsCallableOptions; type _HttpsCallableStreamOptions = HttpsCallableStreamOptions; type _HttpsError = HttpsError; type _HttpsErrorCode = HttpsErrorCode; /** * @deprecated Use the exported types directly instead. * FirebaseFunctionsTypes namespace is kept for backwards compatibility. */ export declare namespace FirebaseFunctionsTypes { type ErrorCode = FunctionsErrorCode; type CallableResult = HttpsCallableResult; type CallableStreamResult = HttpsCallableStreamResult; type Callable = HttpsCallable; type CallableOptions = HttpsCallableOptions; type CallableStreamOptions = HttpsCallableStreamOptions; type Error = HttpsError; type ErrorCodeMap = HttpsErrorCode; type Statics = FunctionsStatics; type Module = Functions; type HttpsCallableResult = _HttpsCallableResult; type HttpsCallableStreamResult = _HttpsCallableStreamResult; type HttpsCallable = _HttpsCallable; type HttpsCallableOptions = _HttpsCallableOptions; type HttpsCallableStreamOptions = _HttpsCallableStreamOptions; type HttpsError = _HttpsError; type HttpsErrorCode = _HttpsErrorCode; } export {}; //# sourceMappingURL=functions.d.ts.map