trait GraphQLInterpreter[-R, +E] extends AnyRef
A GraphQLInterpreter[-R, +E]
represents a GraphQL interpreter whose execution requires
a ZIO environment of type R
and can fail with an E
.
It is a wrapper around a GraphQL
API definition that allows adding some middleware around
query execution, and possibly transform the environment or the error type.
- Self Type
- GraphQLInterpreter[R, E]
- Alphabetic
- By Inheritance
- GraphQLInterpreter
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
check(query: String): IO[CalibanError, Unit]
Parses and validates the provided query against this API.
Parses and validates the provided query against this API.
- query
a string containing the GraphQL query.
- returns
an effect that either fails with a CalibanError or succeeds with
Unit
-
abstract
def
executeRequest(request: GraphQLRequest, skipValidation: Boolean = false, enableIntrospection: Boolean = true): URIO[R, GraphQLResponse[E]]
Parses, validates and finally runs the provided request against this interpreter.
Parses, validates and finally runs the provided request against this interpreter.
- request
a GraphQL request
- skipValidation
skips the validation step if true
- enableIntrospection
returns an error for introspection queries when false
- returns
an effect that either fails with an
E
or succeeds with a ResponseValue
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
execute(query: String, operationName: Option[String] = None, variables: Map[String, InputValue] = Map(), extensions: Map[String, InputValue] = Map(), skipValidation: Boolean = false, enableIntrospection: Boolean = true): URIO[R, GraphQLResponse[E]]
Parses, validates and finally runs the provided query against this interpreter.
Parses, validates and finally runs the provided query against this interpreter.
- query
a string containing the GraphQL query
- operationName
the operation to run in case the query contains multiple operations
- variables
a map of variables
- extensions
a map of extensions
- skipValidation
skips the validation step if true
- enableIntrospection
returns an error for introspection queries when false
- returns
an effect that either fails with an
E
or succeeds with a ResponseValue
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
mapError[E2](f: (E) ⇒ E2): GraphQLInterpreter[R, E2]
Changes the error channel of the
execute
method.Changes the error channel of the
execute
method. This can be used to customize error messages.- f
a function from the current error type
E
to another typeE2
- returns
a new GraphQL interpreter with error type
E2
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
provide(r: R)(implicit ev: NeedsEnv[R]): GraphQLInterpreter[Any, E]
Provides the interpreter with its required environment, which eliminates its dependency on
R
. -
final
def
provideCustomLayer[E1 >: E, R1 <: Has[_]](layer: ZLayer[zio.ZEnv, E1, R1])(implicit ev: <:<[zio.ZEnv with R1, R], tagged: zio.Tag[R1]): GraphQLInterpreter[zio.ZEnv, E1]
Provides the part of the environment that is not part of the
ZEnv
, leaving a query that only depends on theZEnv
. -
final
def
provideLayer[E1 >: E, R0, R1 <: Has[_]](layer: ZLayer[R0, E1, R1])(implicit ev1: <:<[R1, R], ev2: NeedsEnv[R]): GraphQLInterpreter[R0, E1]
Provides a layer to this interpreter, which translates it to another level.
-
final
def
provideSomeLayer[R0 <: Has[_]]: ProvideSomeLayer[R0, R, E]
Splits the environment into two parts, providing one part using the specified layer and leaving the remainder
R0
. -
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
final
def
wrapExecutionWith[R2, E2](f: (URIO[R, GraphQLResponse[E]]) ⇒ URIO[R2, GraphQLResponse[E2]]): GraphQLInterpreter[R2, E2]
Wraps the
execute
method of the interpreter with the given function.Wraps the
execute
method of the interpreter with the given function. This can be used to customize errors, add global timeouts or logging functions.- f
a function from
URIO[R, GraphQLResponse[E]]
toURIO[R2, GraphQLResponse[E2]]
- returns
a new GraphQL interpreter