packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/AuthenticationExtensionsPRFValuesJSON.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.AuthenticationExtensionsPRFValuesJSON
       (newAuthenticationExtensionsPRFValuesJSON, setFirst, getFirst, setSecond, getSecond, getSecondUnsafe, getSecondUnchecked, AuthenticationExtensionsPRFValuesJSON(..), gTypeAuthenticationExtensionsPRFValuesJSON)
       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-authenticationextensionsprfvaluesjson AuthenticationExtensionsPRFValuesJSON specification>
newAuthenticationExtensionsPRFValuesJSON :: (MonadDOM m, ToJSString first) => first -> m AuthenticationExtensionsPRFValuesJSON
newAuthenticationExtensionsPRFValuesJSON first = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "first" (toJSVal first)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-first AuthenticationExtensionsPRFValuesJSON.first specification>
setFirst :: (MonadDOM m, ToJSString val) => AuthenticationExtensionsPRFValuesJSON -> val -> m ()
setFirst self val = liftDOM (void (self ^. jss "first" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-first AuthenticationExtensionsPRFValuesJSON.first specification>
getFirst :: (MonadDOM m, FromJSString result) => AuthenticationExtensionsPRFValuesJSON -> m result
getFirst self = liftDOM (((self ^. js "first") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-second AuthenticationExtensionsPRFValuesJSON.second specification>
setSecond :: (MonadDOM m, ToJSString val) => AuthenticationExtensionsPRFValuesJSON -> val -> m ()
setSecond self val = liftDOM (void (self ^. jss "second" (toJSVal val)))

-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-second AuthenticationExtensionsPRFValuesJSON.second specification>
getSecond :: (MonadDOM m, FromJSString result) => AuthenticationExtensionsPRFValuesJSON -> m (Maybe result)
getSecond self = liftDOM (((self ^. js "second") >>= fromMaybeJSString))

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

-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-second AuthenticationExtensionsPRFValuesJSON.second specification>
getSecondUnchecked :: (MonadDOM m, FromJSString result) => AuthenticationExtensionsPRFValuesJSON -> m result
getSecondUnchecked self = liftDOM (((self ^. js "second") >>= fromJSValUnchecked))