DynamicJsJsonReader

class DynamicJsJsonReader(val root: dynamic, pathRoot: Array<Any> = emptyArray()) : JsonReader

A JsonReader that reads data from a javascript dynamic

Map values should be any of:

  • String

  • Int

  • Double

  • Long

  • JsonNumber

  • null

  • dynamic where values are any of these values recursively

  • Array where values are any of these values recursively

Anything else is undefined

To read from a okio.BufferedSource, see also BufferedSourceJsonReader

Parameters

root

the root Map to read from

pathRoot

the path root to be prefixed to the returned path when calling getPath. Useful for buffer.

Constructors

Link copied to clipboard
constructor(root: dynamic, pathRoot: Array<Any> = emptyArray())

Properties

Link copied to clipboard
val root: dynamic

Functions

Link copied to clipboard
open override fun beginArray(): DynamicJsJsonReader
Link copied to clipboard
open override fun beginObject(): DynamicJsJsonReader
Link copied to clipboard

buffers the next Object. Has to be called in BEGIN_OBJECT position. The returned MapJsonReader can use MapJsonReader.rewind to read fields multiple times

Link copied to clipboard
open fun close()
Link copied to clipboard
open override fun endArray(): DynamicJsJsonReader
Link copied to clipboard
open override fun endObject(): DynamicJsJsonReader
Link copied to clipboard
open override fun getPath(): List<Any>
Link copied to clipboard
open override fun hasNext(): Boolean
Link copied to clipboard
open override fun nextBoolean(): Boolean
Link copied to clipboard
open override fun nextDouble(): Double
Link copied to clipboard
open override fun nextInt(): Int
Link copied to clipboard
open override fun nextLong(): Long
Link copied to clipboard
open override fun nextName(): String
Link copied to clipboard
open override fun nextNull(): Nothing?
Link copied to clipboard
open override fun nextNumber(): JsonNumber
Link copied to clipboard
open override fun nextString(): String
Link copied to clipboard
fun nextValue(): Any
Link copied to clipboard
fun <D : Operation.Data> JsonReader.parseResponse(operation: Operation<D>, requestUuid: Uuid? = null, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, deferredFragmentIdentifiers: Set<DeferredFragmentIdentifier>? = null): ApolloResponse<D>

Reads a ApolloResponse from this. The caller is responsible for closing this.

Link copied to clipboard
open override fun peek(): JsonReader.Token
Link copied to clipboard

Returns the Kotlin representation of the given JsonReader

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun rewind()

Rewinds to the beginning of the current object.

Link copied to clipboard
open override fun selectName(names: List<String>): Int
Link copied to clipboard
open override fun skipValue()
Link copied to clipboard
fun <D : Operation.Data> JsonReader.toApolloResponse(operation: Operation<D>, requestUuid: Uuid? = null, customScalarAdapters: CustomScalarAdapters = CustomScalarAdapters.Empty, deferredFragmentIdentifiers: Set<DeferredFragmentIdentifier>? = null): ApolloResponse<D>

Reads a single ApolloResponse from this. Returns an error response if this contains more than one JSON response or trailing tokens. toApolloResponse takes ownership and closes this.