ApolloResponse

class ApolloResponse<out D : Operation.Data>(requestUuid: Uuid, operation: Operation<*>, data: D?, errors: List<Error>?, extensions: Map<String, Any?>, executionContext: ExecutionContext)

Represents a GraphQL response. GraphQL responses can be be partial responses so it is valid to have both data != null and errors

Constructors

ApolloResponse
Link copied to clipboard
common
fun <out D : Operation.Data> ApolloResponse(requestUuid: Uuid, operation: Operation<*>, data: D?, errors: List<Error>? = null, extensions: Map<String, Any?> = emptyMap(), executionContext: ExecutionContext = ExecutionContext.Empty)

Functions

copy
Link copied to clipboard
common
fun copy(requestUuid: Uuid = this.requestUuid, operation: Operation<*> = this.operation, data: Any? = this.data, errors: List<Error>? = this.errors, extensions: Map<String, Any?> = this.extensions, executionContext: ExecutionContext = this.executionContext): ApolloResponse<D>
hasErrors
Link copied to clipboard
common
fun hasErrors(): Boolean
withExecutionContext
Link copied to clipboard
common
fun withExecutionContext(executionContext: ExecutionContext): ApolloResponse<D>

Properties

data
Link copied to clipboard
common
val data: D?
Parsed response of GraphQL operation execution.
dataAssertNoErrors
Link copied to clipboard
common
val dataAssertNoErrors: D
A shorthand property to get a non-nullable data if handling partial data is not importantNote: A future version could use Definitely non nullable types to implement something like ApolloResponse<D>.assertNoErrors(): ApolloResponse<D & Any>
dataOrThrow
Link copied to clipboard
common
val dataOrThrow: D
A shorthand property to get a non-nullable data if handling partial data is not important
errors
Link copied to clipboard
common
val errors: List<Error>? = null
GraphQL operation execution errors returned by the server to let client know that something has gone wrong.
executionContext
Link copied to clipboard
common
val executionContext: ExecutionContext
The context of GraphQL operation execution.
extensions
Link copied to clipboard
common
val extensions: Map<String, Any?>
Extensions of GraphQL protocol, arbitrary map of key String / value Any sent by server along with the response.
operation
Link copied to clipboard
common
val operation: Operation<*>
The GraphQL operation this response represents
requestUuid
Link copied to clipboard
common
val requestUuid: Uuid