Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dfabb25

Browse files
committed
Merge pull request haskell-github#74 from nataren/add_missing_event_type_data_constructors
Add missing issue event types.
2 parents 18b80c3 + 9520160 commit dfabb25

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

Github/Data.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ instance FromJSON Issue where
207207
parseJSON (Object o) =
208208
Issue <$> o .:? "closed_at"
209209
<*> o .: "updated_at"
210+
<*> o .: "events_url"
210211
<*> o .: "html_url"
211212
<*> o .:? "closed_by"
212213
<*> o .: "labels"
@@ -302,6 +303,16 @@ instance FromJSON EventType where
302303
parseJSON (String "mentioned") = pure Mentioned
303304
parseJSON (String "assigned") = pure Assigned
304305
parseJSON (String "unsubscribed") = pure Unsubscribed
306+
parseJSON (String "unassigned") = pure ActorUnassigned
307+
parseJSON (String "labeled") = pure Labeled
308+
parseJSON (String "unlabeled") = pure Unlabeled
309+
parseJSON (String "milestoned") = pure Milestoned
310+
parseJSON (String "demilestoned") = pure Demilestoned
311+
parseJSON (String "renamed") = pure Renamed
312+
parseJSON (String "locked") = pure Locked
313+
parseJSON (String "unlocked") = pure Unlocked
314+
parseJSON (String "head_ref_deleted") = pure HeadRefDeleted
315+
parseJSON (String "head_ref_restored") = pure HeadRefRestored
305316
parseJSON _ = fail "Could not build an EventType"
306317

307318
instance FromJSON SimpleOrganization where

Github/Data/Definitions.hs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ data GitObject = GitObject {
188188
data Issue = Issue {
189189
issueClosedAt :: Maybe GithubDate
190190
,issueUpdatedAt :: GithubDate
191+
,issueEventsUrl :: String
191192
,issueHtmlUrl :: Maybe String
192193
,issueClosedBy :: Maybe GithubOwner
193194
,issueLabels :: [IssueLabel]
@@ -267,6 +268,16 @@ data EventType =
267268
| Assigned -- ^ The issue was assigned to the actor.
268269
| Closed -- ^ The issue was closed by the actor. When the commit_id is present, it identifies the commit that closed the issue using “closes / fixes #NN” syntax.
269270
| Reopened -- ^ The issue was reopened by the actor.
271+
| ActorUnassigned -- ^ The issue was unassigned to the actor
272+
| Labeled -- ^ A label was added to the issue.
273+
| Unlabeled -- ^ A label was removed from the issue.
274+
| Milestoned -- ^ The issue was added to a milestone.
275+
| Demilestoned -- ^ The issue was removed from a milestone.
276+
| Renamed -- ^ The issue title was changed.
277+
| Locked -- ^ The issue was locked by the actor.
278+
| Unlocked -- ^ The issue was unlocked by the actor.
279+
| HeadRefDeleted -- ^ The pull request’s branch was deleted.
280+
| HeadRefRestored -- ^ The pull request’s branch was restored.
270281
deriving (Show, Data, Typeable, Eq, Ord)
271282

272283
data Event = Event {

github.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Name: github
77
-- The package version. See the Haskell package versioning policy
88
-- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for
99
-- standards guiding when and how versions should be incremented.
10-
Version: 0.9
10+
Version: 0.10.0
1111

1212
-- A short (one-line) description of the package.
1313
Synopsis: Access to the Github API, v3.

0 commit comments

Comments
 (0)