com.google.firebase.dataconnect

Interfaces

DataConnectOperationFailureResponse

The data and errors provided by the backend in the response message.

DataConnectOperationFailureResponse.ErrorInfo

Information about the error, as provided in the response payload from the backend.

DataConnectPathSegment

The "segment" of a path to a field in the response data.

FirebaseDataConnect

Firebase Data Connect is Firebase's first relational database solution for app developers to build mobile and web applications using a fully managed PostgreSQL database powered by Cloud SQL.

FirebaseDataConnect.MutationRefOptionsBuilder

Options that can be specified when creating a MutationRef via the mutation method.

FirebaseDataConnect.QueryRefOptionsBuilder

Options that can be specified when creating a QueryRef via the query method.

MutationRef

A specialization of OperationRef for mutation operations.

MutationResult

A specialization of OperationResult for MutationRef.

OperationRef

Information about a Firebase Data Connect "operation" (i.e. a query or mutation).

OperationResult

The result of a successful execution of an OperationRef.

OptionalVariable

An optional variable to a query or a mutation.

QueryRef

A specialization of OperationRef for query operations.

QueryResult

A specialization of OperationResult for QueryRef.

QuerySubscription

A facility to subscribe to a query to be notified of updates to the query's data when the query is executed.

QuerySubscriptionResult

The result of a query's execution, as notified to a QuerySubscription.

Classes

AnyValue

Represents a variable or field of the Data Connect custom scalar type Any.

ConnectorConfig

Information about a Firebase Data Connect "connector" that is used by FirebaseDataConnect to connect to the correct Google Cloud resources.

DataConnectPathSegment.Field

A named field in a path to a field in the response data.

DataConnectPathSegment.ListIndex

An index of a list in a path to a field in the response data.

DataConnectSettings

Settings that control the behavior of FirebaseDataConnect instances.

LocalDate

A date without a time-zone in the ISO-8601 calendar system, such as {@code 2007-12-03}.

OptionalVariable.Serializer

The KSerializer implementation for OptionalVariable.

OptionalVariable.Value

An implementation of OptionalVariable representing a "defined" value.

Exceptions

DataConnectException

The exception thrown when an error occurs in Firebase Data Connect.

DataConnectOperationException

The exception thrown when an error occurs in the execution of a Firebase Data Connect operation (that is, a query or mutation).

Objects

OptionalVariable.Undefined

An implementation of OptionalVariable representing an "undefined" value.

Annotations

ExperimentalFirebaseDataConnect

Marks declarations in the Firebase Data Connect SDK that are experimental.

Enums

FirebaseDataConnect.CallerSdkType

Indicates where the usages of this object are coming from.

LogLevel

The log levels supported by FirebaseDataConnect.

Extension functions summary

ConnectorConfig
ConnectorConfig.copy(
    connector: String,
    location: String,
    serviceId: String
)

Creates and returns a new ConnectorConfig instance with the given property values.

DataConnectSettings
DataConnectSettings.copy(host: String, sslEnabled: Boolean)

Creates and returns a new DataConnectSettings instance with the given property values.

LocalDate
LocalDate.copy(year: Int, month: Int, day: Int)

Creates and returns a new LocalDate instance with the given property values.

inline T
<T : Any?> AnyValue.decode()

Decodes the encapsulated value using the default serializer for the return type, as computed by serializer.

T
<T : Any?> AnyValue.decode(
    deserializer: DeserializationStrategy<T>,
    serializersModule: SerializersModule?
)

Decodes the encapsulated value using the given deserializer.

AnyValue
<T : Any?> AnyValue.Companion.encode(
    value: T,
    serializer: SerializationStrategy<T>,
    serializersModule: SerializersModule?
)

Encodes the given value using the given serializer to an AnyValue object, and returns it.

inline AnyValue
<T : Any?> AnyValue.Companion.encode(value: T)

Encodes the given value using the given default serializer for the given object, as computed by serializer.

AnyValue

Creates and returns an AnyValue object created using the AnyValue constructor that corresponds to the runtime type of the given value.

AnyValue?

Creates and returns an AnyValue object created using the AnyValue constructor that corresponds to the runtime type of the given value, or returns null if the given value is null.

FirebaseDataConnect

Returns the instance of FirebaseDataConnect associated with the given FirebaseApp and ConnectorConfig, creating the FirebaseDataConnect instance if necessary.

FirebaseDataConnect

Returns the instance of FirebaseDataConnect associated with the default FirebaseApp and the given ConnectorConfig, creating the FirebaseDataConnect instance if necessary.

LocalDate

Creates and returns a LocalDate object that represents the same date as this java.time.LocalDate object.

LocalDate

Creates and returns a LocalDate object that represents the same date as the given kotlinx.datetime.LocalDate object.

LocalDate

Creates and returns a java.time.LocalDate object that represents the same date as this object.

LocalDate

Creates and returns a kotlinx.datetime.LocalDate object that represents the same date as this object.

Extension properties summary

Extension functions

copy

fun ConnectorConfig.copy(
    connector: String = this.connector,
    location: String = this.location,
    serviceId: String = this.serviceId
): ConnectorConfig

Creates and returns a new ConnectorConfig instance with the given property values.

copy

fun DataConnectSettings.copy(
    host: String = this.host,
    sslEnabled: Boolean = this.sslEnabled
): DataConnectSettings

Creates and returns a new DataConnectSettings instance with the given property values.

copy

fun LocalDate.copy(year: Int = this.year, month: Int = this.month, day: Int = this.day): LocalDate

Creates and returns a new LocalDate instance with the given property values.

decode

inline fun <T : Any?> AnyValue.decode(): T

Decodes the encapsulated value using the default serializer for the return type, as computed by serializer.

Returns
T

the object of type T created by decoding the encapsulated value using the default serializer for the return type, as computed by serializer.

decode

fun <T : Any?> AnyValue.decode(
    deserializer: DeserializationStrategy<T>,
    serializersModule: SerializersModule? = null
): T

Decodes the encapsulated value using the given deserializer.

Parameters
deserializer: DeserializationStrategy<T>

The deserializer for the decoder to use.

serializersModule: SerializersModule? = null

a SerializersModule to use during deserialization; may be null (the default) to not use a SerializersModule to use during deserialization.

Returns
T

the object of type T created by decoding the encapsulated value using the given deserializer.

encode

fun <T : Any?> AnyValue.Companion.encode(
    value: T,
    serializer: SerializationStrategy<T>,
    serializersModule: SerializersModule? = null
): AnyValue

Encodes the given value using the given serializer to an AnyValue object, and returns it.

Parameters
value: T

the value to serialize.

serializer: SerializationStrategy<T>

the serializer for the encoder to use.

serializersModule: SerializersModule? = null

a SerializersModule to use during serialization; may be null (the default) to not use a SerializersModule to use during serialization.

Returns
AnyValue

a new AnyValue object whose encapsulated value is the encoding of the given value when decoded with the given serializer.

encode

inline fun <T : Any?> AnyValue.Companion.encode(value: T): AnyValue

Encodes the given value using the given default serializer for the given object, as computed by serializer.

Parameters
value: T

the value to serialize.

Returns
AnyValue

a new AnyValue object whose encapsulated value is the encoding of the given value when decoded with the default serializer for the given object, as computed by serializer.

fromAny

fun AnyValue.Companion.fromAny(value: Any): AnyValue

Creates and returns an AnyValue object created using the AnyValue constructor that corresponds to the runtime type of the given value.

Throws
kotlin.IllegalArgumentException: kotlin.IllegalArgumentException

if the given value is not supported by AnyValue; see the AnyValue constructor for details.

fromAny

fun AnyValue.Companion.fromAny(value: Any?): AnyValue?

Creates and returns an AnyValue object created using the AnyValue constructor that corresponds to the runtime type of the given value, or returns null if the given value is null.

Throws
kotlin.IllegalArgumentException: kotlin.IllegalArgumentException

if the given value is not supported by AnyValue; see the AnyValue constructor for details.

getInstance

fun FirebaseDataConnect.Companion.getInstance(
    app: FirebaseApp,
    config: ConnectorConfig,
    settings: DataConnectSettings = DataConnectSettings()
): FirebaseDataConnect

Returns the instance of FirebaseDataConnect associated with the given FirebaseApp and ConnectorConfig, creating the FirebaseDataConnect instance if necessary.

