diff --git a/src/GraphQL/Client/Variables.purs b/src/GraphQL/Client/Variables.purs index 3a8219d..eb15945 100644 --- a/src/GraphQL/Client/Variables.purs +++ b/src/GraphQL/Client/Variables.purs @@ -27,6 +27,7 @@ import Prelude import Control.Apply (lift2) import Data.Argonaut.Core (Json, jsonEmptyObject) import Data.Argonaut.Encode (class EncodeJson, encodeJson) +import Data.Identity (Identity) import Data.List (List(..), intercalate) import Data.Maybe (Maybe(..)) import Data.Newtype (class Newtype, unwrap) @@ -142,6 +143,12 @@ else instance getVarOrArg :: varR = getVar (Proxy :: _ r) in lift2 Record.merge varL varR +-- else instance getVarUnion :: +-- ( HFoldl GetVarRec (Proxy {}) { | query } (Proxy { | var }) +-- ) => +-- GetVar (GqlUnion query) { | var } where +-- getVar _ = Proxy -- q >>= \query -> hfoldl GetVarRec (Proxy :: _ {}) (query :: { | query }) + else instance getVarRecord :: ( HFoldl GetVarRec (Proxy {}) { | query } (Proxy { | var }) ) => @@ -220,6 +227,24 @@ else instance varsTypeCheckedWithoutVars :: getVarsJson _ _ = jsonEmptyObject getVarsTypeNames _ _ = "" +else instance varsTypeCheckedIdentity :: + GetVar query {} => + VarsTypeChecked schema (Identity query) where + getVarsJson _ _ = jsonEmptyObject + getVarsTypeNames _ _ = "" + +else instance varsTypeCheckedErrorBoundary :: + GetVar query {} => + VarsTypeChecked schema (ErrorBoundary query) where + getVarsJson _ _ = jsonEmptyObject + getVarsTypeNames _ _ = "" + +else instance varsTypeCheckedUnion :: + GetVar { | query } {} => + VarsTypeChecked schema (GqlUnion query) where + getVarsJson _ _ = jsonEmptyObject + getVarsTypeNames _ _ = "" + else instance varsTypeCheckedSpread :: GetVar (Spread alias arg fields) {} => VarsTypeChecked schema (Spread alias arg fields) where @@ -398,4 +423,3 @@ endsWith c str = removeSuffix :: Char -> String -> String removeSuffix c str = if endsWith c str then String.take (String.length str - 1) str else str -