Skip to content

Commit

Permalink
Add new Notification reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
maralorn committed Sep 24, 2024
1 parent 9fa6bde commit c377abb
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions src/GitHub/Data/Activities.hs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,18 @@ instance FromJSON Subject where
<*> o .: "type"

data NotificationReason
= AssignReason
= ApprovalRequestedReason
| AssignReason
| AuthorReason
| CommentReason
| CiActivityReason
| InvitationReason
| ManualReason
| MemberFeatureRequestedReason
| MentionReason
| ReviewRequestedReason
| SecurityAlertReason
| SecurityAdvisoryCreditReason
| StateChangeReason
| SubscribedReason
| TeamMentionReason
Expand All @@ -63,17 +68,22 @@ instance Binary NotificationReason

instance FromJSON NotificationReason where
parseJSON = withText "NotificationReason" $ \t -> case T.toLower t of
"assign" -> pure AssignReason
"author" -> pure AuthorReason
"comment" -> pure CommentReason
"invitation" -> pure InvitationReason
"manual" -> pure ManualReason
"mention" -> pure MentionReason
"review_requested" -> pure ReviewRequestedReason
"state_change" -> pure StateChangeReason
"subscribed" -> pure SubscribedReason
"team_mention" -> pure TeamMentionReason
_ -> fail $ "Unknown NotificationReason " ++ show t
"approval_requested" -> pure ApprovalRequestedReason
"assign" -> pure AssignReason
"author" -> pure AuthorReason
"comment" -> pure CommentReason
"ci_activity" -> pure CiActivityReason
"invitation" -> pure InvitationReason
"manual" -> pure ManualReason
"member_feature_requested" -> pure MemberFeatureRequestedReason
"mention" -> pure MentionReason
"review_requested" -> pure ReviewRequestedReason
"security_alert" -> pure SecurityAlertReason
"security_advisory_credit" -> pure SecurityAdvisoryCreditReason
"state_change" -> pure StateChangeReason
"subscribed" -> pure SubscribedReason
"team_mention" -> pure TeamMentionReason
_ -> fail $ "Unknown NotificationReason " ++ show t

data Notification = Notification
-- XXX: The notification id field type IS in fact string. Not sure why gh
Expand Down

0 comments on commit c377abb

Please sign in to comment.