FirebaseDataConnect

The entry point of Firebase Data Connect: creates QueryRefs and MutationRefs for the operations of the connector config of app. Obtained with FirebaseDataConnect.Companion.getInstance; one instance exists per app and connector until it is closed.

Every operation takes the value to send followed by the serialization strategies to encode it and decode the result with (the Android SDK's pattern, with no reflection-based fallback), and an optional trailing builder for the remaining options.

Types

Link copied to clipboard

Which SDK created a reference: user code (Base) or a generated connector SDK (Generated).

Link copied to clipboard
object Companion
Link copied to clipboard

The options of a MutationRef beyond the required ones, set in the trailing lambda of mutation.

Link copied to clipboard

The options of a QueryRef beyond the required ones, set in the trailing lambda of query.

Properties

Link copied to clipboard
abstract val app: FirebaseApp

The app this instance belongs to.

Link copied to clipboard
abstract val config: ConnectorConfig

The connector this instance executes the operations of.

Link copied to clipboard

The settings this instance was created with.

Functions

Link copied to clipboard
abstract override fun close()

Releases this instance; a later getInstance for the same app and connector creates a new one.

Link copied to clipboard
abstract operator override fun equals(other: Any?): Boolean
Link copied to clipboard
abstract override fun hashCode(): Int
Link copied to clipboard
abstract fun <Data, Variables> mutation(operationName: String, variables: Variables, dataDeserializer: DeserializationStrategy<Data>, variablesSerializer: SerializationStrategy<Variables>, optionsBuilder: FirebaseDataConnect.MutationRefOptionsBuilder<Data, Variables>.() -> Unit? = null): MutationRef<Data, Variables>

Creates a reference to the mutation operationName with the given variables.

Link copied to clipboard
inline fun <Data, Variables> FirebaseDataConnect.mutation(operationName: String, variables: Variables, noinline optionsBuilder: FirebaseDataConnect.MutationRefOptionsBuilder<Data, Variables>.() -> Unit? = null): MutationRef<Data, Variables>

FirebaseDataConnect.mutation with the serializers of Data and Variables looked up by the compiler.

Link copied to clipboard
abstract fun <Data, Variables> query(operationName: String, variables: Variables, dataDeserializer: DeserializationStrategy<Data>, variablesSerializer: SerializationStrategy<Variables>, optionsBuilder: FirebaseDataConnect.QueryRefOptionsBuilder<Data, Variables>.() -> Unit? = null): QueryRef<Data, Variables>

Creates a reference to the query operationName with the given variables.

Link copied to clipboard
inline fun <Data, Variables> FirebaseDataConnect.query(operationName: String, variables: Variables, noinline optionsBuilder: FirebaseDataConnect.QueryRefOptionsBuilder<Data, Variables>.() -> Unit? = null): QueryRef<Data, Variables>

FirebaseDataConnect.query with the serializers of Data and Variables looked up by the compiler.

Link copied to clipboard
abstract suspend fun suspendingClose()

close, waiting for the release to complete.

Link copied to clipboard
abstract override fun toString(): String
Link copied to clipboard
abstract fun useEmulator(host: String = "10.0.2.2", port: Int = 9399)

Connects to the Data Connect emulator instead of the production service; must be called before any operation is executed. The default host is the one the Android emulator reaches its host machine with; the other platforms' tests use localhost.