{"action":"created","issue":{"url":"https://api.github.com/repos/zalora/aws-ec2/issues/12","labels_url":"https://api.github.com/repos/zalora/aws-ec2/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/zalora/aws-ec2/issues/12/comments","events_url":"https://api.github.com/repos/zalora/aws-ec2/issues/12/events","html_url":"https://github.com/zalora/aws-ec2/pull/12","id":120502612,"number":12,"title":"Added support for FromJSON response objects","user":{"login":"saschat","id":7301779,"avatar_url":"https://avatars.githubusercontent.com/u/7301779?v=3","gravatar_id":"","url":"https://api.github.com/users/saschat","html_url":"https://github.com/saschat","followers_url":"https://api.github.com/users/saschat/followers","following_url":"https://api.github.com/users/saschat/following{/other_user}","gists_url":"https://api.github.com/users/saschat/gists{/gist_id}","starred_url":"https://api.github.com/users/saschat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/saschat/subscriptions","organizations_url":"https://api.github.com/users/saschat/orgs","repos_url":"https://api.github.com/users/saschat/repos","events_url":"https://api.github.com/users/saschat/events{/privacy}","received_events_url":"https://api.github.com/users/saschat/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-12-04T22:51:07Z","updated_at":"2016-01-04T09:17:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/zalora/aws-ec2/pulls/12","html_url":"https://github.com/zalora/aws-ec2/pull/12","diff_url":"https://github.com/zalora/aws-ec2/pull/12.diff","patch_url":"https://github.com/zalora/aws-ec2/pull/12.patch"},"body":"Added support to use any response types as long as they are an instance of `FromJSON`. If the `Value` can not be decoded into the `FromJSON` instance, a `ConsumeException` is thrown containing the decoding error message.\r\n\r\nCurrently, old code will remain compatible as `Values` are still returned. However, if per command response types are introduced, this would break existing code. @proger How do you feel about that?\r\n\r\nAn example of how I would introduce response type for `DescribeRegions`:\r\n```\r\ndata Region = Region { regionEndpoint :: Text\r\n                     , regionName :: Text}\r\n                     deriving (Show, Generic)\r\n\r\ninstance FromJSON Region\r\n\r\ndata Regions = Regions [Region] deriving (Show, Generic)\r\ninstance FromJSON Regions\r\n\r\ninstance SignQuery DescribeRegions where\r\n    type ServiceConfiguration DescribeRegions = QueryAPIConfiguration\r\n    signQuery (DescribeRegions arg) = ec2SignQuery $ [ (\"Action\", qArg \"DescribeRegions\")\r\n                                                   , defVersion\r\n                                                   ] +++ enumerate \"RegionName\" arg qArg\r\n\r\ninstance ResponseConsumer DescribeRegions Regions where\r\n    type ResponseMetadata Regions = QueryMetadata\r\n    responseConsumer _ = queryResponseConsumer $ valueConsumerOpt (XMLValueOptions \"item\") \"regionInfo\" fromJSONConsumer\r\n\r\ninstance Transaction DescribeRegions Regions\r\n\r\ninstance AsMemoryResponse Regions where\r\n    type MemoryResponse Regions = Regions\r\n    loadToMemory = return\r\n```"},"comment":{"url":"https://api.github.com/repos/zalora/aws-ec2/issues/comments/168618257","html_url":"https://github.com/zalora/aws-ec2/pull/12#issuecomment-168618257","issue_url":"https://api.github.com/repos/zalora/aws-ec2/issues/12","id":168618257,"user":{"login":"proger","id":66214,"avatar_url":"https://avatars.githubusercontent.com/u/66214?v=3","gravatar_id":"","url":"https://api.github.com/users/proger","html_url":"https://github.com/proger","followers_url":"https://api.github.com/users/proger/followers","following_url":"https://api.github.com/users/proger/following{/other_user}","gists_url":"https://api.github.com/users/proger/gists{/gist_id}","starred_url":"https://api.github.com/users/proger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/proger/subscriptions","organizations_url":"https://api.github.com/users/proger/orgs","repos_url":"https://api.github.com/users/proger/repos","events_url":"https://api.github.com/users/proger/events{/privacy}","received_events_url":"https://api.github.com/users/proger/received_events","type":"User","site_admin":false},"created_at":"2016-01-04T09:17:42Z","updated_at":"2016-01-04T09:17:42Z","body":"Capturing types is quite tricky business because they will vary across API versions and `aws-ec2` explicitly mentions a very old one and manually typing them is *quite* error-prone.\r\nI also meant the library to lack most types (especially response types) on purpose, because I initially intended it for use with fire-and-forget types of commands, where you don't really want to create complex dependent request pipelines – hence all responses return `Value`.\r\n\r\n[amazonka](https://github.com/brendanhay/amazonka) takes typing seriously though, "}}