The instances of FirebaseDataConnect are keyed from the given FirebaseApp, using the identity comparison operator ===, and the given ConnectorConfig, using the equivalence operator ==. That is, the first invocation of this method with a given FirebaseApp and ConnectorConfig will create and return a new FirebaseDataConnect instance that is associated with those objects. A subsequent invocation with the same FirebaseApp object and an equal ConnectorConfig will return the same FirebaseDataConnect instance that was returned from the previous invocation.

If a new FirebaseDataConnect instance is created, it will use the given DataConnectSettings. If an existing instance will be returned, then the given (or default) DataConnectSettings must be equal to the FirebaseDataConnect.settings of the instance about to be returned; otherwise, an exception is thrown.

Parameters
app: FirebaseApp

The FirebaseApp instance with which the returned object is associated.

config: ConnectorConfig

The ConnectorConfig with which the returned object is associated.

settings: DataConnectSettings = DataConnectSettings()

The DataConnectSettings for the returned object to use.

Returns
FirebaseDataConnect

The FirebaseDataConnect instance associated with the given FirebaseApp and ConnectorConfig, using the given DataConnectSettings.

getInstance

fun FirebaseDataConnect.Companion.getInstance(
    config: ConnectorConfig,
    settings: DataConnectSettings = DataConnectSettings()
): FirebaseDataConnect

Returns the instance of FirebaseDataConnect associated with the default FirebaseApp and the given ConnectorConfig, creating the FirebaseDataConnect instance if necessary.

This method is a shorthand for calling FirebaseDataConnect.getInstance(Firebase.app, config) or FirebaseDataConnect.getInstance(Firebase.app, config, settings). See the documentation of that method for full details.

Parameters
config: ConnectorConfig

The ConnectorConfig with which the returned object is associated.

settings: DataConnectSettings = DataConnectSettings()

The DataConnectSettings for the returned object to use.

Returns
FirebaseDataConnect

The FirebaseDataConnect instance associated with the default FirebaseApp and the given ConnectorConfig, using the given DataConnectSettings.

toDataConnectLocalDate

fun LocalDate.toDataConnectLocalDate(): LocalDate

Creates and returns a LocalDate object that represents the same date as this java.time.LocalDate object. This is the inverse operation of LocalDate.toJavaLocalDate.

Be sure to only call this method if java.time.LocalDate is available. See the documentation for LocalDate.toJavaLocalDate for details.

toDataConnectLocalDate

fun LocalDate.toDataConnectLocalDate(): LocalDate

Creates and returns a LocalDate object that represents the same date as the given kotlinx.datetime.LocalDate object. This is the inverse operation of toKotlinxLocalDate.

Be sure to only call this method if your application has a dependency on org.jetbrains.kotlinx:kotlinx-datetime. See the documentation for toKotlinxLocalDate for details.

toJavaLocalDate

fun LocalDate.toJavaLocalDate(): LocalDate

Creates and returns a java.time.LocalDate object that represents the same date as this object.

Be sure to only call this method if java.time.LocalDate is available; otherwise the behavior is undefined. If your application's minSdkVersion is greater than or equal to 26, or if you have configured "desugaring" (https://developer.android.com/studio/write/java8-support-table) then it is guaranteed to be available. Otherwise, check android.os.Build.VERSION.SDK_INT at runtime and verify that its value is at least android.os.Build.VERSION_CODES.O before calling this method.

toKotlinxLocalDate

fun LocalDate.toKotlinxLocalDate(): LocalDate

Creates and returns a kotlinx.datetime.LocalDate object that represents the same date as this object.

Be sure to only call this method if your application has a dependency on org.jetbrains.kotlinx:kotlinx-datetime; otherwise, the behavior of this method is undefined. If your minSdkVersion is less than 26 then you may also need to configure "desugaring" (https://developer.android.com/studio/write/java8-support-table).

Extension properties

logLevel

val FirebaseDataConnect.Companion.logLevelMutableStateFlow<LogLevel>

The log level used by all FirebaseDataConnect instances.

As a MutableStateFlow, the log level can be changed by assigning MutableStateFlow.value. Also, the flow can be "collected" as a means of observing the log level, which may be useful in the case that a user interface shows a UI element, such as a checkbox, to represent whether debug logging is enabled.

The default log level is LogLevel.WARN. Setting this to LogLevel.DEBUG will enable debug logging, which is especially useful when reporting issues to Google or investigating problems yourself. Setting it to LogLevel.NONE will disable all logging.