All Downloads are FREE. Search and download functionalities are using the official Maven repository.

graphql.nadel.enginekt.transform.result.NadelResultInstruction.kt Maven / Gradle / Ivy

Go to download

Nadel is a Java library that combines multiple GrahpQL services together into one API.

The newest version!
package graphql.nadel.enginekt.transform.result

import graphql.GraphQLError
import graphql.nadel.enginekt.transform.result.json.JsonNodePath

sealed class NadelResultInstruction {
    data class Set(
        override val subjectPath: JsonNodePath,
        val newValue: Any?,
    ) : NadelResultInstruction(), NadelResultInstructionWithSubject

    data class Remove(
        override val subjectPath: JsonNodePath,
    ) : NadelResultInstruction(), NadelResultInstructionWithSubject

    data class Copy(
        override val subjectPath: JsonNodePath,
        val destinationPath: JsonNodePath,
    ) : NadelResultInstruction(), NadelResultInstructionWithSubject {
        val destinationKey: String
            get() = destinationPath.segments.last().value as String
    }

    data class AddError(
        val error: GraphQLError,
    ) : NadelResultInstruction()
}

interface NadelResultInstructionWithSubject {
    val subjectPath: JsonNodePath

    val subjectKey: String
        get() = subjectPath.segments.last().value as String
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy