Skip to content

Commit 3085a78

Browse files
committed
Fix #302. Add issueEventLabel
1 parent 405f186 commit 3085a78

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/GitHub/Data/Definitions.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import qualified Data.Text as T
1818

1919
import GitHub.Data.Id (Id)
2020
import GitHub.Data.Name (Name)
21-
import GitHub.Data.URL (URL)
21+
import GitHub.Data.URL (URL (..))
2222

2323
-- | Errors have been tagged according to their source, so you can more easily
2424
-- dispatch and handle them.
@@ -254,5 +254,5 @@ instance Binary IssueLabel
254254
instance FromJSON IssueLabel where
255255
parseJSON = withObject "IssueLabel" $ \o -> IssueLabel
256256
<$> o .: "color"
257-
<*> o .: "url"
257+
<*> o .:? "url" .!= URL "" -- in events there aren't URL
258258
<*> o .: "name"

src/GitHub/Data/Issues.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ data Issue = Issue
2121
, issueEventsUrl :: !URL
2222
, issueHtmlUrl :: !(Maybe URL)
2323
, issueClosedBy :: !(Maybe SimpleUser)
24-
, issueLabels :: (Vector IssueLabel)
24+
, issueLabels :: !(Vector IssueLabel)
2525
, issueNumber :: !Int
2626
, issueAssignees :: !(Vector SimpleUser)
2727
, issueUser :: !SimpleUser
@@ -122,6 +122,7 @@ data IssueEvent = IssueEvent
122122
, issueEventCreatedAt :: !UTCTime
123123
, issueEventId :: !Int
124124
, issueEventIssue :: !(Maybe Issue)
125+
, issueEventLabel :: !(Maybe IssueLabel)
125126
}
126127
deriving (Show, Data, Typeable, Eq, Ord, Generic)
127128

@@ -137,6 +138,7 @@ instance FromJSON IssueEvent where
137138
<*> o .: "created_at"
138139
<*> o .: "id"
139140
<*> o .:? "issue"
141+
<*> o .:? "label"
140142

141143
instance FromJSON EventType where
142144
parseJSON = withText "EventType" $ \t -> case t of

0 commit comments

Comments
 (0)