module NationStates (
Context(),
newContext,
newContext',
module NationStates.Types,
) where
import Network.HTTP.Client
import Network.HTTP.Client.TLS
import NationStates.Core
import NationStates.RateLimit
import NationStates.Types
newContext
:: String
-> IO Context
newContext userAgent = newContext' userAgent True
newContext'
:: String
-> Bool
-> IO Context
newContext' userAgent isSecure = do
man <- newManager $
if isSecure
then tlsManagerSettings
else defaultManagerSettings
limit <- newRateLimit 0.6
return Context {
contextManager = man,
contextRateLimit = rateLimit limit,
contextIsSecure = isSecure,
contextUserAgent = userAgent
}