{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module JSDOM.Generated.URLSearchParams
(newURLSearchParams, append, delete, get, get_, getUnsafe,
getUnchecked, getAll, getAll_, has, has_, set, sort, toString,
toString_, URLSearchParams(..), gTypeURLSearchParams)
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
newURLSearchParams ::
(MonadDOM m, IsURLSearchParamsInit init) =>
init -> m URLSearchParams
newURLSearchParams init
= liftDOM
(URLSearchParams <$> new (jsg "URLSearchParams") [toJSVal init])
append ::
(MonadDOM m, ToJSString name, ToJSString value) =>
URLSearchParams -> name -> value -> m ()
append self name value
= liftDOM
(void (self ^. jsf "append" [toJSVal name, toJSVal value]))
delete ::
(MonadDOM m, ToJSString name) => URLSearchParams -> name -> m ()
delete self name
= liftDOM (void (self ^. jsf "delete" [toJSVal name]))
get ::
(MonadDOM m, ToJSString name, FromJSString result) =>
URLSearchParams -> name -> m (Maybe result)
get self name
= liftDOM
((self ^. jsf "get" [toJSVal name]) >>= fromMaybeJSString)
get_ ::
(MonadDOM m, ToJSString name) => URLSearchParams -> name -> m ()
get_ self name = liftDOM (void (self ^. jsf "get" [toJSVal name]))
getUnsafe ::
(MonadDOM m, ToJSString name, HasCallStack, FromJSString result) =>
URLSearchParams -> name -> m result
getUnsafe self name
= liftDOM
(((self ^. jsf "get" [toJSVal name]) >>= fromMaybeJSString) >>=
maybe (Prelude.error "Nothing to return") return)
getUnchecked ::
(MonadDOM m, ToJSString name, FromJSString result) =>
URLSearchParams -> name -> m result
getUnchecked self name
= liftDOM
((self ^. jsf "get" [toJSVal name]) >>= fromJSValUnchecked)
getAll ::
(MonadDOM m, ToJSString name, FromJSString result) =>
URLSearchParams -> name -> m [result]
getAll self name
= liftDOM
((self ^. jsf "getAll" [toJSVal name]) >>= fromJSArrayUnchecked)
getAll_ ::
(MonadDOM m, ToJSString name) => URLSearchParams -> name -> m ()
getAll_ self name
= liftDOM (void (self ^. jsf "getAll" [toJSVal name]))
has ::
(MonadDOM m, ToJSString name) => URLSearchParams -> name -> m Bool
has self name
= liftDOM ((self ^. jsf "has" [toJSVal name]) >>= valToBool)
has_ ::
(MonadDOM m, ToJSString name) => URLSearchParams -> name -> m ()
has_ self name = liftDOM (void (self ^. jsf "has" [toJSVal name]))
set ::
(MonadDOM m, ToJSString name, ToJSString value) =>
URLSearchParams -> name -> value -> m ()
set self name value
= liftDOM (void (self ^. jsf "set" [toJSVal name, toJSVal value]))
sort :: (MonadDOM m) => URLSearchParams -> m ()
sort self = liftDOM (void (self ^. jsf "sort" ()))
toString ::
(MonadDOM m, FromJSString result) => URLSearchParams -> m result
toString self
= liftDOM ((self ^. jsf "toString" ()) >>= fromJSValUnchecked)
toString_ :: (MonadDOM m) => URLSearchParams -> m ()
toString_ self = liftDOM (void (self ^. jsf "toString" ()))