-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql -- https://github.com/dillonkearns/elm-graphql module Normalize.Enum.Episode_ exposing (Episode_(..), decoder, fromString, list, toString) import Json.Decode as Decode exposing (Decoder) {-| One of the films in the Star Wars Trilogy - Empire - Released in 1980. - Jedi\_ - Released in 1983. - Newhope\_ - Released in 1977. -} type Episode_ = Empire | Jedi_ | Newhope_ list : List Episode_ list = [ Empire, Jedi_, Newhope_ ] decoder : Decoder Episode_ decoder = Decode.string |> Decode.andThen (\string -> case string of "empire" -> Decode.succeed Empire "jedi_" -> Decode.succeed Jedi_ "_newhope" -> Decode.succeed Newhope_ _ -> Decode.fail ("Invalid Episode_ type, " ++ string ++ " try re-running the @dillonkearns/elm-graphql CLI ") ) {-| Convert from the union type representating the Enum to a string that the GraphQL server will recognize. -} toString : Episode_ -> String toString enum = case enum of Empire -> "empire" Jedi_ -> "jedi_" Newhope_ -> "_newhope" {-| Convert from a String representation to an elm representation enum. This is the inverse of the Enum `toString` function. So you can call `toString` and then convert back `fromString` safely. Swapi.Enum.Episode.NewHope |> Swapi.Enum.Episode.toString |> Swapi.Enum.Episode.fromString == Just NewHope This can be useful for generating Strings to use for