jsaddle-dom-0.10.0.0: src/JSDOM/Generated/Cache.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from service-workers (webref). Do not edit.
module JSDOM.Generated.Cache
(add, addAll, delete, delete_, keys, keys_, match, match_, matchAll, matchAll_, put, Cache(..), gTypeCache)
where
import Prelude ((.), (==), (>>=), (<$>), (++), Bool(..), Maybe(..), IO, Int, Word, Double, Float)
import qualified Prelude as P
import Control.Monad (void)
import Control.Lens.Operators ((^.))
import Language.Javascript.JSaddle (JSM, JSVal, JSString, toJSVal, valToBool, valToNumber, js, jss, jsf, jsg, new, function, asyncFunction, jsUndefined, jsNull)
import JSDOM.Types
import qualified JSDOM.Types as Types
import JSDOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import JSDOM.Generated.Enums
-- | <https://developer.mozilla.org/docs/Web/API/Cache/add MDN Cache.add documentation>
add :: (MonadDOM m, IsRequestInfo request) => Cache -> request -> m ()
add self request = liftDOM (void (((self ^. jsf "add" [toJSVal request]) >>= readPromise)))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/addAll MDN Cache.addAll documentation>
addAll :: (MonadDOM m, IsRequestInfo requests) => Cache -> [requests] -> m ()
addAll self requests = liftDOM (void (((self ^. jsf "addAll" [toJSVal requests]) >>= readPromise)))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/delete MDN Cache.delete documentation>
delete :: (MonadDOM m, IsRequestInfo request, IsCacheQueryOptions options) => Cache -> request -> Maybe options -> m Bool
delete self request options = liftDOM (((((self ^. jsf "delete" [toJSVal request, P.maybe (P.return jsUndefined) toJSVal options]) >>= readPromise)) >>= valToBool))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/delete MDN Cache.delete documentation>
delete_ :: (MonadDOM m, IsRequestInfo request, IsCacheQueryOptions options) => Cache -> request -> Maybe options -> m ()
delete_ self request options = liftDOM (void (((self ^. jsf "delete" [toJSVal request, P.maybe (P.return jsUndefined) toJSVal options]) >>= readPromise)))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/keys MDN Cache.keys documentation>
keys :: (MonadDOM m, IsRequestInfo request, IsCacheQueryOptions options) => Cache -> Maybe request -> Maybe options -> m [Request]
keys self request options = liftDOM (((((self ^. jsf "keys" [P.maybe (P.return jsUndefined) toJSVal request, P.maybe (P.return jsUndefined) toJSVal options]) >>= readPromise)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/keys MDN Cache.keys documentation>
keys_ :: (MonadDOM m, IsRequestInfo request, IsCacheQueryOptions options) => Cache -> Maybe request -> Maybe options -> m ()
keys_ self request options = liftDOM (void (((self ^. jsf "keys" [P.maybe (P.return jsUndefined) toJSVal request, P.maybe (P.return jsUndefined) toJSVal options]) >>= readPromise)))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/match MDN Cache.match documentation>
match :: (MonadDOM m, IsRequestInfo request, IsCacheQueryOptions options) => Cache -> request -> Maybe options -> m ResponseOrUndefined
match self request options = liftDOM (((((self ^. jsf "match" [toJSVal request, P.maybe (P.return jsUndefined) toJSVal options]) >>= readPromise)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/match MDN Cache.match documentation>
match_ :: (MonadDOM m, IsRequestInfo request, IsCacheQueryOptions options) => Cache -> request -> Maybe options -> m ()
match_ self request options = liftDOM (void (((self ^. jsf "match" [toJSVal request, P.maybe (P.return jsUndefined) toJSVal options]) >>= readPromise)))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/matchAll MDN Cache.matchAll documentation>
matchAll :: (MonadDOM m, IsRequestInfo request, IsCacheQueryOptions options) => Cache -> Maybe request -> Maybe options -> m [Response]
matchAll self request options = liftDOM (((((self ^. jsf "matchAll" [P.maybe (P.return jsUndefined) toJSVal request, P.maybe (P.return jsUndefined) toJSVal options]) >>= readPromise)) >>= fromJSValUnchecked))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/matchAll MDN Cache.matchAll documentation>
matchAll_ :: (MonadDOM m, IsRequestInfo request, IsCacheQueryOptions options) => Cache -> Maybe request -> Maybe options -> m ()
matchAll_ self request options = liftDOM (void (((self ^. jsf "matchAll" [P.maybe (P.return jsUndefined) toJSVal request, P.maybe (P.return jsUndefined) toJSVal options]) >>= readPromise)))
-- | <https://developer.mozilla.org/docs/Web/API/Cache/put MDN Cache.put documentation>
put :: (MonadDOM m, IsRequestInfo request) => Cache -> request -> Response -> m ()
put self request response = liftDOM (void (((self ^. jsf "put" [toJSVal request, toJSVal response]) >>= readPromise)))