MutationRef

interface MutationRef<Data : Any?, Variables : Any?> : OperationRef


A specialization of OperationRef for mutation operations.

Safe for Concurrent Use

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

Not Stable for Inheritance

The MutationRef interface is not 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

MutationRef<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 a copy of this object, but with the properties whose names corresponding to the given arguments changed to the respective argument's value.

suspend MutationResult<Data, Variables>

Executes this operation and returns the result.

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

Creates and returns a new object that is a copy of this object, just like copy, except that the dataDeserializer can be a different type than Data.

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

Creates and returns a new object that is a copy of this object, just like copy, except that the variables and variablesSerializer can be a different type than Variables.

Inherited functions

From com.google.firebase.dataconnect.OperationRef
operator Boolean
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

From com.google.firebase.dataconnect.OperationRef
FirebaseDataConnect.CallerSdkType

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

FirebaseDataConnect

The FirebaseDataConnect with which this object is associated.

DeserializationStrategy<Data>

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

SerializersModule?

A SerializersModule to use when decoding the response data using dataDeserializer.

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?

A SerializersModule to use when encoding the variables using variablesSerializer.

Public functions

copy

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

Creates and returns a new object that is a copy 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 the copy() method that is generated by the Kotlin compiler for data class classes.

execute

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

Executes this operation and returns the result.

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

  • The FirebaseDataConnect 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.

withDataDeserializer

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

Creates and returns a new object that is a copy of this object, just like copy, except that the dataDeserializer can be a different type than Data.

withVariablesSerializer

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

Creates and returns a new object that is a copy of this object, just like copy, except that the variables and variablesSerializer can be a different type than Variables.