Package-level declarations

Types

Link copied to clipboard
interface Adapter<T>

An Adapter is responsible for adapting scalars between their Json and Kotlin representations.

Link copied to clipboard
class AdapterToCompositeAdapter<T>(wrappedAdapter: Adapter<T>) : CompositeAdapter<T>
Link copied to clipboard

This adapter is used to handle nullable fields when they are represented as Optional. null is deserialized as Optional.Absent.

Link copied to clipboard

A GraphQL request to execute. Execution can be customized with executionContext

Link copied to clipboard

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

Link copied to clipboard
data class BLabel(val label: String?) : BTerm

A term that comes from @defer directives and that needs to be matched against label and current JSON path

Link copied to clipboard
sealed class BooleanExpression<out T : Any>

A boolean expression

Link copied to clipboard
data class BPossibleTypes(val possibleTypes: Set<String>) : BTerm

A term that comes from a fragment type condition and that needs to be matched against __typename

Link copied to clipboard
sealed class BTerm

A generic term in a BooleanExpression

Link copied to clipboard
interface BuilderFactory<out T>
Link copied to clipboard
class BuilderProperty<T>(val adapter: CompositeAdapter<T>)

A property delegate that stores the given property as it would be serialized in a Json This is needed in Data Builders because the serializer only work from Json

Link copied to clipboard
interface BuilderScope
Link copied to clipboard
data class BVariable(val name: String) : BTerm

A term that comes from @include/@skip or @defer directives and that needs to be matched against operation variables

Link copied to clipboard

The Kotlin representation of a GraphQL argument

Link copied to clipboard
data class CompiledCondition(val name: String, val inverted: Boolean)
Link copied to clipboard

A compiled field from a GraphQL operation

Link copied to clipboard

A compiled inline fragment or fragment spread

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
sealed class CompiledSelection
Link copied to clipboard
sealed class CompiledType
Link copied to clipboard
class CompiledVariable(val name: String)

The Kotlin representation of a GraphQL variable value

Link copied to clipboard
interface CompositeAdapter<T>

A CompositeAdapter is responsible for adapting Kotlin-generated GraphQL composite types to/from their Json representation.

Link copied to clipboard
Link copied to clipboard

A wrapper around a MapAdapter> used to retrieve custom scalar adapters at runtime

Link copied to clipboard
class CustomScalarType(val name: String, val className: String) : CompiledNamedType

A GraphQL scalar type that is mapped to a Kotlin. This is named "Custom" for historical reasons but is also used for builtin scalars

Link copied to clipboard

A FakeResolver that generates:

Link copied to clipboard

A default Upload that can upload from a wide variety of content

Link copied to clipboard
data class DeferredFragmentIdentifier(val path: List<Any>, val label: String?)
Link copied to clipboard
class EnumType(val name: String, val values: List<String>) : CompiledNamedType
Link copied to clipboard
class Error(val message: String, val locations: List<Error.Location>?, val path: List<Any>?, val extensions: Map<String, Any?>?, val nonStandardFields: Map<String, Any?>?)

Represents an error response returned from the GraphQL server See https://spec.graphql.org/draft/#sec-Errors.Error-result-format

Link copied to clipboard

Base interface for Operation and Fragment that have a CompositeAdapter and Variables.

Link copied to clipboard

A context of GraphQL operation execution, represented as a set of Key keys and corresponding Element values.

Link copied to clipboard
Link copied to clipboard
interface FakeResolver

Provides fakes values for Data builders

Link copied to clipboard
Link copied to clipboard

Base interface for a fragment implementation. Fragments do not have variables per the GraphQL spec but they are inferred from arguments and used when reading the cache See https://github.com/graphql/graphql-spec/issues/204 for a proposal to add fragment arguments

Link copied to clipboard

A helper class to make it easier to build Maps from the java codegen

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class ListAdapter<T>(wrappedAdapter: Adapter<T>) : Adapter<List<@JvmSuppressWildcards T>>

This file contains a list of Adapter for standard types

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Represents a GraphQL mutation operation that will be sent to the server.

