-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql -- https://github.com/dillonkearns/elm-graphql module Api.Query exposing (..) import Api.Interface import Api.Object import Api.Scalar import Api.Union import Graphql.Field as Field exposing (Field) import Graphql.Internal.Builder.Argument as Argument exposing (Argument) import Graphql.Internal.Builder.Object as Object import Graphql.Internal.Encode as Encode exposing (Value) import Graphql.Operation exposing (RootQuery) import Graphql.OptionalArgument exposing (OptionalArgument(Absent)) import Graphql.SelectionSet exposing (SelectionSet) import Json.Decode as Decode exposing (Decoder) {-| Select fields to build up a top-level query. The request can be sent with functions from `Graphql.Http`. -} selection : (a -> constructor) -> SelectionSet (a -> constructor) RootQuery selection constructor = Object.selection constructor comments : { postId : Api.Scalar.Id } -> SelectionSet decodesTo Api.Object.Comment -> Field (Maybe (List (Maybe decodesTo))) RootQuery comments requiredArgs object = Object.selectionField "comments" [ Argument.required "postId" requiredArgs.postId (\(Api.Scalar.Id raw) -> Encode.string raw) ] object (identity >> Decode.maybe >> Decode.list >> Decode.maybe) {-| Find a Post by ID -} post : { id : Api.Scalar.Id } -> SelectionSet decodesTo Api.Object.Post -> Field (Maybe decodesTo) RootQuery post requiredArgs object = Object.selectionField "post" [ Argument.required "id" requiredArgs.id (\(Api.Scalar.Id raw) -> Encode.string raw) ] object (identity >> Decode.maybe) posts : SelectionSet decodesTo Api.Object.Post -> Field (Maybe (List (Maybe decodesTo))) RootQuery posts object = Object.selectionField "posts" [] object (identity >> Decode.maybe >> Decode.list >> Decode.maybe)