packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/PublicKeyCredentialRequestOptionsJSON.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.PublicKeyCredentialRequestOptionsJSON
       (newPublicKeyCredentialRequestOptionsJSON, setChallenge, getChallenge, setTimeout, getTimeout, getTimeoutUnsafe, getTimeoutUnchecked, setRpId, getRpId, getRpIdUnsafe, getRpIdUnchecked, setAllowCredentials, getAllowCredentials, getAllowCredentialsUnsafe, getAllowCredentialsUnchecked, setUserVerification, getUserVerification, getUserVerificationUnsafe, getUserVerificationUnchecked, setHints, getHints, getHintsUnsafe, getHintsUnchecked, setExtensions, getExtensions, getExtensionsUnsafe, getExtensionsUnchecked, PublicKeyCredentialRequestOptionsJSON(..), gTypePublicKeyCredentialRequestOptionsJSON)
       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-publickeycredentialrequestoptionsjson PublicKeyCredentialRequestOptionsJSON specification>
newPublicKeyCredentialRequestOptionsJSON :: (MonadDOM m, ToJSString challenge) => challenge -> m PublicKeyCredentialRequestOptionsJSON
newPublicKeyCredentialRequestOptionsJSON challenge = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "challenge" (toJSVal challenge)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-challenge PublicKeyCredentialRequestOptionsJSON.challenge specification>
setChallenge :: (MonadDOM m, ToJSString val) => PublicKeyCredentialRequestOptionsJSON -> val -> m ()
setChallenge self val = liftDOM (void (self ^. jss "challenge" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-challenge PublicKeyCredentialRequestOptionsJSON.challenge specification>
getChallenge :: (MonadDOM m, FromJSString result) => PublicKeyCredentialRequestOptionsJSON -> m result
getChallenge self = liftDOM (((self ^. js "challenge") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-timeout PublicKeyCredentialRequestOptionsJSON.timeout specification>
setTimeout :: (MonadDOM m) => PublicKeyCredentialRequestOptionsJSON -> Word -> m ()
setTimeout self val = liftDOM (void (self ^. jss "timeout" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-timeout PublicKeyCredentialRequestOptionsJSON.timeout specification>
getTimeout :: (MonadDOM m) => PublicKeyCredentialRequestOptionsJSON -> m (Maybe Word)
getTimeout self = liftDOM (((self ^. js "timeout") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-timeout PublicKeyCredentialRequestOptionsJSON.timeout specification>
getTimeoutUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialRequestOptionsJSON -> m Word
getTimeoutUnsafe self = liftDOM ((((self ^. js "timeout") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-timeout PublicKeyCredentialRequestOptionsJSON.timeout specification>
getTimeoutUnchecked :: (MonadDOM m) => PublicKeyCredentialRequestOptionsJSON -> m Word
getTimeoutUnchecked self = liftDOM ((P.round <$> ((self ^. js "timeout") >>= valToNumber)))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-rpid PublicKeyCredentialRequestOptionsJSON.rpId specification>
setRpId :: (MonadDOM m, ToJSString val) => PublicKeyCredentialRequestOptionsJSON -> val -> m ()
setRpId self val = liftDOM (void (self ^. jss "rpId" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-rpid PublicKeyCredentialRequestOptionsJSON.rpId specification>
getRpId :: (MonadDOM m, FromJSString result) => PublicKeyCredentialRequestOptionsJSON -> m (Maybe result)
getRpId self = liftDOM (((self ^. js "rpId") >>= fromMaybeJSString))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-rpid PublicKeyCredentialRequestOptionsJSON.rpId specification>
getRpIdUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PublicKeyCredentialRequestOptionsJSON -> m result
getRpIdUnsafe self = liftDOM ((((self ^. js "rpId") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-rpid PublicKeyCredentialRequestOptionsJSON.rpId specification>
getRpIdUnchecked :: (MonadDOM m, FromJSString result) => PublicKeyCredentialRequestOptionsJSON -> m result
getRpIdUnchecked self = liftDOM (((self ^. js "rpId") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-allowcredentials PublicKeyCredentialRequestOptionsJSON.allowCredentials specification>
setAllowCredentials :: (MonadDOM m) => PublicKeyCredentialRequestOptionsJSON -> [PublicKeyCredentialDescriptorJSON] -> m ()
setAllowCredentials self val = liftDOM (void (self ^. jss "allowCredentials" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-allowcredentials PublicKeyCredentialRequestOptionsJSON.allowCredentials specification>
getAllowCredentials :: (MonadDOM m) => PublicKeyCredentialRequestOptionsJSON -> m (Maybe [PublicKeyCredentialDescriptorJSON])
getAllowCredentials self = liftDOM (((self ^. js "allowCredentials") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-allowcredentials PublicKeyCredentialRequestOptionsJSON.allowCredentials specification>
getAllowCredentialsUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialRequestOptionsJSON -> m [PublicKeyCredentialDescriptorJSON]
getAllowCredentialsUnsafe self = liftDOM ((((self ^. js "allowCredentials") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-allowcredentials PublicKeyCredentialRequestOptionsJSON.allowCredentials specification>
getAllowCredentialsUnchecked :: (MonadDOM m) => PublicKeyCredentialRequestOptionsJSON -> m [PublicKeyCredentialDescriptorJSON]
getAllowCredentialsUnchecked self = liftDOM (((self ^. js "allowCredentials") >>= fromJSValUnchecked))

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

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

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

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

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-hints PublicKeyCredentialRequestOptionsJSON.hints specification>
setHints :: (MonadDOM m, ToJSString val) => PublicKeyCredentialRequestOptionsJSON -> [val] -> m ()
setHints self val = liftDOM (void (self ^. jss "hints" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-hints PublicKeyCredentialRequestOptionsJSON.hints specification>
getHints :: (MonadDOM m, FromJSString result) => PublicKeyCredentialRequestOptionsJSON -> m (Maybe [result])
getHints self = liftDOM (((self ^. js "hints") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-hints PublicKeyCredentialRequestOptionsJSON.hints specification>
getHintsUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PublicKeyCredentialRequestOptionsJSON -> m [result]
getHintsUnsafe self = liftDOM ((((self ^. js "hints") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-hints PublicKeyCredentialRequestOptionsJSON.hints specification>
getHintsUnchecked :: (MonadDOM m, FromJSString result) => PublicKeyCredentialRequestOptionsJSON -> m [result]
getHintsUnchecked self = liftDOM (((self ^. js "hints") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-extensions PublicKeyCredentialRequestOptionsJSON.extensions specification>
setExtensions :: (MonadDOM m) => PublicKeyCredentialRequestOptionsJSON -> AuthenticationExtensionsClientInputsJSON -> m ()
setExtensions self val = liftDOM (void (self ^. jss "extensions" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-extensions PublicKeyCredentialRequestOptionsJSON.extensions specification>
getExtensions :: (MonadDOM m) => PublicKeyCredentialRequestOptionsJSON -> m (Maybe AuthenticationExtensionsClientInputsJSON)
getExtensions self = liftDOM (((self ^. js "extensions") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-extensions PublicKeyCredentialRequestOptionsJSON.extensions specification>
getExtensionsUnsafe :: (MonadDOM m, HasCallStack) => PublicKeyCredentialRequestOptionsJSON -> m AuthenticationExtensionsClientInputsJSON
getExtensionsUnsafe self = liftDOM ((((self ^. js "extensions") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-publickeycredentialrequestoptionsjson-extensions PublicKeyCredentialRequestOptionsJSON.extensions specification>
getExtensionsUnchecked :: (MonadDOM m) => PublicKeyCredentialRequestOptionsJSON -> m AuthenticationExtensionsClientInputsJSON
getExtensionsUnchecked self = liftDOM (((self ^. js "extensions") >>= fromJSValUnchecked))