-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql -- https://github.com/dillonkearns/elm-graphql module Github.Enum.SearchType exposing (SearchType(..), decoder, fromString, list, toString) import Json.Decode as Decode exposing (Decoder) {-| Represents the individual results of a search. - Issue - Returns results matching issues in repositories. - Repository - Returns results matching repositories. - User - Returns results matching users and organizations on GitHub. -} type SearchType = Issue | Repository | User list : List SearchType list = [ Issue, Repository, User ] decoder : Decoder SearchType decoder = Decode.string |> Decode.andThen (\string -> case string of "ISSUE" -> Decode.succeed Issue "REPOSITORY" -> Decode.succeed Repository "USER" -> Decode.succeed User _ -> Decode.fail ("Invalid SearchType 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 : SearchType -> String toString enum = case enum of Issue -> "ISSUE" Repository -> "REPOSITORY" User -> "USER" {-| 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