packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from credential-management-1 (webref). Do not edit.
module JSDOM.Generated.PasswordCredentialData
       (newPasswordCredentialData, setName, getName, getNameUnsafe, getNameUnchecked, setIconURL, getIconURL, getIconURLUnsafe, getIconURLUnchecked, setOrigin, getOrigin, setPassword, getPassword, PasswordCredentialData(..), gTypePasswordCredentialData)
       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/webappsec-credential-management/#dictdef-passwordcredentialdata PasswordCredentialData specification>
newPasswordCredentialData :: (MonadDOM m, ToJSString id, ToJSString origin, ToJSString password) => id -> origin -> password -> m PasswordCredentialData
newPasswordCredentialData id origin password = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "id" (toJSVal id)) P.>> (o ^. jss "origin" (toJSVal origin)) P.>> (o ^. jss "password" (toJSVal password)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-name PasswordCredentialData.name specification>
setName :: (MonadDOM m, ToJSString val) => PasswordCredentialData -> val -> m ()
setName self val = liftDOM (void (self ^. jss "name" (toJSVal val)))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-name PasswordCredentialData.name specification>
getName :: (MonadDOM m, FromJSString result) => PasswordCredentialData -> m (Maybe result)
getName self = liftDOM (((self ^. js "name") >>= fromMaybeJSString))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-name PasswordCredentialData.name specification>
getNameUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PasswordCredentialData -> m result
getNameUnsafe self = liftDOM ((((self ^. js "name") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-name PasswordCredentialData.name specification>
getNameUnchecked :: (MonadDOM m, FromJSString result) => PasswordCredentialData -> m result
getNameUnchecked self = liftDOM (((self ^. js "name") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-iconurl PasswordCredentialData.iconURL specification>
setIconURL :: (MonadDOM m, ToJSString val) => PasswordCredentialData -> val -> m ()
setIconURL self val = liftDOM (void (self ^. jss "iconURL" (toJSVal val)))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-iconurl PasswordCredentialData.iconURL specification>
getIconURL :: (MonadDOM m, FromJSString result) => PasswordCredentialData -> m (Maybe result)
getIconURL self = liftDOM (((self ^. js "iconURL") >>= fromMaybeJSString))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-iconurl PasswordCredentialData.iconURL specification>
getIconURLUnsafe :: (MonadDOM m, HasCallStack, FromJSString result) => PasswordCredentialData -> m result
getIconURLUnsafe self = liftDOM ((((self ^. js "iconURL") >>= fromMaybeJSString) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-iconurl PasswordCredentialData.iconURL specification>
getIconURLUnchecked :: (MonadDOM m, FromJSString result) => PasswordCredentialData -> m result
getIconURLUnchecked self = liftDOM (((self ^. js "iconURL") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-origin PasswordCredentialData.origin specification>
setOrigin :: (MonadDOM m, ToJSString val) => PasswordCredentialData -> val -> m ()
setOrigin self val = liftDOM (void (self ^. jss "origin" (toJSVal val)))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-origin PasswordCredentialData.origin specification>
getOrigin :: (MonadDOM m, FromJSString result) => PasswordCredentialData -> m result
getOrigin self = liftDOM (((self ^. js "origin") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-password PasswordCredentialData.password specification>
setPassword :: (MonadDOM m, ToJSString val) => PasswordCredentialData -> val -> m ()
setPassword self val = liftDOM (void (self ^. jss "password" (toJSVal val)))

-- | <https://w3c.github.io/webappsec-credential-management/#dom-passwordcredentialdata-password PasswordCredentialData.password specification>
getPassword :: (MonadDOM m, FromJSString result) => PasswordCredentialData -> m result
getPassword self = liftDOM (((self ^. js "password") >>= fromJSValUnchecked))