File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import Data.Bifunctor (class Bifunctor)
77import Data.Maybe (Maybe )
88import Data.Newtype (class Newtype )
99import Data.Symbol (class IsSymbol )
10+ import Data.Variant (Variant )
1011import GraphQL.Client.Args.AllowedMismatch (AllowedMismatch )
1112import GraphQL.Client.AsGql (AsGql )
1213import GraphQL.Client.NullArray (NullArray )
@@ -70,7 +71,8 @@ class ArgGqlAt at params arg
7071instance argAsGql :: ArgGqlAt at param arg => ArgGqlAt at (AsGql gqlName param ) arg
7172else instance argToGqlNotNull :: (IsNotNull at param arg , ArgGqlAt at param arg ) => ArgGqlAt at (NotNull param ) arg
7273else instance argToGqlIgnore :: ArgGqlAt at param IgnoreArg
73- else instance argVarJson :: ArgGqlAt at Json (Var sym Json ) -- Json can only be used with a variable
74+ else instance argToGqlVariant :: (Union r () params ) => ArgGqlAt at (Variant params ) (Variant r )
75+ else instance argVarJson :: ArgGqlAt at Json (Var sym Json ) -- Json can only be used with a variable
7476else instance argToGqlJsonNotAllowed :: TE.Fail (TE.Text " A `Json` query argument can only be used as a variable " ) => ArgGqlAt at Json Json
7577else instance argVar :: ArgGqlAt at param arg => ArgGqlAt at param (Var sym arg )
7678else instance argToGqlArrayNull :: ArgGqlAt at (Array param ) NullArray
Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ import Data.String.Regex.Flags (global)
5656import Data.String.Regex.Unsafe (unsafeRegex )
5757import Data.Symbol (class IsSymbol , reflectSymbol )
5858import Data.Time (Time )
59+ import Data.Variant (Unvariant (..), Variant , unvariant )
5960import Foreign (Foreign )
6061import Foreign.Object (Object )
6162import Foreign.Object as Object
@@ -317,6 +318,8 @@ else instance gqlArgStringErrorBoundary :: GqlArgString a => GqlArgString (Error
317318 toGqlArgStringImpl (ErrorBoundary a) = toGqlArgStringImpl a
318319else instance gqlArgStringAllowedMismatch :: GqlArgString a => GqlArgString (AllowedMismatch t a ) where
319320 toGqlArgStringImpl = unwrap >>> toGqlArgStringImpl
321+ else instance gqlargVariant :: GqlArgString (Variant r ) where
322+ toGqlArgStringImpl v = unvariant v # \(Unvariant f) -> f \p _ -> reflectSymbol p
320323else instance gqlArgStringVar :: IsSymbol sym => GqlArgString (Var sym a ) where
321324 toGqlArgStringImpl _ = " $" <> reflectSymbol (Proxy :: Proxy sym )
322325else instance gqlArgStringOrArg ::
You can’t perform that action at this time.
0 commit comments