diff options
Diffstat (limited to 'src/Main.hs')
-rw-r--r-- | src/Main.hs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Main.hs b/src/Main.hs index 0f0146c..626983c 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -42,7 +42,10 @@ instance ToJSON PendingBang where Nothing -> [] Just e -> ["email" .= e] - -- TODO toEncoding. Not sure how much value that holds though + toEncoding (PendingBang b u dp em) = pairs $ case em of + Nothing -> withoutEmail + Just e -> withoutEmail <> "email" .= e + where withoutEmail = "bang" .= b <> "url" .= u <> "name" .= dp instance FromJSON PendingBang where parseJSON = withObject "PendingBang" $ \ob -> |