module Network.Wreq.Internal.OAuth1 (signRequest) where

import Network.HTTP.Client (Request(..))
import Web.Authenticate.OAuth ( signOAuth, newOAuth, oauthConsumerKey
                              , oauthConsumerSecret, newCredential)
import qualified Data.ByteString as S

signRequest :: S.ByteString -> S.ByteString -> S.ByteString -> S.ByteString -> Request -> IO Request
signRequest :: ByteString
-> ByteString -> ByteString -> ByteString -> Request -> IO Request
signRequest ByteString
consumerToken ByteString
consumerSecret ByteString
token ByteString
tokenSecret = OAuth -> Credential -> Request -> IO Request
forall (m :: * -> *).
MonadIO m =>
OAuth -> Credential -> Request -> m Request
signOAuth OAuth
app Credential
creds
  where
    app :: OAuth
app = OAuth
newOAuth { oauthConsumerKey = consumerToken, oauthConsumerSecret = consumerSecret }
    creds :: Credential
creds = ByteString -> ByteString -> Credential
newCredential ByteString
token ByteString
tokenSecret