|
| 1 | +-- Do not manually edit this file, it was auto-generated by dillonkearns/elm-graphql |
| 2 | +-- https://github.com/dillonkearns/elm-graphql |
| 3 | +module Api.Enum.Closed_tasks_histogram_column exposing (..) |
| 4 | + |
| 5 | +import Json.Decode as Decode exposing (Decoder) |
| 6 | + |
| 7 | + |
| 8 | +{-| This enum contains a variant for each column in the table |
| 9 | +-} |
| 10 | +type Closed_tasks_histogram_column |
| 11 | + = Date_short |
| 12 | + | Num_of_closed_tasks |
| 13 | +list : List Closed_tasks_histogram_column |
| 14 | +list = |
| 15 | + [Date_short, Num_of_closed_tasks] |
| 16 | +decoder : Decoder Closed_tasks_histogram_column |
| 17 | +decoder = |
| 18 | + Decode.string |
| 19 | + |> Decode.andThen |
| 20 | + (\string -> |
| 21 | + case string of |
| 22 | + "date_short" -> |
| 23 | + Decode.succeed Date_short |
| 24 | + |
| 25 | + "num_of_closed_tasks" -> |
| 26 | + Decode.succeed Num_of_closed_tasks |
| 27 | + |
| 28 | + _ -> |
| 29 | + Decode.fail ("Invalid Closed_tasks_histogram_column type, " ++ string ++ " try re-running the @dillonkearns/elm-graphql CLI ") |
| 30 | + ) |
| 31 | + |
| 32 | + |
| 33 | +{-| Convert from the union type representing the Enum to a string that the GraphQL server will recognize. |
| 34 | +-} |
| 35 | +toString : Closed_tasks_histogram_column -> String |
| 36 | +toString enum____ = |
| 37 | + case enum____ of |
| 38 | + Date_short -> |
| 39 | + "date_short" |
| 40 | + |
| 41 | + |
| 42 | + Num_of_closed_tasks -> |
| 43 | + "num_of_closed_tasks" |
| 44 | + |
| 45 | + |
| 46 | +{-| Convert from a String representation to an elm representation enum. |
| 47 | +This is the inverse of the Enum `toString` function. So you can call `toString` and then convert back `fromString` safely. |
| 48 | +
|
| 49 | + Swapi.Enum.Episode.NewHope |
| 50 | + |> Swapi.Enum.Episode.toString |
| 51 | + |> Swapi.Enum.Episode.fromString |
| 52 | + == Just NewHope |
| 53 | +
|
| 54 | +This can be useful for generating Strings to use for <select> menus to check which item was selected. |
| 55 | +
|
| 56 | +-} |
| 57 | +fromString : String -> Maybe Closed_tasks_histogram_column |
| 58 | +fromString enumString____ = |
| 59 | + case enumString____ of |
| 60 | + "date_short" -> |
| 61 | + Just Date_short |
| 62 | + |
| 63 | + |
| 64 | + "num_of_closed_tasks" -> |
| 65 | + Just Num_of_closed_tasks |
| 66 | + |
| 67 | + _ -> |
| 68 | + Nothing |
0 commit comments