Skip to content

Commit

Permalink
Restyled by stylish-haskell
Browse files Browse the repository at this point in the history
  • Loading branch information
restyled-commits committed Sep 11, 2024
1 parent 2e0cd5a commit 6b15c9e
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 38 deletions.
6 changes: 3 additions & 3 deletions github-app-token/src/GitHub/App/Token.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ module GitHub.App.Token
, AccessToken (..)
) where

import GitHub.App.Token.AppCredentials
import GitHub.App.Token.Generate
import GitHub.App.Token.JWT
import GitHub.App.Token.AppCredentials
import GitHub.App.Token.Generate
import GitHub.App.Token.JWT
6 changes: 3 additions & 3 deletions github-app-token/src/GitHub/App/Token/AppCredentials.hs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ module GitHub.App.Token.AppCredentials
, PrivateKey (..)
) where

import GitHub.App.Token.JWT (PrivateKey (..))
import GitHub.App.Token.Prelude
import GitHub.App.Token.JWT (PrivateKey (..))
import GitHub.App.Token.Prelude

data AppCredentials = AppCredentials
{ appId :: AppId
{ appId :: AppId
, privateKey :: PrivateKey
}

Expand Down
32 changes: 15 additions & 17 deletions github-app-token/src/GitHub/App/Token/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,40 @@ module GitHub.App.Token.Generate
, AccessTokenJsonDecodeError (..)
) where

import GitHub.App.Token.Prelude
import GitHub.App.Token.Prelude

import Data.Aeson (FromJSON, eitherDecode)
import Data.ByteString.Lazy qualified as BSL
import GitHub.App.Token.AppCredentials
import GitHub.App.Token.JWT
import Network.HTTP.Simple
( addRequestHeader
, getResponseBody
, getResponseStatus
, httpLBS
, parseRequest
)
import Network.HTTP.Types.Header (hAccept, hAuthorization, hUserAgent)
import Network.HTTP.Types.Status (Status, statusIsSuccessful)
import Data.Aeson (FromJSON, eitherDecode)
import qualified Data.ByteString.Lazy as BSL
import GitHub.App.Token.AppCredentials
import GitHub.App.Token.JWT
import Network.HTTP.Simple (addRequestHeader,
getResponseBody,
getResponseStatus, httpLBS,
parseRequest)
import Network.HTTP.Types.Header (hAccept, hAuthorization,
hUserAgent)
import Network.HTTP.Types.Status (Status, statusIsSuccessful)

newtype InstallationId = InstallationId
{ unwrap :: Int
}

data AccessToken = AccessToken
{ token :: Text
{ token :: Text
, expires_at :: UTCTime
}
deriving stock (Show, Generic)
deriving anyclass (FromJSON)

data AccessTokenHttpError = AccessTokenHttpError
{ status :: Status
, body :: BSL.ByteString
, body :: BSL.ByteString
}
deriving stock (Show)
deriving anyclass (Exception)

data AccessTokenJsonDecodeError = AccessTokenJsonDecodeError
{ body :: BSL.ByteString
{ body :: BSL.ByteString
, message :: String
}
deriving stock (Show)
Expand Down
13 changes: 7 additions & 6 deletions github-app-token/src/GitHub/App/Token/JWT.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,13 @@ module GitHub.App.Token.JWT
, InvalidIssuer (..)
) where

import GitHub.App.Token.Prelude
import GitHub.App.Token.Prelude

import Data.Text.Encoding (encodeUtf8)
import Data.Time (NominalDiffTime, addUTCTime, getCurrentTime)
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
import Web.JWT qualified as JWT
import Data.Text.Encoding (encodeUtf8)
import Data.Time (NominalDiffTime, addUTCTime,
getCurrentTime)
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
import qualified Web.JWT as JWT

newtype ExpirationTime = ExpirationTime
{ unwrap :: NominalDiffTime
Expand All @@ -43,7 +44,7 @@ newtype InvalidPrivateKey = InvalidPrivateKey PrivateKey

data InvalidDate = InvalidDate
{ field :: String
, date :: UTCTime
, date :: UTCTime
}
deriving stock (Show)
deriving anyclass (Exception)
Expand Down
19 changes: 10 additions & 9 deletions github-app-token/src/GitHub/App/Token/Prelude.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ module GitHub.App.Token.Prelude
( module X
) where

import Prelude as X hiding (exp)
import Prelude as X hiding (exp)

import Control.Monad as X (unless, when)
import Control.Monad.IO.Class as X (MonadIO (..))
import Data.ByteString as X (ByteString)
import Data.Text as X (Text, pack, unpack)
import Data.Time as X (UTCTime)
import GHC.Generics as X (Generic)
import Path as X (Abs, Dir, File, Path, Rel, toFilePath)
import UnliftIO.Exception as X (Exception, throwIO)
import Control.Monad as X (unless, when)
import Control.Monad.IO.Class as X (MonadIO (..))
import Data.ByteString as X (ByteString)
import Data.Text as X (Text, pack, unpack)
import Data.Time as X (UTCTime)
import GHC.Generics as X (Generic)
import Path as X (Abs, Dir, File, Path, Rel,
toFilePath)
import UnliftIO.Exception as X (Exception, throwIO)

0 comments on commit 6b15c9e

Please sign in to comment.