github 0.7.0 → 0.7.1
raw patch · 7 files changed
+150/−3 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Github.Data: instance ToJSON EditComment
+ Github.Data: instance ToJSON EditIssue
+ Github.Data: instance ToJSON NewComment
+ Github.Data: instance ToJSON NewIssue
+ Github.Data.Definitions: EditComment :: String -> EditComment
+ Github.Data.Definitions: EditIssue :: Maybe String -> Maybe String -> Maybe String -> Maybe String -> Maybe Int -> Maybe [String] -> EditIssue
+ Github.Data.Definitions: NewComment :: String -> NewComment
+ Github.Data.Definitions: NewIssue :: String -> Maybe String -> Maybe String -> Maybe Int -> Maybe [String] -> NewIssue
+ Github.Data.Definitions: data EditComment
+ Github.Data.Definitions: data EditIssue
+ Github.Data.Definitions: data NewComment
+ Github.Data.Definitions: data NewIssue
+ Github.Data.Definitions: editCommentBody :: EditComment -> String
+ Github.Data.Definitions: editIssueAssignee :: EditIssue -> Maybe String
+ Github.Data.Definitions: editIssueBody :: EditIssue -> Maybe String
+ Github.Data.Definitions: editIssueLabels :: EditIssue -> Maybe [String]
+ Github.Data.Definitions: editIssueMilestone :: EditIssue -> Maybe Int
+ Github.Data.Definitions: editIssueState :: EditIssue -> Maybe String
+ Github.Data.Definitions: editIssueTitle :: EditIssue -> Maybe String
+ Github.Data.Definitions: instance Data EditComment
+ Github.Data.Definitions: instance Data EditIssue
+ Github.Data.Definitions: instance Data NewComment
+ Github.Data.Definitions: instance Data NewIssue
+ Github.Data.Definitions: instance Eq EditComment
+ Github.Data.Definitions: instance Eq EditIssue
+ Github.Data.Definitions: instance Eq NewComment
+ Github.Data.Definitions: instance Eq NewIssue
+ Github.Data.Definitions: instance Ord EditComment
+ Github.Data.Definitions: instance Ord EditIssue
+ Github.Data.Definitions: instance Ord NewComment
+ Github.Data.Definitions: instance Ord NewIssue
+ Github.Data.Definitions: instance Show EditComment
+ Github.Data.Definitions: instance Show EditIssue
+ Github.Data.Definitions: instance Show NewComment
+ Github.Data.Definitions: instance Show NewIssue
+ Github.Data.Definitions: instance Typeable EditComment
+ Github.Data.Definitions: instance Typeable EditIssue
+ Github.Data.Definitions: instance Typeable NewComment
+ Github.Data.Definitions: instance Typeable NewIssue
+ Github.Data.Definitions: newCommentBody :: NewComment -> String
+ Github.Data.Definitions: newIssueAssignee :: NewIssue -> Maybe String
+ Github.Data.Definitions: newIssueBody :: NewIssue -> Maybe String
+ Github.Data.Definitions: newIssueLabels :: NewIssue -> Maybe [String]
+ Github.Data.Definitions: newIssueMilestone :: NewIssue -> Maybe Int
+ Github.Data.Definitions: newIssueTitle :: NewIssue -> String
+ Github.GitData.Blobs: blob :: String -> String -> String -> IO (Either Error Blob)
+ Github.Issues: GithubBasicAuth :: ByteString -> ByteString -> GithubAuth
+ Github.Issues: GithubOAuth :: String -> GithubAuth
+ Github.Issues: createIssue :: GithubAuth -> String -> String -> NewIssue -> IO (Either Error Issue)
+ Github.Issues: data GithubAuth
+ Github.Issues: editIssue :: GithubAuth -> String -> String -> Int -> EditIssue -> IO (Either Error Issue)
+ Github.Issues: editOfIssue :: EditIssue
+ Github.Issues: newIssue :: String -> NewIssue
+ Github.Issues.Comments: GithubBasicAuth :: ByteString -> ByteString -> GithubAuth
+ Github.Issues.Comments: GithubOAuth :: String -> GithubAuth
+ Github.Issues.Comments: createComment :: GithubAuth -> String -> String -> Int -> String -> IO (Either Error Comment)
+ Github.Issues.Comments: data GithubAuth
+ Github.Issues.Comments: editComment :: GithubAuth -> String -> String -> Int -> String -> IO (Either Error Comment)
Files
- Github/Data.hs +26/−0
- Github/Data/Definitions.hs +26/−0
- Github/GitData/Blobs.hs +16/−0
- Github/Issues.hs +46/−0
- Github/Issues/Comments.hs +32/−0
- README.md +2/−2
- github.cabal +2/−1
Github/Data.hs view
@@ -122,6 +122,12 @@ <*> o .: "id" parseJSON _ = fail "Could not build a Comment" +instance ToJSON NewComment where+ toJSON (NewComment b) = object [ "body" .= b ]++instance ToJSON EditComment where+ toJSON (EditComment b) = object [ "body" .= b ]+ instance FromJSON Diff where parseJSON (Object o) = Diff <$> o .: "status"@@ -217,6 +223,26 @@ <*> o .: "comments" <*> o .:? "milestone" parseJSON _ = fail "Could not build an Issue"++instance ToJSON NewIssue where+ toJSON (NewIssue t b a m ls) =+ object+ [ "title" .= t+ , "body" .= b+ , "assignee" .= a+ , "milestone" .= m+ , "labels" .= ls ]++instance ToJSON EditIssue where+ toJSON (EditIssue t b a s m ls) =+ object $ filter notNull $ [ "title" .= t+ , "body" .= b+ , "assignee" .= a+ , "state" .= s+ , "milestone" .= m+ , "labels" .= ls ]+ where notNull (_, Null) = False+ notNull (_, _) = True instance FromJSON Milestone where parseJSON (Object o) =
Github/Data/Definitions.hs view
@@ -107,6 +107,14 @@ ,commentId :: Int } deriving (Show, Data, Typeable, Eq, Ord) +data NewComment = NewComment {+ newCommentBody :: String+} deriving (Show, Data, Typeable, Eq, Ord)++data EditComment = EditComment {+ editCommentBody :: String+} deriving (Show, Data, Typeable, Eq, Ord)+ data Diff = Diff { diffStatus :: String ,diffBehindBy :: Int@@ -194,6 +202,24 @@ ,issueComments :: Int ,issueMilestone :: Maybe Milestone } deriving (Show, Data, Typeable, Eq, Ord)++data NewIssue = NewIssue {+ newIssueTitle :: String+, newIssueBody :: Maybe String+, newIssueAssignee :: Maybe String+, newIssueMilestone :: Maybe Int+, newIssueLabels :: Maybe [String]+} deriving (Show, Data, Typeable, Eq, Ord)++data EditIssue = EditIssue {+ editIssueTitle :: Maybe String+, editIssueBody :: Maybe String+, editIssueAssignee :: Maybe String+, editIssueState :: Maybe String+, editIssueMilestone :: Maybe Int+, editIssueLabels :: Maybe [String]+} deriving (Show, Data, Typeable, Eq, Ord)+ data Milestone = Milestone { milestoneCreator :: GithubOwner
+ Github/GitData/Blobs.hs view
@@ -0,0 +1,16 @@+-- | The API for dealing with git blobs from Github repos, as described in+-- <http://developer.github.com/v3/git/blobs/>.+module Github.GitData.Blobs (+ blob+,module Github.Data+) where++import Github.Data+import Github.Private++-- | Get a blob by SHA1.+--+-- > blob "thoughtbot" "paperclip" "bc5c51d1ece1ee45f94b056a0f5a1674d7e8cba9"+blob :: String -> String -> String -> IO (Either Error Blob)+blob user repoName sha =+ githubGet ["repos", user, repoName, "git", "blobs", sha]
Github/Issues.hs view
@@ -1,3 +1,4 @@+{-# LANGUAGE OverloadedStrings #-} -- | The issues API as described on <http://developer.github.com/v3/issues/>. module Github.Issues ( issue@@ -5,11 +6,23 @@ ,issuesForRepo ,issuesForRepo' ,IssueLimitation(..)++-- * Modifying Issues+-- |+-- Only authenticated users may create and edit issues.+,GithubAuth(..)++,createIssue+,newIssue+,editIssue+,editOfIssue ,module Github.Data ) where import Github.Data import Github.Private+import Data.Aeson.Types+import qualified Data.Aeson as A import Data.List (intercalate) import Data.Time.Format (formatTime) import System.Locale (defaultTimeLocale)@@ -84,3 +97,36 @@ -- > issuesForRepo "thoughtbot" "paperclip" [NoMilestone, OnlyClosed, Mentions "jyurek", Ascending] issuesForRepo :: String -> String -> [IssueLimitation] -> IO (Either Error [Issue]) issuesForRepo = issuesForRepo' Nothing+++-- Creating new issues.++newIssue :: String -> NewIssue+newIssue title = NewIssue title Nothing Nothing Nothing Nothing+++-- |+-- Create a new issue.+--+-- > createIssue (GithubUser (user, password)) user repo+-- > (newIssue "some_repo") {...}+createIssue :: GithubAuth -> String -> String -> NewIssue+ -> IO (Either Error Issue)+createIssue auth user repo = githubPost auth ["repos", user, repo, "issues"]+++-- Editing issues.++editOfIssue :: EditIssue+editOfIssue = EditIssue Nothing Nothing Nothing Nothing Nothing Nothing+++-- |+-- Edit an issue.+--+-- > editIssue (GithubUser (user, password)) user repo issue+-- > editOfIssue {...}+editIssue :: GithubAuth -> String -> String -> Int -> EditIssue+ -> IO (Either Error Issue)+editIssue auth user repo iss =+ githubPatch auth ["repos", user, repo, "issues", show iss]
Github/Issues/Comments.hs view
@@ -4,6 +4,14 @@ comment ,comments ,comments'++-- * Modifying Comments+-- |+-- Only authenticated users may create and edit comments.+,GithubAuth(..)++,createComment+,editComment ,module Github.Data ) where @@ -31,3 +39,27 @@ comments' auth user repoName issueNumber = githubGet' auth ["repos", user, repoName, "issues", show issueNumber, "comments"] +++-- |+-- Create a new comment.+--+-- > createComment (GithubUser (user, password)) user repo issue+-- > "some words"+createComment :: GithubAuth -> String -> String -> Int -> String+ -> IO (Either Error Comment)+createComment auth user repo iss body =+ githubPost auth+ ["repos", user, repo, "issues", show iss, "comments"] (NewComment body)+++-- |+-- Edit a comment.+--+-- > editComment (GithubUser (user, password)) user repo commentid+-- > "new words"+editComment :: GithubAuth -> String -> String -> Int -> String+ -> IO (Either Error Comment)+editComment auth user repo commid body =+ githubPatch auth ["repos", user, repo, "issues", "comments", show commid]+ (EditComment body)
README.md view
@@ -22,7 +22,7 @@ Example Usage ============= -See the samples in the [samples/](https://github.com/mike-burns/github/tree/master/samples) directory.+See the samples in the [samples/](https://github.com/fpco/github/tree/master/samples) directory. Documentation =============@@ -46,7 +46,7 @@ Contributions ============= -Please see [CONTRIBUTING.md](https://github.com/mike-burns/github/tree/master/CONTRIBUTING.md) for details on how you can help.+Please see [CONTRIBUTING.md](https://github.com/fpco/github/blob/master/CONTRIBUTING.md) for details on how you can help. Copyright =========
github.cabal view
@@ -7,7 +7,7 @@ -- The package version. See the Haskell package versioning policy -- (http://www.haskell.org/haskellwiki/Package_versioning_policy) for -- standards guiding when and how versions should be incremented.-Version: 0.7.0+Version: 0.7.1 -- A short (one-line) description of the package. Synopsis: Access to the Github API, v3.@@ -120,6 +120,7 @@ Github.GitData.Commits, Github.GitData.References, Github.GitData.Trees,+ Github.GitData.Blobs, Github.Issues, Github.Issues.Comments, Github.Issues.Events,