jsaddle-dom-0.10.0.0: src/JSDOM/Generated/URLPatternInit.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from urlpattern (webref). Do not edit.
module JSDOM.Generated.URLPatternInit
(newURLPatternInit, setProtocol, getProtocol, getProtocolUnsafe, getProtocolUnchecked, setUsername, getUsername, getUsernameUnsafe, getUsernameUnchecked, setPassword, getPassword, getPasswordUnsafe, getPasswordUnchecked, setHostname, getHostname, getHostnameUnsafe, getHostnameUnchecked, setPort, getPort, getPortUnsafe, getPortUnchecked, setPathname, getPathname, getPathnameUnsafe, getPathnameUnchecked, setSearch, getSearch, getSearchUnsafe, getSearchUnchecked, setHash, getHash, getHashUnsafe, getHashUnchecked, setBaseURL, getBaseURL, getBaseURLUnsafe, getBaseURLUnchecked, URLPatternInit(..), gTypeURLPatternInit)
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://urlpattern.spec.whatwg.org/#dictdef-urlpatterninit URLPatternInit specification>
newURLPatternInit :: (MonadDOM m) => m URLPatternInit
newURLPatternInit = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-protocol URLPatternInit.protocol specification>
setProtocol :: (MonadDOM m, ToJSString val) => URLPatternInit -> val -> m ()
setProtocol self val = liftDOM (void (self ^. jss "protocol" (toJSVal val)))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-protocol URLPatternInit.protocol specification>
getProtocol :: (MonadDOM m, FromJSString result) => URLPatternInit -> m (Maybe result)
getProtocol self = liftDOM (((self ^. js "protocol") >>= fromMaybeJSString))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-protocol URLPatternInit.protocol specification>
getProtocolUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => URLPatternInit -> m result
getProtocolUnsafe self = liftDOM ((((self ^. js "protocol") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-protocol URLPatternInit.protocol specification>
getProtocolUnchecked :: (MonadDOM m, FromJSString result) => URLPatternInit -> m result
getProtocolUnchecked self = liftDOM (((self ^. js "protocol") >>= fromJSValUnchecked))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-username URLPatternInit.username specification>
setUsername :: (MonadDOM m, ToJSString val) => URLPatternInit -> val -> m ()
setUsername self val = liftDOM (void (self ^. jss "username" (toJSVal val)))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-username URLPatternInit.username specification>
getUsername :: (MonadDOM m, FromJSString result) => URLPatternInit -> m (Maybe result)
getUsername self = liftDOM (((self ^. js "username") >>= fromMaybeJSString))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-username URLPatternInit.username specification>
getUsernameUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => URLPatternInit -> m result
getUsernameUnsafe self = liftDOM ((((self ^. js "username") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-username URLPatternInit.username specification>
getUsernameUnchecked :: (MonadDOM m, FromJSString result) => URLPatternInit -> m result
getUsernameUnchecked self = liftDOM (((self ^. js "username") >>= fromJSValUnchecked))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-password URLPatternInit.password specification>
setPassword :: (MonadDOM m, ToJSString val) => URLPatternInit -> val -> m ()
setPassword self val = liftDOM (void (self ^. jss "password" (toJSVal val)))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-password URLPatternInit.password specification>
getPassword :: (MonadDOM m, FromJSString result) => URLPatternInit -> m (Maybe result)
getPassword self = liftDOM (((self ^. js "password") >>= fromMaybeJSString))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-password URLPatternInit.password specification>
getPasswordUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => URLPatternInit -> m result
getPasswordUnsafe self = liftDOM ((((self ^. js "password") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-password URLPatternInit.password specification>
getPasswordUnchecked :: (MonadDOM m, FromJSString result) => URLPatternInit -> m result
getPasswordUnchecked self = liftDOM (((self ^. js "password") >>= fromJSValUnchecked))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-hostname URLPatternInit.hostname specification>
setHostname :: (MonadDOM m, ToJSString val) => URLPatternInit -> val -> m ()
setHostname self val = liftDOM (void (self ^. jss "hostname" (toJSVal val)))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-hostname URLPatternInit.hostname specification>
getHostname :: (MonadDOM m, FromJSString result) => URLPatternInit -> m (Maybe result)
getHostname self = liftDOM (((self ^. js "hostname") >>= fromMaybeJSString))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-hostname URLPatternInit.hostname specification>
getHostnameUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => URLPatternInit -> m result
getHostnameUnsafe self = liftDOM ((((self ^. js "hostname") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-hostname URLPatternInit.hostname specification>
getHostnameUnchecked :: (MonadDOM m, FromJSString result) => URLPatternInit -> m result
getHostnameUnchecked self = liftDOM (((self ^. js "hostname") >>= fromJSValUnchecked))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-port URLPatternInit.port specification>
setPort :: (MonadDOM m, ToJSString val) => URLPatternInit -> val -> m ()
setPort self val = liftDOM (void (self ^. jss "port" (toJSVal val)))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-port URLPatternInit.port specification>
getPort :: (MonadDOM m, FromJSString result) => URLPatternInit -> m (Maybe result)
getPort self = liftDOM (((self ^. js "port") >>= fromMaybeJSString))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-port URLPatternInit.port specification>
getPortUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => URLPatternInit -> m result
getPortUnsafe self = liftDOM ((((self ^. js "port") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-port URLPatternInit.port specification>
getPortUnchecked :: (MonadDOM m, FromJSString result) => URLPatternInit -> m result
getPortUnchecked self = liftDOM (((self ^. js "port") >>= fromJSValUnchecked))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-pathname URLPatternInit.pathname specification>
setPathname :: (MonadDOM m, ToJSString val) => URLPatternInit -> val -> m ()
setPathname self val = liftDOM (void (self ^. jss "pathname" (toJSVal val)))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-pathname URLPatternInit.pathname specification>
getPathname :: (MonadDOM m, FromJSString result) => URLPatternInit -> m (Maybe result)
getPathname self = liftDOM (((self ^. js "pathname") >>= fromMaybeJSString))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-pathname URLPatternInit.pathname specification>
getPathnameUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => URLPatternInit -> m result
getPathnameUnsafe self = liftDOM ((((self ^. js "pathname") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-pathname URLPatternInit.pathname specification>
getPathnameUnchecked :: (MonadDOM m, FromJSString result) => URLPatternInit -> m result
getPathnameUnchecked self = liftDOM (((self ^. js "pathname") >>= fromJSValUnchecked))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-search URLPatternInit.search specification>
setSearch :: (MonadDOM m, ToJSString val) => URLPatternInit -> val -> m ()
setSearch self val = liftDOM (void (self ^. jss "search" (toJSVal val)))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-search URLPatternInit.search specification>
getSearch :: (MonadDOM m, FromJSString result) => URLPatternInit -> m (Maybe result)
getSearch self = liftDOM (((self ^. js "search") >>= fromMaybeJSString))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-search URLPatternInit.search specification>
getSearchUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => URLPatternInit -> m result
getSearchUnsafe self = liftDOM ((((self ^. js "search") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-search URLPatternInit.search specification>
getSearchUnchecked :: (MonadDOM m, FromJSString result) => URLPatternInit -> m result
getSearchUnchecked self = liftDOM (((self ^. js "search") >>= fromJSValUnchecked))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-hash URLPatternInit.hash specification>
setHash :: (MonadDOM m, ToJSString val) => URLPatternInit -> val -> m ()
setHash self val = liftDOM (void (self ^. jss "hash" (toJSVal val)))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-hash URLPatternInit.hash specification>
getHash :: (MonadDOM m, FromJSString result) => URLPatternInit -> m (Maybe result)
getHash self = liftDOM (((self ^. js "hash") >>= fromMaybeJSString))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-hash URLPatternInit.hash specification>
getHashUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => URLPatternInit -> m result
getHashUnsafe self = liftDOM ((((self ^. js "hash") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-hash URLPatternInit.hash specification>
getHashUnchecked :: (MonadDOM m, FromJSString result) => URLPatternInit -> m result
getHashUnchecked self = liftDOM (((self ^. js "hash") >>= fromJSValUnchecked))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-baseurl URLPatternInit.baseURL specification>
setBaseURL :: (MonadDOM m, ToJSString val) => URLPatternInit -> val -> m ()
setBaseURL self val = liftDOM (void (self ^. jss "baseURL" (toJSVal val)))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-baseurl URLPatternInit.baseURL specification>
getBaseURL :: (MonadDOM m, FromJSString result) => URLPatternInit -> m (Maybe result)
getBaseURL self = liftDOM (((self ^. js "baseURL") >>= fromMaybeJSString))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-baseurl URLPatternInit.baseURL specification>
getBaseURLUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => URLPatternInit -> m result
getBaseURLUnsafe self = liftDOM ((((self ^. js "baseURL") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://urlpattern.spec.whatwg.org/#dom-urlpatterninit-baseurl URLPatternInit.baseURL specification>
getBaseURLUnchecked :: (MonadDOM m, FromJSString result) => URLPatternInit -> m result
getBaseURLUnchecked self = liftDOM (((self ^. js "baseURL") >>= fromJSValUnchecked))