packages feed

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

{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ImplicitParams, ConstraintKinds, KindSignatures #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- | Generated by dom-gen from webrtc (webref). Do not edit.
module JSDOM.Generated.RTCRtpSendParameters
       (newRTCRtpSendParameters, setTransactionId, getTransactionId, setEncodings, getEncodings, setDegradationPreference, getDegradationPreference, getDegradationPreferenceUnsafe, getDegradationPreferenceUnchecked, RTCRtpSendParameters(..), gTypeRTCRtpSendParameters)
       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/webrtc-pc/#dom-rtcrtpsendparameters RTCRtpSendParameters specification>
newRTCRtpSendParameters :: (MonadDOM m, ToJSString transactionId) => [RTCRtpHeaderExtensionParameters] -> RTCRtcpParameters -> [RTCRtpCodecParameters] -> transactionId -> [RTCRtpEncodingParameters] -> m RTCRtpSendParameters
newRTCRtpSendParameters headerExtensions rtcp codecs transactionId encodings = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "headerExtensions" (toJSVal headerExtensions)) P.>> (o ^. jss "rtcp" (toJSVal rtcp)) P.>> (o ^. jss "codecs" (toJSVal codecs)) P.>> (o ^. jss "transactionId" (toJSVal transactionId)) P.>> (o ^. jss "encodings" (toJSVal encodings)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpsendparameters-transactionid RTCRtpSendParameters.transactionId specification>
setTransactionId :: (MonadDOM m, ToJSString val) => RTCRtpSendParameters -> val -> m ()
setTransactionId self val = liftDOM (void (self ^. jss "transactionId" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpsendparameters-transactionid RTCRtpSendParameters.transactionId specification>
getTransactionId :: (MonadDOM m, FromJSString result) => RTCRtpSendParameters -> m result
getTransactionId self = liftDOM (((self ^. js "transactionId") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpsendparameters-encodings RTCRtpSendParameters.encodings specification>
setEncodings :: (MonadDOM m) => RTCRtpSendParameters -> [RTCRtpEncodingParameters] -> m ()
setEncodings self val = liftDOM (void (self ^. jss "encodings" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcrtpsendparameters-encodings RTCRtpSendParameters.encodings specification>
getEncodings :: (MonadDOM m) => RTCRtpSendParameters -> m [RTCRtpEncodingParameters]
getEncodings self = liftDOM (((self ^. js "encodings") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/mst-content-hint/#dom-rtcrtpsendparameters-degradationpreference RTCRtpSendParameters.degradationPreference specification>
setDegradationPreference :: (MonadDOM m) => RTCRtpSendParameters -> RTCDegradationPreference -> m ()
setDegradationPreference self val = liftDOM (void (self ^. jss "degradationPreference" (toJSVal val)))

-- | <https://w3c.github.io/mst-content-hint/#dom-rtcrtpsendparameters-degradationpreference RTCRtpSendParameters.degradationPreference specification>
getDegradationPreference :: (MonadDOM m) => RTCRtpSendParameters -> m (Maybe RTCDegradationPreference)
getDegradationPreference self = liftDOM (((self ^. js "degradationPreference") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/mst-content-hint/#dom-rtcrtpsendparameters-degradationpreference RTCRtpSendParameters.degradationPreference specification>
getDegradationPreferenceUnsafe :: (MonadDOM m, HasCallStack) => RTCRtpSendParameters -> m RTCDegradationPreference
getDegradationPreferenceUnsafe self = liftDOM ((((self ^. js "degradationPreference") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/mst-content-hint/#dom-rtcrtpsendparameters-degradationpreference RTCRtpSendParameters.degradationPreference specification>
getDegradationPreferenceUnchecked :: (MonadDOM m) => RTCRtpSendParameters -> m RTCDegradationPreference
getDegradationPreferenceUnchecked self = liftDOM (((self ^. js "degradationPreference") >>= fromJSValUnchecked))