packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from image-capture (webref). Do not edit.
module JSDOM.Generated.PhotoSettings
       (newPhotoSettings, setFillLightMode, getFillLightMode, getFillLightModeUnsafe, getFillLightModeUnchecked, setImageHeight, getImageHeight, getImageHeightUnsafe, getImageHeightUnchecked, setImageWidth, getImageWidth, getImageWidthUnsafe, getImageWidthUnchecked, setRedEyeReduction, getRedEyeReduction, getRedEyeReductionUnsafe, getRedEyeReductionUnchecked, PhotoSettings(..), gTypePhotoSettings)
       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/mediacapture-image/#dictdef-photosettings PhotoSettings specification>
newPhotoSettings :: (MonadDOM m) => m PhotoSettings
newPhotoSettings = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-filllightmode PhotoSettings.fillLightMode specification>
setFillLightMode :: (MonadDOM m) => PhotoSettings -> FillLightMode -> m ()
setFillLightMode self val = liftDOM (void (self ^. jss "fillLightMode" (toJSVal val)))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-filllightmode PhotoSettings.fillLightMode specification>
getFillLightMode :: (MonadDOM m) => PhotoSettings -> m (Maybe FillLightMode)
getFillLightMode self = liftDOM (((self ^. js "fillLightMode") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-filllightmode PhotoSettings.fillLightMode specification>
getFillLightModeUnsafe :: (MonadDOM m, HasCallStack) => PhotoSettings -> m FillLightMode
getFillLightModeUnsafe self = liftDOM ((((self ^. js "fillLightMode") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-filllightmode PhotoSettings.fillLightMode specification>
getFillLightModeUnchecked :: (MonadDOM m) => PhotoSettings -> m FillLightMode
getFillLightModeUnchecked self = liftDOM (((self ^. js "fillLightMode") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-imageheight PhotoSettings.imageHeight specification>
setImageHeight :: (MonadDOM m) => PhotoSettings -> Double -> m ()
setImageHeight self val = liftDOM (void (self ^. jss "imageHeight" (toJSVal val)))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-imageheight PhotoSettings.imageHeight specification>
getImageHeight :: (MonadDOM m) => PhotoSettings -> m (Maybe Double)
getImageHeight self = liftDOM (((self ^. js "imageHeight") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-imageheight PhotoSettings.imageHeight specification>
getImageHeightUnsafe :: (MonadDOM m, HasCallStack) => PhotoSettings -> m Double
getImageHeightUnsafe self = liftDOM ((((self ^. js "imageHeight") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-imageheight PhotoSettings.imageHeight specification>
getImageHeightUnchecked :: (MonadDOM m) => PhotoSettings -> m Double
getImageHeightUnchecked self = liftDOM (((self ^. js "imageHeight") >>= valToNumber))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-imagewidth PhotoSettings.imageWidth specification>
setImageWidth :: (MonadDOM m) => PhotoSettings -> Double -> m ()
setImageWidth self val = liftDOM (void (self ^. jss "imageWidth" (toJSVal val)))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-imagewidth PhotoSettings.imageWidth specification>
getImageWidth :: (MonadDOM m) => PhotoSettings -> m (Maybe Double)
getImageWidth self = liftDOM (((self ^. js "imageWidth") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-imagewidth PhotoSettings.imageWidth specification>
getImageWidthUnsafe :: (MonadDOM m, HasCallStack) => PhotoSettings -> m Double
getImageWidthUnsafe self = liftDOM ((((self ^. js "imageWidth") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-imagewidth PhotoSettings.imageWidth specification>
getImageWidthUnchecked :: (MonadDOM m) => PhotoSettings -> m Double
getImageWidthUnchecked self = liftDOM (((self ^. js "imageWidth") >>= valToNumber))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-redeyereduction PhotoSettings.redEyeReduction specification>
setRedEyeReduction :: (MonadDOM m) => PhotoSettings -> Bool -> m ()
setRedEyeReduction self val = liftDOM (void (self ^. jss "redEyeReduction" (toJSVal val)))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-redeyereduction PhotoSettings.redEyeReduction specification>
getRedEyeReduction :: (MonadDOM m) => PhotoSettings -> m (Maybe Bool)
getRedEyeReduction self = liftDOM (((self ^. js "redEyeReduction") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-redeyereduction PhotoSettings.redEyeReduction specification>
getRedEyeReductionUnsafe :: (MonadDOM m, HasCallStack) => PhotoSettings -> m Bool
getRedEyeReductionUnsafe self = liftDOM ((((self ^. js "redEyeReduction") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/mediacapture-image/#dom-photosettings-redeyereduction PhotoSettings.redEyeReduction specification>
getRedEyeReductionUnchecked :: (MonadDOM m) => PhotoSettings -> m Bool
getRedEyeReductionUnchecked self = liftDOM (((self ^. js "redEyeReduction") >>= valToBool))