Revert "Support pagination (#503)" · haskell-github/github@dc43816 · GitHub
Skip to content

Commit dc43816

Browse files
committed
Revert "Support pagination (#503)"
This reverts commit 2bed394.
1 parent 63a4e0c commit dc43816

4 files changed

Lines changed: 19 additions & 115 deletions

File tree

‎github.cabal‎

Lines changed: 0 additions & 1 deletion

‎spec/GitHub/IssuesSpec.hs‎

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,12 @@ import qualified GitHub
66
import Prelude ()
77
import Prelude.Compat
88

9-
import Data.Either.Compat (isRight)
10-
import Data.Foldable (for_)
11-
import Data.String (fromString)
12-
import Network.HTTP.Client (newManager, responseBody)
13-
import System.Environment (lookupEnv)
14-
import Test.Hspec (Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy)
15-
9+
import Data.Either.Compat (isRight)
10+
import Data.Foldable (for_)
11+
import Data.String (fromString)
12+
import System.Environment (lookupEnv)
13+
import Test.Hspec
14+
(Spec, describe, expectationFailure, it, pendingWith, shouldSatisfy)
1615

1716
fromRightS :: Show a => Either a b -> b
1817
fromRightS (Right b) = b
@@ -39,25 +38,6 @@ spec = do
3938
cms <- GitHub.executeRequest auth $
4039
GitHub.commentsR owner repo (GitHub.issueNumber i) 1
4140
cms `shouldSatisfy` isRight
42-
43-
describe "issuesForRepoR paged" $ do
44-
it "works" $ withAuth $ \auth -> for_ repos $ \(owner, repo) -> do
45-
mgr <- newManager GitHub.tlsManagerSettings
46-
ret <- GitHub.executeRequestWithMgrAndRes mgr auth $
47-
GitHub.issuesForRepoR owner repo mempty (GitHub.FetchPage (GitHub.PageParams (Just 2) (Just 1)))
48-
49-
case ret of
50-
Left e ->
51-
expectationFailure . show $ e
52-
Right res -> do
53-
let issues = responseBody res
54-
length issues `shouldSatisfy` (<= 2)
55-
56-
for_ issues $ \i -> do
57-
cms <- GitHub.executeRequest auth $
58-
GitHub.commentsR owner repo (GitHub.issueNumber i) 1
59-
cms `shouldSatisfy` isRight
60-
6141
describe "issueR" $ do
6242
it "fetches issue #428" $ withAuth $ \auth -> do
6343
resIss <- GitHub.executeRequest auth $

‎src/GitHub/Data/Request.hs‎

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ module GitHub.Data.Request (
1414
CommandMethod(..),
1515
toMethod,
1616
FetchCount(..),
17-
PageParams(..),
18-
PageLinks(..),
1917
MediaType (..),
2018
Paths,
2119
IsPathPart(..),
@@ -31,7 +29,6 @@ import GitHub.Internal.Prelude
3129
import qualified Data.ByteString.Lazy as LBS
3230
import qualified Data.Text as T
3331
import qualified Network.HTTP.Types.Method as Method
34-
import Network.URI (URI)
3532

3633
------------------------------------------------------------------------------
3734
-- Path parts
@@ -77,10 +74,7 @@ toMethod Delete = Method.methodDelete
7774

7875
-- | 'PagedQuery' returns just some results, using this data we can specify how
7976
-- many pages we want to fetch.
80-
data FetchCount =
81-
FetchAtLeast !Word
82-
| FetchAll
83-
| FetchPage PageParams
77+
data FetchCount = FetchAtLeast !Word | FetchAll
8478
deriving (Eq, Ord, Read, Show, Generic, Typeable)
8579

8680

@@ -102,37 +96,6 @@ instance Hashable FetchCount
10296
instance Binary FetchCount
10397
instance NFData FetchCount where rnf = genericRnf
10498

105-
-------------------------------------------------------------------------------
106-
-- PageParams
107-
-------------------------------------------------------------------------------
108-
109-
-- | Params for specifying the precise page and items per page.
110-
data PageParams = PageParams {
111-
pageParamsPerPage :: Maybe Int
112-
, pageParamsPage :: Maybe Int
113-
}
114-
deriving (Eq, Ord, Read, Show, Generic, Typeable)
115-
116-
instance Hashable PageParams
117-
instance Binary PageParams
118-
instance NFData PageParams where rnf = genericRnf
119-
120-
-------------------------------------------------------------------------------
121-
-- PageLinks
122-
-------------------------------------------------------------------------------
123-
124-
-- | 'PagedQuery' returns just some results, using this data we can specify how
125-
-- many pages we want to fetch.
126-
data PageLinks = PageLinks {
127-
pageLinksPrev :: Maybe URI
128-
, pageLinksNext :: Maybe URI
129-
, pageLinksLast :: Maybe URI
130-
, pageLinksFirst :: Maybe URI
131-
}
132-
deriving (Eq, Ord, Show, Generic, Typeable)
133-
134-
instance NFData PageLinks where rnf = genericRnf
135-
13699
-------------------------------------------------------------------------------
137100
-- MediaType
138101
-------------------------------------------------------------------------------

‎src/GitHub/Request.hs‎

Lines changed: 12 additions & 50 deletions

0 commit comments

Comments
 (0)