Created
February 25, 2019 20:31
-
-
Save chamook/6561ca0b26e9053a050b144d69eb0ceb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| type MiniColour = { | |
| Id : string | |
| Name : string | |
| Hex : string | |
| } | |
| type MiniMyColoursDto = { Colours : MiniColour list } | |
| let toMiniColour (c : Colour) = { MiniColour.Id = c.Id; Name = c.Name; Hex = c.Hex } | |
| let getMyColours: HttpHandler = | |
| fun next ctx -> | |
| match ctx.TryGetRequestHeader "Accept" with | |
| | Some x when x.Contains "application/vnd.chamook.mini-colours+json" -> | |
| Successful.OK | |
| { MiniMyColoursDto.Colours = myColours |> List.map toMiniColour } | |
| next | |
| ctx | |
| | _ -> | |
| Successful.OK | |
| { MyColoursDto.Colours = myColours } | |
| next | |
| ctx |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment