@@ -268,6 +268,7 @@ data IssueLabel = IssueLabel
268268 { labelColor :: ! Text
269269 , labelUrl :: ! URL
270270 , labelName :: ! (Name IssueLabel )
271+ , labelDesc :: ! (Maybe Text )
271272 }
272273 deriving (Show , Data , Typeable , Eq , Ord , Generic )
273274
@@ -279,3 +280,57 @@ instance FromJSON IssueLabel where
279280 <$> o .: " color"
280281 <*> o .:? " url" .!= URL " " -- in events there aren't URL
281282 <*> o .: " name"
283+ <*> o .:? " description"
284+
285+
286+ -------------------------------------------------------------------------------
287+ -- NewIssueLabel
288+ -------------------------------------------------------------------------------
289+
290+ data NewIssueLabel = NewIssueLabel
291+ { newLabelColor :: ! Text
292+ , newLabelName :: ! (Name NewIssueLabel )
293+ , newLabelDesc :: ! (Maybe Text )
294+ }
295+ deriving (Show , Data , Typeable , Eq , Ord , Generic )
296+
297+ instance NFData NewIssueLabel where rnf = genericRnf
298+ instance Binary NewIssueLabel
299+
300+
301+ instance ToJSON NewIssueLabel where
302+ toJSON (NewIssueLabel color lblName lblDesc) = object $ filter notNull
303+ [ " name" .= lblName
304+ , " color" .= color
305+ , " description" .= lblDesc
306+ ]
307+ where
308+ notNull (_, Null ) = False
309+ notNull (_, _) = True
310+
311+
312+
313+ -------------------------------------------------------------------------------
314+ -- UpdateIssueLabel
315+ -------------------------------------------------------------------------------
316+
317+ data UpdateIssueLabel = UpdateIssueLabel
318+ { updateLabelColor :: ! Text
319+ , updateLabelName :: ! (Name UpdateIssueLabel )
320+ , updateLabelDesc :: ! (Maybe Text )
321+ }
322+ deriving (Show , Data , Typeable , Eq , Ord , Generic )
323+
324+ instance NFData UpdateIssueLabel where rnf = genericRnf
325+ instance Binary UpdateIssueLabel
326+
327+
328+ instance ToJSON UpdateIssueLabel where
329+ toJSON (UpdateIssueLabel color lblName lblDesc) = object $ filter notNull
330+ [ " new_name" .= lblName
331+ , " color" .= color
332+ , " description" .= lblDesc
333+ ]
334+ where
335+ notNull (_, Null ) = False
336+ notNull (_, _) = True
0 commit comments