Skip to content

Commit 2fa617c

Browse files
committed
Tighten lower bounds
Also add RateLimitSpec
1 parent 6ae6af7 commit 2fa617c

File tree

11 files changed

+96
-110
lines changed

11 files changed

+96
-110
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## Changes for 0.19.1
1+
## Changes for 0.20
22

33
- Add ratelimit endpoint
44
[#315](https://github.com/phadej/github/pull/315/)

github.cabal

Lines changed: 27 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
name: github
2-
version: 0.19
3-
x-revision: 3
2+
version: 0.20
43
synopsis: Access to the GitHub API, v3.
54
description:
65
The GitHub API provides programmatic access to the full
@@ -140,6 +139,7 @@ Library
140139
-- Packages bundles with GHC, mtl and text are also here
141140
build-depends:
142141
base >=4.7 && <4.12,
142+
binary >=0.7.1.0 && <0.10,
143143
bytestring >=0.10.4.0 && <0.11,
144144
containers >=0.5.5.1 && <0.6,
145145
deepseq >=1.3.0.2 && <1.5,
@@ -150,34 +150,28 @@ Library
150150

151151
-- other packages
152152
build-depends:
153-
aeson >=0.7.0.6 && <1.5,
154-
base-compat >=0.9.1 && <0.11,
153+
aeson >=1.4.0.0 && <1.5,
154+
base-compat >=0.10.4 && <0.11,
155155
base16-bytestring >=0.1.1.6 && <0.2,
156-
binary >=0.7.1.0 && <0.10,
157-
binary-orphans >=0.1.0.0 && <0.2,
156+
binary-orphans >=0.1.8.0 && <0.2,
158157
byteable >=0.1.1 && <0.2,
159-
cryptohash >=0.11 && <0.12,
160-
deepseq-generics >=0.1.1.2 && <0.3,
161-
exceptions >=0.8.0.2 && <0.11,
162-
hashable >=1.2.3.3 && <1.3,
163-
http-client >=0.4.8.1 && <0.6,
164-
http-client-tls >=0.2.2 && <0.4,
165-
http-link-header >=1.0.1 && <1.1,
158+
cryptohash >=0.11.9 && <0.12,
159+
deepseq-generics >=0.2.0.0 && <0.3,
160+
exceptions >=0.10.0 && <0.11,
161+
hashable >=1.2.7.0 && <1.3,
162+
http-client >=0.5.12 && <0.6,
163+
http-client-tls >=0.3.5.3 && <0.4,
164+
http-link-header >=1.0.3.1 && <1.1,
166165
http-types >=0.12.1 && <0.13,
167-
iso8601-time >=0.1.4 && <0.2,
168-
network-uri >=2.6.0.3 && <2.7,
169-
semigroups >=0.16.2.2 && <0.19,
170-
transformers-compat >=0.4.0.3 && <0.7,
171-
unordered-containers >=0.2 && <0.3,
172-
vector >=0.10.12.3 && <0.13,
173-
vector-instances >=3.3.0.1 && <3.5,
174-
175-
tls >=1.3.5
166+
iso8601-time >=0.1.5 && <0.2,
167+
network-uri >=2.6.1.0 && <2.7,
168+
semigroups >=0.18.5 && <0.19,
169+
transformers-compat >=0.6 && <0.7,
170+
unordered-containers >=0.2.9.0 && <0.3,
171+
vector >=0.12.0.1 && <0.13,
172+
vector-instances >=3.4 && <3.5,
176173

177-
if flag(aeson-compat)
178-
build-depends: aeson-compat >=0.3.0.0 && <0.4
179-
else
180-
build-depends: aeson-extra >=0.2.0.0 && <0.3
174+
tls >=1.4.1
181175

182176
test-suite github-test
183177
default-language: Haskell2010
@@ -188,28 +182,25 @@ test-suite github-test
188182
other-modules:
189183
GitHub.ActivitySpec
190184
GitHub.CommitsSpec
191-
GitHub.OrganizationsSpec
185+
GitHub.EventsSpec
192186
GitHub.IssuesSpec
193-
GitHub.PullRequestsSpec
187+
GitHub.OrganizationsSpec
194188
GitHub.PullRequestReviewsSpec
189+
GitHub.PullRequestsSpec
190+
GitHub.RateLimitSpec
195191
GitHub.ReleasesSpec
196192
GitHub.ReposSpec
197193
GitHub.SearchSpec
198194
GitHub.UsersSpec
199-
GitHub.EventsSpec
200195
main-is: Spec.hs
201196
ghc-options: -Wall
202-
build-tool-depends: hspec-discover:hspec-discover
197+
build-tool-depends: hspec-discover:hspec-discover >=2.5.6 && <2.6
203198
build-depends: base,
204199
base-compat,
200+
aeson,
205201
bytestring,
206202
github,
207203
vector,
208204
unordered-containers,
209205
file-embed,
210-
hspec
211-
if flag(aeson-compat)
212-
build-depends: aeson-compat
213-
else
214-
build-depends: aeson-extra
215-
206+
hspec >= 2.5.6 && <2.6

spec/GitHub/OrganizationsSpec.hs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@
33
module GitHub.OrganizationsSpec where
44

55
import GitHub.Auth (Auth (..))
6-
import GitHub.Data (SimpleOrganization (..),
7-
SimpleOwner (..),
8-
SimpleTeam (..))
6+
import GitHub.Data
7+
(SimpleOrganization (..), SimpleOwner (..), SimpleTeam (..))
98
import GitHub.Endpoints.Organizations (publicOrganizationsFor')
109
import GitHub.Endpoints.Organizations.Members (membersOf')
1110

12-
import Data.Aeson.Compat (eitherDecodeStrict)
11+
import Data.Aeson (eitherDecodeStrict)
1312
import Data.Either.Compat (isRight)
1413
import Data.FileEmbed (embedFile)
1514
import Data.String (fromString)
1615
import System.Environment (lookupEnv)
17-
import Test.Hspec (Spec, describe, it, pendingWith, shouldBe,
18-
shouldSatisfy)
16+
import Test.Hspec
17+
(Spec, describe, it, pendingWith, shouldBe, shouldSatisfy)
1918

2019
fromRightS :: Show a => Either a b -> b
2120
fromRightS (Right b) = b

spec/GitHub/PullRequestReviewsSpec.hs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@
22
module GitHub.PullRequestReviewsSpec where
33

44
import qualified GitHub
5-
import GitHub.Data.Id (Id(Id))
5+
import GitHub.Data.Id (Id (Id))
66

77
import Prelude ()
88
import Prelude.Compat
99

10-
import Data.Either.Compat (isRight)
11-
import Data.Foldable (for_)
12-
import Data.String (fromString)
13-
import System.Environment (lookupEnv)
14-
import Test.Hspec (Spec, describe, it, pendingWith, shouldSatisfy)
10+
import Data.Either.Compat (isRight)
11+
import Data.Foldable (for_)
12+
import Data.String (fromString)
13+
import System.Environment (lookupEnv)
14+
import Test.Hspec (Spec, describe, it, pendingWith, shouldSatisfy)
1515

1616
withAuth :: (GitHub.Auth -> IO ()) -> IO ()
1717
withAuth action = do

spec/GitHub/PullRequestsSpec.hs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,21 @@
33
module GitHub.PullRequestsSpec where
44

55
import qualified GitHub
6-
import GitHub.Data.Id (Id(Id))
6+
import GitHub.Data.Id (Id (Id))
77

88
import Prelude ()
99
import Prelude.Compat
1010

11-
import Data.Aeson.Compat (eitherDecodeStrict)
12-
import Data.ByteString (ByteString)
13-
import Data.Either.Compat (isRight)
14-
import Data.FileEmbed (embedFile)
15-
import Data.Foldable (for_)
16-
import Data.String (fromString)
17-
import qualified Data.Vector as V
18-
import System.Environment (lookupEnv)
19-
import Test.Hspec (Spec, describe, it, pendingWith, shouldBe, shouldSatisfy)
11+
import Data.Aeson (eitherDecodeStrict)
12+
import Data.ByteString (ByteString)
13+
import Data.Either.Compat (isRight)
14+
import Data.FileEmbed (embedFile)
15+
import Data.Foldable (for_)
16+
import Data.String (fromString)
17+
import qualified Data.Vector as V
18+
import System.Environment (lookupEnv)
19+
import Test.Hspec
20+
(Spec, describe, it, pendingWith, shouldBe, shouldSatisfy)
2021

2122
fromRightS :: Show a => Either a b -> b
2223
fromRightS (Right b) = b

spec/GitHub/RateLimitSpec.hs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
{-# LANGUAGE OverloadedStrings #-}
2+
module GitHub.RateLimitSpec where
3+
4+
import qualified GitHub
5+
6+
import Prelude ()
7+
import Prelude.Compat
8+
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 (Spec, describe, it, pendingWith, shouldSatisfy)
14+
15+
fromRightS :: Show a => Either a b -> b
16+
fromRightS (Right b) = b
17+
fromRightS (Left a) = error $ "Expected a Right and got a Left" ++ show a
18+
19+
withAuth :: (GitHub.Auth -> IO ()) -> IO ()
20+
withAuth action = do
21+
mtoken <- lookupEnv "GITHUB_TOKEN"
22+
case mtoken of
23+
Nothing -> pendingWith "no GITHUB_TOKEN"
24+
Just token -> action (GitHub.OAuth $ fromString token)
25+
26+
spec :: Spec
27+
spec = describe "rateLimitR" $
28+
it "works" $ withAuth $ \auth -> do
29+
cs <- GitHub.executeRequest auth GitHub.rateLimitR
30+
cs `shouldSatisfy` isRight

spec/GitHub/SearchSpec.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
{-# LANGUAGE TemplateHaskell #-}
33
module GitHub.SearchSpec where
44

5-
import Prelude ()
5+
import Prelude ()
66
import Prelude.Compat
77

8-
import Data.Aeson.Compat (eitherDecodeStrict)
8+
import Data.Aeson (eitherDecodeStrict)
99
import Data.FileEmbed (embedFile)
1010
import Data.Proxy (Proxy (..))
1111
import Data.String (fromString)
@@ -14,7 +14,7 @@ import Test.Hspec (Spec, describe, it, pendingWith, shouldBe)
1414

1515
import qualified Data.Vector as V
1616

17-
import GitHub.Data (Auth (..), Issue (..), mkId, IssueState (..))
17+
import GitHub.Data (Auth (..), Issue (..), IssueState (..), mkId)
1818
import GitHub.Endpoints.Search (SearchResult (..), searchIssues')
1919

2020
fromRightS :: Show a => Either a b -> b

spec/GitHub/UsersSpec.hs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
{-# LANGUAGE TemplateHaskell #-}
33
module GitHub.UsersSpec where
44

5-
import Data.Aeson.Compat (eitherDecodeStrict)
5+
import Data.Aeson (eitherDecodeStrict)
66
import Data.Either.Compat (isLeft, isRight)
77
import Data.FileEmbed (embedFile)
88
import Data.String (fromString)
99
import System.Environment (lookupEnv)
10-
import Test.Hspec (Spec, describe, it, pendingWith, shouldBe,
11-
shouldSatisfy)
10+
import Test.Hspec
11+
(Spec, describe, it, pendingWith, shouldBe, shouldSatisfy)
1212

1313
import qualified GitHub
1414

15-
import GitHub.Data (Auth (..), Organization (..),
16-
User (..), fromOwner)
17-
import GitHub.Endpoints.Users (ownerInfoForR, userInfoCurrent',
18-
userInfoFor')
15+
import GitHub.Data
16+
(Auth (..), Organization (..), User (..), fromOwner)
17+
import GitHub.Endpoints.Users
18+
(ownerInfoForR, userInfoCurrent', userInfoFor')
1919
import GitHub.Endpoints.Users.Followers (usersFollowedByR, usersFollowingR)
2020
import GitHub.Request (executeRequest)
2121

src/GitHub/Data/Request.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import qualified Data.Text as T
3737
import qualified Network.HTTP.Types as Types
3838
import qualified Network.HTTP.Types.Method as Method
3939
import Network.URI (URI)
40+
4041
------------------------------------------------------------------------------
4142
-- Auxillary types
4243
------------------------------------------------------------------------------

src/GitHub/Internal/Prelude.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ module GitHub.Internal.Prelude (
3737
import Control.Applicative ((<|>))
3838
import Control.DeepSeq (NFData (..))
3939
import Control.DeepSeq.Generics (genericRnf)
40-
import Data.Aeson.Compat
40+
import Data.Aeson
4141
(FromJSON (..), Object, ToJSON (..), Value (..), encode, object,
4242
withObject, withText, (.!=), (.:), (.:?), (.=))
4343
import Data.Aeson.Types (typeMismatch)

0 commit comments

Comments
 (0)