Package com.apollographql.apollo3.api

Types

Adapter
Link copied to clipboard
common
interface Adapter<T>
An Adapter is responsible for adapting Kotlin-generated GraphQL types to/from their Json representation.
ApolloRequest
Link copied to clipboard
common
class ApolloRequest<D : Operation.Data> : ExecutionOptions
A GraphQL request to execute.
ApolloResponse
Link copied to clipboard
common
class ApolloResponse<D : Operation.Data>
Represents a GraphQL response.
BooleanExpression
Link copied to clipboard
common
sealed class BooleanExpression<out T : Any>
A boolean expression
BPossibleTypes
Link copied to clipboard
common
data class BPossibleTypes(possibleTypes: Set<String>) : BTerm
A term that comes from a fragment type condition and that needs to be matched against __typename
BTerm
Link copied to clipboard
common
sealed class BTerm
A generic term in a BooleanExpression
BVariable
Link copied to clipboard
common
data class BVariable(name: String) : BTerm
A term that comes from @include/@skip directives and that needs to be matched against operation variables
CompiledArgument
Link copied to clipboard
common
class CompiledArgument(name: String, value: Any?, isKey: Boolean)
The Kotlin representation of a GraphQL argumentvalue can beNote: for now, enums are mapped to Strings
CompiledCondition
Link copied to clipboard
common
data class CompiledCondition(name: String, inverted: Boolean)
CompiledField
Link copied to clipboard
common
class CompiledField : CompiledSelection
A compiled field from a GraphQL operation
CompiledFragment
Link copied to clipboard
common
class CompiledFragment : CompiledSelection
A compiled inline fragment or fragment spread
CompiledListType
Link copied to clipboard
common
class CompiledListType(ofType: CompiledType) : CompiledType
CompiledNamedType
Link copied to clipboard
common
sealed class CompiledNamedType : CompiledType
CompiledNotNullType
Link copied to clipboard
common
class CompiledNotNullType(ofType: CompiledType) : CompiledType
CompiledSelection
Link copied to clipboard
common
sealed class CompiledSelection
CompiledType
Link copied to clipboard
common
sealed class CompiledType
CompiledVariable
Link copied to clipboard
common
class CompiledVariable(name: String)
The Kotlin representation of a GraphQL variable value
CustomScalarAdapters
Link copied to clipboard
common
class CustomScalarAdapters : ExecutionContext.Element
A wrapper around a Map<String, Adapter> used to retrieve custom scalar adapters at runtime
CustomScalarType
Link copied to clipboard
common
class CustomScalarType(name: String, className: String) : CompiledNamedType
CustomTypeAdapter
Link copied to clipboard
common
interface CustomTypeAdapter<T>
A replica of Apollo Android v2's CustomTypeAdapter, to ease migration from v2 to v3.
CustomTypeValue
Link copied to clipboard
common
sealed class CustomTypeValue<T>
A replica of Apollo Android v2's CustomTypeValue, to ease migration from v2 to v3.
DefaultUpload
Link copied to clipboard
common
class DefaultUpload : Upload
An Upload that writes data from the provided contentIf the content is a bufferedSource, the DefaultUpload will close it once uploaded If the content is a byteString, the DefaultUpload can be reused
EnumType
Link copied to clipboard
common
class EnumType(name: String) : CompiledNamedType
Error
Link copied to clipboard
common
class Error(message: String, locations: List<Error.Location>?, path: List<Any>?, extensions: Map<String, Any?>?, nonStandardFields: Map<String, Any?>?)
Represents an error response returned from the GraphQL server See https://spec.graphql.org/draft/#sec-Errors.
Executable
Link copied to clipboard
common
interface Executable<D : Executable.Data>
Base interface for Operation and Fragment that have an Adapter and Variables.
ExecutionContext
Link copied to clipboard
common
interface ExecutionContext
A context of GraphQL operation execution, represented as a set of Key keys and corresponding Element values.
ExecutionOptions
Link copied to clipboard
common
interface ExecutionOptions
Fragment
Link copied to clipboard
common
interface Fragment<D : Fragment.Data> : Executable<D>
Base interface for a fragment implementation.
ImmutableMapBuilder
Link copied to clipboard
common
class ImmutableMapBuilder<K, V>
A helper class to make it easier to build Maps from the java codegen
Input
Link copied to clipboard
common
class Input
InputObjectType
Link copied to clipboard
common
class InputObjectType(name: String) : CompiledNamedType
InterfaceType
Link copied to clipboard
common
class InterfaceType(name: String, keyFields: List<String>, implements: List<InterfaceType>) : CompiledNamedType
ListAdapter
Link copied to clipboard
common
class ListAdapter<T>(wrappedAdapter: Adapter<T>) : Adapter<List<@JvmSuppressWildcards() T>>
This file contains a list of Adapter for standard typesThey are mostly used from the generated code but could be useful in any other situations that requires adapting from GraphQL to Kotlin.
MutableExecutionOptions
Link copied to clipboard
common
interface MutableExecutionOptions<T> : ExecutionOptions
Mutation
Link copied to clipboard
common
interface Mutation<D : Mutation.Data> : Operation<D>
Represents a GraphQL mutation operation that will be sent to the server.
NullableAdapter
Link copied to clipboard
common
class NullableAdapter<T : Any>(wrappedAdapter: Adapter<T>) : Adapter<@JvmSuppressWildcards() T?>
ObjectAdapter
Link copied to clipboard
common
class ObjectAdapter<T>(wrappedAdapter: Adapter<T>, buffered: Boolean) : Adapter<@JvmSuppressWildcards() T>
ObjectType
Link copied to clipboard
common
class ObjectType(name: String, keyFields: List<String>, implements: List<InterfaceType>) : CompiledNamedType
Operation
Link copied to clipboard
common
interface Operation<D : Operation.Data> : Executable<D>
Represents a GraphQL operation (mutation, query or subscription).
Optional
Link copied to clipboard
common
sealed class Optional<out V>
A sealed class that can either be Present or AbsentIt provides a convenient way to distinguish the case when a value is provided explicitly and should be serialized (even if it's null) and the case where it's absent and shouldn't be serialized.
OptionalAdapter
Link copied to clipboard
common
class OptionalAdapter<T>(wrappedAdapter: Adapter<T>) : Adapter<Optional.Present<@JvmSuppressWildcards() T>>
ResponseAdapters can only express something that's present.
Query
Link copied to clipboard
common
interface Query<D : Query.Data> : Operation<D>
Represents a GraphQL query that will be sent to the server.
QueryDocumentMinifier
Link copied to clipboard
common
object QueryDocumentMinifier
Response
Link copied to clipboard
common
typealias Response<D> = ApolloResponse<D>
ScalarType
Link copied to clipboard
common
class ScalarType(name: String) : CompiledNamedType
ScalarTypeAdapters
Link copied to clipboard
common
class ScalarTypeAdapters(customAdapters: Map<CustomScalarType, CustomTypeAdapter<*>>)
A replica of Apollo Android v2's ScalarTypeAdapters, to ease migration from v2 to v3.
Subscription
Link copied to clipboard
common
interface Subscription<D : Subscription.Data> : Operation<D>
Represents a GraphQL subscription.
UnionType
Link copied to clipboard
common
class UnionType(name: String, members: ObjectType) : CompiledNamedType
Upload
Link copied to clipboard
common
interface Upload
A class that represents a file upload in a multipart upload See https://github.

Functions

and
Link copied to clipboard
common
fun <T : Any> and(vararg other: BooleanExpression<T>): BooleanExpression<T>
fun <T : Any> BooleanExpression<T>.and(vararg other: BooleanExpression<T>): BooleanExpression<T>
checkFieldNotMissing
Link copied to clipboard
common
fun checkFieldNotMissing(value: Any?, name: String)
Helper function for the JavaCodegen
composeJsonRequest
Link copied to clipboard
common
fun <D : Operation.Data> Operation<D>.composeJsonRequest(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty)
Reads a GraphQL Json response like below to a ApolloResponse
{
"data": ...
"errors": ...
"extensions": ...
}
composeJsonResponse
Link copied to clipboard
common
fun <D : Operation.Data> Operation<D>.composeJsonResponse(jsonWriter: JsonWriter, data: D, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty)
writes a successful GraphQL Json response containing "data" to the given sink.
content
Link copied to clipboard
fun DefaultUpload.Builder.content(file: File): DefaultUpload.Builder
create
Link copied to clipboard
fun create(mimetype: String, filePath: String): Upload
evaluate
Link copied to clipboard
common
fun <T : Any> BooleanExpression<T>.evaluate(block: (T) -> Boolean): Boolean
fun BooleanExpression<BTerm>.evaluate(variables: Set<String>, typename: String): Boolean
isComposite
Link copied to clipboard
common
fun CompiledNamedType.isComposite(): Boolean
keyFields
Link copied to clipboard
common
fun CompiledNamedType.keyFields(): List<String>
list
Link copied to clipboard
common
@JvmName(name = -list)
fun <T> Adapter<T>.list(): ListAdapter<T>
@JvmName(name = -list)
fun CompiledType.list(): CompiledListType
not
Link copied to clipboard
common
fun <T : Any> not(other: BooleanExpression<T>): BooleanExpression<T>
notNull
Link copied to clipboard
common
@JvmName(name = -notNull)
fun CompiledType.notNull(): CompiledNotNullType
nullable
Link copied to clipboard
common
@JvmName(name = -nullable)
fun <T : Any> Adapter<T>.nullable(): NullableAdapter<T>
obj
Link copied to clipboard
common
@JvmName(name = -obj)
fun <T> Adapter<T>.obj(buffered: Boolean = false): ObjectAdapter<T>
optional
Link copied to clipboard
common
@JvmName(name = -optional)
fun <T> Adapter<T>.optional(): OptionalAdapter<T>
or
Link copied to clipboard
common
fun <T : Any> or(vararg other: BooleanExpression<T>): BooleanExpression<T>
fun <T : Any> BooleanExpression<T>.or(vararg other: BooleanExpression<T>): BooleanExpression<T>
parseJsonResponse
Link copied to clipboard
common
fun <D : Operation.Data> Operation<D>.parseJsonResponse(jsonReader: JsonReader, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty): ApolloResponse<D>
Reads a GraphQL Json response like below to a ApolloResponse
{
"data": ...
"errors": ...
"extensions": ...
}
possibleTypes
Link copied to clipboard
common
fun possibleTypes(vararg typenames: String): BooleanExpression<BPossibleTypes>
fun possibleTypes(allTypes: List<CompiledType>, type: CompiledNamedType): List<ObjectType>
resolveVariables
Link copied to clipboard
common
fun resolveVariables(value: Any?, variables: Executable.Variables): Any?
Resolve all variables that may be contained inside value
toInput
Link copied to clipboard
common
@JvmName(name = -toInputOrAbsent)
fun <T> T.toInput(): Optional<T>
@JvmName(name = -toInput)
fun <T : Any> T.toInput(): Optional<T>
toJsonString
Link copied to clipboard
common
@JvmName(name = -toJson)
fun <T> Adapter<T>.toJsonString(value: T, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, indent: String? = null): String
variable
Link copied to clipboard
common
fun variable(name: String): BooleanExpression<BVariable>
variables
Link copied to clipboard
common
fun <D : Executable.Data> Executable<D>.variables(customScalarAdapters: CustomScalarAdapters): Executable.Variables
variablesJson
Link copied to clipboard
common
fun <D : Executable.Data> Executable<D>.variablesJson(customScalarAdapters: CustomScalarAdapters): String

Properties

AnyAdapter
Link copied to clipboard
common
val AnyAdapter: Adapter<Any>
BooleanAdapter
Link copied to clipboard
common
val BooleanAdapter: Adapter<Boolean>
CompiledBooleanType
Link copied to clipboard
common
val CompiledBooleanType: ScalarType
CompiledDirectiveType
Link copied to clipboard
common
val CompiledDirectiveType: ObjectType
CompiledEnumValueType
Link copied to clipboard
common
val CompiledEnumValueType: ObjectType
CompiledFieldType
Link copied to clipboard
common
val CompiledFieldType: ObjectType
CompiledFloatType
Link copied to clipboard
common
val CompiledFloatType: ScalarType
CompiledIDType
Link copied to clipboard
common
val CompiledIDType: ScalarType
CompiledInputValueType
Link copied to clipboard
common
val CompiledInputValueType: ObjectType
CompiledIntType
Link copied to clipboard
common
val CompiledIntType: ScalarType
CompiledSchemaType
Link copied to clipboard
common
val CompiledSchemaType: ObjectType
CompiledStringType
Link copied to clipboard
common
val CompiledStringType: ScalarType
CompiledTypeType
Link copied to clipboard
common
val CompiledTypeType: ObjectType
DoubleAdapter
Link copied to clipboard
common
val DoubleAdapter: Adapter<Double>
FloatAdapter
Link copied to clipboard
common
val FloatAdapter: Adapter<Float>
An Adapter that converts to/from a Float Floats are not part of the GraphQL spec but this can be used in custom scalars
IntAdapter
Link copied to clipboard
common
val IntAdapter: Adapter<Int>
LongAdapter
Link copied to clipboard
common
val LongAdapter: Adapter<Long>
An Adapter that converts to/from a Long Longs are not part of the GraphQL spec but this can be used in custom scalarsIf the Json number does not fit in a Long, an exception will be thrown
NullableAnyAdapter
Link copied to clipboard
common
val NullableAnyAdapter: NullableAdapter<Any>
NullableBooleanAdapter
Link copied to clipboard
common
val NullableBooleanAdapter: NullableAdapter<Boolean>
NullableDoubleAdapter
Link copied to clipboard
common
val NullableDoubleAdapter: NullableAdapter<Double>
NullableIntAdapter
Link copied to clipboard
common
val NullableIntAdapter: NullableAdapter<Int>
NullableStringAdapter
Link copied to clipboard
common
val NullableStringAdapter: NullableAdapter<String>
Global instances of nullable adapters for built-in scalar types
StringAdapter
Link copied to clipboard
common
val StringAdapter: Adapter<String>
UploadAdapter
Link copied to clipboard
common
val UploadAdapter: Adapter<Upload>