Created
January 19, 2021 05:11
-
-
Save hsmnzaydn/140d249e89ab3f17425ad5e05b3afdad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// AUTO-GENERATED FILE. DO NOT MODIFY. | |
// | |
// This class was automatically generated by Apollo GraphQL plugin from the GraphQL queries it found. | |
// It should not be modified by hand. | |
// | |
package com.example.rocketreserver | |
import com.apollographql.apollo.api.Input | |
import com.apollographql.apollo.api.Mutation | |
import com.apollographql.apollo.api.Operation | |
import com.apollographql.apollo.api.OperationName | |
import com.apollographql.apollo.api.Response | |
import com.apollographql.apollo.api.ResponseField | |
import com.apollographql.apollo.api.ScalarTypeAdapters | |
import com.apollographql.apollo.api.ScalarTypeAdapters.Companion.DEFAULT | |
import com.apollographql.apollo.api.internal.InputFieldMarshaller | |
import com.apollographql.apollo.api.internal.OperationRequestBodyComposer | |
import com.apollographql.apollo.api.internal.QueryDocumentMinifier | |
import com.apollographql.apollo.api.internal.ResponseFieldMapper | |
import com.apollographql.apollo.api.internal.ResponseFieldMarshaller | |
import com.apollographql.apollo.api.internal.ResponseReader | |
import com.apollographql.apollo.api.internal.SimpleOperationResponseParser | |
import com.apollographql.apollo.api.internal.Throws | |
import kotlin.Any | |
import kotlin.Array | |
import kotlin.Boolean | |
import kotlin.String | |
import kotlin.Suppress | |
import kotlin.collections.Map | |
import kotlin.jvm.Transient | |
import okio.Buffer | |
import okio.BufferedSource | |
import okio.ByteString | |
import okio.IOException | |
@Suppress("NAME_SHADOWING", "UNUSED_ANONYMOUS_PARAMETER", "LocalVariableName", | |
"RemoveExplicitTypeArguments", "NestedLambdaShadowedImplicitParameter") | |
data class LoginMutation( | |
val email: Input<String> = Input.absent() | |
) : Mutation<LoginMutation.Data, LoginMutation.Data, Operation.Variables> { | |
@Transient | |
private val variables: Operation.Variables = object : Operation.Variables() { | |
override fun valueMap(): Map<String, Any?> = mutableMapOf<String, Any?>().apply { | |
if (this@LoginMutation.email.defined) { | |
this["email"] = this@LoginMutation.email.value | |
} | |
} | |
override fun marshaller(): InputFieldMarshaller = InputFieldMarshaller.invoke { writer -> | |
if (this@LoginMutation.email.defined) { | |
writer.writeString("email", this@LoginMutation.email.value) | |
} | |
} | |
} | |
override fun operationId(): String = OPERATION_ID | |
override fun queryDocument(): String = QUERY_DOCUMENT | |
override fun wrapData(data: Data?): Data? = data | |
override fun variables(): Operation.Variables = variables | |
override fun name(): OperationName = OPERATION_NAME | |
override fun responseFieldMapper(): ResponseFieldMapper<Data> = ResponseFieldMapper.invoke { | |
Data(it) | |
} | |
@Throws(IOException::class) | |
override fun parse(source: BufferedSource, scalarTypeAdapters: ScalarTypeAdapters): Response<Data> | |
= SimpleOperationResponseParser.parse(source, this, scalarTypeAdapters) | |
@Throws(IOException::class) | |
override fun parse(byteString: ByteString, scalarTypeAdapters: ScalarTypeAdapters): Response<Data> | |
= parse(Buffer().write(byteString), scalarTypeAdapters) | |
@Throws(IOException::class) | |
override fun parse(source: BufferedSource): Response<Data> = parse(source, DEFAULT) | |
@Throws(IOException::class) | |
override fun parse(byteString: ByteString): Response<Data> = parse(byteString, DEFAULT) | |
override fun composeRequestBody(scalarTypeAdapters: ScalarTypeAdapters): ByteString = | |
OperationRequestBodyComposer.compose( | |
operation = this, | |
autoPersistQueries = false, | |
withQueryDocument = true, | |
scalarTypeAdapters = scalarTypeAdapters | |
) | |
override fun composeRequestBody(): ByteString = OperationRequestBodyComposer.compose( | |
operation = this, | |
autoPersistQueries = false, | |
withQueryDocument = true, | |
scalarTypeAdapters = DEFAULT | |
) | |
override fun composeRequestBody( | |
autoPersistQueries: Boolean, | |
withQueryDocument: Boolean, | |
scalarTypeAdapters: ScalarTypeAdapters | |
): ByteString = OperationRequestBodyComposer.compose( | |
operation = this, | |
autoPersistQueries = autoPersistQueries, | |
withQueryDocument = withQueryDocument, | |
scalarTypeAdapters = scalarTypeAdapters | |
) | |
/** | |
* Data from the response after executing this GraphQL operation | |
*/ | |
data class Data( | |
val login: String? | |
) : Operation.Data { | |
override fun marshaller(): ResponseFieldMarshaller = ResponseFieldMarshaller.invoke { writer -> | |
writer.writeString(RESPONSE_FIELDS[0], this@Data.login) | |
} | |
companion object { | |
private val RESPONSE_FIELDS: Array<ResponseField> = arrayOf( | |
ResponseField.forString("login", "login", mapOf<String, Any>( | |
"email" to mapOf<String, Any>( | |
"kind" to "Variable", | |
"variableName" to "email")), true, null) | |
) | |
operator fun invoke(reader: ResponseReader): Data = reader.run { | |
val login = readString(RESPONSE_FIELDS[0]) | |
Data( | |
login = login | |
) | |
} | |
@Suppress("FunctionName") | |
fun Mapper(): ResponseFieldMapper<Data> = ResponseFieldMapper { invoke(it) } | |
} | |
} | |
companion object { | |
const val OPERATION_ID: String = | |
"4f52585fce2252e26e0c51bdf1e1e6a699d92a946df3858c397a85af735806e9" | |
val QUERY_DOCUMENT: String = QueryDocumentMinifier.minify( | |
""" | |
|mutation Login(${'$'}email: String = "serkan.zaydn@gmail.com") { | |
| login(email: ${'$'}email) | |
|} | |
""".trimMargin() | |
) | |
val OPERATION_NAME: OperationName = object : OperationName { | |
override fun name(): String = "Login" | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment