-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql -- https://github.com/dillonkearns/elm-graphql module Github.Enum.GistOrderField exposing (GistOrderField(..), decoder, fromString, list, toString) import Json.Decode as Decode exposing (Decoder) {-| Properties by which gist connections can be ordered. - CreatedAt - Order gists by creation time - UpdatedAt - Order gists by update time - PushedAt - Order gists by push time -} type GistOrderField = CreatedAt | UpdatedAt | PushedAt list : List GistOrderField list = [ CreatedAt, UpdatedAt, PushedAt ] decoder : Decoder GistOrderField decoder = Decode.string |> Decode.andThen (\string -> case string of "CREATED_AT" -> Decode.succeed CreatedAt "UPDATED_AT" -> Decode.succeed UpdatedAt "PUSHED_AT" -> Decode.succeed PushedAt _ -> Decode.fail ("Invalid GistOrderField 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 : GistOrderField -> String toString enum = case enum of CreatedAt -> "CREATED_AT" UpdatedAt -> "UPDATED_AT" PushedAt -> "PUSHED_AT" {-| 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