-
-
Notifications
You must be signed in to change notification settings - Fork 107
/
Query.elm
137 lines (96 loc) · 4.25 KB
/
Query.elm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql
-- https://github.com/dillonkearns/elm-graphql
module Swapi.Query exposing (..)
import CustomScalarCodecs
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, RootQuery, RootSubscription)
import Graphql.OptionalArgument exposing (OptionalArgument(..))
import Graphql.SelectionSet exposing (SelectionSet)
import Json.Decode as Decode exposing (Decoder)
import Swapi.Enum.Episode
import Swapi.InputObject
import Swapi.Interface
import Swapi.Object
import Swapi.Scalar
import Swapi.Union
type alias DroidRequiredArguments =
{ id : CustomScalarCodecs.Id }
{-|
- id - ID of the droid.
-}
droid :
DroidRequiredArguments
-> SelectionSet decodesTo Swapi.Object.Droid
-> SelectionSet (Maybe decodesTo) RootQuery
droid requiredArgs____ object____ =
Object.selectionForCompositeField "droid" [ Argument.required "id" requiredArgs____.id (CustomScalarCodecs.codecs |> Swapi.Scalar.unwrapEncoder .codecId) ] object____ (Basics.identity >> Decode.nullable)
{-| Getting this field will result in an error.
-}
forcedError : SelectionSet (Maybe String) RootQuery
forcedError =
Object.selectionForField "(Maybe String)" "forcedError" [] (Decode.string |> Decode.nullable)
type alias GreetRequiredArguments =
{ input : Swapi.InputObject.Greeting }
greet :
GreetRequiredArguments
-> SelectionSet String RootQuery
greet requiredArgs____ =
Object.selectionForField "String" "greet" [ Argument.required "input" requiredArgs____.input Swapi.InputObject.encodeGreeting ] Decode.string
hello : SelectionSet String RootQuery
hello =
Object.selectionForField "String" "hello" [] Decode.string
type alias HeroOptionalArguments =
{ episode : OptionalArgument Swapi.Enum.Episode.Episode }
{-|
- episode - If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.
-}
hero :
(HeroOptionalArguments -> HeroOptionalArguments)
-> SelectionSet decodesTo Swapi.Interface.Character
-> SelectionSet decodesTo RootQuery
hero fillInOptionals____ object____ =
let
filledInOptionals____ =
fillInOptionals____ { episode = Absent }
optionalArgs____ =
[ Argument.optional "episode" filledInOptionals____.episode (Encode.enum Swapi.Enum.Episode.toString) ]
|> List.filterMap Basics.identity
in
Object.selectionForCompositeField "hero" optionalArgs____ object____ Basics.identity
type alias HeroUnionOptionalArguments =
{ episode : OptionalArgument Swapi.Enum.Episode.Episode }
{-|
- episode - If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.
-}
heroUnion :
(HeroUnionOptionalArguments -> HeroUnionOptionalArguments)
-> SelectionSet decodesTo Swapi.Union.CharacterUnion
-> SelectionSet decodesTo RootQuery
heroUnion fillInOptionals____ object____ =
let
filledInOptionals____ =
fillInOptionals____ { episode = Absent }
optionalArgs____ =
[ Argument.optional "episode" filledInOptionals____.episode (Encode.enum Swapi.Enum.Episode.toString) ]
|> List.filterMap Basics.identity
in
Object.selectionForCompositeField "heroUnion" optionalArgs____ object____ Basics.identity
type alias HumanRequiredArguments =
{ id : CustomScalarCodecs.Id }
{-|
- id - ID of the human.
-}
human :
HumanRequiredArguments
-> SelectionSet decodesTo Swapi.Object.Human
-> SelectionSet (Maybe decodesTo) RootQuery
human requiredArgs____ object____ =
Object.selectionForCompositeField "human" [ Argument.required "id" requiredArgs____.id (CustomScalarCodecs.codecs |> Swapi.Scalar.unwrapEncoder .codecId) ] object____ (Basics.identity >> Decode.nullable)
now : SelectionSet CustomScalarCodecs.PosixTime RootQuery
now =
Object.selectionForField "CustomScalarCodecs.PosixTime" "now" [] (CustomScalarCodecs.codecs |> Swapi.Scalar.unwrapCodecs |> .codecPosixTime |> .decoder)
today : SelectionSet String RootQuery
today =
Object.selectionForField "String" "today" [] Decode.string