Skip to content

Commit 250e5d9

Browse files
committed
Add new data structure for updating milestones
1 parent bd574f4 commit 250e5d9

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

src/GitHub/Data/Milestone.hs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,26 @@ instance ToJSON NewMilestone where
6363
where
6464
notNull (_, Null) = False
6565
notNull (_, _) = True
66+
67+
data UpdateMilestone = UpdateMilestone
68+
{ updateMilestoneTitle :: !(Maybe Text)
69+
, updateMilestoneState :: !(Maybe Text)
70+
, updateMilestoneDescription :: !(Maybe Text)
71+
, updateMilestoneDueOn :: !(Maybe UTCTime)
72+
}
73+
deriving (Show, Data, Typeable, Eq, Ord, Generic)
74+
75+
instance NFData UpdateMilestone where rnf = genericRnf
76+
instance Binary UpdateMilestone
77+
78+
79+
instance ToJSON UpdateMilestone where
80+
toJSON (UpdateMilestone title state desc due) = object $ filter notNull
81+
[ "title" .= title
82+
, "state" .= state
83+
, "description" .= desc
84+
, "due_on" .= due
85+
]
86+
where
87+
notNull (_, Null) = False
88+
notNull (_, _) = True

0 commit comments

Comments
 (0)