ghcjs-dom-javascript-0.10.0.0: src/GHCJS/DOM/JSFFI/Generated/PaymentShippingOption.hs
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ForeignFunctionInterface, JavaScriptFFI #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from payment-request (webref). Do not edit.
module GHCJS.DOM.JSFFI.Generated.PaymentShippingOption
(js_newPaymentShippingOption, js_setId, js_getId, js_setLabel, js_getLabel, js_setAmount, js_getAmount, js_setSelected, js_getSelected, newPaymentShippingOption, setId, getId, setLabel, getLabel, setAmount, getAmount, setSelected, getSelected, getSelectedUnsafe, getSelectedUnchecked, PaymentShippingOption(..), gTypePaymentShippingOption)
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, $2, $3) => { return ({\"id\": $1, \"label\": $2, \"amount\": $3}); })"
js_newPaymentShippingOption :: JSString -> JSString -> PaymentCurrencyAmount -> IO PaymentShippingOption
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption PaymentShippingOption specification>
newPaymentShippingOption :: (MonadDOM m, ToJSString id, ToJSString label) => id -> label -> PaymentCurrencyAmount -> m PaymentShippingOption
newPaymentShippingOption id label amount = liftDOM ((js_newPaymentShippingOption (toJSString id) (toJSString label) (amount)))
foreign import javascript safe "(($1, $2) => { $1[\"id\"] = $2; })"
js_setId :: PaymentShippingOption -> JSString -> IO ()
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-id PaymentShippingOption.id specification>
setId :: (MonadDOM m, ToJSString val) => PaymentShippingOption -> val -> m ()
setId self val = liftDOM (void ((js_setId (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"id\"]; })"
js_getId :: PaymentShippingOption -> IO JSString
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-id PaymentShippingOption.id specification>
getId :: (MonadDOM m, FromJSString result) => PaymentShippingOption -> m result
getId self = liftDOM ((fromJSString <$> (js_getId (self))))
foreign import javascript safe "(($1, $2) => { $1[\"label\"] = $2; })"
js_setLabel :: PaymentShippingOption -> JSString -> IO ()
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-label PaymentShippingOption.label specification>
setLabel :: (MonadDOM m, ToJSString val) => PaymentShippingOption -> val -> m ()
setLabel self val = liftDOM (void ((js_setLabel (self) (toJSString val))))
foreign import javascript unsafe "(($1) => { return $1[\"label\"]; })"
js_getLabel :: PaymentShippingOption -> IO JSString
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-label PaymentShippingOption.label specification>
getLabel :: (MonadDOM m, FromJSString result) => PaymentShippingOption -> m result
getLabel self = liftDOM ((fromJSString <$> (js_getLabel (self))))
foreign import javascript safe "(($1, $2) => { $1[\"amount\"] = $2; })"
js_setAmount :: PaymentShippingOption -> PaymentCurrencyAmount -> IO ()
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-amount PaymentShippingOption.amount specification>
setAmount :: (MonadDOM m) => PaymentShippingOption -> PaymentCurrencyAmount -> m ()
setAmount self val = liftDOM (void ((js_setAmount (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"amount\"]; })"
js_getAmount :: PaymentShippingOption -> IO PaymentCurrencyAmount
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-amount PaymentShippingOption.amount specification>
getAmount :: (MonadDOM m) => PaymentShippingOption -> m PaymentCurrencyAmount
getAmount self = liftDOM ((js_getAmount (self)))
foreign import javascript safe "(($1, $2) => { $1[\"selected\"] = $2; })"
js_setSelected :: PaymentShippingOption -> Bool -> IO ()
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-selected PaymentShippingOption.selected specification>
setSelected :: (MonadDOM m) => PaymentShippingOption -> Bool -> m ()
setSelected self val = liftDOM (void ((js_setSelected (self) (val))))
foreign import javascript unsafe "(($1) => { return $1[\"selected\"]; })"
js_getSelected :: PaymentShippingOption -> IO JSVal
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-selected PaymentShippingOption.selected specification>
getSelected :: (MonadDOM m) => PaymentShippingOption -> m (Maybe Bool)
getSelected self = liftDOM (((js_getSelected (self)) >>= fromJSValUnchecked))
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-selected PaymentShippingOption.selected specification>
getSelectedUnsafe :: (MonadDOM m, HasCallStack) => PaymentShippingOption -> m Bool
getSelectedUnsafe self = liftDOM ((((js_getSelected (self)) >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))
-- | <https://w3c.github.io/payment-request/#dom-paymentshippingoption-selected PaymentShippingOption.selected specification>
getSelectedUnchecked :: (MonadDOM m) => PaymentShippingOption -> m Bool
getSelectedUnchecked self = liftDOM ((pFromJSVal <$> (js_getSelected (self))))