{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.Request
(newRequest, clone, clone_, getMethod, getUrl, getHeaders, getType,
getDestination, getReferrer, getReferrerPolicy, getMode,
getCredentials, getCache, getRedirect, getIntegrity, Request(..),
gTypeRequest)
where
import Prelude ((.), (==), (>>=), return, IO, Int, Float, Double, Bool(..), Maybe, maybe, fromIntegral, round, realToFrac, fmap, Show, Read, Eq, Ord, Maybe(..))
import qualified Prelude (error)
import Data.Typeable (Typeable)
import Data.Traversable (mapM)
import Language.Javascript.JSaddle (JSM(..), JSVal(..), JSString, strictEqual, toJSVal, valToStr, valToNumber, valToBool, js, jss, jsf, jsg, function, asyncFunction, new, array, jsUndefined, (!), (!!))
import Data.Int (Int64)
import Data.Word (Word, Word64)
import JSDOM.Types
import Control.Applicative ((<$>))
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Enums
newRequest ::
(MonadDOM m, ToJSVal input) =>
input -> Maybe RequestInit -> m Request
newRequest input init
= liftDOM
(Request <$> new (jsg "Request") [toJSVal input, toJSVal init])
clone :: (MonadDOM m) => Request -> m Request
clone self
= liftDOM ((self ^. jsf "clone" ()) >>= fromJSValUnchecked)
clone_ :: (MonadDOM m) => Request -> m ()
clone_ self = liftDOM (void (self ^. jsf "clone" ()))
getMethod ::
(MonadDOM m, FromJSString result) => Request -> m result
getMethod self
= liftDOM ((self ^. js "method") >>= fromJSValUnchecked)
getUrl :: (MonadDOM m, FromJSString result) => Request -> m result
getUrl self = liftDOM ((self ^. js "url") >>= fromJSValUnchecked)
getHeaders :: (MonadDOM m) => Request -> m Headers
getHeaders self
= liftDOM ((self ^. js "headers") >>= fromJSValUnchecked)
getType :: (MonadDOM m) => Request -> m RequestType
getType self = liftDOM ((self ^. js "type") >>= fromJSValUnchecked)
getDestination :: (MonadDOM m) => Request -> m RequestDestination
getDestination self
= liftDOM ((self ^. js "destination") >>= fromJSValUnchecked)
getReferrer ::
(MonadDOM m, FromJSString result) => Request -> m result
getReferrer self
= liftDOM ((self ^. js "referrer") >>= fromJSValUnchecked)
getReferrerPolicy :: (MonadDOM m) => Request -> m ReferrerPolicy
getReferrerPolicy self
= liftDOM ((self ^. js "referrerPolicy") >>= fromJSValUnchecked)
getMode :: (MonadDOM m) => Request -> m RequestMode
getMode self = liftDOM ((self ^. js "mode") >>= fromJSValUnchecked)
getCredentials :: (MonadDOM m) => Request -> m RequestCredentials
getCredentials self
= liftDOM ((self ^. js "credentials") >>= fromJSValUnchecked)
getCache :: (MonadDOM m) => Request -> m RequestCache
getCache self
= liftDOM ((self ^. js "cache") >>= fromJSValUnchecked)
getRedirect :: (MonadDOM m) => Request -> m RequestRedirect
getRedirect self
= liftDOM ((self ^. js "redirect") >>= fromJSValUnchecked)
getIntegrity ::
(MonadDOM m, FromJSString result) => Request -> m result
getIntegrity self
= liftDOM ((self ^. js "integrity") >>= fromJSValUnchecked)