module NationStates (
Context(),
withContext,
module NationStates.Types,
) where
import Network.HTTP.Client
import Network.HTTP.Client.TLS
import NationStates.Core
import NationStates.RateLimit
import NationStates.Types
withContext
:: String
-> (Context -> IO a)
-> IO a
withContext userAgent f = withManager tlsManagerSettings $ \man -> do
limit <- newRateLimit delay
f Context {
contextManager = man,
contextRateLimit = rateLimit limit,
contextUserAgent = userAgent
}
where
delay = 600 * 1000 * 1000