/* * Copyright (c) 2016-present Invertase Limited & Contributors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this library except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ import type { FirebasePerformance, HttpMetric, HttpMethod, PerformanceTrace, ScreenTrace, } from './perf'; export type PerfModularDeprecationArg = string; /** * Namespaced perf instance used by modular entrypoints; methods accept an optional modular deprecation token. */ export interface PerfInternal extends FirebasePerformance { /** * @deprecated Prefer assigning {@link FirebasePerformance.dataCollectionEnabled}. */ setPerformanceCollectionEnabled(enabled: boolean): Promise; newTrace(name: string, deprecationArg?: PerfModularDeprecationArg): PerformanceTrace; startTrace(name: string, deprecationArg?: PerfModularDeprecationArg): Promise; newScreenTrace(screenName: string, deprecationArg?: PerfModularDeprecationArg): ScreenTrace; startScreenTrace( screenName: string, deprecationArg?: PerfModularDeprecationArg, ): Promise; newHttpMetric( url: string, httpMethod: HttpMethod, deprecationArg?: PerfModularDeprecationArg, ): HttpMetric; } export interface RNFBPerfTraceData { metrics: Record; attributes: Record; } export interface RNFBPerfHttpMetricData { attributes: Record; httpResponseCode?: number; requestPayloadSize?: number; responsePayloadSize?: number; responseContentType?: string; } export interface RNFBPerfNativeModule { isPerformanceCollectionEnabled: boolean; isInstrumentationEnabled: boolean; setPerformanceCollectionEnabled(enabled: boolean): Promise; instrumentationEnabled(enabled: boolean): Promise; startTrace(id: number, identifier: string): Promise; stopTrace(id: number, traceData: RNFBPerfTraceData): Promise; startHttpMetric(id: number, url: string, httpMethod: HttpMethod): Promise; stopHttpMetric(id: number, metricData: RNFBPerfHttpMetricData): Promise; startScreenTrace(id: number, identifier: string): Promise; stopScreenTrace(id: number): Promise; } declare module '@react-native-firebase/app/dist/module/internal/NativeModules' { interface ReactNativeFirebaseNativeModules { RNFBPerfModule: RNFBPerfNativeModule; } }