Last active
August 23, 2018 13:35
-
-
Save ngw/6671b2e0e17c452c6c8df8fde8141ebf 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
userByEmail : UserByEmailRequiredArguments -> SelectionSet decodesTo Schema.Object.User -> Field (Maybe decodesTo) RootQuery | |
userByEmail requiredArgs object = | |
Object.selectionField "userByEmail" [ Argument.required "email" requiredArgs.email Encode.string ] object (identity >> Decode.nullable) | |
type alias EmailQueryResponse = | |
{ email : Maybe Email } | |
type alias Email = | |
{ email: String } | |
query : SelectionSet EmailQueryResponse RootQuery | |
query = | |
let | |
q = Query.selection EmailQueryResponse |> with (Query.userByEmail { email = "ngw@test.org" } user) | |
in | |
Debug.log "Q" q | |
user : SelectionSet Email Schema.Object.User | |
user = | |
Schema.Object.User.selection Email | |
|> with Schema.Object.User.email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment