diff --git a/github-app-token/src/GitHub/App/Token.hs b/github-app-token/src/GitHub/App/Token.hs index 6c135ef..88eec22 100644 --- a/github-app-token/src/GitHub/App/Token.hs +++ b/github-app-token/src/GitHub/App/Token.hs @@ -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 diff --git a/github-app-token/src/GitHub/App/Token/AppCredentials.hs b/github-app-token/src/GitHub/App/Token/AppCredentials.hs index 10a3244..9e5c701 100644 --- a/github-app-token/src/GitHub/App/Token/AppCredentials.hs +++ b/github-app-token/src/GitHub/App/Token/AppCredentials.hs @@ -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 } diff --git a/github-app-token/src/GitHub/App/Token/Generate.hs b/github-app-token/src/GitHub/App/Token/Generate.hs index 20f4f06..cffce44 100644 --- a/github-app-token/src/GitHub/App/Token/Generate.hs +++ b/github-app-token/src/GitHub/App/Token/Generate.hs @@ -11,28 +11,26 @@ 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) @@ -40,13 +38,13 @@ data AccessToken = AccessToken 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) diff --git a/github-app-token/src/GitHub/App/Token/JWT.hs b/github-app-token/src/GitHub/App/Token/JWT.hs index db1e973..f06d2d6 100644 --- a/github-app-token/src/GitHub/App/Token/JWT.hs +++ b/github-app-token/src/GitHub/App/Token/JWT.hs @@ -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 @@ -43,7 +44,7 @@ newtype InvalidPrivateKey = InvalidPrivateKey PrivateKey data InvalidDate = InvalidDate { field :: String - , date :: UTCTime + , date :: UTCTime } deriving stock (Show) deriving anyclass (Exception) diff --git a/github-app-token/src/GitHub/App/Token/Prelude.hs b/github-app-token/src/GitHub/App/Token/Prelude.hs index 9caef3c..7c86ba4 100644 --- a/github-app-token/src/GitHub/App/Token/Prelude.hs +++ b/github-app-token/src/GitHub/App/Token/Prelude.hs @@ -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)