-
-
Notifications
You must be signed in to change notification settings - Fork 107
/
Character.elm
85 lines (66 loc) · 2.79 KB
/
Character.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
-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql
-- https://github.com/dillonkearns/elm-graphql
module Swapi.Interface.Character 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 (FragmentSelectionSet(..), SelectionSet(..))
import Json.Decode as Decode
import Swapi.Enum.Episode
import Swapi.InputObject
import Swapi.Interface
import Swapi.Object
import Swapi.Scalar
import Swapi.Union
type alias Fragments decodesTo =
{ onHuman : SelectionSet decodesTo Swapi.Object.Human
, onDroid : SelectionSet decodesTo Swapi.Object.Droid
}
{-| Build an exhaustive selection of type-specific fragments.
-}
fragments :
Fragments decodesTo
-> SelectionSet decodesTo Swapi.Interface.Character
fragments selections____ =
Object.exhaustiveFragmentSelection
[ Object.buildFragment "Human" selections____.onHuman
, Object.buildFragment "Droid" selections____.onDroid
]
{-| Can be used to create a non-exhaustive set of fragments by using the record
update syntax to add `SelectionSet`s for the types you want to handle.
-}
maybeFragments : Fragments (Maybe decodesTo)
maybeFragments =
{ onHuman = Graphql.SelectionSet.empty |> Graphql.SelectionSet.map (\_ -> Nothing)
, onDroid = Graphql.SelectionSet.empty |> Graphql.SelectionSet.map (\_ -> Nothing)
}
{-| Which movies they appear in.
-}
appearsIn : SelectionSet (List Swapi.Enum.Episode.Episode) Swapi.Interface.Character
appearsIn =
Object.selectionForField "(List Enum.Episode.Episode)" "appearsIn" [] (Swapi.Enum.Episode.decoder |> Decode.list)
{-| Url to a profile picture for the character.
-}
avatarUrl : SelectionSet String Swapi.Interface.Character
avatarUrl =
Object.selectionForField "String" "avatarUrl" [] Decode.string
{-| The friends of the character, or an empty list if they have none.
-}
friends :
SelectionSet decodesTo Swapi.Interface.Character
-> SelectionSet (List decodesTo) Swapi.Interface.Character
friends object____ =
Object.selectionForCompositeField "friends" [] object____ (Basics.identity >> Decode.list)
{-| The ID of the character.
-}
id : SelectionSet CustomScalarCodecs.Id Swapi.Interface.Character
id =
Object.selectionForField "CustomScalarCodecs.Id" "id" [] (CustomScalarCodecs.codecs |> Swapi.Scalar.unwrapCodecs |> .codecId |> .decoder)
{-| The name of the character.
-}
name : SelectionSet String Swapi.Interface.Character
name =
Object.selectionForField "String" "name" [] Decode.string