packages feed

ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/OTPCredentialRequestOptions.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from web-otp (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.OTPCredentialRequestOptions
       (js_newOTPCredentialRequestOptions, js_setTransport, js_getTransport, 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 GHCJS.Types (JSVal, JSString)
import GHCJS.Foreign (jsUndefined, jsNull)
import GHCJS.DOM.Types
import qualified GHCJS.DOM.Types as Types
import GHCJS.DOM.EventTargetClosures (EventName, unsafeEventName, unsafeEventNameAsync)
import GHCJS.DOM.JSFFI.Generated.Enums

foreign import javascript safe "(() => { return ({}); })"
        js_newOTPCredentialRequestOptions :: IO OTPCredentialRequestOptions
-- | <https://wicg.github.io/web-otp/#dictdef-otpcredentialrequestoptions OTPCredentialRequestOptions specification>
newOTPCredentialRequestOptions :: (MonadDOM m) => m OTPCredentialRequestOptions
newOTPCredentialRequestOptions = liftDOM ((js_newOTPCredentialRequestOptions))

foreign import javascript safe "(($1, $2) => { $1[\"transport\"] = $2; })"
        js_setTransport :: OTPCredentialRequestOptions -> JSVal -> IO ()
-- | <https://wicg.github.io/web-otp/#dom-otpcredentialrequestoptions-transport OTPCredentialRequestOptions.transport specification>
setTransport :: (MonadDOM m) => OTPCredentialRequestOptions -> [OTPCredentialTransportType] -> m ()
setTransport self val = liftDOM (void (((toJSVal val) >>= \a2' -> js_setTransport (self) a2')))

foreign import javascript unsafe "(($1) => { return $1[\"transport\"]; })"
        js_getTransport :: OTPCredentialRequestOptions -> IO JSVal
-- | <https://wicg.github.io/web-otp/#dom-otpcredentialrequestoptions-transport OTPCredentialRequestOptions.transport specification>
getTransport :: (MonadDOM m) => OTPCredentialRequestOptions -> m (Maybe [OTPCredentialTransportType])
getTransport self = liftDOM (((js_getTransport (self)) >>= fromJSValUnchecked))

-- | <https://wicg.github.io/web-otp/#dom-otpcredentialrequestoptions-transport OTPCredentialRequestOptions.transport specification>
getTransportUnsafe :: (MonadDOM m, HasCallStack) => OTPCredentialRequestOptions -> m [OTPCredentialTransportType]
getTransportUnsafe self = liftDOM ((((js_getTransport (self)) >>= 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 (((js_getTransport (self)) >>= fromJSValUnchecked))