com.lahzouz.apollo.graphql.client.adapter.GetAuthorsQuery_ResponseAdapter.kt Maven / Gradle / Ivy
//
// AUTO-GENERATED FILE. DO NOT MODIFY.
//
// This class was automatically generated by Apollo GraphQL version '3.0.0'.
//
package com.lahzouz.apollo.graphql.client.adapter
import com.apollographql.apollo3.api.Adapter
import com.apollographql.apollo3.api.CustomScalarAdapters
import com.apollographql.apollo3.api.StringAdapter
import com.apollographql.apollo3.api.json.JsonReader
import com.apollographql.apollo3.api.json.JsonWriter
import com.apollographql.apollo3.api.list
import com.apollographql.apollo3.api.obj
import com.lahzouz.apollo.graphql.client.GetAuthorsQuery
import kotlin.String
import kotlin.Unit
import kotlin.collections.List
public object GetAuthorsQuery_ResponseAdapter {
public object Data : Adapter {
public val RESPONSE_NAMES: List = listOf("authors")
public override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters):
GetAuthorsQuery.Data {
var authors: List? = null
while(true) {
when (reader.selectName(RESPONSE_NAMES)) {
0 -> authors = Author.obj().list().fromJson(reader, customScalarAdapters)
else -> break
}
}
return GetAuthorsQuery.Data(
authors = authors!!
)
}
public override fun toJson(
writer: JsonWriter,
customScalarAdapters: CustomScalarAdapters,
`value`: GetAuthorsQuery.Data
): Unit {
writer.name("authors")
Author.obj().list().toJson(writer, customScalarAdapters, value.authors)
}
}
public object Author : Adapter {
public val RESPONSE_NAMES: List = listOf("name")
public override fun fromJson(reader: JsonReader, customScalarAdapters: CustomScalarAdapters):
GetAuthorsQuery.Author {
var name: String? = null
while(true) {
when (reader.selectName(RESPONSE_NAMES)) {
0 -> name = StringAdapter.fromJson(reader, customScalarAdapters)
else -> break
}
}
return GetAuthorsQuery.Author(
name = name!!
)
}
public override fun toJson(
writer: JsonWriter,
customScalarAdapters: CustomScalarAdapters,
`value`: GetAuthorsQuery.Author
): Unit {
writer.name("name")
StringAdapter.toJson(writer, customScalarAdapters, value.name)
}
}
}