QueryRef

interfaceQueryRef<Data : Any?, Variables : Any?> :OperationRef


A specialization ofOperationRef forquery operations.

Safe for concurrent use

All methods and properties ofQueryRef are thread-safe and may be safely called and/or accessed concurrently from multiple threads and/or coroutines.

Not stable for inheritance

TheQueryRef interface isnot stable for inheritance in third-party libraries, as new methods might be added to this interface or contracts of the existing methods can be changed.

Summary

Public functions

QueryRef<Data, Variables>
@ExperimentalFirebaseDataConnect
copy(
    operationName: String,
    variables: Variables,
    dataDeserializer: DeserializationStrategy<Data>,
    variablesSerializer: SerializationStrategy<Variables>,
    callerSdkType: FirebaseDataConnect.CallerSdkType,
    dataSerializersModule: SerializersModule?,
    variablesSerializersModule: SerializersModule?
)

Creates and returns a new object that is acopy of this object, but with the properties whose names corresponding to the given arguments changed to the respective argument's value.

suspendQueryResult<Data, Variables>

Executes this operation and returns the result.

QuerySubscription<Data, Variables>

Subscribes to a query to be notified of updates to the query's data when the query is executed.

QueryRef<NewData, Variables>
@ExperimentalFirebaseDataConnect
<NewData : Any?>withDataDeserializer(
    dataDeserializer: DeserializationStrategy<NewData>,
    dataSerializersModule: SerializersModule?
)

Creates and returns a new object that is acopy of this object, just likecopy, except that thedataDeserializer can be a different type thanData.

QueryRef<Data, NewVariables>
@ExperimentalFirebaseDataConnect
<NewVariables : Any?>withVariablesSerializer(
    variables: NewVariables,
    variablesSerializer: SerializationStrategy<NewVariables>,
    variablesSerializersModule: SerializersModule?
)

Creates and returns a new object that is acopy of this object, just likecopy, except that thevariables andvariablesSerializer can be a different type thanVariables.

Inherited functions

Fromcom.google.firebase.dataconnect.OperationRef
operatorBoolean
equals(other: Any?)

Compares this object with another object for equality.

Int

Calculates and returns the hash code for this object.

String

Returns a string representation of this object, useful for debugging.

Inherited properties

Fromcom.google.firebase.dataconnect.OperationRef
FirebaseDataConnect.CallerSdkType

TheFirebaseDataConnect.CallerSdkType that will be associated with all operations performed by this object for analytics purposes.

FirebaseDataConnect

TheFirebaseDataConnect with which this object is associated.

DeserializationStrategy<Data>

The deserializer to use to deserialize the response data for this operation.

SerializersModule?

ASerializersModule to use when decoding the response data usingdataDeserializer.

String

The name of the operation, as defined in GraphQL.

Variables

The variables for the operation.

SerializationStrategy<Variables>

The serializer to use to serialize the variables for this operation.

SerializersModule?

ASerializersModule to use when encoding the variables usingvariablesSerializer.

Public functions

copy

@ExperimentalFirebaseDataConnect
fun copy(
    operationName: String,
    variables: Variables,
    dataDeserializer: DeserializationStrategy<Data>,
    variablesSerializer: SerializationStrategy<Variables>,
    callerSdkType: FirebaseDataConnect.CallerSdkType,
    dataSerializersModule: SerializersModule?,
    variablesSerializersModule: SerializersModule?
): QueryRef<Data, Variables>

Creates and returns a new object that is acopy of this object, but with the properties whose names corresponding to the given arguments changed to the respective argument's value.

This function is essentially the same as thecopy() method that is generated by the Kotlin compiler fordata class classes.

execute

suspend fun execute(): QueryResult<Data, Variables>

Executes this operation and returns the result.

An exception is thrown if the operation fails for any reason, including

  • TheFirebaseDataConnect object has been closed.

  • The Firebase Data Connect server is unreachable.

  • Authentication with the Firebase Data Connect server fails.

  • The variables are rejected by the Firebase Data Connect server.

  • The data response sent by the Firebase Data Connect server cannot be deserialized.

subscribe

fun subscribe(): QuerySubscription<Data, Variables>

Subscribes to a query to be notified of updates to the query's data when the query is executed.

At this time the notifications arenot realtime, and arenot pushed from the server. Instead, the notifications are sent whenever the query is explicitly executed by callingQueryRef.execute.

Returns
QuerySubscription<Data, Variables>

an object that can be used to subscribe to query results.

withDataDeserializer

@ExperimentalFirebaseDataConnect
fun <NewData : Any?>withDataDeserializer(
    dataDeserializer: DeserializationStrategy<NewData>,
    dataSerializersModule: SerializersModule?
): QueryRef<NewData, Variables>

Creates and returns a new object that is acopy of this object, just likecopy, except that thedataDeserializer can be a different type thanData.

withVariablesSerializer

@ExperimentalFirebaseDataConnect
fun <NewVariables : Any?>withVariablesSerializer(
    variables: NewVariables,
    variablesSerializer: SerializationStrategy<NewVariables>,
    variablesSerializersModule: SerializersModule?
): QueryRef<Data, NewVariables>

Creates and returns a new object that is acopy of this object, just likecopy, except that thevariables andvariablesSerializer can be a different type thanVariables.

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-09 UTC.