Adapter

interface Adapter<T>

An Adapter is responsible for adapting Kotlin-generated GraphQL types to/from their Json representation.

It is used to

  • deserialize network responses

  • serialize variables

  • normalize models into records that can be stored in cache

  • deserialize records

Note: Adapters are called from multiple threads and implementations must be thread safe.

Functions

Link copied to clipboard
abstract fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters): T

Deserializes the given Json to the expected Kotlin type.

Link copied to clipboard
abstract fun toJson(    writer: JsonWriter,     customScalarAdapters: CustomScalarAdapters,     value: T)

Serializes a Kotlin type into its equivalent Json representation.

Inheritors

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

Extensions

Link copied to clipboard
@JvmName(name = "-list")
fun <T> Adapter<T>.list(): ListAdapter<T>
Link copied to clipboard
@JvmName(name = "-nullable")
fun <T : Any> Adapter<T>.nullable(): NullableAdapter<T>
Link copied to clipboard
@JvmName(name = "-obj")
fun <T> Adapter<T>.obj(buffered: Boolean = false): ObjectAdapter<T>
Link copied to clipboard
@JvmName(name = "-optional")
fun <T> Adapter<T>.optional(): PresentAdapter<T>
Link copied to clipboard
@JvmName(name = "-present")
fun <T> Adapter<T>.present(): PresentAdapter<T>
Link copied to clipboard
@JvmName(name = "-toJson")
fun <T> Adapter<T>.toJsonString(    value: T,     customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty,     indent: String? = null): String