jsaddle-dom-0.10.0.0: src/JSDOM/Generated/OTPCredentialRequestOptions.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from web-otp (webref). Do not edit.
module JSDOM.Generated.OTPCredentialRequestOptions
(newOTPCredentialRequestOptions, setTransport, getTransport, getTransportUnsafe, getTransportUnchecked, OTPCredentialRequestOptions(..), gTypeOTPCredentialRequestOptions)
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://wicg.github.io/web-otp/#dictdef-otpcredentialrequestoptions OTPCredentialRequestOptions specification>
newOTPCredentialRequestOptions :: (MonadDOM m) => m OTPCredentialRequestOptions
newOTPCredentialRequestOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))
-- | <https://wicg.github.io/web-otp/#dom-otpcredentialrequestoptions-transport OTPCredentialRequestOptions.transport specification>
setTransport :: (MonadDOM m) => OTPCredentialRequestOptions -> [OTPCredentialTransportType] -> m ()
setTransport self val = liftDOM (void (self ^. jss "transport" (toJSVal val)))
-- | <https://wicg.github.io/web-otp/#dom-otpcredentialrequestoptions-transport OTPCredentialRequestOptions.transport specification>
getTransport :: (MonadDOM m) => OTPCredentialRequestOptions -> m (Maybe [OTPCredentialTransportType])
getTransport self = liftDOM (((self ^. js "transport") >>= fromJSValUnchecked))
-- | <https://wicg.github.io/web-otp/#dom-otpcredentialrequestoptions-transport OTPCredentialRequestOptions.transport specification>
getTransportUnsafe :: (MonadDOM m, HasCallStack) => OTPCredentialRequestOptions -> m [OTPCredentialTransportType]
getTransportUnsafe self = liftDOM ((((self ^. js "transport") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://wicg.github.io/web-otp/#dom-otpcredentialrequestoptions-transport OTPCredentialRequestOptions.transport specification>
getTransportUnchecked :: (MonadDOM m) => OTPCredentialRequestOptions -> m [OTPCredentialTransportType]
getTransportUnchecked self = liftDOM (((self ^. js "transport") >>= fromJSValUnchecked))