packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/CredentialPropertiesOutput.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.CredentialPropertiesOutput
       (newCredentialPropertiesOutput, setRk, getRk, getRkUnsafe, getRkUnchecked, CredentialPropertiesOutput(..), gTypeCredentialPropertiesOutput)
       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-credentialpropertiesoutput CredentialPropertiesOutput specification>
newCredentialPropertiesOutput :: (MonadDOM m) => m CredentialPropertiesOutput
newCredentialPropertiesOutput = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-credentialpropertiesoutput-rk CredentialPropertiesOutput.rk specification>
setRk :: (MonadDOM m) => CredentialPropertiesOutput -> Bool -> m ()
setRk self val = liftDOM (void (self ^. jss "rk" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-credentialpropertiesoutput-rk CredentialPropertiesOutput.rk specification>
getRk :: (MonadDOM m) => CredentialPropertiesOutput -> m (Maybe Bool)
getRk self = liftDOM (((self ^. js "rk") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-credentialpropertiesoutput-rk CredentialPropertiesOutput.rk specification>
getRkUnsafe :: (MonadDOM m, HasCallStack) => CredentialPropertiesOutput -> m Bool
getRkUnsafe self = liftDOM ((((self ^. js "rk") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webauthn/#dom-credentialpropertiesoutput-rk CredentialPropertiesOutput.rk specification>
getRkUnchecked :: (MonadDOM m) => CredentialPropertiesOutput -> m Bool
getRkUnchecked self = liftDOM (((self ^. js "rk") >>= valToBool))