packages feed

github 0.13.1 → 0.13.2

raw patch · 8 files changed

+111/−13 lines, 8 filesdep +hspecdep ~http-conduitPVP ok

version bump matches the API change (PVP)

Dependencies added: hspec

Dependency ranges changed: http-conduit

API changes (from Hackage documentation)

+ Github.Data: instance ToJSON CreatePullRequest
+ Github.Data.Definitions: CreatePullRequest :: String -> String -> String -> String -> CreatePullRequest
+ Github.Data.Definitions: CreatePullRequestIssue :: Int -> String -> String -> CreatePullRequest
+ Github.Data.Definitions: createPullRequestBase :: CreatePullRequest -> String
+ Github.Data.Definitions: createPullRequestBody :: CreatePullRequest -> String
+ Github.Data.Definitions: createPullRequestHead :: CreatePullRequest -> String
+ Github.Data.Definitions: createPullRequestIssueNum :: CreatePullRequest -> Int
+ Github.Data.Definitions: createPullRequestTitle :: CreatePullRequest -> String
+ Github.Data.Definitions: data CreatePullRequest
+ Github.Data.Definitions: instance Show CreatePullRequest
+ Github.Issues.Events: event' :: Maybe GithubAuth -> String -> String -> Int -> IO (Either Error Event)
+ Github.Issues.Events: eventsForIssue' :: Maybe GithubAuth -> String -> String -> Int -> IO (Either Error [Event])
+ Github.Issues.Events: eventsForRepo' :: Maybe GithubAuth -> String -> String -> IO (Either Error [Event])
+ Github.PullRequests: createPullRequest :: GithubAuth -> String -> String -> CreatePullRequest -> IO (Either Error DetailedPullRequest)

Files

