packages feed

jsaddle-dom-0.10.0.0: src/JSDOM/Generated/RTCErrorInit.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.RTCErrorInit
       (newRTCErrorInit, setErrorDetail, getErrorDetail, setSdpLineNumber, getSdpLineNumber, getSdpLineNumberUnsafe, getSdpLineNumberUnchecked, setSctpCauseCode, getSctpCauseCode, getSctpCauseCodeUnsafe, getSctpCauseCodeUnchecked, setReceivedAlert, getReceivedAlert, getReceivedAlertUnsafe, getReceivedAlertUnchecked, setSentAlert, getSentAlert, getSentAlertUnsafe, getSentAlertUnchecked, setHttpRequestStatusCode, getHttpRequestStatusCode, getHttpRequestStatusCodeUnsafe, getHttpRequestStatusCodeUnchecked, RTCErrorInit(..), gTypeRTCErrorInit)
       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-rtcerrorinit RTCErrorInit specification>
newRTCErrorInit :: (MonadDOM m) => RTCErrorDetailType -> m RTCErrorInit
newRTCErrorInit errorDetail = liftDOM ((((new (jsg "Object") () >>= \o -> (o ^. jss "errorDetail" (toJSVal errorDetail)) P.>> P.return o)) >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-errordetail RTCErrorInit.errorDetail specification>
setErrorDetail :: (MonadDOM m) => RTCErrorInit -> RTCErrorDetailType -> m ()
setErrorDetail self val = liftDOM (void (self ^. jss "errorDetail" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-errordetail RTCErrorInit.errorDetail specification>
getErrorDetail :: (MonadDOM m) => RTCErrorInit -> m RTCErrorDetailType
getErrorDetail self = liftDOM (((self ^. js "errorDetail") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sdplinenumber RTCErrorInit.sdpLineNumber specification>
setSdpLineNumber :: (MonadDOM m) => RTCErrorInit -> Int -> m ()
setSdpLineNumber self val = liftDOM (void (self ^. jss "sdpLineNumber" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sdplinenumber RTCErrorInit.sdpLineNumber specification>
getSdpLineNumber :: (MonadDOM m) => RTCErrorInit -> m (Maybe Int)
getSdpLineNumber self = liftDOM (((self ^. js "sdpLineNumber") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sdplinenumber RTCErrorInit.sdpLineNumber specification>
getSdpLineNumberUnsafe :: (MonadDOM m, HasCallStack) => RTCErrorInit -> m Int
getSdpLineNumberUnsafe self = liftDOM ((((self ^. js "sdpLineNumber") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sdplinenumber RTCErrorInit.sdpLineNumber specification>
getSdpLineNumberUnchecked :: (MonadDOM m) => RTCErrorInit -> m Int
getSdpLineNumberUnchecked self = liftDOM ((P.round <$> ((self ^. js "sdpLineNumber") >>= valToNumber)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sctpcausecode RTCErrorInit.sctpCauseCode specification>
setSctpCauseCode :: (MonadDOM m) => RTCErrorInit -> Int -> m ()
setSctpCauseCode self val = liftDOM (void (self ^. jss "sctpCauseCode" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sctpcausecode RTCErrorInit.sctpCauseCode specification>
getSctpCauseCode :: (MonadDOM m) => RTCErrorInit -> m (Maybe Int)
getSctpCauseCode self = liftDOM (((self ^. js "sctpCauseCode") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sctpcausecode RTCErrorInit.sctpCauseCode specification>
getSctpCauseCodeUnsafe :: (MonadDOM m, HasCallStack) => RTCErrorInit -> m Int
getSctpCauseCodeUnsafe self = liftDOM ((((self ^. js "sctpCauseCode") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sctpcausecode RTCErrorInit.sctpCauseCode specification>
getSctpCauseCodeUnchecked :: (MonadDOM m) => RTCErrorInit -> m Int
getSctpCauseCodeUnchecked self = liftDOM ((P.round <$> ((self ^. js "sctpCauseCode") >>= valToNumber)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-receivedalert RTCErrorInit.receivedAlert specification>
setReceivedAlert :: (MonadDOM m) => RTCErrorInit -> Word -> m ()
setReceivedAlert self val = liftDOM (void (self ^. jss "receivedAlert" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-receivedalert RTCErrorInit.receivedAlert specification>
getReceivedAlert :: (MonadDOM m) => RTCErrorInit -> m (Maybe Word)
getReceivedAlert self = liftDOM (((self ^. js "receivedAlert") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-receivedalert RTCErrorInit.receivedAlert specification>
getReceivedAlertUnsafe :: (MonadDOM m, HasCallStack) => RTCErrorInit -> m Word
getReceivedAlertUnsafe self = liftDOM ((((self ^. js "receivedAlert") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-receivedalert RTCErrorInit.receivedAlert specification>
getReceivedAlertUnchecked :: (MonadDOM m) => RTCErrorInit -> m Word
getReceivedAlertUnchecked self = liftDOM ((P.round <$> ((self ^. js "receivedAlert") >>= valToNumber)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sentalert RTCErrorInit.sentAlert specification>
setSentAlert :: (MonadDOM m) => RTCErrorInit -> Word -> m ()
setSentAlert self val = liftDOM (void (self ^. jss "sentAlert" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sentalert RTCErrorInit.sentAlert specification>
getSentAlert :: (MonadDOM m) => RTCErrorInit -> m (Maybe Word)
getSentAlert self = liftDOM (((self ^. js "sentAlert") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sentalert RTCErrorInit.sentAlert specification>
getSentAlertUnsafe :: (MonadDOM m, HasCallStack) => RTCErrorInit -> m Word
getSentAlertUnsafe self = liftDOM ((((self ^. js "sentAlert") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-pc/#dom-rtcerrorinit-sentalert RTCErrorInit.sentAlert specification>
getSentAlertUnchecked :: (MonadDOM m) => RTCErrorInit -> m Word
getSentAlertUnchecked self = liftDOM ((P.round <$> ((self ^. js "sentAlert") >>= valToNumber)))

-- | <https://w3c.github.io/webrtc-identity/#dom-rtcerrorinit-httprequeststatuscode RTCErrorInit.httpRequestStatusCode specification>
setHttpRequestStatusCode :: (MonadDOM m) => RTCErrorInit -> Int -> m ()
setHttpRequestStatusCode self val = liftDOM (void (self ^. jss "httpRequestStatusCode" (toJSVal val)))

-- | <https://w3c.github.io/webrtc-identity/#dom-rtcerrorinit-httprequeststatuscode RTCErrorInit.httpRequestStatusCode specification>
getHttpRequestStatusCode :: (MonadDOM m) => RTCErrorInit -> m (Maybe Int)
getHttpRequestStatusCode self = liftDOM (((self ^. js "httpRequestStatusCode") >>= fromJSValUnchecked))

-- | <https://w3c.github.io/webrtc-identity/#dom-rtcerrorinit-httprequeststatuscode RTCErrorInit.httpRequestStatusCode specification>
getHttpRequestStatusCodeUnsafe :: (MonadDOM m, HasCallStack) => RTCErrorInit -> m Int
getHttpRequestStatusCodeUnsafe self = liftDOM ((((self ^. js "httpRequestStatusCode") >>= fromJSValUnchecked) >>= P.maybe (P.error "Nothing to return") P.return))

-- | <https://w3c.github.io/webrtc-identity/#dom-rtcerrorinit-httprequeststatuscode RTCErrorInit.httpRequestStatusCode specification>
getHttpRequestStatusCodeUnchecked :: (MonadDOM m) => RTCErrorInit -> m Int
getHttpRequestStatusCodeUnchecked self = liftDOM ((P.round <$> ((self ^. js "httpRequestStatusCode") >>= valToNumber)))