packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webauthn-4 (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.AuthenticationExtensionsPRFValuesJSON
       (js_newAuthenticationExtensionsPRFValuesJSON, js_setFirst, js_getFirst, js_setSecond, js_getSecond, 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 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 "(($1) => { return ({\"first\": $1}); })"
        js_newAuthenticationExtensionsPRFValuesJSON :: JSString -> IO AuthenticationExtensionsPRFValuesJSON
-- | <https://w3c.github.io/webauthn/#dictdef-authenticationextensionsprfvaluesjson AuthenticationExtensionsPRFValuesJSON specification>
newAuthenticationExtensionsPRFValuesJSON :: (MonadDOM m, ToJSString first) => first -> m AuthenticationExtensionsPRFValuesJSON
newAuthenticationExtensionsPRFValuesJSON first = liftDOM ((js_newAuthenticationExtensionsPRFValuesJSON (toJSString first)))

foreign import javascript safe "(($1, $2) => { $1[\"first\"] = $2; })"
        js_setFirst :: AuthenticationExtensionsPRFValuesJSON -> JSString -> IO ()
-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-first AuthenticationExtensionsPRFValuesJSON.first specification>
setFirst :: (MonadDOM m, ToJSString val) => AuthenticationExtensionsPRFValuesJSON -> val -> m ()
setFirst self val = liftDOM (void ((js_setFirst (self) (toJSString val))))

foreign import javascript unsafe "(($1) => { return $1[\"first\"]; })"
        js_getFirst :: AuthenticationExtensionsPRFValuesJSON -> IO JSString
-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-first AuthenticationExtensionsPRFValuesJSON.first specification>
getFirst :: (MonadDOM m, FromJSString result) => AuthenticationExtensionsPRFValuesJSON -> m result
getFirst self = liftDOM ((fromJSString <$> (js_getFirst (self))))

foreign import javascript safe "(($1, $2) => { $1[\"second\"] = $2; })"
        js_setSecond :: AuthenticationExtensionsPRFValuesJSON -> JSString -> IO ()
-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-second AuthenticationExtensionsPRFValuesJSON.second specification>
setSecond :: (MonadDOM m, ToJSString val) => AuthenticationExtensionsPRFValuesJSON -> val -> m ()
setSecond self val = liftDOM (void ((js_setSecond (self) (toJSString val))))

foreign import javascript unsafe "(($1) => { return $1[\"second\"]; })"
        js_getSecond :: AuthenticationExtensionsPRFValuesJSON -> IO JSVal
-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-second AuthenticationExtensionsPRFValuesJSON.second specification>
getSecond :: (MonadDOM m, FromJSString result) => AuthenticationExtensionsPRFValuesJSON -> m (Maybe result)
getSecond self = liftDOM (((fromMaybeJSString . Nullable) <$> (js_getSecond (self))))

-- | <https://w3c.github.io/webauthn/#dom-authenticationextensionsprfvaluesjson-second AuthenticationExtensionsPRFValuesJSON.second specification>
getSecondUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => AuthenticationExtensionsPRFValuesJSON -> m result
getSecondUnsafe self = liftDOM ((((fromMaybeJSString . Nullable) <$> (js_getSecond (self))) >>= 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 ((pFromJSVal <$> (js_getSecond (self))))