packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/AuthenticatorSelectionCriteria.hs

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webauthn-4 (webref). Do not edit.
module JSDOM.Generated.AuthenticatorSelectionCriteria
       (newAuthenticatorSelectionCriteria, setAuthenticatorAttachment, getAuthenticatorAttachment, getAuthenticatorAttachmentUnsafe, getAuthenticatorAttachmentUnchecked, setResidentKey, getResidentKey, getResidentKeyUnsafe, getResidentKeyUnchecked, setRequireResidentKey, getRequireResidentKey, getRequireResidentKeyUnsafe, getRequireResidentKeyUnchecked, setUserVerification, getUserVerification, getUserVerificationUnsafe, getUserVerificationUnchecked, AuthenticatorSelectionCriteria(..), gTypeAuthenticatorSelectionCriteria)
       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://w3c.github.io/webauthn/#dictdef-authenticatorselectioncriteria AuthenticatorSelectionCriteria specification>
newAuthenticatorSelectionCriteria :: (MonadDOM m) => m AuthenticatorSelectionCriteria
newAuthenticatorSelectionCriteria = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-authenticatorattachment AuthenticatorSelectionCriteria.authenticatorAttachment specification>
setAuthenticatorAttachment :: (MonadDOM m, ToJSString val) => AuthenticatorSelectionCriteria -> val -> m ()
setAuthenticatorAttachment self val = liftDOM (void (self ^. jss "authenticatorAttachment" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-authenticatorattachment AuthenticatorSelectionCriteria.authenticatorAttachment specification>
getAuthenticatorAttachment :: (MonadDOM m, FromJSString result) => AuthenticatorSelectionCriteria -> m (Maybe result)
getAuthenticatorAttachment self = liftDOM (((self ^. js "authenticatorAttachment") >>= fromMaybeJSString))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-authenticatorattachment AuthenticatorSelectionCriteria.authenticatorAttachment specification>
getAuthenticatorAttachmentUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => AuthenticatorSelectionCriteria -> m result
getAuthenticatorAttachmentUnsafe self = liftDOM ((((self ^. js "authenticatorAttachment") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-authenticatorattachment AuthenticatorSelectionCriteria.authenticatorAttachment specification>
getAuthenticatorAttachmentUnchecked :: (MonadDOM m, FromJSString result) => AuthenticatorSelectionCriteria -> m result
getAuthenticatorAttachmentUnchecked self = liftDOM (((self ^. js "authenticatorAttachment") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-residentkey AuthenticatorSelectionCriteria.residentKey specification>
setResidentKey :: (MonadDOM m, ToJSString val) => AuthenticatorSelectionCriteria -> val -> m ()
setResidentKey self val = liftDOM (void (self ^. jss "residentKey" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-residentkey AuthenticatorSelectionCriteria.residentKey specification>
getResidentKey :: (MonadDOM m, FromJSString result) => AuthenticatorSelectionCriteria -> m (Maybe result)
getResidentKey self = liftDOM (((self ^. js "residentKey") >>= fromMaybeJSString))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-residentkey AuthenticatorSelectionCriteria.residentKey specification>
getResidentKeyUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => AuthenticatorSelectionCriteria -> m result
getResidentKeyUnsafe self = liftDOM ((((self ^. js "residentKey") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-residentkey AuthenticatorSelectionCriteria.residentKey specification>
getResidentKeyUnchecked :: (MonadDOM m, FromJSString result) => AuthenticatorSelectionCriteria -> m result
getResidentKeyUnchecked self = liftDOM (((self ^. js "residentKey") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-requireresidentkey AuthenticatorSelectionCriteria.requireResidentKey specification>
setRequireResidentKey :: (MonadDOM m) => AuthenticatorSelectionCriteria -> Bool -> m ()
setRequireResidentKey self val = liftDOM (void (self ^. jss "requireResidentKey" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-requireresidentkey AuthenticatorSelectionCriteria.requireResidentKey specification>
getRequireResidentKey :: (MonadDOM m) => AuthenticatorSelectionCriteria -> m (Maybe Bool)
getRequireResidentKey self = liftDOM (((self ^. js "requireResidentKey") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-requireresidentkey AuthenticatorSelectionCriteria.requireResidentKey specification>
getRequireResidentKeyUnsafe :: (MonadDOM m, HasCallStack) => AuthenticatorSelectionCriteria -> m Bool
getRequireResidentKeyUnsafe self = liftDOM ((((self ^. js "requireResidentKey") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-requireresidentkey AuthenticatorSelectionCriteria.requireResidentKey specification>
getRequireResidentKeyUnchecked :: (MonadDOM m) => AuthenticatorSelectionCriteria -> m Bool
getRequireResidentKeyUnchecked self = liftDOM (((self ^. js "requireResidentKey") >>= valToBool))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-userverification AuthenticatorSelectionCriteria.userVerification specification>
setUserVerification :: (MonadDOM m, ToJSString val) => AuthenticatorSelectionCriteria -> val -> m ()
setUserVerification self val = liftDOM (void (self ^. jss "userVerification" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-userverification AuthenticatorSelectionCriteria.userVerification specification>
getUserVerification :: (MonadDOM m, FromJSString result) => AuthenticatorSelectionCriteria -> m (Maybe result)
getUserVerification self = liftDOM (((self ^. js "userVerification") >>= fromMaybeJSString))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-userverification AuthenticatorSelectionCriteria.userVerification specification>
getUserVerificationUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => AuthenticatorSelectionCriteria -> m result
getUserVerificationUnsafe self = liftDOM ((((self ^. js "userVerification") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-authenticatorselectioncriteria-userverification AuthenticatorSelectionCriteria.userVerification specification>
getUserVerificationUnchecked :: (MonadDOM m, FromJSString result) => AuthenticatorSelectionCriteria -> m result
getUserVerificationUnchecked self = liftDOM (((self ^. js "userVerification") >>= fromJSValUnchecked))