Github/Data.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE DeriveDataTypeable, OverloadedStrings #-}+{-# LANGUAGE CPP, DeriveDataTypeable, OverloadedStrings #-}  -- | This module re-exports the @Github.Data.Definitions@ module, adding -- instances of @FromJSON@ to it. If you wish to use the data without the@@ -6,16 +6,21 @@  module Github.Data (module Github.Data.Definitions) where -import Data.Time import Control.Applicative import Control.Monad import qualified Data.Text as T import Data.Aeson.Types-import System.Locale (defaultTimeLocale) import qualified Data.Vector as V import qualified Data.HashMap.Lazy as Map import Data.Hashable (Hashable) +#if MIN_VERSION_base(4,8,0)+import Data.Time+#else+import Data.Time+import System.Locale (defaultTimeLocale)+#endif+ import Github.Data.Definitions  instance FromJSON GithubDate where@@ -376,6 +381,12 @@     object $ filter notNull [ "title" .= t, "body" .= b, "state" .= s ]     where notNull (_, Null) = False           notNull (_, _) = True++instance ToJSON CreatePullRequest where+  toJSON (CreatePullRequest t b headPR basePR) =+    object [ "title" .= t, "body" .= b, "head" .= headPR, "base" .= basePR ]+  toJSON (CreatePullRequestIssue issueNum headPR basePR) =+    object [ "issue" .= issueNum, "head" .= headPR, "base" .= basePR]  instance FromJSON DetailedPullRequest where   parseJSON (Object o) =
Github/Data/Definitions.hs view
@@ -378,6 +378,20 @@   ,editPullRequestState :: Maybe EditPullRequestState } deriving (Show) +data CreatePullRequest =+      CreatePullRequest+      { createPullRequestTitle :: String+      , createPullRequestBody  :: String+      , createPullRequestHead  :: String+      , createPullRequestBase  :: String+      }+    | CreatePullRequestIssue+      { createPullRequestIssueNum :: Int+      , createPullRequestHead     :: String+      , createPullRequestBase     :: String+      }+    deriving (Show)+ data PullRequestLinks = PullRequestLinks {    pullRequestLinksReviewComments :: String   ,pullRequestLinksComments :: String
Github/Issues.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE CPP, OverloadedStrings #-} -- | The issues API as described on <http://developer.github.com/v3/issues/>. module Github.Issues (  issue@@ -16,8 +16,13 @@ import Github.Data import Github.Private import Data.List (intercalate)-import Data.Time.Format (formatTime)+#if MIN_VERSION_base(4, 8, 0)+import Data.Time (defaultTimeLocale)+#else import System.Locale (defaultTimeLocale)+#endif++import Data.Time.Format (formatTime) import Data.Time.Clock (UTCTime(..))  -- | A data structure for describing how to filter issues. This is used by
Github/Issues/Events.hs view
@@ -2,8 +2,11 @@ -- <http://developer.github.com/v3/issues/events/> module Github.Issues.Events (  eventsForIssue+,eventsForIssue' ,eventsForRepo+,eventsForRepo' ,event+,event' ,module Github.Data ) where @@ -17,6 +20,13 @@ eventsForIssue user reqRepoName reqIssueNumber =   githubGet ["repos", user, reqRepoName, "issues", show reqIssueNumber, "events"] +-- | All events that have happened on an issue, using authentication.+--+-- > eventsForIssue' (GithubUser (user, password)) "thoughtbot" "paperclip" 49+eventsForIssue' :: Maybe GithubAuth -> String -> String -> Int -> IO (Either Error [Event])+eventsForIssue' auth user reqRepoName reqIssueNumber =+  githubGet' auth ["repos", user, reqRepoName, "issues", show reqIssueNumber, "events"]+ -- | All the events for all issues in a repo. -- -- > eventsForRepo "thoughtbot" "paperclip"@@ -24,9 +34,23 @@ eventsForRepo user reqRepoName =   githubGet ["repos", user, reqRepoName, "issues", "events"] +-- | All the events for all issues in a repo, using authentication.+--+-- > eventsForRepo' (GithubUser (user, password)) "thoughtbot" "paperclip"+eventsForRepo' :: Maybe GithubAuth -> String -> String -> IO (Either Error [Event])+eventsForRepo' auth user reqRepoName =+  githubGet' auth ["repos", user, reqRepoName, "issues", "events"]+ -- | Details on a specific event, by the event's ID. -- -- > event "thoughtbot" "paperclip" 5335772 event :: String -> String -> Int -> IO (Either Error Event) event user reqRepoName reqEventId =   githubGet ["repos", user, reqRepoName, "issues", "events", show reqEventId]++-- | Details on a specific event, by the event's ID, using authentication.+--+-- > event' (GithubUser (user, password)) "thoughtbot" "paperclip" 5335772+event' :: Maybe GithubAuth -> String -> String -> Int -> IO (Either Error Event)+event' auth user reqRepoName reqEventId =+  githubGet' auth ["repos", user, reqRepoName, "issues", "events", show reqEventId]
Github/Private.hs view
@@ -1,5 +1,5 @@ {-# LANGUAGE OverloadedStrings, StandaloneDeriving, DeriveDataTypeable #-}-{-# LANGUAGE CPP #-}+{-# LANGUAGE CPP, FlexibleContexts #-} module Github.Private where  import Github.Data
Github/PullRequests.hs view
@@ -12,6 +12,7 @@ ,pullRequestFiles ,isPullRequestMerged ,mergePullRequest+,createPullRequest ,updatePullRequest ,module Github.Data ) where@@ -103,3 +104,11 @@ buildCommitMessageMap :: Maybe String -> M.Map String String buildCommitMessageMap (Just commitMessage) = M.singleton "commit_message" commitMessage buildCommitMessageMap _ = M.empty++createPullRequest :: GithubAuth+                  -> String+                  -> String+                  -> CreatePullRequest+                  -> IO (Either Error DetailedPullRequest)+createPullRequest auth reqUserName reqRepoName createPR =+    githubPost auth ["repos", reqUserName, reqRepoName, "pulls"] createPR
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.13.1+Version:             0.13.2  -- A short (one-line) description of the package. Synopsis:            Access to the Github API, v3.@@ -18,7 +18,7 @@                      like references and trees. This library wraps all of that, exposing a basic but                      Haskell-friendly set of functions and data structures.                      .-                     For more of an overview please see the README: <https://github.com/fpco/github/blob/master/README.md>+                     For more of an overview please see the README: <https://github.com/jwiegley/github/blob/master/README.md>  -- The license under which the package is released. License:             BSD3@@ -31,12 +31,12 @@  -- An email address to which users can send suggestions, bug reports, -- and patches.-Maintainer:          johnw@fpcomplete.com+Maintainer:          johnw@newartisans.com -Homepage:            https://github.com/fpco/github+Homepage:            https://github.com/jwiegley/github  -- A copyright notice.-Copyright:           Copyright 2012-2013 Mike Burns, Copyright 2013 John Wiegley+Copyright:           Copyright 2012-2013 Mike Burns, Copyright 2013-2015 John Wiegley  Category:            Network APIs @@ -113,14 +113,15 @@   -- Constraint on the version of Cabal needed to build this package.-Cabal-version:       >=1.6+Cabal-version:       >=1.10  source-repository head   type: git-  location: git://github.com/fpco/github.git+  location: git://github.com/jwiegley/github.git  Library   -- Modules exported by the library.+  Default-Language: Haskell2010   Exposed-modules: Github.Auth,                    Github.Data,                    Github.Data.Definitions,@@ -183,3 +184,36 @@   -- Build-tools:    GHC-Options: -Wall -fno-warn-orphans+++test-suite github-test+  default-language: Haskell2010+  type: exitcode-stdio-1.0+  hs-source-dirs: spec, .+  main-is: Spec.hs+  build-depends: base >= 4.0 && < 5.0,+                 time,+                 aeson >= 0.6.1.0,+                 attoparsec >= 0.10.3.0,+                 bytestring,+                 case-insensitive >= 0.4.0.4,+                 containers,+                 hashable,+                 text,+                 old-locale,+                 HTTP,+                 network,+                 http-conduit >= 1.8,+                 conduit,+                 failure,+                 http-types,+                 data-default,+                 vector,+                 unordered-containers >= 0.2 && < 0.3,+                 cryptohash >= 0.11,+                 byteable >= 0.1.0,+                 base16-bytestring >= 0.1.1.6++                 , hspec++  ghc-options: -Wall -fno-warn-orphans
+ spec/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}