Link copied to clipboard
class NullableAdapter<T : Any>(wrappedAdapter: Adapter<T>) : Adapter<@JvmSuppressWildcards T?>
Link copied to clipboard
abstract class ObjectBuilder<out T : Map<String, Any?>>(val customScalarAdapters: CustomScalarAdapters) : BuilderScope
Link copied to clipboard
Link copied to clipboard
abstract class ObjectMap(__fields: Map<String, Any?>) : Map<String, Any?>
Link copied to clipboard
Link copied to clipboard

Represents a GraphQL operation (mutation, query or subscription).

Link copied to clipboard
sealed class Optional<out V>

A sealed class that can either be Present or Absent

Link copied to clipboard
Link copied to clipboard

PresentAdapter can only express something that's present. Absent values are handled outside of the adapter.

Link copied to clipboard
interface Query<D : Query.Data> : Operation<D>

Represents a GraphQL query that will be sent to the server.

Link copied to clipboard

TODO v4: remove (see also CustomScalarType above

Link copied to clipboard

Represents a GraphQL subscription.

Link copied to clipboard
class UnionType(val name: String, val members: ObjectType) : CompiledNamedType
Link copied to clipboard
interface Upload

A class that represents a file upload in a multipart upload See https://github.com/jaydenseric/graphql-multipart-request-spec

Functions

Link copied to clipboard
fun <T> adaptValue(adapter: Adapter<T>, value: T): Any?
fun <T> adaptValue(adapter: CompositeAdapter<T>, value: T): Any?
Link copied to clipboard
fun <T : Any> and(vararg other: BooleanExpression<T>): BooleanExpression<T>
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
fun <T : Any> BooleanExpression<T>.and(vararg other: BooleanExpression<T>): BooleanExpression<T>
Link copied to clipboard
actual inline fun <T> Any.apolloUnsafeCast(): T
@ApolloExperimental
expect inline fun <T> Any.apolloUnsafeCast(): T

Uses unsafeCast on JS or a regular as unsafe cast on other platforms.

actual inline fun <T> Any.apolloUnsafeCast(): T
actual inline fun <T> Any.apolloUnsafeCast(): T
actual inline fun <T> Any.apolloUnsafeCast(): T
Link copied to clipboard
@JvmName(name = "-array")
inline fun <T> Adapter<T>.array(): Adapter<Array<T>>
@JvmName(name = "-array2")
inline fun <T> CompositeAdapter<T>.array(): CompositeAdapter<Array<T>>

Note that Arrays require their type to be known at compile time, so we construct an anonymous object with reference to function with reified type parameters as a workaround.

Link copied to clipboard
fun <T> buildData(adapter: CompositeAdapter<T>, selections: List<CompiledSelection>, typename: String, map: Map<String, Any?>, resolver: FakeResolver, customScalarAdapters: CustomScalarAdapters): T
fun <T, Builder : ObjectBuilder<*>> buildData(builderFactory: BuilderFactory<Builder>, block: Builder.() -> Unit, adapter: CompositeAdapter<T>, selections: List<CompiledSelection>, typename: String, resolver: FakeResolver, customScalarAdapters: CustomScalarAdapters): T
Link copied to clipboard
fun Builder(customScalarAdapters: CustomScalarAdapters): BuilderScope
Link copied to clipboard
fun checkFieldNotMissing(value: Any?, name: String)

Helper function for the JavaCodegen

Link copied to clipboard
fun <D : Executable.Data> Executable<D>.composeData(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: D)
Link copied to clipboard
fun <D : Operation.Data> Operation<D>.composeJsonRequest(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty)

Reads a GraphQL Json response like below to a ApolloResponse

Link copied to clipboard
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.

Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
fun <T : Any> BooleanExpression<T>.containsPossibleTypes(): Boolean
Link copied to clipboard
inline fun <T> Any.defaultApolloUnsafeCast(): T
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
fun <T : Any> BooleanExpression<T>.evaluate(block: (T) -> Boolean): Boolean
fun BooleanExpression<BTerm>.evaluate(variables: Set<String>, typename: String?, deferredFragmentIdentifiers: Set<DeferredFragmentIdentifier>?, path: List<Any>?): Boolean
Link copied to clipboard

Returns the Set of boolean variables that are false either explicitly or because there is a default value

Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
fun <T : Any, U : Any> BooleanExpression<T>.firstElementOfType(type: KClass<U>): U?
Link copied to clipboard
fun <T> CompositeAdapter<T>.fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun label(label: String? = null): BooleanExpression<BLabel>
Link copied to clipboard
@JvmName(name = "-list")
fun <T> Adapter<T>.list(): ListAdapter<T>
@JvmName(name = "-list")
fun CompiledType.list(): CompiledListType
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@JvmName(name = "-nullable")
fun <T : Any> Adapter<T>.nullable(): NullableAdapter<T>
Link copied to clipboard
@JvmName(name = "-obj")
fun <T> CompositeAdapter<T>.obj(buffered: Boolean = false): ObjectCompositeAdapter<T>
Link copied to clipboard
@JvmName(name = "-optional")
fun <T> Adapter<T>.optional(): PresentAdapter<T>
Link copied to clipboard
fun <T : Any> or(vararg other: BooleanExpression<T>): BooleanExpression<T>
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
fun <T : Any> BooleanExpression<T>.or(vararg other: BooleanExpression<T>): BooleanExpression<T>
Link copied to clipboard
fun <D : Executable.Data> Executable<D>.parseData(jsonReader: JsonReader, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, falseVariables: Set<String>? = null, deferredFragmentIds: Set<DeferredFragmentIdentifier>? = null): D?
Link copied to clipboard
@ApolloExperimental
fun <D : Operation.Data> Operation<D>.parseJsonResponse(json: String, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty): ApolloResponse<D>

fun <D : Operation.Data> Operation<D>.parseJsonResponse(jsonReader: JsonReader, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, deferredFragmentIdentifiers: Set<DeferredFragmentIdentifier>? = null): ApolloResponse<D>

Reads a GraphQL Json response like below to a ApolloResponse

Link copied to clipboard

Returns all objects that implement type

Link copied to clipboard
@JvmName(name = "-present")
fun <T> Adapter<T>.present(): PresentAdapter<T>
Link copied to clipboard
fun resolveVariables(value: Any?, variables: Executable.Variables): Any?

Resolve all variables that may be contained inside value

Link copied to clipboard
actual fun Operation.Data.toJson(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters)
fun Operation.Data.toJson(customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty): String
expect fun Operation.Data.toJson(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty)
fun <T> CompositeAdapter<T>.toJson(writer: JsonWriter, customScalarAdapters: CustomScalarAdapters, value: T)
actual fun Operation.Data.toJson(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters)
actual fun Operation.Data.toJson(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters)
actual fun Operation.Data.toJson(jsonWriter: JsonWriter, customScalarAdapters: CustomScalarAdapters)
Link copied to clipboard
@JvmName(name = "-toJson")
fun <T> Adapter<T>.toJsonString(value: T, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, indent: String? = null): String
@JvmName(name = "-toJson")
fun <T> CompositeAdapter<T>.toJsonString(value: T, adapterContext: CompositeAdapterContext = CompositeAdapterContext.Builder().build(), indent: String? = null): String
@ApolloExperimental
fun Operation.Data.toJsonString(customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, indent: String? = null): String
Link copied to clipboard
fun Operation.Data.toResponseJson(customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty): String
Link copied to clipboard
fun Path.toUpload(contentType: String, fileSystem: FileSystem = systemFileSystem): Upload
fun File.toUpload(contentType: String): DefaultUpload
Link copied to clipboard
Link copied to clipboard

Returns a map of the variables as they would be sent over the wire. Use this to construct your own HTTP requests

fun <D : Executable.Data> Executable<D>.variables(customScalarAdapters: CustomScalarAdapters, withBooleanDefaultValues: Boolean): Executable.Variables
Link copied to clipboard

Returns the variables as they would be sent over the wire. Use this to construct your own HTTP requests

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
val CompiledDirectiveType: ObjectType
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
val CompiledEnumValueType: ObjectType
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
val CompiledFieldType: ObjectType
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
val CompiledInputValueType: ObjectType
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
val CompiledSchemaType: ObjectType
Link copied to clipboard
@ApolloDeprecatedSince(version = ApolloDeprecatedSince.Version.v4_0_0)
val CompiledTypeType: ObjectType
Link copied to clipboard
Link copied to clipboard

An Adapter that converts to/from a Float Floats are not part of the GraphQL spec but this can be used in custom scalars

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

An Adapter that converts to/from a Long Longs are not part of the GraphQL spec but this can be used in custom scalars

Link copied to clipboard
Link copied to clipboard