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

Skip to content

Commit eb610e6

Browse files
committed
Merge pull request haskell-github#215 from phadej/pull-request-opts
Add PullRequestOptions
2 parents 29e5ca5 + 06f5112 commit eb610e6

File tree

11 files changed

+342
-191
lines changed

11 files changed

+342
-191
lines changed

github.cabal

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ Library
6767
GitHub.Data.Search
6868
GitHub.Data.Teams
6969
GitHub.Data.Activities
70+
GitHub.Data.URL
7071
GitHub.Data.Webhooks
7172
GitHub.Data.Webhooks.Validate
7273
GitHub.Endpoints.Activity.Starring
@@ -102,7 +103,7 @@ Library
102103
build-depends: base >= 4.7 && <4.9,
103104
aeson >=0.7.0.6 && <0.12,
104105
attoparsec >=0.11.3.4 && <0.14,
105-
base-compat >=0.6.0 && <0.10,
106+
base-compat >=0.9.1 && <0.10,
106107
base16-bytestring >=0.1.1.6 && <0.2,
107108
binary >=0.7.1.0 && <0.9,
108109
binary-orphans >=0.1.0.0 && <0.2,

spec/GitHub/PullRequestsSpec.hs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ module GitHub.PullRequestsSpec where
33

44
import qualified GitHub
55

6-
import Data.Either.Compat (isRight)
7-
import Data.Foldable (for_)
8-
import Data.String (fromString)
9-
import System.Environment (lookupEnv)
10-
import Test.Hspec (Spec, describe, it, pendingWith, shouldSatisfy)
6+
import Data.Either.Compat (isRight)
7+
import Data.Foldable (for_)
8+
import Data.Function.Compat ((&))
9+
import Data.String (fromString)
10+
import System.Environment (lookupEnv)
11+
import Test.Hspec (Spec, describe, it, pendingWith, shouldSatisfy)
1112

1213
fromRightS :: Show a => Either a b -> b
1314
fromRightS (Right b) = b
@@ -25,11 +26,13 @@ spec = do
2526
describe "pullRequestsForR" $ do
2627
it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do
2728
cs <- GitHub.executeRequest auth $
28-
GitHub.pullRequestsForR owner repo (Just "closed") Nothing
29+
GitHub.pullRequestsForR owner repo opts Nothing
2930
cs `shouldSatisfy` isRight
3031
where
3132
repos =
3233
[ ("thoughtbot", "paperclip")
3334
, ("phadej", "github")
3435
, ("haskell", "cabal")
3536
]
37+
opts = GitHub.defaultPullRequestOptions
38+
& GitHub.setPullRequestOptionsState GitHub.PullRequestStateClosed

src/GitHub/Data.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ module GitHub.Data (
4545
module GitHub.Data.Request,
4646
module GitHub.Data.Search,
4747
module GitHub.Data.Teams,
48+
module GitHub.Data.URL,
4849
module GitHub.Data.Webhooks,
4950
) where
5051

@@ -68,6 +69,7 @@ import GitHub.Data.Repos
6869
import GitHub.Data.Request
6970
import GitHub.Data.Search
7071
import GitHub.Data.Teams
72+
import GitHub.Data.URL
7173
import GitHub.Data.Webhooks
7274

7375
mkOwnerId :: Int -> Id Owner

src/GitHub/Data/Definitions.hs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import Network.HTTP.Client (HttpException)
2626

2727
import qualified Control.Exception as E
2828
import qualified Data.Text as T
29+
import qualified Data.ByteString as BS
2930

3031
import GitHub.Data.Id
3132
import GitHub.Data.Name
@@ -242,3 +243,9 @@ data OrgMemberRole
242243
| OrgMemberRoleAdmin -- ^ Organization owners.
243244
| OrgMemberRoleMember -- ^ Non-owner organization members.
244245
deriving (Show, Eq, Ord, Enum, Bounded, Typeable, Data, Generic)
246+
247+
-- | Request query string
248+
type QueryString = [(BS.ByteString, Maybe BS.ByteString)]
249+
250+
-- | Count of elements
251+
type Count = Int

0 commit comments

Comments
 (0)