packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from payment-request (webref). Do not edit.
module JSDOM.Generated.PaymentOptions
       (newPaymentOptions, setRequestPayerName, getRequestPayerName, getRequestPayerNameUnsafe, getRequestPayerNameUnchecked, setRequestBillingAddress, getRequestBillingAddress, getRequestBillingAddressUnsafe, getRequestBillingAddressUnchecked, setRequestPayerEmail, getRequestPayerEmail, getRequestPayerEmailUnsafe, getRequestPayerEmailUnchecked, setRequestPayerPhone, getRequestPayerPhone, getRequestPayerPhoneUnsafe, getRequestPayerPhoneUnchecked, setRequestShipping, getRequestShipping, getRequestShippingUnsafe, getRequestShippingUnchecked, setShippingType, getShippingType, getShippingTypeUnsafe, getShippingTypeUnchecked, PaymentOptions(..), gTypePaymentOptions)
       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/payment-request/#dom-paymentoptions PaymentOptions specification>
newPaymentOptions :: (MonadDOM m) => m PaymentOptions
newPaymentOptions = liftDOM ((((new (jsg "Object") () >>= \o -> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayername PaymentOptions.requestPayerName specification>
setRequestPayerName :: (MonadDOM m) => PaymentOptions -> Bool -> m ()
setRequestPayerName self val = liftDOM (void (self ^. jss "requestPayerName" (toJSVal val)))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayername PaymentOptions.requestPayerName specification>
getRequestPayerName :: (MonadDOM m) => PaymentOptions -> m (Maybe Bool)
getRequestPayerName self = liftDOM (((self ^. js "requestPayerName") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayername PaymentOptions.requestPayerName specification>
getRequestPayerNameUnsafe :: (MonadDOM m, HasCallStack) => PaymentOptions -> m Bool
getRequestPayerNameUnsafe self = liftDOM ((((self ^. js "requestPayerName") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayername PaymentOptions.requestPayerName specification>
getRequestPayerNameUnchecked :: (MonadDOM m) => PaymentOptions -> m Bool
getRequestPayerNameUnchecked self = liftDOM (((self ^. js "requestPayerName") >>= valToBool))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestbillingaddress PaymentOptions.requestBillingAddress specification>
setRequestBillingAddress :: (MonadDOM m) => PaymentOptions -> Bool -> m ()
setRequestBillingAddress self val = liftDOM (void (self ^. jss "requestBillingAddress" (toJSVal val)))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestbillingaddress PaymentOptions.requestBillingAddress specification>
getRequestBillingAddress :: (MonadDOM m) => PaymentOptions -> m (Maybe Bool)
getRequestBillingAddress self = liftDOM (((self ^. js "requestBillingAddress") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestbillingaddress PaymentOptions.requestBillingAddress specification>
getRequestBillingAddressUnsafe :: (MonadDOM m, HasCallStack) => PaymentOptions -> m Bool
getRequestBillingAddressUnsafe self = liftDOM ((((self ^. js "requestBillingAddress") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestbillingaddress PaymentOptions.requestBillingAddress specification>
getRequestBillingAddressUnchecked :: (MonadDOM m) => PaymentOptions -> m Bool
getRequestBillingAddressUnchecked self = liftDOM (((self ^. js "requestBillingAddress") >>= valToBool))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayeremail PaymentOptions.requestPayerEmail specification>
setRequestPayerEmail :: (MonadDOM m) => PaymentOptions -> Bool -> m ()
setRequestPayerEmail self val = liftDOM (void (self ^. jss "requestPayerEmail" (toJSVal val)))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayeremail PaymentOptions.requestPayerEmail specification>
getRequestPayerEmail :: (MonadDOM m) => PaymentOptions -> m (Maybe Bool)
getRequestPayerEmail self = liftDOM (((self ^. js "requestPayerEmail") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayeremail PaymentOptions.requestPayerEmail specification>
getRequestPayerEmailUnsafe :: (MonadDOM m, HasCallStack) => PaymentOptions -> m Bool
getRequestPayerEmailUnsafe self = liftDOM ((((self ^. js "requestPayerEmail") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayeremail PaymentOptions.requestPayerEmail specification>
getRequestPayerEmailUnchecked :: (MonadDOM m) => PaymentOptions -> m Bool
getRequestPayerEmailUnchecked self = liftDOM (((self ^. js "requestPayerEmail") >>= valToBool))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayerphone PaymentOptions.requestPayerPhone specification>
setRequestPayerPhone :: (MonadDOM m) => PaymentOptions -> Bool -> m ()
setRequestPayerPhone self val = liftDOM (void (self ^. jss "requestPayerPhone" (toJSVal val)))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayerphone PaymentOptions.requestPayerPhone specification>
getRequestPayerPhone :: (MonadDOM m) => PaymentOptions -> m (Maybe Bool)
getRequestPayerPhone self = liftDOM (((self ^. js "requestPayerPhone") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayerphone PaymentOptions.requestPayerPhone specification>
getRequestPayerPhoneUnsafe :: (MonadDOM m, HasCallStack) => PaymentOptions -> m Bool
getRequestPayerPhoneUnsafe self = liftDOM ((((self ^. js "requestPayerPhone") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestpayerphone PaymentOptions.requestPayerPhone specification>
getRequestPayerPhoneUnchecked :: (MonadDOM m) => PaymentOptions -> m Bool
getRequestPayerPhoneUnchecked self = liftDOM (((self ^. js "requestPayerPhone") >>= valToBool))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestshipping PaymentOptions.requestShipping specification>
setRequestShipping :: (MonadDOM m) => PaymentOptions -> Bool -> m ()
setRequestShipping self val = liftDOM (void (self ^. jss "requestShipping" (toJSVal val)))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestshipping PaymentOptions.requestShipping specification>
getRequestShipping :: (MonadDOM m) => PaymentOptions -> m (Maybe Bool)
getRequestShipping self = liftDOM (((self ^. js "requestShipping") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestshipping PaymentOptions.requestShipping specification>
getRequestShippingUnsafe :: (MonadDOM m, HasCallStack) => PaymentOptions -> m Bool
getRequestShippingUnsafe self = liftDOM ((((self ^. js "requestShipping") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-requestshipping PaymentOptions.requestShipping specification>
getRequestShippingUnchecked :: (MonadDOM m) => PaymentOptions -> m Bool
getRequestShippingUnchecked self = liftDOM (((self ^. js "requestShipping") >>= valToBool))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-shippingtype PaymentOptions.shippingType specification>
setShippingType :: (MonadDOM m) => PaymentOptions -> PaymentShippingType -> m ()
setShippingType self val = liftDOM (void (self ^. jss "shippingType" (toJSVal val)))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-shippingtype PaymentOptions.shippingType specification>
getShippingType :: (MonadDOM m) => PaymentOptions -> m (Maybe PaymentShippingType)
getShippingType self = liftDOM (((self ^. js "shippingType") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-shippingtype PaymentOptions.shippingType specification>
getShippingTypeUnsafe :: (MonadDOM m, HasCallStack) => PaymentOptions -> m PaymentShippingType
getShippingTypeUnsafe self = liftDOM ((((self ^. js "shippingType") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/payment-request/#dom-paymentoptions-shippingtype PaymentOptions.shippingType specification>
getShippingTypeUnchecked :: (MonadDOM m) => PaymentOptions -> m PaymentShippingType
getShippingTypeUnchecked self = liftDOM (((self ^. js "shippingType") >>= fromJSValUnchecked))