-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql -- https://github.com/dillonkearns/elm-graphql module Api.Mutation 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 (RootMutation) 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 mutation. The request can be sent with functions from `Graphql.Http`. -} selection : (a -> constructor) -> SelectionSet (a -> constructor) RootMutation selection constructor = Object.selection constructor {-| Create a new blog comment. -} createComment : { postId : Api.Scalar.Id, body : String } -> SelectionSet decodesTo Api.Object.Comment -> Field (Maybe decodesTo) RootMutation createComment requiredArgs object = Object.selectionField "createComment" [ Argument.required "postId" requiredArgs.postId (\(Api.Scalar.Id raw) -> Encode.string raw), Argument.required "body" requiredArgs.body Encode.string ] object (identity >> Decode.maybe) {-| Create a new blog post. -} createPost : { title : String, body : String } -> SelectionSet decodesTo Api.Object.Post -> Field (Maybe decodesTo) RootMutation createPost requiredArgs object = Object.selectionField "createPost" [ Argument.required "title" requiredArgs.title Encode.string, Argument.required "body" requiredArgs.body Encode.string ] object (identity >> Decode.maybe)