{-# LANGUAGE OverloadedStrings, RecordWildCards, TupleSections #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TypeFamilies #-} {- | = DOM This domain exposes DOM read/write operations. Each DOM Node is represented with its mirror object that has an `id`. This `id` can be used to get additional information on the Node, resolve it into the JavaScript object wrapper, etc. It is important that client receives DOM events only for the nodes that are known to the client. Backend keeps track of the nodes that were sent to the client and never sends the same node twice. It is client's responsibility to collect information about the nodes that were sent to the client.
Note that `iframe` owner elements will return corresponding document elements as their child nodes.
= Emulation This domain emulates different environments for the page. = Network Network domain allows tracking network activities of the page. It exposes information about http, file, data and other requests and responses, their headers, bodies, timing, etc. = Page Actions and events related to the inspected page belong to the page domain. = Security Security -} module CDP.Domains.DOMPageNetworkEmulationSecurity (module CDP.Domains.DOMPageNetworkEmulationSecurity) where import Control.Applicative ((<$>)) import Control.Monad import Control.Monad.Loops import Control.Monad.Trans (liftIO) import qualified Data.Map as M import Data.Maybe import Data.Functor.Identity import Data.String import qualified Data.Text as T import qualified Data.List as List import qualified Data.Text.IO as TI import qualified Data.Vector as V import Data.Aeson.Types (Parser(..)) import Data.Aeson (FromJSON (..), ToJSON (..), (.:), (.:?), (.=), (.!=), (.:!)) import qualified Data.Aeson as A import qualified Network.HTTP.Simple as Http import qualified Network.URI as Uri import qualified Network.WebSockets as WS import Control.Concurrent import qualified Data.ByteString.Lazy as BS import qualified Data.Map as Map import Data.Proxy import System.Random import GHC.Generics import Data.Char import Data.Default import CDP.Internal.Utils import CDP.Domains.Debugger as Debugger import CDP.Domains.IO as IO import CDP.Domains.Runtime as Runtime -- | Type 'DOM.NodeId'. -- Unique DOM node identifier. type DOMNodeId = Int -- | Type 'DOM.BackendNodeId'. -- Unique DOM node identifier used to reference a node that may not have been pushed to the -- front-end. type DOMBackendNodeId = Int -- | Type 'DOM.BackendNode'. -- Backend node with a friendly name. data DOMBackendNode = DOMBackendNode { -- | `Node`'s nodeType. dOMBackendNodeNodeType :: Int, -- | `Node`'s nodeName. dOMBackendNodeNodeName :: T.Text, dOMBackendNodeBackendNodeId :: DOMBackendNodeId } deriving (Eq, Show) instance FromJSON DOMBackendNode where parseJSON = A.withObject "DOMBackendNode" $ \o -> DOMBackendNode <$> o A..: "nodeType" <*> o A..: "nodeName" <*> o A..: "backendNodeId" instance ToJSON DOMBackendNode where toJSON p = A.object $ catMaybes [ ("nodeType" A..=) <$> Just (dOMBackendNodeNodeType p), ("nodeName" A..=) <$> Just (dOMBackendNodeNodeName p), ("backendNodeId" A..=) <$> Just (dOMBackendNodeBackendNodeId p) ] -- | Type 'DOM.PseudoType'. -- Pseudo element type. data DOMPseudoType = DOMPseudoTypeFirstLine | DOMPseudoTypeFirstLetter | DOMPseudoTypeBefore | DOMPseudoTypeAfter | DOMPseudoTypeMarker | DOMPseudoTypeBackdrop | DOMPseudoTypeSelection | DOMPseudoTypeTargetText | DOMPseudoTypeSpellingError | DOMPseudoTypeGrammarError | DOMPseudoTypeHighlight | DOMPseudoTypeFirstLineInherited | DOMPseudoTypeScrollbar | DOMPseudoTypeScrollbarThumb | DOMPseudoTypeScrollbarButton | DOMPseudoTypeScrollbarTrack | DOMPseudoTypeScrollbarTrackPiece | DOMPseudoTypeScrollbarCorner | DOMPseudoTypeResizer | DOMPseudoTypeInputListButton | DOMPseudoTypePageTransition | DOMPseudoTypePageTransitionContainer | DOMPseudoTypePageTransitionImageWrapper | DOMPseudoTypePageTransitionOutgoingImage | DOMPseudoTypePageTransitionIncomingImage deriving (Ord, Eq, Show, Read) instance FromJSON DOMPseudoType where parseJSON = A.withText "DOMPseudoType" $ \v -> case v of "first-line" -> pure DOMPseudoTypeFirstLine "first-letter" -> pure DOMPseudoTypeFirstLetter "before" -> pure DOMPseudoTypeBefore "after" -> pure DOMPseudoTypeAfter "marker" -> pure DOMPseudoTypeMarker "backdrop" -> pure DOMPseudoTypeBackdrop "selection" -> pure DOMPseudoTypeSelection "target-text" -> pure DOMPseudoTypeTargetText "spelling-error" -> pure DOMPseudoTypeSpellingError "grammar-error" -> pure DOMPseudoTypeGrammarError "highlight" -> pure DOMPseudoTypeHighlight "first-line-inherited" -> pure DOMPseudoTypeFirstLineInherited "scrollbar" -> pure DOMPseudoTypeScrollbar "scrollbar-thumb" -> pure DOMPseudoTypeScrollbarThumb "scrollbar-button" -> pure DOMPseudoTypeScrollbarButton "scrollbar-track" -> pure DOMPseudoTypeScrollbarTrack "scrollbar-track-piece" -> pure DOMPseudoTypeScrollbarTrackPiece "scrollbar-corner" -> pure DOMPseudoTypeScrollbarCorner "resizer" -> pure DOMPseudoTypeResizer "input-list-button" -> pure DOMPseudoTypeInputListButton "page-transition" -> pure DOMPseudoTypePageTransition "page-transition-container" -> pure DOMPseudoTypePageTransitionContainer "page-transition-image-wrapper" -> pure DOMPseudoTypePageTransitionImageWrapper "page-transition-outgoing-image" -> pure DOMPseudoTypePageTransitionOutgoingImage "page-transition-incoming-image" -> pure DOMPseudoTypePageTransitionIncomingImage "_" -> fail "failed to parse DOMPseudoType" instance ToJSON DOMPseudoType where toJSON v = A.String $ case v of DOMPseudoTypeFirstLine -> "first-line" DOMPseudoTypeFirstLetter -> "first-letter" DOMPseudoTypeBefore -> "before" DOMPseudoTypeAfter -> "after" DOMPseudoTypeMarker -> "marker" DOMPseudoTypeBackdrop -> "backdrop" DOMPseudoTypeSelection -> "selection" DOMPseudoTypeTargetText -> "target-text" DOMPseudoTypeSpellingError -> "spelling-error" DOMPseudoTypeGrammarError -> "grammar-error" DOMPseudoTypeHighlight -> "highlight" DOMPseudoTypeFirstLineInherited -> "first-line-inherited" DOMPseudoTypeScrollbar -> "scrollbar" DOMPseudoTypeScrollbarThumb -> "scrollbar-thumb" DOMPseudoTypeScrollbarButton -> "scrollbar-button" DOMPseudoTypeScrollbarTrack -> "scrollbar-track" DOMPseudoTypeScrollbarTrackPiece -> "scrollbar-track-piece" DOMPseudoTypeScrollbarCorner -> "scrollbar-corner" DOMPseudoTypeResizer -> "resizer" DOMPseudoTypeInputListButton -> "input-list-button" DOMPseudoTypePageTransition -> "page-transition" DOMPseudoTypePageTransitionContainer -> "page-transition-container" DOMPseudoTypePageTransitionImageWrapper -> "page-transition-image-wrapper" DOMPseudoTypePageTransitionOutgoingImage -> "page-transition-outgoing-image" DOMPseudoTypePageTransitionIncomingImage -> "page-transition-incoming-image" -- | Type 'DOM.ShadowRootType'. -- Shadow root type. data DOMShadowRootType = DOMShadowRootTypeUserAgent | DOMShadowRootTypeOpen | DOMShadowRootTypeClosed deriving (Ord, Eq, Show, Read) instance FromJSON DOMShadowRootType where parseJSON = A.withText "DOMShadowRootType" $ \v -> case v of "user-agent" -> pure DOMShadowRootTypeUserAgent "open" -> pure DOMShadowRootTypeOpen "closed" -> pure DOMShadowRootTypeClosed "_" -> fail "failed to parse DOMShadowRootType" instance ToJSON DOMShadowRootType where toJSON v = A.String $ case v of DOMShadowRootTypeUserAgent -> "user-agent" DOMShadowRootTypeOpen -> "open" DOMShadowRootTypeClosed -> "closed" -- | Type 'DOM.CompatibilityMode'. -- Document compatibility mode. data DOMCompatibilityMode = DOMCompatibilityModeQuirksMode | DOMCompatibilityModeLimitedQuirksMode | DOMCompatibilityModeNoQuirksMode deriving (Ord, Eq, Show, Read) instance FromJSON DOMCompatibilityMode where parseJSON = A.withText "DOMCompatibilityMode" $ \v -> case v of "QuirksMode" -> pure DOMCompatibilityModeQuirksMode "LimitedQuirksMode" -> pure DOMCompatibilityModeLimitedQuirksMode "NoQuirksMode" -> pure DOMCompatibilityModeNoQuirksMode "_" -> fail "failed to parse DOMCompatibilityMode" instance ToJSON DOMCompatibilityMode where toJSON v = A.String $ case v of DOMCompatibilityModeQuirksMode -> "QuirksMode" DOMCompatibilityModeLimitedQuirksMode -> "LimitedQuirksMode" DOMCompatibilityModeNoQuirksMode -> "NoQuirksMode" -- | Type 'DOM.Node'. -- DOM interaction is implemented in terms of mirror objects that represent the actual DOM nodes. -- DOMNode is a base node mirror type. data DOMNode = DOMNode { -- | Node identifier that is passed into the rest of the DOM messages as the `nodeId`. Backend -- will only push node with given `id` once. It is aware of all requested nodes and will only -- fire DOM events for nodes known to the client. dOMNodeNodeId :: DOMNodeId, -- | The id of the parent node if any. dOMNodeParentId :: Maybe DOMNodeId, -- | The BackendNodeId for this node. dOMNodeBackendNodeId :: DOMBackendNodeId, -- | `Node`'s nodeType. dOMNodeNodeType :: Int, -- | `Node`'s nodeName. dOMNodeNodeName :: T.Text, -- | `Node`'s localName. dOMNodeLocalName :: T.Text, -- | `Node`'s nodeValue. dOMNodeNodeValue :: T.Text, -- | Child count for `Container` nodes. dOMNodeChildNodeCount :: Maybe Int, -- | Child nodes of this node when requested with children. dOMNodeChildren :: Maybe [DOMNode], -- | Attributes of the `Element` node in the form of flat array `[name1, value1, name2, value2]`. dOMNodeAttributes :: Maybe [T.Text], -- | Document URL that `Document` or `FrameOwner` node points to. dOMNodeDocumentURL :: Maybe T.Text, -- | Base URL that `Document` or `FrameOwner` node uses for URL completion. dOMNodeBaseURL :: Maybe T.Text, -- | `DocumentType`'s publicId. dOMNodePublicId :: Maybe T.Text, -- | `DocumentType`'s systemId. dOMNodeSystemId :: Maybe T.Text, -- | `DocumentType`'s internalSubset. dOMNodeInternalSubset :: Maybe T.Text, -- | `Document`'s XML version in case of XML documents. dOMNodeXmlVersion :: Maybe T.Text, -- | `Attr`'s name. dOMNodeName :: Maybe T.Text, -- | `Attr`'s value. dOMNodeValue :: Maybe T.Text, -- | Pseudo element type for this node. dOMNodePseudoType :: Maybe DOMPseudoType, -- | Pseudo element identifier for this node. Only present if there is a -- valid pseudoType. dOMNodePseudoIdentifier :: Maybe T.Text, -- | Shadow root type. dOMNodeShadowRootType :: Maybe DOMShadowRootType, -- | Frame ID for frame owner elements. dOMNodeFrameId :: Maybe PageFrameId, -- | Content document for frame owner elements. dOMNodeContentDocument :: Maybe DOMNode, -- | Shadow root list for given element host. dOMNodeShadowRoots :: Maybe [DOMNode], -- | Content document fragment for template elements. dOMNodeTemplateContent :: Maybe DOMNode, -- | Pseudo elements associated with this node. dOMNodePseudoElements :: Maybe [DOMNode], -- | Distributed nodes for given insertion point. dOMNodeDistributedNodes :: Maybe [DOMBackendNode], -- | Whether the node is SVG. dOMNodeIsSVG :: Maybe Bool, dOMNodeCompatibilityMode :: Maybe DOMCompatibilityMode, dOMNodeAssignedSlot :: Maybe DOMBackendNode } deriving (Eq, Show) instance FromJSON DOMNode where parseJSON = A.withObject "DOMNode" $ \o -> DOMNode <$> o A..: "nodeId" <*> o A..:? "parentId" <*> o A..: "backendNodeId" <*> o A..: "nodeType" <*> o A..: "nodeName" <*> o A..: "localName" <*> o A..: "nodeValue" <*> o A..:? "childNodeCount" <*> o A..:? "children" <*> o A..:? "attributes" <*> o A..:? "documentURL" <*> o A..:? "baseURL" <*> o A..:? "publicId" <*> o A..:? "systemId" <*> o A..:? "internalSubset" <*> o A..:? "xmlVersion" <*> o A..:? "name" <*> o A..:? "value" <*> o A..:? "pseudoType" <*> o A..:? "pseudoIdentifier" <*> o A..:? "shadowRootType" <*> o A..:? "frameId" <*> o A..:? "contentDocument" <*> o A..:? "shadowRoots" <*> o A..:? "templateContent" <*> o A..:? "pseudoElements" <*> o A..:? "distributedNodes" <*> o A..:? "isSVG" <*> o A..:? "compatibilityMode" <*> o A..:? "assignedSlot" instance ToJSON DOMNode where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (dOMNodeNodeId p), ("parentId" A..=) <$> (dOMNodeParentId p), ("backendNodeId" A..=) <$> Just (dOMNodeBackendNodeId p), ("nodeType" A..=) <$> Just (dOMNodeNodeType p), ("nodeName" A..=) <$> Just (dOMNodeNodeName p), ("localName" A..=) <$> Just (dOMNodeLocalName p), ("nodeValue" A..=) <$> Just (dOMNodeNodeValue p), ("childNodeCount" A..=) <$> (dOMNodeChildNodeCount p), ("children" A..=) <$> (dOMNodeChildren p), ("attributes" A..=) <$> (dOMNodeAttributes p), ("documentURL" A..=) <$> (dOMNodeDocumentURL p), ("baseURL" A..=) <$> (dOMNodeBaseURL p), ("publicId" A..=) <$> (dOMNodePublicId p), ("systemId" A..=) <$> (dOMNodeSystemId p), ("internalSubset" A..=) <$> (dOMNodeInternalSubset p), ("xmlVersion" A..=) <$> (dOMNodeXmlVersion p), ("name" A..=) <$> (dOMNodeName p), ("value" A..=) <$> (dOMNodeValue p), ("pseudoType" A..=) <$> (dOMNodePseudoType p), ("pseudoIdentifier" A..=) <$> (dOMNodePseudoIdentifier p), ("shadowRootType" A..=) <$> (dOMNodeShadowRootType p), ("frameId" A..=) <$> (dOMNodeFrameId p), ("contentDocument" A..=) <$> (dOMNodeContentDocument p), ("shadowRoots" A..=) <$> (dOMNodeShadowRoots p), ("templateContent" A..=) <$> (dOMNodeTemplateContent p), ("pseudoElements" A..=) <$> (dOMNodePseudoElements p), ("distributedNodes" A..=) <$> (dOMNodeDistributedNodes p), ("isSVG" A..=) <$> (dOMNodeIsSVG p), ("compatibilityMode" A..=) <$> (dOMNodeCompatibilityMode p), ("assignedSlot" A..=) <$> (dOMNodeAssignedSlot p) ] -- | Type 'DOM.RGBA'. -- A structure holding an RGBA color. data DOMRGBA = DOMRGBA { -- | The red component, in the [0-255] range. dOMRGBAR :: Int, -- | The green component, in the [0-255] range. dOMRGBAG :: Int, -- | The blue component, in the [0-255] range. dOMRGBAB :: Int, -- | The alpha component, in the [0-1] range (default: 1). dOMRGBAA :: Maybe Double } deriving (Eq, Show) instance FromJSON DOMRGBA where parseJSON = A.withObject "DOMRGBA" $ \o -> DOMRGBA <$> o A..: "r" <*> o A..: "g" <*> o A..: "b" <*> o A..:? "a" instance ToJSON DOMRGBA where toJSON p = A.object $ catMaybes [ ("r" A..=) <$> Just (dOMRGBAR p), ("g" A..=) <$> Just (dOMRGBAG p), ("b" A..=) <$> Just (dOMRGBAB p), ("a" A..=) <$> (dOMRGBAA p) ] -- | Type 'DOM.Quad'. -- An array of quad vertices, x immediately followed by y for each point, points clock-wise. type DOMQuad = [Double] -- | Type 'DOM.BoxModel'. -- Box model. data DOMBoxModel = DOMBoxModel { -- | Content box dOMBoxModelContent :: DOMQuad, -- | Padding box dOMBoxModelPadding :: DOMQuad, -- | Border box dOMBoxModelBorder :: DOMQuad, -- | Margin box dOMBoxModelMargin :: DOMQuad, -- | Node width dOMBoxModelWidth :: Int, -- | Node height dOMBoxModelHeight :: Int, -- | Shape outside coordinates dOMBoxModelShapeOutside :: Maybe DOMShapeOutsideInfo } deriving (Eq, Show) instance FromJSON DOMBoxModel where parseJSON = A.withObject "DOMBoxModel" $ \o -> DOMBoxModel <$> o A..: "content" <*> o A..: "padding" <*> o A..: "border" <*> o A..: "margin" <*> o A..: "width" <*> o A..: "height" <*> o A..:? "shapeOutside" instance ToJSON DOMBoxModel where toJSON p = A.object $ catMaybes [ ("content" A..=) <$> Just (dOMBoxModelContent p), ("padding" A..=) <$> Just (dOMBoxModelPadding p), ("border" A..=) <$> Just (dOMBoxModelBorder p), ("margin" A..=) <$> Just (dOMBoxModelMargin p), ("width" A..=) <$> Just (dOMBoxModelWidth p), ("height" A..=) <$> Just (dOMBoxModelHeight p), ("shapeOutside" A..=) <$> (dOMBoxModelShapeOutside p) ] -- | Type 'DOM.ShapeOutsideInfo'. -- CSS Shape Outside details. data DOMShapeOutsideInfo = DOMShapeOutsideInfo { -- | Shape bounds dOMShapeOutsideInfoBounds :: DOMQuad, -- | Shape coordinate details dOMShapeOutsideInfoShape :: [A.Value], -- | Margin shape bounds dOMShapeOutsideInfoMarginShape :: [A.Value] } deriving (Eq, Show) instance FromJSON DOMShapeOutsideInfo where parseJSON = A.withObject "DOMShapeOutsideInfo" $ \o -> DOMShapeOutsideInfo <$> o A..: "bounds" <*> o A..: "shape" <*> o A..: "marginShape" instance ToJSON DOMShapeOutsideInfo where toJSON p = A.object $ catMaybes [ ("bounds" A..=) <$> Just (dOMShapeOutsideInfoBounds p), ("shape" A..=) <$> Just (dOMShapeOutsideInfoShape p), ("marginShape" A..=) <$> Just (dOMShapeOutsideInfoMarginShape p) ] -- | Type 'DOM.Rect'. -- Rectangle. data DOMRect = DOMRect { -- | X coordinate dOMRectX :: Double, -- | Y coordinate dOMRectY :: Double, -- | Rectangle width dOMRectWidth :: Double, -- | Rectangle height dOMRectHeight :: Double } deriving (Eq, Show) instance FromJSON DOMRect where parseJSON = A.withObject "DOMRect" $ \o -> DOMRect <$> o A..: "x" <*> o A..: "y" <*> o A..: "width" <*> o A..: "height" instance ToJSON DOMRect where toJSON p = A.object $ catMaybes [ ("x" A..=) <$> Just (dOMRectX p), ("y" A..=) <$> Just (dOMRectY p), ("width" A..=) <$> Just (dOMRectWidth p), ("height" A..=) <$> Just (dOMRectHeight p) ] -- | Type 'DOM.CSSComputedStyleProperty'. data DOMCSSComputedStyleProperty = DOMCSSComputedStyleProperty { -- | Computed style property name. dOMCSSComputedStylePropertyName :: T.Text, -- | Computed style property value. dOMCSSComputedStylePropertyValue :: T.Text } deriving (Eq, Show) instance FromJSON DOMCSSComputedStyleProperty where parseJSON = A.withObject "DOMCSSComputedStyleProperty" $ \o -> DOMCSSComputedStyleProperty <$> o A..: "name" <*> o A..: "value" instance ToJSON DOMCSSComputedStyleProperty where toJSON p = A.object $ catMaybes [ ("name" A..=) <$> Just (dOMCSSComputedStylePropertyName p), ("value" A..=) <$> Just (dOMCSSComputedStylePropertyValue p) ] -- | Type of the 'DOM.attributeModified' event. data DOMAttributeModified = DOMAttributeModified { -- | Id of the node that has changed. dOMAttributeModifiedNodeId :: DOMNodeId, -- | Attribute name. dOMAttributeModifiedName :: T.Text, -- | Attribute value. dOMAttributeModifiedValue :: T.Text } deriving (Eq, Show) instance FromJSON DOMAttributeModified where parseJSON = A.withObject "DOMAttributeModified" $ \o -> DOMAttributeModified <$> o A..: "nodeId" <*> o A..: "name" <*> o A..: "value" instance Event DOMAttributeModified where eventName _ = "DOM.attributeModified" -- | Type of the 'DOM.attributeRemoved' event. data DOMAttributeRemoved = DOMAttributeRemoved { -- | Id of the node that has changed. dOMAttributeRemovedNodeId :: DOMNodeId, -- | A ttribute name. dOMAttributeRemovedName :: T.Text } deriving (Eq, Show) instance FromJSON DOMAttributeRemoved where parseJSON = A.withObject "DOMAttributeRemoved" $ \o -> DOMAttributeRemoved <$> o A..: "nodeId" <*> o A..: "name" instance Event DOMAttributeRemoved where eventName _ = "DOM.attributeRemoved" -- | Type of the 'DOM.characterDataModified' event. data DOMCharacterDataModified = DOMCharacterDataModified { -- | Id of the node that has changed. dOMCharacterDataModifiedNodeId :: DOMNodeId, -- | New text value. dOMCharacterDataModifiedCharacterData :: T.Text } deriving (Eq, Show) instance FromJSON DOMCharacterDataModified where parseJSON = A.withObject "DOMCharacterDataModified" $ \o -> DOMCharacterDataModified <$> o A..: "nodeId" <*> o A..: "characterData" instance Event DOMCharacterDataModified where eventName _ = "DOM.characterDataModified" -- | Type of the 'DOM.childNodeCountUpdated' event. data DOMChildNodeCountUpdated = DOMChildNodeCountUpdated { -- | Id of the node that has changed. dOMChildNodeCountUpdatedNodeId :: DOMNodeId, -- | New node count. dOMChildNodeCountUpdatedChildNodeCount :: Int } deriving (Eq, Show) instance FromJSON DOMChildNodeCountUpdated where parseJSON = A.withObject "DOMChildNodeCountUpdated" $ \o -> DOMChildNodeCountUpdated <$> o A..: "nodeId" <*> o A..: "childNodeCount" instance Event DOMChildNodeCountUpdated where eventName _ = "DOM.childNodeCountUpdated" -- | Type of the 'DOM.childNodeInserted' event. data DOMChildNodeInserted = DOMChildNodeInserted { -- | Id of the node that has changed. dOMChildNodeInsertedParentNodeId :: DOMNodeId, -- | Id of the previous sibling. dOMChildNodeInsertedPreviousNodeId :: DOMNodeId, -- | Inserted node data. dOMChildNodeInsertedNode :: DOMNode } deriving (Eq, Show) instance FromJSON DOMChildNodeInserted where parseJSON = A.withObject "DOMChildNodeInserted" $ \o -> DOMChildNodeInserted <$> o A..: "parentNodeId" <*> o A..: "previousNodeId" <*> o A..: "node" instance Event DOMChildNodeInserted where eventName _ = "DOM.childNodeInserted" -- | Type of the 'DOM.childNodeRemoved' event. data DOMChildNodeRemoved = DOMChildNodeRemoved { -- | Parent id. dOMChildNodeRemovedParentNodeId :: DOMNodeId, -- | Id of the node that has been removed. dOMChildNodeRemovedNodeId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMChildNodeRemoved where parseJSON = A.withObject "DOMChildNodeRemoved" $ \o -> DOMChildNodeRemoved <$> o A..: "parentNodeId" <*> o A..: "nodeId" instance Event DOMChildNodeRemoved where eventName _ = "DOM.childNodeRemoved" -- | Type of the 'DOM.distributedNodesUpdated' event. data DOMDistributedNodesUpdated = DOMDistributedNodesUpdated { -- | Insertion point where distributed nodes were updated. dOMDistributedNodesUpdatedInsertionPointId :: DOMNodeId, -- | Distributed nodes for given insertion point. dOMDistributedNodesUpdatedDistributedNodes :: [DOMBackendNode] } deriving (Eq, Show) instance FromJSON DOMDistributedNodesUpdated where parseJSON = A.withObject "DOMDistributedNodesUpdated" $ \o -> DOMDistributedNodesUpdated <$> o A..: "insertionPointId" <*> o A..: "distributedNodes" instance Event DOMDistributedNodesUpdated where eventName _ = "DOM.distributedNodesUpdated" -- | Type of the 'DOM.documentUpdated' event. data DOMDocumentUpdated = DOMDocumentUpdated deriving (Eq, Show, Read) instance FromJSON DOMDocumentUpdated where parseJSON _ = pure DOMDocumentUpdated instance Event DOMDocumentUpdated where eventName _ = "DOM.documentUpdated" -- | Type of the 'DOM.inlineStyleInvalidated' event. data DOMInlineStyleInvalidated = DOMInlineStyleInvalidated { -- | Ids of the nodes for which the inline styles have been invalidated. dOMInlineStyleInvalidatedNodeIds :: [DOMNodeId] } deriving (Eq, Show) instance FromJSON DOMInlineStyleInvalidated where parseJSON = A.withObject "DOMInlineStyleInvalidated" $ \o -> DOMInlineStyleInvalidated <$> o A..: "nodeIds" instance Event DOMInlineStyleInvalidated where eventName _ = "DOM.inlineStyleInvalidated" -- | Type of the 'DOM.pseudoElementAdded' event. data DOMPseudoElementAdded = DOMPseudoElementAdded { -- | Pseudo element's parent element id. dOMPseudoElementAddedParentId :: DOMNodeId, -- | The added pseudo element. dOMPseudoElementAddedPseudoElement :: DOMNode } deriving (Eq, Show) instance FromJSON DOMPseudoElementAdded where parseJSON = A.withObject "DOMPseudoElementAdded" $ \o -> DOMPseudoElementAdded <$> o A..: "parentId" <*> o A..: "pseudoElement" instance Event DOMPseudoElementAdded where eventName _ = "DOM.pseudoElementAdded" -- | Type of the 'DOM.topLayerElementsUpdated' event. data DOMTopLayerElementsUpdated = DOMTopLayerElementsUpdated deriving (Eq, Show, Read) instance FromJSON DOMTopLayerElementsUpdated where parseJSON _ = pure DOMTopLayerElementsUpdated instance Event DOMTopLayerElementsUpdated where eventName _ = "DOM.topLayerElementsUpdated" -- | Type of the 'DOM.pseudoElementRemoved' event. data DOMPseudoElementRemoved = DOMPseudoElementRemoved { -- | Pseudo element's parent element id. dOMPseudoElementRemovedParentId :: DOMNodeId, -- | The removed pseudo element id. dOMPseudoElementRemovedPseudoElementId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMPseudoElementRemoved where parseJSON = A.withObject "DOMPseudoElementRemoved" $ \o -> DOMPseudoElementRemoved <$> o A..: "parentId" <*> o A..: "pseudoElementId" instance Event DOMPseudoElementRemoved where eventName _ = "DOM.pseudoElementRemoved" -- | Type of the 'DOM.setChildNodes' event. data DOMSetChildNodes = DOMSetChildNodes { -- | Parent node id to populate with children. dOMSetChildNodesParentId :: DOMNodeId, -- | Child nodes array. dOMSetChildNodesNodes :: [DOMNode] } deriving (Eq, Show) instance FromJSON DOMSetChildNodes where parseJSON = A.withObject "DOMSetChildNodes" $ \o -> DOMSetChildNodes <$> o A..: "parentId" <*> o A..: "nodes" instance Event DOMSetChildNodes where eventName _ = "DOM.setChildNodes" -- | Type of the 'DOM.shadowRootPopped' event. data DOMShadowRootPopped = DOMShadowRootPopped { -- | Host element id. dOMShadowRootPoppedHostId :: DOMNodeId, -- | Shadow root id. dOMShadowRootPoppedRootId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMShadowRootPopped where parseJSON = A.withObject "DOMShadowRootPopped" $ \o -> DOMShadowRootPopped <$> o A..: "hostId" <*> o A..: "rootId" instance Event DOMShadowRootPopped where eventName _ = "DOM.shadowRootPopped" -- | Type of the 'DOM.shadowRootPushed' event. data DOMShadowRootPushed = DOMShadowRootPushed { -- | Host element id. dOMShadowRootPushedHostId :: DOMNodeId, -- | Shadow root. dOMShadowRootPushedRoot :: DOMNode } deriving (Eq, Show) instance FromJSON DOMShadowRootPushed where parseJSON = A.withObject "DOMShadowRootPushed" $ \o -> DOMShadowRootPushed <$> o A..: "hostId" <*> o A..: "root" instance Event DOMShadowRootPushed where eventName _ = "DOM.shadowRootPushed" -- | Collects class names for the node with given id and all of it's child nodes. -- | Parameters of the 'DOM.collectClassNamesFromSubtree' command. data PDOMCollectClassNamesFromSubtree = PDOMCollectClassNamesFromSubtree { -- | Id of the node to collect class names. pDOMCollectClassNamesFromSubtreeNodeId :: DOMNodeId } deriving (Eq, Show) pDOMCollectClassNamesFromSubtree {- -- | Id of the node to collect class names. -} :: DOMNodeId -> PDOMCollectClassNamesFromSubtree pDOMCollectClassNamesFromSubtree arg_pDOMCollectClassNamesFromSubtreeNodeId = PDOMCollectClassNamesFromSubtree arg_pDOMCollectClassNamesFromSubtreeNodeId instance ToJSON PDOMCollectClassNamesFromSubtree where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMCollectClassNamesFromSubtreeNodeId p) ] data DOMCollectClassNamesFromSubtree = DOMCollectClassNamesFromSubtree { -- | Class name list. dOMCollectClassNamesFromSubtreeClassNames :: [T.Text] } deriving (Eq, Show) instance FromJSON DOMCollectClassNamesFromSubtree where parseJSON = A.withObject "DOMCollectClassNamesFromSubtree" $ \o -> DOMCollectClassNamesFromSubtree <$> o A..: "classNames" instance Command PDOMCollectClassNamesFromSubtree where type CommandResponse PDOMCollectClassNamesFromSubtree = DOMCollectClassNamesFromSubtree commandName _ = "DOM.collectClassNamesFromSubtree" -- | Creates a deep copy of the specified node and places it into the target container before the -- given anchor. -- | Parameters of the 'DOM.copyTo' command. data PDOMCopyTo = PDOMCopyTo { -- | Id of the node to copy. pDOMCopyToNodeId :: DOMNodeId, -- | Id of the element to drop the copy into. pDOMCopyToTargetNodeId :: DOMNodeId, -- | Drop the copy before this node (if absent, the copy becomes the last child of -- `targetNodeId`). pDOMCopyToInsertBeforeNodeId :: Maybe DOMNodeId } deriving (Eq, Show) pDOMCopyTo {- -- | Id of the node to copy. -} :: DOMNodeId {- -- | Id of the element to drop the copy into. -} -> DOMNodeId -> PDOMCopyTo pDOMCopyTo arg_pDOMCopyToNodeId arg_pDOMCopyToTargetNodeId = PDOMCopyTo arg_pDOMCopyToNodeId arg_pDOMCopyToTargetNodeId Nothing instance ToJSON PDOMCopyTo where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMCopyToNodeId p), ("targetNodeId" A..=) <$> Just (pDOMCopyToTargetNodeId p), ("insertBeforeNodeId" A..=) <$> (pDOMCopyToInsertBeforeNodeId p) ] data DOMCopyTo = DOMCopyTo { -- | Id of the node clone. dOMCopyToNodeId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMCopyTo where parseJSON = A.withObject "DOMCopyTo" $ \o -> DOMCopyTo <$> o A..: "nodeId" instance Command PDOMCopyTo where type CommandResponse PDOMCopyTo = DOMCopyTo commandName _ = "DOM.copyTo" -- | Describes node given its id, does not require domain to be enabled. Does not start tracking any -- objects, can be used for automation. -- | Parameters of the 'DOM.describeNode' command. data PDOMDescribeNode = PDOMDescribeNode { -- | Identifier of the node. pDOMDescribeNodeNodeId :: Maybe DOMNodeId, -- | Identifier of the backend node. pDOMDescribeNodeBackendNodeId :: Maybe DOMBackendNodeId, -- | JavaScript object id of the node wrapper. pDOMDescribeNodeObjectId :: Maybe Runtime.RuntimeRemoteObjectId, -- | The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the -- entire subtree or provide an integer larger than 0. pDOMDescribeNodeDepth :: Maybe Int, -- | Whether or not iframes and shadow roots should be traversed when returning the subtree -- (default is false). pDOMDescribeNodePierce :: Maybe Bool } deriving (Eq, Show) pDOMDescribeNode :: PDOMDescribeNode pDOMDescribeNode = PDOMDescribeNode Nothing Nothing Nothing Nothing Nothing instance ToJSON PDOMDescribeNode where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> (pDOMDescribeNodeNodeId p), ("backendNodeId" A..=) <$> (pDOMDescribeNodeBackendNodeId p), ("objectId" A..=) <$> (pDOMDescribeNodeObjectId p), ("depth" A..=) <$> (pDOMDescribeNodeDepth p), ("pierce" A..=) <$> (pDOMDescribeNodePierce p) ] data DOMDescribeNode = DOMDescribeNode { -- | Node description. dOMDescribeNodeNode :: DOMNode } deriving (Eq, Show) instance FromJSON DOMDescribeNode where parseJSON = A.withObject "DOMDescribeNode" $ \o -> DOMDescribeNode <$> o A..: "node" instance Command PDOMDescribeNode where type CommandResponse PDOMDescribeNode = DOMDescribeNode commandName _ = "DOM.describeNode" -- | Scrolls the specified rect of the given node into view if not already visible. -- Note: exactly one between nodeId, backendNodeId and objectId should be passed -- to identify the node. -- | Parameters of the 'DOM.scrollIntoViewIfNeeded' command. data PDOMScrollIntoViewIfNeeded = PDOMScrollIntoViewIfNeeded { -- | Identifier of the node. pDOMScrollIntoViewIfNeededNodeId :: Maybe DOMNodeId, -- | Identifier of the backend node. pDOMScrollIntoViewIfNeededBackendNodeId :: Maybe DOMBackendNodeId, -- | JavaScript object id of the node wrapper. pDOMScrollIntoViewIfNeededObjectId :: Maybe Runtime.RuntimeRemoteObjectId, -- | The rect to be scrolled into view, relative to the node's border box, in CSS pixels. -- When omitted, center of the node will be used, similar to Element.scrollIntoView. pDOMScrollIntoViewIfNeededRect :: Maybe DOMRect } deriving (Eq, Show) pDOMScrollIntoViewIfNeeded :: PDOMScrollIntoViewIfNeeded pDOMScrollIntoViewIfNeeded = PDOMScrollIntoViewIfNeeded Nothing Nothing Nothing Nothing instance ToJSON PDOMScrollIntoViewIfNeeded where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> (pDOMScrollIntoViewIfNeededNodeId p), ("backendNodeId" A..=) <$> (pDOMScrollIntoViewIfNeededBackendNodeId p), ("objectId" A..=) <$> (pDOMScrollIntoViewIfNeededObjectId p), ("rect" A..=) <$> (pDOMScrollIntoViewIfNeededRect p) ] instance Command PDOMScrollIntoViewIfNeeded where type CommandResponse PDOMScrollIntoViewIfNeeded = () commandName _ = "DOM.scrollIntoViewIfNeeded" fromJSON = const . A.Success . const () -- | Disables DOM agent for the given page. -- | Parameters of the 'DOM.disable' command. data PDOMDisable = PDOMDisable deriving (Eq, Show) pDOMDisable :: PDOMDisable pDOMDisable = PDOMDisable instance ToJSON PDOMDisable where toJSON _ = A.Null instance Command PDOMDisable where type CommandResponse PDOMDisable = () commandName _ = "DOM.disable" fromJSON = const . A.Success . const () -- | Discards search results from the session with the given id. `getSearchResults` should no longer -- be called for that search. -- | Parameters of the 'DOM.discardSearchResults' command. data PDOMDiscardSearchResults = PDOMDiscardSearchResults { -- | Unique search session identifier. pDOMDiscardSearchResultsSearchId :: T.Text } deriving (Eq, Show) pDOMDiscardSearchResults {- -- | Unique search session identifier. -} :: T.Text -> PDOMDiscardSearchResults pDOMDiscardSearchResults arg_pDOMDiscardSearchResultsSearchId = PDOMDiscardSearchResults arg_pDOMDiscardSearchResultsSearchId instance ToJSON PDOMDiscardSearchResults where toJSON p = A.object $ catMaybes [ ("searchId" A..=) <$> Just (pDOMDiscardSearchResultsSearchId p) ] instance Command PDOMDiscardSearchResults where type CommandResponse PDOMDiscardSearchResults = () commandName _ = "DOM.discardSearchResults" fromJSON = const . A.Success . const () -- | Enables DOM agent for the given page. -- | Parameters of the 'DOM.enable' command. data PDOMEnableIncludeWhitespace = PDOMEnableIncludeWhitespaceNone | PDOMEnableIncludeWhitespaceAll deriving (Ord, Eq, Show, Read) instance FromJSON PDOMEnableIncludeWhitespace where parseJSON = A.withText "PDOMEnableIncludeWhitespace" $ \v -> case v of "none" -> pure PDOMEnableIncludeWhitespaceNone "all" -> pure PDOMEnableIncludeWhitespaceAll "_" -> fail "failed to parse PDOMEnableIncludeWhitespace" instance ToJSON PDOMEnableIncludeWhitespace where toJSON v = A.String $ case v of PDOMEnableIncludeWhitespaceNone -> "none" PDOMEnableIncludeWhitespaceAll -> "all" data PDOMEnable = PDOMEnable { -- | Whether to include whitespaces in the children array of returned Nodes. pDOMEnableIncludeWhitespace :: Maybe PDOMEnableIncludeWhitespace } deriving (Eq, Show) pDOMEnable :: PDOMEnable pDOMEnable = PDOMEnable Nothing instance ToJSON PDOMEnable where toJSON p = A.object $ catMaybes [ ("includeWhitespace" A..=) <$> (pDOMEnableIncludeWhitespace p) ] instance Command PDOMEnable where type CommandResponse PDOMEnable = () commandName _ = "DOM.enable" fromJSON = const . A.Success . const () -- | Focuses the given element. -- | Parameters of the 'DOM.focus' command. data PDOMFocus = PDOMFocus { -- | Identifier of the node. pDOMFocusNodeId :: Maybe DOMNodeId, -- | Identifier of the backend node. pDOMFocusBackendNodeId :: Maybe DOMBackendNodeId, -- | JavaScript object id of the node wrapper. pDOMFocusObjectId :: Maybe Runtime.RuntimeRemoteObjectId } deriving (Eq, Show) pDOMFocus :: PDOMFocus pDOMFocus = PDOMFocus Nothing Nothing Nothing instance ToJSON PDOMFocus where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> (pDOMFocusNodeId p), ("backendNodeId" A..=) <$> (pDOMFocusBackendNodeId p), ("objectId" A..=) <$> (pDOMFocusObjectId p) ] instance Command PDOMFocus where type CommandResponse PDOMFocus = () commandName _ = "DOM.focus" fromJSON = const . A.Success . const () -- | Returns attributes for the specified node. -- | Parameters of the 'DOM.getAttributes' command. data PDOMGetAttributes = PDOMGetAttributes { -- | Id of the node to retrieve attibutes for. pDOMGetAttributesNodeId :: DOMNodeId } deriving (Eq, Show) pDOMGetAttributes {- -- | Id of the node to retrieve attibutes for. -} :: DOMNodeId -> PDOMGetAttributes pDOMGetAttributes arg_pDOMGetAttributesNodeId = PDOMGetAttributes arg_pDOMGetAttributesNodeId instance ToJSON PDOMGetAttributes where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMGetAttributesNodeId p) ] data DOMGetAttributes = DOMGetAttributes { -- | An interleaved array of node attribute names and values. dOMGetAttributesAttributes :: [T.Text] } deriving (Eq, Show) instance FromJSON DOMGetAttributes where parseJSON = A.withObject "DOMGetAttributes" $ \o -> DOMGetAttributes <$> o A..: "attributes" instance Command PDOMGetAttributes where type CommandResponse PDOMGetAttributes = DOMGetAttributes commandName _ = "DOM.getAttributes" -- | Returns boxes for the given node. -- | Parameters of the 'DOM.getBoxModel' command. data PDOMGetBoxModel = PDOMGetBoxModel { -- | Identifier of the node. pDOMGetBoxModelNodeId :: Maybe DOMNodeId, -- | Identifier of the backend node. pDOMGetBoxModelBackendNodeId :: Maybe DOMBackendNodeId, -- | JavaScript object id of the node wrapper. pDOMGetBoxModelObjectId :: Maybe Runtime.RuntimeRemoteObjectId } deriving (Eq, Show) pDOMGetBoxModel :: PDOMGetBoxModel pDOMGetBoxModel = PDOMGetBoxModel Nothing Nothing Nothing instance ToJSON PDOMGetBoxModel where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> (pDOMGetBoxModelNodeId p), ("backendNodeId" A..=) <$> (pDOMGetBoxModelBackendNodeId p), ("objectId" A..=) <$> (pDOMGetBoxModelObjectId p) ] data DOMGetBoxModel = DOMGetBoxModel { -- | Box model for the node. dOMGetBoxModelModel :: DOMBoxModel } deriving (Eq, Show) instance FromJSON DOMGetBoxModel where parseJSON = A.withObject "DOMGetBoxModel" $ \o -> DOMGetBoxModel <$> o A..: "model" instance Command PDOMGetBoxModel where type CommandResponse PDOMGetBoxModel = DOMGetBoxModel commandName _ = "DOM.getBoxModel" -- | Returns quads that describe node position on the page. This method -- might return multiple quads for inline nodes. -- | Parameters of the 'DOM.getContentQuads' command. data PDOMGetContentQuads = PDOMGetContentQuads { -- | Identifier of the node. pDOMGetContentQuadsNodeId :: Maybe DOMNodeId, -- | Identifier of the backend node. pDOMGetContentQuadsBackendNodeId :: Maybe DOMBackendNodeId, -- | JavaScript object id of the node wrapper. pDOMGetContentQuadsObjectId :: Maybe Runtime.RuntimeRemoteObjectId } deriving (Eq, Show) pDOMGetContentQuads :: PDOMGetContentQuads pDOMGetContentQuads = PDOMGetContentQuads Nothing Nothing Nothing instance ToJSON PDOMGetContentQuads where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> (pDOMGetContentQuadsNodeId p), ("backendNodeId" A..=) <$> (pDOMGetContentQuadsBackendNodeId p), ("objectId" A..=) <$> (pDOMGetContentQuadsObjectId p) ] data DOMGetContentQuads = DOMGetContentQuads { -- | Quads that describe node layout relative to viewport. dOMGetContentQuadsQuads :: [DOMQuad] } deriving (Eq, Show) instance FromJSON DOMGetContentQuads where parseJSON = A.withObject "DOMGetContentQuads" $ \o -> DOMGetContentQuads <$> o A..: "quads" instance Command PDOMGetContentQuads where type CommandResponse PDOMGetContentQuads = DOMGetContentQuads commandName _ = "DOM.getContentQuads" -- | Returns the root DOM node (and optionally the subtree) to the caller. -- | Parameters of the 'DOM.getDocument' command. data PDOMGetDocument = PDOMGetDocument { -- | The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the -- entire subtree or provide an integer larger than 0. pDOMGetDocumentDepth :: Maybe Int, -- | Whether or not iframes and shadow roots should be traversed when returning the subtree -- (default is false). pDOMGetDocumentPierce :: Maybe Bool } deriving (Eq, Show) pDOMGetDocument :: PDOMGetDocument pDOMGetDocument = PDOMGetDocument Nothing Nothing instance ToJSON PDOMGetDocument where toJSON p = A.object $ catMaybes [ ("depth" A..=) <$> (pDOMGetDocumentDepth p), ("pierce" A..=) <$> (pDOMGetDocumentPierce p) ] data DOMGetDocument = DOMGetDocument { -- | Resulting node. dOMGetDocumentRoot :: DOMNode } deriving (Eq, Show) instance FromJSON DOMGetDocument where parseJSON = A.withObject "DOMGetDocument" $ \o -> DOMGetDocument <$> o A..: "root" instance Command PDOMGetDocument where type CommandResponse PDOMGetDocument = DOMGetDocument commandName _ = "DOM.getDocument" -- | Finds nodes with a given computed style in a subtree. -- | Parameters of the 'DOM.getNodesForSubtreeByStyle' command. data PDOMGetNodesForSubtreeByStyle = PDOMGetNodesForSubtreeByStyle { -- | Node ID pointing to the root of a subtree. pDOMGetNodesForSubtreeByStyleNodeId :: DOMNodeId, -- | The style to filter nodes by (includes nodes if any of properties matches). pDOMGetNodesForSubtreeByStyleComputedStyles :: [DOMCSSComputedStyleProperty], -- | Whether or not iframes and shadow roots in the same target should be traversed when returning the -- results (default is false). pDOMGetNodesForSubtreeByStylePierce :: Maybe Bool } deriving (Eq, Show) pDOMGetNodesForSubtreeByStyle {- -- | Node ID pointing to the root of a subtree. -} :: DOMNodeId {- -- | The style to filter nodes by (includes nodes if any of properties matches). -} -> [DOMCSSComputedStyleProperty] -> PDOMGetNodesForSubtreeByStyle pDOMGetNodesForSubtreeByStyle arg_pDOMGetNodesForSubtreeByStyleNodeId arg_pDOMGetNodesForSubtreeByStyleComputedStyles = PDOMGetNodesForSubtreeByStyle arg_pDOMGetNodesForSubtreeByStyleNodeId arg_pDOMGetNodesForSubtreeByStyleComputedStyles Nothing instance ToJSON PDOMGetNodesForSubtreeByStyle where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMGetNodesForSubtreeByStyleNodeId p), ("computedStyles" A..=) <$> Just (pDOMGetNodesForSubtreeByStyleComputedStyles p), ("pierce" A..=) <$> (pDOMGetNodesForSubtreeByStylePierce p) ] data DOMGetNodesForSubtreeByStyle = DOMGetNodesForSubtreeByStyle { -- | Resulting nodes. dOMGetNodesForSubtreeByStyleNodeIds :: [DOMNodeId] } deriving (Eq, Show) instance FromJSON DOMGetNodesForSubtreeByStyle where parseJSON = A.withObject "DOMGetNodesForSubtreeByStyle" $ \o -> DOMGetNodesForSubtreeByStyle <$> o A..: "nodeIds" instance Command PDOMGetNodesForSubtreeByStyle where type CommandResponse PDOMGetNodesForSubtreeByStyle = DOMGetNodesForSubtreeByStyle commandName _ = "DOM.getNodesForSubtreeByStyle" -- | Returns node id at given location. Depending on whether DOM domain is enabled, nodeId is -- either returned or not. -- | Parameters of the 'DOM.getNodeForLocation' command. data PDOMGetNodeForLocation = PDOMGetNodeForLocation { -- | X coordinate. pDOMGetNodeForLocationX :: Int, -- | Y coordinate. pDOMGetNodeForLocationY :: Int, -- | False to skip to the nearest non-UA shadow root ancestor (default: false). pDOMGetNodeForLocationIncludeUserAgentShadowDOM :: Maybe Bool, -- | Whether to ignore pointer-events: none on elements and hit test them. pDOMGetNodeForLocationIgnorePointerEventsNone :: Maybe Bool } deriving (Eq, Show) pDOMGetNodeForLocation {- -- | X coordinate. -} :: Int {- -- | Y coordinate. -} -> Int -> PDOMGetNodeForLocation pDOMGetNodeForLocation arg_pDOMGetNodeForLocationX arg_pDOMGetNodeForLocationY = PDOMGetNodeForLocation arg_pDOMGetNodeForLocationX arg_pDOMGetNodeForLocationY Nothing Nothing instance ToJSON PDOMGetNodeForLocation where toJSON p = A.object $ catMaybes [ ("x" A..=) <$> Just (pDOMGetNodeForLocationX p), ("y" A..=) <$> Just (pDOMGetNodeForLocationY p), ("includeUserAgentShadowDOM" A..=) <$> (pDOMGetNodeForLocationIncludeUserAgentShadowDOM p), ("ignorePointerEventsNone" A..=) <$> (pDOMGetNodeForLocationIgnorePointerEventsNone p) ] data DOMGetNodeForLocation = DOMGetNodeForLocation { -- | Resulting node. dOMGetNodeForLocationBackendNodeId :: DOMBackendNodeId, -- | Frame this node belongs to. dOMGetNodeForLocationFrameId :: PageFrameId, -- | Id of the node at given coordinates, only when enabled and requested document. dOMGetNodeForLocationNodeId :: Maybe DOMNodeId } deriving (Eq, Show) instance FromJSON DOMGetNodeForLocation where parseJSON = A.withObject "DOMGetNodeForLocation" $ \o -> DOMGetNodeForLocation <$> o A..: "backendNodeId" <*> o A..: "frameId" <*> o A..:? "nodeId" instance Command PDOMGetNodeForLocation where type CommandResponse PDOMGetNodeForLocation = DOMGetNodeForLocation commandName _ = "DOM.getNodeForLocation" -- | Returns node's HTML markup. -- | Parameters of the 'DOM.getOuterHTML' command. data PDOMGetOuterHTML = PDOMGetOuterHTML { -- | Identifier of the node. pDOMGetOuterHTMLNodeId :: Maybe DOMNodeId, -- | Identifier of the backend node. pDOMGetOuterHTMLBackendNodeId :: Maybe DOMBackendNodeId, -- | JavaScript object id of the node wrapper. pDOMGetOuterHTMLObjectId :: Maybe Runtime.RuntimeRemoteObjectId } deriving (Eq, Show) pDOMGetOuterHTML :: PDOMGetOuterHTML pDOMGetOuterHTML = PDOMGetOuterHTML Nothing Nothing Nothing instance ToJSON PDOMGetOuterHTML where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> (pDOMGetOuterHTMLNodeId p), ("backendNodeId" A..=) <$> (pDOMGetOuterHTMLBackendNodeId p), ("objectId" A..=) <$> (pDOMGetOuterHTMLObjectId p) ] data DOMGetOuterHTML = DOMGetOuterHTML { -- | Outer HTML markup. dOMGetOuterHTMLOuterHTML :: T.Text } deriving (Eq, Show) instance FromJSON DOMGetOuterHTML where parseJSON = A.withObject "DOMGetOuterHTML" $ \o -> DOMGetOuterHTML <$> o A..: "outerHTML" instance Command PDOMGetOuterHTML where type CommandResponse PDOMGetOuterHTML = DOMGetOuterHTML commandName _ = "DOM.getOuterHTML" -- | Returns the id of the nearest ancestor that is a relayout boundary. -- | Parameters of the 'DOM.getRelayoutBoundary' command. data PDOMGetRelayoutBoundary = PDOMGetRelayoutBoundary { -- | Id of the node. pDOMGetRelayoutBoundaryNodeId :: DOMNodeId } deriving (Eq, Show) pDOMGetRelayoutBoundary {- -- | Id of the node. -} :: DOMNodeId -> PDOMGetRelayoutBoundary pDOMGetRelayoutBoundary arg_pDOMGetRelayoutBoundaryNodeId = PDOMGetRelayoutBoundary arg_pDOMGetRelayoutBoundaryNodeId instance ToJSON PDOMGetRelayoutBoundary where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMGetRelayoutBoundaryNodeId p) ] data DOMGetRelayoutBoundary = DOMGetRelayoutBoundary { -- | Relayout boundary node id for the given node. dOMGetRelayoutBoundaryNodeId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMGetRelayoutBoundary where parseJSON = A.withObject "DOMGetRelayoutBoundary" $ \o -> DOMGetRelayoutBoundary <$> o A..: "nodeId" instance Command PDOMGetRelayoutBoundary where type CommandResponse PDOMGetRelayoutBoundary = DOMGetRelayoutBoundary commandName _ = "DOM.getRelayoutBoundary" -- | Returns search results from given `fromIndex` to given `toIndex` from the search with the given -- identifier. -- | Parameters of the 'DOM.getSearchResults' command. data PDOMGetSearchResults = PDOMGetSearchResults { -- | Unique search session identifier. pDOMGetSearchResultsSearchId :: T.Text, -- | Start index of the search result to be returned. pDOMGetSearchResultsFromIndex :: Int, -- | End index of the search result to be returned. pDOMGetSearchResultsToIndex :: Int } deriving (Eq, Show) pDOMGetSearchResults {- -- | Unique search session identifier. -} :: T.Text {- -- | Start index of the search result to be returned. -} -> Int {- -- | End index of the search result to be returned. -} -> Int -> PDOMGetSearchResults pDOMGetSearchResults arg_pDOMGetSearchResultsSearchId arg_pDOMGetSearchResultsFromIndex arg_pDOMGetSearchResultsToIndex = PDOMGetSearchResults arg_pDOMGetSearchResultsSearchId arg_pDOMGetSearchResultsFromIndex arg_pDOMGetSearchResultsToIndex instance ToJSON PDOMGetSearchResults where toJSON p = A.object $ catMaybes [ ("searchId" A..=) <$> Just (pDOMGetSearchResultsSearchId p), ("fromIndex" A..=) <$> Just (pDOMGetSearchResultsFromIndex p), ("toIndex" A..=) <$> Just (pDOMGetSearchResultsToIndex p) ] data DOMGetSearchResults = DOMGetSearchResults { -- | Ids of the search result nodes. dOMGetSearchResultsNodeIds :: [DOMNodeId] } deriving (Eq, Show) instance FromJSON DOMGetSearchResults where parseJSON = A.withObject "DOMGetSearchResults" $ \o -> DOMGetSearchResults <$> o A..: "nodeIds" instance Command PDOMGetSearchResults where type CommandResponse PDOMGetSearchResults = DOMGetSearchResults commandName _ = "DOM.getSearchResults" -- | Hides any highlight. -- | Parameters of the 'DOM.hideHighlight' command. data PDOMHideHighlight = PDOMHideHighlight deriving (Eq, Show) pDOMHideHighlight :: PDOMHideHighlight pDOMHideHighlight = PDOMHideHighlight instance ToJSON PDOMHideHighlight where toJSON _ = A.Null instance Command PDOMHideHighlight where type CommandResponse PDOMHideHighlight = () commandName _ = "DOM.hideHighlight" fromJSON = const . A.Success . const () -- | Highlights DOM node. -- | Parameters of the 'DOM.highlightNode' command. data PDOMHighlightNode = PDOMHighlightNode deriving (Eq, Show) pDOMHighlightNode :: PDOMHighlightNode pDOMHighlightNode = PDOMHighlightNode instance ToJSON PDOMHighlightNode where toJSON _ = A.Null instance Command PDOMHighlightNode where type CommandResponse PDOMHighlightNode = () commandName _ = "DOM.highlightNode" fromJSON = const . A.Success . const () -- | Highlights given rectangle. -- | Parameters of the 'DOM.highlightRect' command. data PDOMHighlightRect = PDOMHighlightRect deriving (Eq, Show) pDOMHighlightRect :: PDOMHighlightRect pDOMHighlightRect = PDOMHighlightRect instance ToJSON PDOMHighlightRect where toJSON _ = A.Null instance Command PDOMHighlightRect where type CommandResponse PDOMHighlightRect = () commandName _ = "DOM.highlightRect" fromJSON = const . A.Success . const () -- | Marks last undoable state. -- | Parameters of the 'DOM.markUndoableState' command. data PDOMMarkUndoableState = PDOMMarkUndoableState deriving (Eq, Show) pDOMMarkUndoableState :: PDOMMarkUndoableState pDOMMarkUndoableState = PDOMMarkUndoableState instance ToJSON PDOMMarkUndoableState where toJSON _ = A.Null instance Command PDOMMarkUndoableState where type CommandResponse PDOMMarkUndoableState = () commandName _ = "DOM.markUndoableState" fromJSON = const . A.Success . const () -- | Moves node into the new container, places it before the given anchor. -- | Parameters of the 'DOM.moveTo' command. data PDOMMoveTo = PDOMMoveTo { -- | Id of the node to move. pDOMMoveToNodeId :: DOMNodeId, -- | Id of the element to drop the moved node into. pDOMMoveToTargetNodeId :: DOMNodeId, -- | Drop node before this one (if absent, the moved node becomes the last child of -- `targetNodeId`). pDOMMoveToInsertBeforeNodeId :: Maybe DOMNodeId } deriving (Eq, Show) pDOMMoveTo {- -- | Id of the node to move. -} :: DOMNodeId {- -- | Id of the element to drop the moved node into. -} -> DOMNodeId -> PDOMMoveTo pDOMMoveTo arg_pDOMMoveToNodeId arg_pDOMMoveToTargetNodeId = PDOMMoveTo arg_pDOMMoveToNodeId arg_pDOMMoveToTargetNodeId Nothing instance ToJSON PDOMMoveTo where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMMoveToNodeId p), ("targetNodeId" A..=) <$> Just (pDOMMoveToTargetNodeId p), ("insertBeforeNodeId" A..=) <$> (pDOMMoveToInsertBeforeNodeId p) ] data DOMMoveTo = DOMMoveTo { -- | New id of the moved node. dOMMoveToNodeId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMMoveTo where parseJSON = A.withObject "DOMMoveTo" $ \o -> DOMMoveTo <$> o A..: "nodeId" instance Command PDOMMoveTo where type CommandResponse PDOMMoveTo = DOMMoveTo commandName _ = "DOM.moveTo" -- | Searches for a given string in the DOM tree. Use `getSearchResults` to access search results or -- `cancelSearch` to end this search session. -- | Parameters of the 'DOM.performSearch' command. data PDOMPerformSearch = PDOMPerformSearch { -- | Plain text or query selector or XPath search query. pDOMPerformSearchQuery :: T.Text, -- | True to search in user agent shadow DOM. pDOMPerformSearchIncludeUserAgentShadowDOM :: Maybe Bool } deriving (Eq, Show) pDOMPerformSearch {- -- | Plain text or query selector or XPath search query. -} :: T.Text -> PDOMPerformSearch pDOMPerformSearch arg_pDOMPerformSearchQuery = PDOMPerformSearch arg_pDOMPerformSearchQuery Nothing instance ToJSON PDOMPerformSearch where toJSON p = A.object $ catMaybes [ ("query" A..=) <$> Just (pDOMPerformSearchQuery p), ("includeUserAgentShadowDOM" A..=) <$> (pDOMPerformSearchIncludeUserAgentShadowDOM p) ] data DOMPerformSearch = DOMPerformSearch { -- | Unique search session identifier. dOMPerformSearchSearchId :: T.Text, -- | Number of search results. dOMPerformSearchResultCount :: Int } deriving (Eq, Show) instance FromJSON DOMPerformSearch where parseJSON = A.withObject "DOMPerformSearch" $ \o -> DOMPerformSearch <$> o A..: "searchId" <*> o A..: "resultCount" instance Command PDOMPerformSearch where type CommandResponse PDOMPerformSearch = DOMPerformSearch commandName _ = "DOM.performSearch" -- | Requests that the node is sent to the caller given its path. // FIXME, use XPath -- | Parameters of the 'DOM.pushNodeByPathToFrontend' command. data PDOMPushNodeByPathToFrontend = PDOMPushNodeByPathToFrontend { -- | Path to node in the proprietary format. pDOMPushNodeByPathToFrontendPath :: T.Text } deriving (Eq, Show) pDOMPushNodeByPathToFrontend {- -- | Path to node in the proprietary format. -} :: T.Text -> PDOMPushNodeByPathToFrontend pDOMPushNodeByPathToFrontend arg_pDOMPushNodeByPathToFrontendPath = PDOMPushNodeByPathToFrontend arg_pDOMPushNodeByPathToFrontendPath instance ToJSON PDOMPushNodeByPathToFrontend where toJSON p = A.object $ catMaybes [ ("path" A..=) <$> Just (pDOMPushNodeByPathToFrontendPath p) ] data DOMPushNodeByPathToFrontend = DOMPushNodeByPathToFrontend { -- | Id of the node for given path. dOMPushNodeByPathToFrontendNodeId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMPushNodeByPathToFrontend where parseJSON = A.withObject "DOMPushNodeByPathToFrontend" $ \o -> DOMPushNodeByPathToFrontend <$> o A..: "nodeId" instance Command PDOMPushNodeByPathToFrontend where type CommandResponse PDOMPushNodeByPathToFrontend = DOMPushNodeByPathToFrontend commandName _ = "DOM.pushNodeByPathToFrontend" -- | Requests that a batch of nodes is sent to the caller given their backend node ids. -- | Parameters of the 'DOM.pushNodesByBackendIdsToFrontend' command. data PDOMPushNodesByBackendIdsToFrontend = PDOMPushNodesByBackendIdsToFrontend { -- | The array of backend node ids. pDOMPushNodesByBackendIdsToFrontendBackendNodeIds :: [DOMBackendNodeId] } deriving (Eq, Show) pDOMPushNodesByBackendIdsToFrontend {- -- | The array of backend node ids. -} :: [DOMBackendNodeId] -> PDOMPushNodesByBackendIdsToFrontend pDOMPushNodesByBackendIdsToFrontend arg_pDOMPushNodesByBackendIdsToFrontendBackendNodeIds = PDOMPushNodesByBackendIdsToFrontend arg_pDOMPushNodesByBackendIdsToFrontendBackendNodeIds instance ToJSON PDOMPushNodesByBackendIdsToFrontend where toJSON p = A.object $ catMaybes [ ("backendNodeIds" A..=) <$> Just (pDOMPushNodesByBackendIdsToFrontendBackendNodeIds p) ] data DOMPushNodesByBackendIdsToFrontend = DOMPushNodesByBackendIdsToFrontend { -- | The array of ids of pushed nodes that correspond to the backend ids specified in -- backendNodeIds. dOMPushNodesByBackendIdsToFrontendNodeIds :: [DOMNodeId] } deriving (Eq, Show) instance FromJSON DOMPushNodesByBackendIdsToFrontend where parseJSON = A.withObject "DOMPushNodesByBackendIdsToFrontend" $ \o -> DOMPushNodesByBackendIdsToFrontend <$> o A..: "nodeIds" instance Command PDOMPushNodesByBackendIdsToFrontend where type CommandResponse PDOMPushNodesByBackendIdsToFrontend = DOMPushNodesByBackendIdsToFrontend commandName _ = "DOM.pushNodesByBackendIdsToFrontend" -- | Executes `querySelector` on a given node. -- | Parameters of the 'DOM.querySelector' command. data PDOMQuerySelector = PDOMQuerySelector { -- | Id of the node to query upon. pDOMQuerySelectorNodeId :: DOMNodeId, -- | Selector string. pDOMQuerySelectorSelector :: T.Text } deriving (Eq, Show) pDOMQuerySelector {- -- | Id of the node to query upon. -} :: DOMNodeId {- -- | Selector string. -} -> T.Text -> PDOMQuerySelector pDOMQuerySelector arg_pDOMQuerySelectorNodeId arg_pDOMQuerySelectorSelector = PDOMQuerySelector arg_pDOMQuerySelectorNodeId arg_pDOMQuerySelectorSelector instance ToJSON PDOMQuerySelector where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMQuerySelectorNodeId p), ("selector" A..=) <$> Just (pDOMQuerySelectorSelector p) ] data DOMQuerySelector = DOMQuerySelector { -- | Query selector result. dOMQuerySelectorNodeId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMQuerySelector where parseJSON = A.withObject "DOMQuerySelector" $ \o -> DOMQuerySelector <$> o A..: "nodeId" instance Command PDOMQuerySelector where type CommandResponse PDOMQuerySelector = DOMQuerySelector commandName _ = "DOM.querySelector" -- | Executes `querySelectorAll` on a given node. -- | Parameters of the 'DOM.querySelectorAll' command. data PDOMQuerySelectorAll = PDOMQuerySelectorAll { -- | Id of the node to query upon. pDOMQuerySelectorAllNodeId :: DOMNodeId, -- | Selector string. pDOMQuerySelectorAllSelector :: T.Text } deriving (Eq, Show) pDOMQuerySelectorAll {- -- | Id of the node to query upon. -} :: DOMNodeId {- -- | Selector string. -} -> T.Text -> PDOMQuerySelectorAll pDOMQuerySelectorAll arg_pDOMQuerySelectorAllNodeId arg_pDOMQuerySelectorAllSelector = PDOMQuerySelectorAll arg_pDOMQuerySelectorAllNodeId arg_pDOMQuerySelectorAllSelector instance ToJSON PDOMQuerySelectorAll where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMQuerySelectorAllNodeId p), ("selector" A..=) <$> Just (pDOMQuerySelectorAllSelector p) ] data DOMQuerySelectorAll = DOMQuerySelectorAll { -- | Query selector result. dOMQuerySelectorAllNodeIds :: [DOMNodeId] } deriving (Eq, Show) instance FromJSON DOMQuerySelectorAll where parseJSON = A.withObject "DOMQuerySelectorAll" $ \o -> DOMQuerySelectorAll <$> o A..: "nodeIds" instance Command PDOMQuerySelectorAll where type CommandResponse PDOMQuerySelectorAll = DOMQuerySelectorAll commandName _ = "DOM.querySelectorAll" -- | Returns NodeIds of current top layer elements. -- Top layer is rendered closest to the user within a viewport, therefore its elements always -- appear on top of all other content. -- | Parameters of the 'DOM.getTopLayerElements' command. data PDOMGetTopLayerElements = PDOMGetTopLayerElements deriving (Eq, Show) pDOMGetTopLayerElements :: PDOMGetTopLayerElements pDOMGetTopLayerElements = PDOMGetTopLayerElements instance ToJSON PDOMGetTopLayerElements where toJSON _ = A.Null data DOMGetTopLayerElements = DOMGetTopLayerElements { -- | NodeIds of top layer elements dOMGetTopLayerElementsNodeIds :: [DOMNodeId] } deriving (Eq, Show) instance FromJSON DOMGetTopLayerElements where parseJSON = A.withObject "DOMGetTopLayerElements" $ \o -> DOMGetTopLayerElements <$> o A..: "nodeIds" instance Command PDOMGetTopLayerElements where type CommandResponse PDOMGetTopLayerElements = DOMGetTopLayerElements commandName _ = "DOM.getTopLayerElements" -- | Re-does the last undone action. -- | Parameters of the 'DOM.redo' command. data PDOMRedo = PDOMRedo deriving (Eq, Show) pDOMRedo :: PDOMRedo pDOMRedo = PDOMRedo instance ToJSON PDOMRedo where toJSON _ = A.Null instance Command PDOMRedo where type CommandResponse PDOMRedo = () commandName _ = "DOM.redo" fromJSON = const . A.Success . const () -- | Removes attribute with given name from an element with given id. -- | Parameters of the 'DOM.removeAttribute' command. data PDOMRemoveAttribute = PDOMRemoveAttribute { -- | Id of the element to remove attribute from. pDOMRemoveAttributeNodeId :: DOMNodeId, -- | Name of the attribute to remove. pDOMRemoveAttributeName :: T.Text } deriving (Eq, Show) pDOMRemoveAttribute {- -- | Id of the element to remove attribute from. -} :: DOMNodeId {- -- | Name of the attribute to remove. -} -> T.Text -> PDOMRemoveAttribute pDOMRemoveAttribute arg_pDOMRemoveAttributeNodeId arg_pDOMRemoveAttributeName = PDOMRemoveAttribute arg_pDOMRemoveAttributeNodeId arg_pDOMRemoveAttributeName instance ToJSON PDOMRemoveAttribute where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMRemoveAttributeNodeId p), ("name" A..=) <$> Just (pDOMRemoveAttributeName p) ] instance Command PDOMRemoveAttribute where type CommandResponse PDOMRemoveAttribute = () commandName _ = "DOM.removeAttribute" fromJSON = const . A.Success . const () -- | Removes node with given id. -- | Parameters of the 'DOM.removeNode' command. data PDOMRemoveNode = PDOMRemoveNode { -- | Id of the node to remove. pDOMRemoveNodeNodeId :: DOMNodeId } deriving (Eq, Show) pDOMRemoveNode {- -- | Id of the node to remove. -} :: DOMNodeId -> PDOMRemoveNode pDOMRemoveNode arg_pDOMRemoveNodeNodeId = PDOMRemoveNode arg_pDOMRemoveNodeNodeId instance ToJSON PDOMRemoveNode where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMRemoveNodeNodeId p) ] instance Command PDOMRemoveNode where type CommandResponse PDOMRemoveNode = () commandName _ = "DOM.removeNode" fromJSON = const . A.Success . const () -- | Requests that children of the node with given id are returned to the caller in form of -- `setChildNodes` events where not only immediate children are retrieved, but all children down to -- the specified depth. -- | Parameters of the 'DOM.requestChildNodes' command. data PDOMRequestChildNodes = PDOMRequestChildNodes { -- | Id of the node to get children for. pDOMRequestChildNodesNodeId :: DOMNodeId, -- | The maximum depth at which children should be retrieved, defaults to 1. Use -1 for the -- entire subtree or provide an integer larger than 0. pDOMRequestChildNodesDepth :: Maybe Int, -- | Whether or not iframes and shadow roots should be traversed when returning the sub-tree -- (default is false). pDOMRequestChildNodesPierce :: Maybe Bool } deriving (Eq, Show) pDOMRequestChildNodes {- -- | Id of the node to get children for. -} :: DOMNodeId -> PDOMRequestChildNodes pDOMRequestChildNodes arg_pDOMRequestChildNodesNodeId = PDOMRequestChildNodes arg_pDOMRequestChildNodesNodeId Nothing Nothing instance ToJSON PDOMRequestChildNodes where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMRequestChildNodesNodeId p), ("depth" A..=) <$> (pDOMRequestChildNodesDepth p), ("pierce" A..=) <$> (pDOMRequestChildNodesPierce p) ] instance Command PDOMRequestChildNodes where type CommandResponse PDOMRequestChildNodes = () commandName _ = "DOM.requestChildNodes" fromJSON = const . A.Success . const () -- | Requests that the node is sent to the caller given the JavaScript node object reference. All -- nodes that form the path from the node to the root are also sent to the client as a series of -- `setChildNodes` notifications. -- | Parameters of the 'DOM.requestNode' command. data PDOMRequestNode = PDOMRequestNode { -- | JavaScript object id to convert into node. pDOMRequestNodeObjectId :: Runtime.RuntimeRemoteObjectId } deriving (Eq, Show) pDOMRequestNode {- -- | JavaScript object id to convert into node. -} :: Runtime.RuntimeRemoteObjectId -> PDOMRequestNode pDOMRequestNode arg_pDOMRequestNodeObjectId = PDOMRequestNode arg_pDOMRequestNodeObjectId instance ToJSON PDOMRequestNode where toJSON p = A.object $ catMaybes [ ("objectId" A..=) <$> Just (pDOMRequestNodeObjectId p) ] data DOMRequestNode = DOMRequestNode { -- | Node id for given object. dOMRequestNodeNodeId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMRequestNode where parseJSON = A.withObject "DOMRequestNode" $ \o -> DOMRequestNode <$> o A..: "nodeId" instance Command PDOMRequestNode where type CommandResponse PDOMRequestNode = DOMRequestNode commandName _ = "DOM.requestNode" -- | Resolves the JavaScript node object for a given NodeId or BackendNodeId. -- | Parameters of the 'DOM.resolveNode' command. data PDOMResolveNode = PDOMResolveNode { -- | Id of the node to resolve. pDOMResolveNodeNodeId :: Maybe DOMNodeId, -- | Backend identifier of the node to resolve. pDOMResolveNodeBackendNodeId :: Maybe DOMBackendNodeId, -- | Symbolic group name that can be used to release multiple objects. pDOMResolveNodeObjectGroup :: Maybe T.Text, -- | Execution context in which to resolve the node. pDOMResolveNodeExecutionContextId :: Maybe Runtime.RuntimeExecutionContextId } deriving (Eq, Show) pDOMResolveNode :: PDOMResolveNode pDOMResolveNode = PDOMResolveNode Nothing Nothing Nothing Nothing instance ToJSON PDOMResolveNode where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> (pDOMResolveNodeNodeId p), ("backendNodeId" A..=) <$> (pDOMResolveNodeBackendNodeId p), ("objectGroup" A..=) <$> (pDOMResolveNodeObjectGroup p), ("executionContextId" A..=) <$> (pDOMResolveNodeExecutionContextId p) ] data DOMResolveNode = DOMResolveNode { -- | JavaScript object wrapper for given node. dOMResolveNodeObject :: Runtime.RuntimeRemoteObject } deriving (Eq, Show) instance FromJSON DOMResolveNode where parseJSON = A.withObject "DOMResolveNode" $ \o -> DOMResolveNode <$> o A..: "object" instance Command PDOMResolveNode where type CommandResponse PDOMResolveNode = DOMResolveNode commandName _ = "DOM.resolveNode" -- | Sets attribute for an element with given id. -- | Parameters of the 'DOM.setAttributeValue' command. data PDOMSetAttributeValue = PDOMSetAttributeValue { -- | Id of the element to set attribute for. pDOMSetAttributeValueNodeId :: DOMNodeId, -- | Attribute name. pDOMSetAttributeValueName :: T.Text, -- | Attribute value. pDOMSetAttributeValueValue :: T.Text } deriving (Eq, Show) pDOMSetAttributeValue {- -- | Id of the element to set attribute for. -} :: DOMNodeId {- -- | Attribute name. -} -> T.Text {- -- | Attribute value. -} -> T.Text -> PDOMSetAttributeValue pDOMSetAttributeValue arg_pDOMSetAttributeValueNodeId arg_pDOMSetAttributeValueName arg_pDOMSetAttributeValueValue = PDOMSetAttributeValue arg_pDOMSetAttributeValueNodeId arg_pDOMSetAttributeValueName arg_pDOMSetAttributeValueValue instance ToJSON PDOMSetAttributeValue where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMSetAttributeValueNodeId p), ("name" A..=) <$> Just (pDOMSetAttributeValueName p), ("value" A..=) <$> Just (pDOMSetAttributeValueValue p) ] instance Command PDOMSetAttributeValue where type CommandResponse PDOMSetAttributeValue = () commandName _ = "DOM.setAttributeValue" fromJSON = const . A.Success . const () -- | Sets attributes on element with given id. This method is useful when user edits some existing -- attribute value and types in several attribute name/value pairs. -- | Parameters of the 'DOM.setAttributesAsText' command. data PDOMSetAttributesAsText = PDOMSetAttributesAsText { -- | Id of the element to set attributes for. pDOMSetAttributesAsTextNodeId :: DOMNodeId, -- | Text with a number of attributes. Will parse this text using HTML parser. pDOMSetAttributesAsTextText :: T.Text, -- | Attribute name to replace with new attributes derived from text in case text parsed -- successfully. pDOMSetAttributesAsTextName :: Maybe T.Text } deriving (Eq, Show) pDOMSetAttributesAsText {- -- | Id of the element to set attributes for. -} :: DOMNodeId {- -- | Text with a number of attributes. Will parse this text using HTML parser. -} -> T.Text -> PDOMSetAttributesAsText pDOMSetAttributesAsText arg_pDOMSetAttributesAsTextNodeId arg_pDOMSetAttributesAsTextText = PDOMSetAttributesAsText arg_pDOMSetAttributesAsTextNodeId arg_pDOMSetAttributesAsTextText Nothing instance ToJSON PDOMSetAttributesAsText where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMSetAttributesAsTextNodeId p), ("text" A..=) <$> Just (pDOMSetAttributesAsTextText p), ("name" A..=) <$> (pDOMSetAttributesAsTextName p) ] instance Command PDOMSetAttributesAsText where type CommandResponse PDOMSetAttributesAsText = () commandName _ = "DOM.setAttributesAsText" fromJSON = const . A.Success . const () -- | Sets files for the given file input element. -- | Parameters of the 'DOM.setFileInputFiles' command. data PDOMSetFileInputFiles = PDOMSetFileInputFiles { -- | Array of file paths to set. pDOMSetFileInputFilesFiles :: [T.Text], -- | Identifier of the node. pDOMSetFileInputFilesNodeId :: Maybe DOMNodeId, -- | Identifier of the backend node. pDOMSetFileInputFilesBackendNodeId :: Maybe DOMBackendNodeId, -- | JavaScript object id of the node wrapper. pDOMSetFileInputFilesObjectId :: Maybe Runtime.RuntimeRemoteObjectId } deriving (Eq, Show) pDOMSetFileInputFiles {- -- | Array of file paths to set. -} :: [T.Text] -> PDOMSetFileInputFiles pDOMSetFileInputFiles arg_pDOMSetFileInputFilesFiles = PDOMSetFileInputFiles arg_pDOMSetFileInputFilesFiles Nothing Nothing Nothing instance ToJSON PDOMSetFileInputFiles where toJSON p = A.object $ catMaybes [ ("files" A..=) <$> Just (pDOMSetFileInputFilesFiles p), ("nodeId" A..=) <$> (pDOMSetFileInputFilesNodeId p), ("backendNodeId" A..=) <$> (pDOMSetFileInputFilesBackendNodeId p), ("objectId" A..=) <$> (pDOMSetFileInputFilesObjectId p) ] instance Command PDOMSetFileInputFiles where type CommandResponse PDOMSetFileInputFiles = () commandName _ = "DOM.setFileInputFiles" fromJSON = const . A.Success . const () -- | Sets if stack traces should be captured for Nodes. See `Node.getNodeStackTraces`. Default is disabled. -- | Parameters of the 'DOM.setNodeStackTracesEnabled' command. data PDOMSetNodeStackTracesEnabled = PDOMSetNodeStackTracesEnabled { -- | Enable or disable. pDOMSetNodeStackTracesEnabledEnable :: Bool } deriving (Eq, Show) pDOMSetNodeStackTracesEnabled {- -- | Enable or disable. -} :: Bool -> PDOMSetNodeStackTracesEnabled pDOMSetNodeStackTracesEnabled arg_pDOMSetNodeStackTracesEnabledEnable = PDOMSetNodeStackTracesEnabled arg_pDOMSetNodeStackTracesEnabledEnable instance ToJSON PDOMSetNodeStackTracesEnabled where toJSON p = A.object $ catMaybes [ ("enable" A..=) <$> Just (pDOMSetNodeStackTracesEnabledEnable p) ] instance Command PDOMSetNodeStackTracesEnabled where type CommandResponse PDOMSetNodeStackTracesEnabled = () commandName _ = "DOM.setNodeStackTracesEnabled" fromJSON = const . A.Success . const () -- | Gets stack traces associated with a Node. As of now, only provides stack trace for Node creation. -- | Parameters of the 'DOM.getNodeStackTraces' command. data PDOMGetNodeStackTraces = PDOMGetNodeStackTraces { -- | Id of the node to get stack traces for. pDOMGetNodeStackTracesNodeId :: DOMNodeId } deriving (Eq, Show) pDOMGetNodeStackTraces {- -- | Id of the node to get stack traces for. -} :: DOMNodeId -> PDOMGetNodeStackTraces pDOMGetNodeStackTraces arg_pDOMGetNodeStackTracesNodeId = PDOMGetNodeStackTraces arg_pDOMGetNodeStackTracesNodeId instance ToJSON PDOMGetNodeStackTraces where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMGetNodeStackTracesNodeId p) ] data DOMGetNodeStackTraces = DOMGetNodeStackTraces { -- | Creation stack trace, if available. dOMGetNodeStackTracesCreation :: Maybe Runtime.RuntimeStackTrace } deriving (Eq, Show) instance FromJSON DOMGetNodeStackTraces where parseJSON = A.withObject "DOMGetNodeStackTraces" $ \o -> DOMGetNodeStackTraces <$> o A..:? "creation" instance Command PDOMGetNodeStackTraces where type CommandResponse PDOMGetNodeStackTraces = DOMGetNodeStackTraces commandName _ = "DOM.getNodeStackTraces" -- | Returns file information for the given -- File wrapper. -- | Parameters of the 'DOM.getFileInfo' command. data PDOMGetFileInfo = PDOMGetFileInfo { -- | JavaScript object id of the node wrapper. pDOMGetFileInfoObjectId :: Runtime.RuntimeRemoteObjectId } deriving (Eq, Show) pDOMGetFileInfo {- -- | JavaScript object id of the node wrapper. -} :: Runtime.RuntimeRemoteObjectId -> PDOMGetFileInfo pDOMGetFileInfo arg_pDOMGetFileInfoObjectId = PDOMGetFileInfo arg_pDOMGetFileInfoObjectId instance ToJSON PDOMGetFileInfo where toJSON p = A.object $ catMaybes [ ("objectId" A..=) <$> Just (pDOMGetFileInfoObjectId p) ] data DOMGetFileInfo = DOMGetFileInfo { dOMGetFileInfoPath :: T.Text } deriving (Eq, Show) instance FromJSON DOMGetFileInfo where parseJSON = A.withObject "DOMGetFileInfo" $ \o -> DOMGetFileInfo <$> o A..: "path" instance Command PDOMGetFileInfo where type CommandResponse PDOMGetFileInfo = DOMGetFileInfo commandName _ = "DOM.getFileInfo" -- | Enables console to refer to the node with given id via $x (see Command Line API for more details -- $x functions). -- | Parameters of the 'DOM.setInspectedNode' command. data PDOMSetInspectedNode = PDOMSetInspectedNode { -- | DOM node id to be accessible by means of $x command line API. pDOMSetInspectedNodeNodeId :: DOMNodeId } deriving (Eq, Show) pDOMSetInspectedNode {- -- | DOM node id to be accessible by means of $x command line API. -} :: DOMNodeId -> PDOMSetInspectedNode pDOMSetInspectedNode arg_pDOMSetInspectedNodeNodeId = PDOMSetInspectedNode arg_pDOMSetInspectedNodeNodeId instance ToJSON PDOMSetInspectedNode where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMSetInspectedNodeNodeId p) ] instance Command PDOMSetInspectedNode where type CommandResponse PDOMSetInspectedNode = () commandName _ = "DOM.setInspectedNode" fromJSON = const . A.Success . const () -- | Sets node name for a node with given id. -- | Parameters of the 'DOM.setNodeName' command. data PDOMSetNodeName = PDOMSetNodeName { -- | Id of the node to set name for. pDOMSetNodeNameNodeId :: DOMNodeId, -- | New node's name. pDOMSetNodeNameName :: T.Text } deriving (Eq, Show) pDOMSetNodeName {- -- | Id of the node to set name for. -} :: DOMNodeId {- -- | New node's name. -} -> T.Text -> PDOMSetNodeName pDOMSetNodeName arg_pDOMSetNodeNameNodeId arg_pDOMSetNodeNameName = PDOMSetNodeName arg_pDOMSetNodeNameNodeId arg_pDOMSetNodeNameName instance ToJSON PDOMSetNodeName where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMSetNodeNameNodeId p), ("name" A..=) <$> Just (pDOMSetNodeNameName p) ] data DOMSetNodeName = DOMSetNodeName { -- | New node's id. dOMSetNodeNameNodeId :: DOMNodeId } deriving (Eq, Show) instance FromJSON DOMSetNodeName where parseJSON = A.withObject "DOMSetNodeName" $ \o -> DOMSetNodeName <$> o A..: "nodeId" instance Command PDOMSetNodeName where type CommandResponse PDOMSetNodeName = DOMSetNodeName commandName _ = "DOM.setNodeName" -- | Sets node value for a node with given id. -- | Parameters of the 'DOM.setNodeValue' command. data PDOMSetNodeValue = PDOMSetNodeValue { -- | Id of the node to set value for. pDOMSetNodeValueNodeId :: DOMNodeId, -- | New node's value. pDOMSetNodeValueValue :: T.Text } deriving (Eq, Show) pDOMSetNodeValue {- -- | Id of the node to set value for. -} :: DOMNodeId {- -- | New node's value. -} -> T.Text -> PDOMSetNodeValue pDOMSetNodeValue arg_pDOMSetNodeValueNodeId arg_pDOMSetNodeValueValue = PDOMSetNodeValue arg_pDOMSetNodeValueNodeId arg_pDOMSetNodeValueValue instance ToJSON PDOMSetNodeValue where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMSetNodeValueNodeId p), ("value" A..=) <$> Just (pDOMSetNodeValueValue p) ] instance Command PDOMSetNodeValue where type CommandResponse PDOMSetNodeValue = () commandName _ = "DOM.setNodeValue" fromJSON = const . A.Success . const () -- | Sets node HTML markup, returns new node id. -- | Parameters of the 'DOM.setOuterHTML' command. data PDOMSetOuterHTML = PDOMSetOuterHTML { -- | Id of the node to set markup for. pDOMSetOuterHTMLNodeId :: DOMNodeId, -- | Outer HTML markup to set. pDOMSetOuterHTMLOuterHTML :: T.Text } deriving (Eq, Show) pDOMSetOuterHTML {- -- | Id of the node to set markup for. -} :: DOMNodeId {- -- | Outer HTML markup to set. -} -> T.Text -> PDOMSetOuterHTML pDOMSetOuterHTML arg_pDOMSetOuterHTMLNodeId arg_pDOMSetOuterHTMLOuterHTML = PDOMSetOuterHTML arg_pDOMSetOuterHTMLNodeId arg_pDOMSetOuterHTMLOuterHTML instance ToJSON PDOMSetOuterHTML where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMSetOuterHTMLNodeId p), ("outerHTML" A..=) <$> Just (pDOMSetOuterHTMLOuterHTML p) ] instance Command PDOMSetOuterHTML where type CommandResponse PDOMSetOuterHTML = () commandName _ = "DOM.setOuterHTML" fromJSON = const . A.Success . const () -- | Undoes the last performed action. -- | Parameters of the 'DOM.undo' command. data PDOMUndo = PDOMUndo deriving (Eq, Show) pDOMUndo :: PDOMUndo pDOMUndo = PDOMUndo instance ToJSON PDOMUndo where toJSON _ = A.Null instance Command PDOMUndo where type CommandResponse PDOMUndo = () commandName _ = "DOM.undo" fromJSON = const . A.Success . const () -- | Returns iframe node that owns iframe with the given domain. -- | Parameters of the 'DOM.getFrameOwner' command. data PDOMGetFrameOwner = PDOMGetFrameOwner { pDOMGetFrameOwnerFrameId :: PageFrameId } deriving (Eq, Show) pDOMGetFrameOwner :: PageFrameId -> PDOMGetFrameOwner pDOMGetFrameOwner arg_pDOMGetFrameOwnerFrameId = PDOMGetFrameOwner arg_pDOMGetFrameOwnerFrameId instance ToJSON PDOMGetFrameOwner where toJSON p = A.object $ catMaybes [ ("frameId" A..=) <$> Just (pDOMGetFrameOwnerFrameId p) ] data DOMGetFrameOwner = DOMGetFrameOwner { -- | Resulting node. dOMGetFrameOwnerBackendNodeId :: DOMBackendNodeId, -- | Id of the node at given coordinates, only when enabled and requested document. dOMGetFrameOwnerNodeId :: Maybe DOMNodeId } deriving (Eq, Show) instance FromJSON DOMGetFrameOwner where parseJSON = A.withObject "DOMGetFrameOwner" $ \o -> DOMGetFrameOwner <$> o A..: "backendNodeId" <*> o A..:? "nodeId" instance Command PDOMGetFrameOwner where type CommandResponse PDOMGetFrameOwner = DOMGetFrameOwner commandName _ = "DOM.getFrameOwner" -- | Returns the container of the given node based on container query conditions. -- If containerName is given, it will find the nearest container with a matching name; -- otherwise it will find the nearest container regardless of its container name. -- | Parameters of the 'DOM.getContainerForNode' command. data PDOMGetContainerForNode = PDOMGetContainerForNode { pDOMGetContainerForNodeNodeId :: DOMNodeId, pDOMGetContainerForNodeContainerName :: Maybe T.Text } deriving (Eq, Show) pDOMGetContainerForNode :: DOMNodeId -> PDOMGetContainerForNode pDOMGetContainerForNode arg_pDOMGetContainerForNodeNodeId = PDOMGetContainerForNode arg_pDOMGetContainerForNodeNodeId Nothing instance ToJSON PDOMGetContainerForNode where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMGetContainerForNodeNodeId p), ("containerName" A..=) <$> (pDOMGetContainerForNodeContainerName p) ] data DOMGetContainerForNode = DOMGetContainerForNode { -- | The container node for the given node, or null if not found. dOMGetContainerForNodeNodeId :: Maybe DOMNodeId } deriving (Eq, Show) instance FromJSON DOMGetContainerForNode where parseJSON = A.withObject "DOMGetContainerForNode" $ \o -> DOMGetContainerForNode <$> o A..:? "nodeId" instance Command PDOMGetContainerForNode where type CommandResponse PDOMGetContainerForNode = DOMGetContainerForNode commandName _ = "DOM.getContainerForNode" -- | Returns the descendants of a container query container that have -- container queries against this container. -- | Parameters of the 'DOM.getQueryingDescendantsForContainer' command. data PDOMGetQueryingDescendantsForContainer = PDOMGetQueryingDescendantsForContainer { -- | Id of the container node to find querying descendants from. pDOMGetQueryingDescendantsForContainerNodeId :: DOMNodeId } deriving (Eq, Show) pDOMGetQueryingDescendantsForContainer {- -- | Id of the container node to find querying descendants from. -} :: DOMNodeId -> PDOMGetQueryingDescendantsForContainer pDOMGetQueryingDescendantsForContainer arg_pDOMGetQueryingDescendantsForContainerNodeId = PDOMGetQueryingDescendantsForContainer arg_pDOMGetQueryingDescendantsForContainerNodeId instance ToJSON PDOMGetQueryingDescendantsForContainer where toJSON p = A.object $ catMaybes [ ("nodeId" A..=) <$> Just (pDOMGetQueryingDescendantsForContainerNodeId p) ] data DOMGetQueryingDescendantsForContainer = DOMGetQueryingDescendantsForContainer { -- | Descendant nodes with container queries against the given container. dOMGetQueryingDescendantsForContainerNodeIds :: [DOMNodeId] } deriving (Eq, Show) instance FromJSON DOMGetQueryingDescendantsForContainer where parseJSON = A.withObject "DOMGetQueryingDescendantsForContainer" $ \o -> DOMGetQueryingDescendantsForContainer <$> o A..: "nodeIds" instance Command PDOMGetQueryingDescendantsForContainer where type CommandResponse PDOMGetQueryingDescendantsForContainer = DOMGetQueryingDescendantsForContainer commandName _ = "DOM.getQueryingDescendantsForContainer" -- | Type 'Emulation.ScreenOrientation'. -- Screen orientation. data EmulationScreenOrientationType = EmulationScreenOrientationTypePortraitPrimary | EmulationScreenOrientationTypePortraitSecondary | EmulationScreenOrientationTypeLandscapePrimary | EmulationScreenOrientationTypeLandscapeSecondary deriving (Ord, Eq, Show, Read) instance FromJSON EmulationScreenOrientationType where parseJSON = A.withText "EmulationScreenOrientationType" $ \v -> case v of "portraitPrimary" -> pure EmulationScreenOrientationTypePortraitPrimary "portraitSecondary" -> pure EmulationScreenOrientationTypePortraitSecondary "landscapePrimary" -> pure EmulationScreenOrientationTypeLandscapePrimary "landscapeSecondary" -> pure EmulationScreenOrientationTypeLandscapeSecondary "_" -> fail "failed to parse EmulationScreenOrientationType" instance ToJSON EmulationScreenOrientationType where toJSON v = A.String $ case v of EmulationScreenOrientationTypePortraitPrimary -> "portraitPrimary" EmulationScreenOrientationTypePortraitSecondary -> "portraitSecondary" EmulationScreenOrientationTypeLandscapePrimary -> "landscapePrimary" EmulationScreenOrientationTypeLandscapeSecondary -> "landscapeSecondary" data EmulationScreenOrientation = EmulationScreenOrientation { -- | Orientation type. emulationScreenOrientationType :: EmulationScreenOrientationType, -- | Orientation angle. emulationScreenOrientationAngle :: Int } deriving (Eq, Show) instance FromJSON EmulationScreenOrientation where parseJSON = A.withObject "EmulationScreenOrientation" $ \o -> EmulationScreenOrientation <$> o A..: "type" <*> o A..: "angle" instance ToJSON EmulationScreenOrientation where toJSON p = A.object $ catMaybes [ ("type" A..=) <$> Just (emulationScreenOrientationType p), ("angle" A..=) <$> Just (emulationScreenOrientationAngle p) ] -- | Type 'Emulation.DisplayFeature'. data EmulationDisplayFeatureOrientation = EmulationDisplayFeatureOrientationVertical | EmulationDisplayFeatureOrientationHorizontal deriving (Ord, Eq, Show, Read) instance FromJSON EmulationDisplayFeatureOrientation where parseJSON = A.withText "EmulationDisplayFeatureOrientation" $ \v -> case v of "vertical" -> pure EmulationDisplayFeatureOrientationVertical "horizontal" -> pure EmulationDisplayFeatureOrientationHorizontal "_" -> fail "failed to parse EmulationDisplayFeatureOrientation" instance ToJSON EmulationDisplayFeatureOrientation where toJSON v = A.String $ case v of EmulationDisplayFeatureOrientationVertical -> "vertical" EmulationDisplayFeatureOrientationHorizontal -> "horizontal" data EmulationDisplayFeature = EmulationDisplayFeature { -- | Orientation of a display feature in relation to screen emulationDisplayFeatureOrientation :: EmulationDisplayFeatureOrientation, -- | The offset from the screen origin in either the x (for vertical -- orientation) or y (for horizontal orientation) direction. emulationDisplayFeatureOffset :: Int, -- | A display feature may mask content such that it is not physically -- displayed - this length along with the offset describes this area. -- A display feature that only splits content will have a 0 mask_length. emulationDisplayFeatureMaskLength :: Int } deriving (Eq, Show) instance FromJSON EmulationDisplayFeature where parseJSON = A.withObject "EmulationDisplayFeature" $ \o -> EmulationDisplayFeature <$> o A..: "orientation" <*> o A..: "offset" <*> o A..: "maskLength" instance ToJSON EmulationDisplayFeature where toJSON p = A.object $ catMaybes [ ("orientation" A..=) <$> Just (emulationDisplayFeatureOrientation p), ("offset" A..=) <$> Just (emulationDisplayFeatureOffset p), ("maskLength" A..=) <$> Just (emulationDisplayFeatureMaskLength p) ] -- | Type 'Emulation.MediaFeature'. data EmulationMediaFeature = EmulationMediaFeature { emulationMediaFeatureName :: T.Text, emulationMediaFeatureValue :: T.Text } deriving (Eq, Show) instance FromJSON EmulationMediaFeature where parseJSON = A.withObject "EmulationMediaFeature" $ \o -> EmulationMediaFeature <$> o A..: "name" <*> o A..: "value" instance ToJSON EmulationMediaFeature where toJSON p = A.object $ catMaybes [ ("name" A..=) <$> Just (emulationMediaFeatureName p), ("value" A..=) <$> Just (emulationMediaFeatureValue p) ] -- | Type 'Emulation.VirtualTimePolicy'. -- advance: If the scheduler runs out of immediate work, the virtual time base may fast forward to -- allow the next delayed task (if any) to run; pause: The virtual time base may not advance; -- pauseIfNetworkFetchesPending: The virtual time base may not advance if there are any pending -- resource fetches. data EmulationVirtualTimePolicy = EmulationVirtualTimePolicyAdvance | EmulationVirtualTimePolicyPause | EmulationVirtualTimePolicyPauseIfNetworkFetchesPending deriving (Ord, Eq, Show, Read) instance FromJSON EmulationVirtualTimePolicy where parseJSON = A.withText "EmulationVirtualTimePolicy" $ \v -> case v of "advance" -> pure EmulationVirtualTimePolicyAdvance "pause" -> pure EmulationVirtualTimePolicyPause "pauseIfNetworkFetchesPending" -> pure EmulationVirtualTimePolicyPauseIfNetworkFetchesPending "_" -> fail "failed to parse EmulationVirtualTimePolicy" instance ToJSON EmulationVirtualTimePolicy where toJSON v = A.String $ case v of EmulationVirtualTimePolicyAdvance -> "advance" EmulationVirtualTimePolicyPause -> "pause" EmulationVirtualTimePolicyPauseIfNetworkFetchesPending -> "pauseIfNetworkFetchesPending" -- | Type 'Emulation.UserAgentBrandVersion'. -- Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints data EmulationUserAgentBrandVersion = EmulationUserAgentBrandVersion { emulationUserAgentBrandVersionBrand :: T.Text, emulationUserAgentBrandVersionVersion :: T.Text } deriving (Eq, Show) instance FromJSON EmulationUserAgentBrandVersion where parseJSON = A.withObject "EmulationUserAgentBrandVersion" $ \o -> EmulationUserAgentBrandVersion <$> o A..: "brand" <*> o A..: "version" instance ToJSON EmulationUserAgentBrandVersion where toJSON p = A.object $ catMaybes [ ("brand" A..=) <$> Just (emulationUserAgentBrandVersionBrand p), ("version" A..=) <$> Just (emulationUserAgentBrandVersionVersion p) ] -- | Type 'Emulation.UserAgentMetadata'. -- Used to specify User Agent Cient Hints to emulate. See https://wicg.github.io/ua-client-hints -- Missing optional values will be filled in by the target with what it would normally use. data EmulationUserAgentMetadata = EmulationUserAgentMetadata { emulationUserAgentMetadataBrands :: Maybe [EmulationUserAgentBrandVersion], emulationUserAgentMetadataFullVersionList :: Maybe [EmulationUserAgentBrandVersion], emulationUserAgentMetadataPlatform :: T.Text, emulationUserAgentMetadataPlatformVersion :: T.Text, emulationUserAgentMetadataArchitecture :: T.Text, emulationUserAgentMetadataModel :: T.Text, emulationUserAgentMetadataMobile :: Bool, emulationUserAgentMetadataBitness :: Maybe T.Text, emulationUserAgentMetadataWow64 :: Maybe Bool } deriving (Eq, Show) instance FromJSON EmulationUserAgentMetadata where parseJSON = A.withObject "EmulationUserAgentMetadata" $ \o -> EmulationUserAgentMetadata <$> o A..:? "brands" <*> o A..:? "fullVersionList" <*> o A..: "platform" <*> o A..: "platformVersion" <*> o A..: "architecture" <*> o A..: "model" <*> o A..: "mobile" <*> o A..:? "bitness" <*> o A..:? "wow64" instance ToJSON EmulationUserAgentMetadata where toJSON p = A.object $ catMaybes [ ("brands" A..=) <$> (emulationUserAgentMetadataBrands p), ("fullVersionList" A..=) <$> (emulationUserAgentMetadataFullVersionList p), ("platform" A..=) <$> Just (emulationUserAgentMetadataPlatform p), ("platformVersion" A..=) <$> Just (emulationUserAgentMetadataPlatformVersion p), ("architecture" A..=) <$> Just (emulationUserAgentMetadataArchitecture p), ("model" A..=) <$> Just (emulationUserAgentMetadataModel p), ("mobile" A..=) <$> Just (emulationUserAgentMetadataMobile p), ("bitness" A..=) <$> (emulationUserAgentMetadataBitness p), ("wow64" A..=) <$> (emulationUserAgentMetadataWow64 p) ] -- | Type 'Emulation.DisabledImageType'. -- Enum of image types that can be disabled. data EmulationDisabledImageType = EmulationDisabledImageTypeAvif | EmulationDisabledImageTypeJxl | EmulationDisabledImageTypeWebp deriving (Ord, Eq, Show, Read) instance FromJSON EmulationDisabledImageType where parseJSON = A.withText "EmulationDisabledImageType" $ \v -> case v of "avif" -> pure EmulationDisabledImageTypeAvif "jxl" -> pure EmulationDisabledImageTypeJxl "webp" -> pure EmulationDisabledImageTypeWebp "_" -> fail "failed to parse EmulationDisabledImageType" instance ToJSON EmulationDisabledImageType where toJSON v = A.String $ case v of EmulationDisabledImageTypeAvif -> "avif" EmulationDisabledImageTypeJxl -> "jxl" EmulationDisabledImageTypeWebp -> "webp" -- | Type of the 'Emulation.virtualTimeBudgetExpired' event. data EmulationVirtualTimeBudgetExpired = EmulationVirtualTimeBudgetExpired deriving (Eq, Show, Read) instance FromJSON EmulationVirtualTimeBudgetExpired where parseJSON _ = pure EmulationVirtualTimeBudgetExpired instance Event EmulationVirtualTimeBudgetExpired where eventName _ = "Emulation.virtualTimeBudgetExpired" -- | Tells whether emulation is supported. -- | Parameters of the 'Emulation.canEmulate' command. data PEmulationCanEmulate = PEmulationCanEmulate deriving (Eq, Show) pEmulationCanEmulate :: PEmulationCanEmulate pEmulationCanEmulate = PEmulationCanEmulate instance ToJSON PEmulationCanEmulate where toJSON _ = A.Null data EmulationCanEmulate = EmulationCanEmulate { -- | True if emulation is supported. emulationCanEmulateResult :: Bool } deriving (Eq, Show) instance FromJSON EmulationCanEmulate where parseJSON = A.withObject "EmulationCanEmulate" $ \o -> EmulationCanEmulate <$> o A..: "result" instance Command PEmulationCanEmulate where type CommandResponse PEmulationCanEmulate = EmulationCanEmulate commandName _ = "Emulation.canEmulate" -- | Clears the overridden device metrics. -- | Parameters of the 'Emulation.clearDeviceMetricsOverride' command. data PEmulationClearDeviceMetricsOverride = PEmulationClearDeviceMetricsOverride deriving (Eq, Show) pEmulationClearDeviceMetricsOverride :: PEmulationClearDeviceMetricsOverride pEmulationClearDeviceMetricsOverride = PEmulationClearDeviceMetricsOverride instance ToJSON PEmulationClearDeviceMetricsOverride where toJSON _ = A.Null instance Command PEmulationClearDeviceMetricsOverride where type CommandResponse PEmulationClearDeviceMetricsOverride = () commandName _ = "Emulation.clearDeviceMetricsOverride" fromJSON = const . A.Success . const () -- | Clears the overridden Geolocation Position and Error. -- | Parameters of the 'Emulation.clearGeolocationOverride' command. data PEmulationClearGeolocationOverride = PEmulationClearGeolocationOverride deriving (Eq, Show) pEmulationClearGeolocationOverride :: PEmulationClearGeolocationOverride pEmulationClearGeolocationOverride = PEmulationClearGeolocationOverride instance ToJSON PEmulationClearGeolocationOverride where toJSON _ = A.Null instance Command PEmulationClearGeolocationOverride where type CommandResponse PEmulationClearGeolocationOverride = () commandName _ = "Emulation.clearGeolocationOverride" fromJSON = const . A.Success . const () -- | Requests that page scale factor is reset to initial values. -- | Parameters of the 'Emulation.resetPageScaleFactor' command. data PEmulationResetPageScaleFactor = PEmulationResetPageScaleFactor deriving (Eq, Show) pEmulationResetPageScaleFactor :: PEmulationResetPageScaleFactor pEmulationResetPageScaleFactor = PEmulationResetPageScaleFactor instance ToJSON PEmulationResetPageScaleFactor where toJSON _ = A.Null instance Command PEmulationResetPageScaleFactor where type CommandResponse PEmulationResetPageScaleFactor = () commandName _ = "Emulation.resetPageScaleFactor" fromJSON = const . A.Success . const () -- | Enables or disables simulating a focused and active page. -- | Parameters of the 'Emulation.setFocusEmulationEnabled' command. data PEmulationSetFocusEmulationEnabled = PEmulationSetFocusEmulationEnabled { -- | Whether to enable to disable focus emulation. pEmulationSetFocusEmulationEnabledEnabled :: Bool } deriving (Eq, Show) pEmulationSetFocusEmulationEnabled {- -- | Whether to enable to disable focus emulation. -} :: Bool -> PEmulationSetFocusEmulationEnabled pEmulationSetFocusEmulationEnabled arg_pEmulationSetFocusEmulationEnabledEnabled = PEmulationSetFocusEmulationEnabled arg_pEmulationSetFocusEmulationEnabledEnabled instance ToJSON PEmulationSetFocusEmulationEnabled where toJSON p = A.object $ catMaybes [ ("enabled" A..=) <$> Just (pEmulationSetFocusEmulationEnabledEnabled p) ] instance Command PEmulationSetFocusEmulationEnabled where type CommandResponse PEmulationSetFocusEmulationEnabled = () commandName _ = "Emulation.setFocusEmulationEnabled" fromJSON = const . A.Success . const () -- | Automatically render all web contents using a dark theme. -- | Parameters of the 'Emulation.setAutoDarkModeOverride' command. data PEmulationSetAutoDarkModeOverride = PEmulationSetAutoDarkModeOverride { -- | Whether to enable or disable automatic dark mode. -- If not specified, any existing override will be cleared. pEmulationSetAutoDarkModeOverrideEnabled :: Maybe Bool } deriving (Eq, Show) pEmulationSetAutoDarkModeOverride :: PEmulationSetAutoDarkModeOverride pEmulationSetAutoDarkModeOverride = PEmulationSetAutoDarkModeOverride Nothing instance ToJSON PEmulationSetAutoDarkModeOverride where toJSON p = A.object $ catMaybes [ ("enabled" A..=) <$> (pEmulationSetAutoDarkModeOverrideEnabled p) ] instance Command PEmulationSetAutoDarkModeOverride where type CommandResponse PEmulationSetAutoDarkModeOverride = () commandName _ = "Emulation.setAutoDarkModeOverride" fromJSON = const . A.Success . const () -- | Enables CPU throttling to emulate slow CPUs. -- | Parameters of the 'Emulation.setCPUThrottlingRate' command. data PEmulationSetCPUThrottlingRate = PEmulationSetCPUThrottlingRate { -- | Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc). pEmulationSetCPUThrottlingRateRate :: Double } deriving (Eq, Show) pEmulationSetCPUThrottlingRate {- -- | Throttling rate as a slowdown factor (1 is no throttle, 2 is 2x slowdown, etc). -} :: Double -> PEmulationSetCPUThrottlingRate pEmulationSetCPUThrottlingRate arg_pEmulationSetCPUThrottlingRateRate = PEmulationSetCPUThrottlingRate arg_pEmulationSetCPUThrottlingRateRate instance ToJSON PEmulationSetCPUThrottlingRate where toJSON p = A.object $ catMaybes [ ("rate" A..=) <$> Just (pEmulationSetCPUThrottlingRateRate p) ] instance Command PEmulationSetCPUThrottlingRate where type CommandResponse PEmulationSetCPUThrottlingRate = () commandName _ = "Emulation.setCPUThrottlingRate" fromJSON = const . A.Success . const () -- | Sets or clears an override of the default background color of the frame. This override is used -- if the content does not specify one. -- | Parameters of the 'Emulation.setDefaultBackgroundColorOverride' command. data PEmulationSetDefaultBackgroundColorOverride = PEmulationSetDefaultBackgroundColorOverride { -- | RGBA of the default background color. If not specified, any existing override will be -- cleared. pEmulationSetDefaultBackgroundColorOverrideColor :: Maybe DOMRGBA } deriving (Eq, Show) pEmulationSetDefaultBackgroundColorOverride :: PEmulationSetDefaultBackgroundColorOverride pEmulationSetDefaultBackgroundColorOverride = PEmulationSetDefaultBackgroundColorOverride Nothing instance ToJSON PEmulationSetDefaultBackgroundColorOverride where toJSON p = A.object $ catMaybes [ ("color" A..=) <$> (pEmulationSetDefaultBackgroundColorOverrideColor p) ] instance Command PEmulationSetDefaultBackgroundColorOverride where type CommandResponse PEmulationSetDefaultBackgroundColorOverride = () commandName _ = "Emulation.setDefaultBackgroundColorOverride" fromJSON = const . A.Success . const () -- | Overrides the values of device screen dimensions (window.screen.width, window.screen.height, -- window.innerWidth, window.innerHeight, and "device-width"/"device-height"-related CSS media -- query results). -- | Parameters of the 'Emulation.setDeviceMetricsOverride' command. data PEmulationSetDeviceMetricsOverride = PEmulationSetDeviceMetricsOverride { -- | Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. pEmulationSetDeviceMetricsOverrideWidth :: Int, -- | Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. pEmulationSetDeviceMetricsOverrideHeight :: Int, -- | Overriding device scale factor value. 0 disables the override. pEmulationSetDeviceMetricsOverrideDeviceScaleFactor :: Double, -- | Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text -- autosizing and more. pEmulationSetDeviceMetricsOverrideMobile :: Bool, -- | Scale to apply to resulting view image. pEmulationSetDeviceMetricsOverrideScale :: Maybe Double, -- | Overriding screen width value in pixels (minimum 0, maximum 10000000). pEmulationSetDeviceMetricsOverrideScreenWidth :: Maybe Int, -- | Overriding screen height value in pixels (minimum 0, maximum 10000000). pEmulationSetDeviceMetricsOverrideScreenHeight :: Maybe Int, -- | Overriding view X position on screen in pixels (minimum 0, maximum 10000000). pEmulationSetDeviceMetricsOverridePositionX :: Maybe Int, -- | Overriding view Y position on screen in pixels (minimum 0, maximum 10000000). pEmulationSetDeviceMetricsOverridePositionY :: Maybe Int, -- | Do not set visible view size, rely upon explicit setVisibleSize call. pEmulationSetDeviceMetricsOverrideDontSetVisibleSize :: Maybe Bool, -- | Screen orientation override. pEmulationSetDeviceMetricsOverrideScreenOrientation :: Maybe EmulationScreenOrientation, -- | If set, the visible area of the page will be overridden to this viewport. This viewport -- change is not observed by the page, e.g. viewport-relative elements do not change positions. pEmulationSetDeviceMetricsOverrideViewport :: Maybe PageViewport, -- | If set, the display feature of a multi-segment screen. If not set, multi-segment support -- is turned-off. pEmulationSetDeviceMetricsOverrideDisplayFeature :: Maybe EmulationDisplayFeature } deriving (Eq, Show) pEmulationSetDeviceMetricsOverride {- -- | Overriding width value in pixels (minimum 0, maximum 10000000). 0 disables the override. -} :: Int {- -- | Overriding height value in pixels (minimum 0, maximum 10000000). 0 disables the override. -} -> Int {- -- | Overriding device scale factor value. 0 disables the override. -} -> Double {- -- | Whether to emulate mobile device. This includes viewport meta tag, overlay scrollbars, text -- autosizing and more. -} -> Bool -> PEmulationSetDeviceMetricsOverride pEmulationSetDeviceMetricsOverride arg_pEmulationSetDeviceMetricsOverrideWidth arg_pEmulationSetDeviceMetricsOverrideHeight arg_pEmulationSetDeviceMetricsOverrideDeviceScaleFactor arg_pEmulationSetDeviceMetricsOverrideMobile = PEmulationSetDeviceMetricsOverride arg_pEmulationSetDeviceMetricsOverrideWidth arg_pEmulationSetDeviceMetricsOverrideHeight arg_pEmulationSetDeviceMetricsOverrideDeviceScaleFactor arg_pEmulationSetDeviceMetricsOverrideMobile Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing instance ToJSON PEmulationSetDeviceMetricsOverride where toJSON p = A.object $ catMaybes [ ("width" A..=) <$> Just (pEmulationSetDeviceMetricsOverrideWidth p), ("height" A..=) <$> Just (pEmulationSetDeviceMetricsOverrideHeight p), ("deviceScaleFactor" A..=) <$> Just (pEmulationSetDeviceMetricsOverrideDeviceScaleFactor p), ("mobile" A..=) <$> Just (pEmulationSetDeviceMetricsOverrideMobile p), ("scale" A..=) <$> (pEmulationSetDeviceMetricsOverrideScale p), ("screenWidth" A..=) <$> (pEmulationSetDeviceMetricsOverrideScreenWidth p), ("screenHeight" A..=) <$> (pEmulationSetDeviceMetricsOverrideScreenHeight p), ("positionX" A..=) <$> (pEmulationSetDeviceMetricsOverridePositionX p), ("positionY" A..=) <$> (pEmulationSetDeviceMetricsOverridePositionY p), ("dontSetVisibleSize" A..=) <$> (pEmulationSetDeviceMetricsOverrideDontSetVisibleSize p), ("screenOrientation" A..=) <$> (pEmulationSetDeviceMetricsOverrideScreenOrientation p), ("viewport" A..=) <$> (pEmulationSetDeviceMetricsOverrideViewport p), ("displayFeature" A..=) <$> (pEmulationSetDeviceMetricsOverrideDisplayFeature p) ] instance Command PEmulationSetDeviceMetricsOverride where type CommandResponse PEmulationSetDeviceMetricsOverride = () commandName _ = "Emulation.setDeviceMetricsOverride" fromJSON = const . A.Success . const () -- | Parameters of the 'Emulation.setScrollbarsHidden' command. data PEmulationSetScrollbarsHidden = PEmulationSetScrollbarsHidden { -- | Whether scrollbars should be always hidden. pEmulationSetScrollbarsHiddenHidden :: Bool } deriving (Eq, Show) pEmulationSetScrollbarsHidden {- -- | Whether scrollbars should be always hidden. -} :: Bool -> PEmulationSetScrollbarsHidden pEmulationSetScrollbarsHidden arg_pEmulationSetScrollbarsHiddenHidden = PEmulationSetScrollbarsHidden arg_pEmulationSetScrollbarsHiddenHidden instance ToJSON PEmulationSetScrollbarsHidden where toJSON p = A.object $ catMaybes [ ("hidden" A..=) <$> Just (pEmulationSetScrollbarsHiddenHidden p) ] instance Command PEmulationSetScrollbarsHidden where type CommandResponse PEmulationSetScrollbarsHidden = () commandName _ = "Emulation.setScrollbarsHidden" fromJSON = const . A.Success . const () -- | Parameters of the 'Emulation.setDocumentCookieDisabled' command. data PEmulationSetDocumentCookieDisabled = PEmulationSetDocumentCookieDisabled { -- | Whether document.coookie API should be disabled. pEmulationSetDocumentCookieDisabledDisabled :: Bool } deriving (Eq, Show) pEmulationSetDocumentCookieDisabled {- -- | Whether document.coookie API should be disabled. -} :: Bool -> PEmulationSetDocumentCookieDisabled pEmulationSetDocumentCookieDisabled arg_pEmulationSetDocumentCookieDisabledDisabled = PEmulationSetDocumentCookieDisabled arg_pEmulationSetDocumentCookieDisabledDisabled instance ToJSON PEmulationSetDocumentCookieDisabled where toJSON p = A.object $ catMaybes [ ("disabled" A..=) <$> Just (pEmulationSetDocumentCookieDisabledDisabled p) ] instance Command PEmulationSetDocumentCookieDisabled where type CommandResponse PEmulationSetDocumentCookieDisabled = () commandName _ = "Emulation.setDocumentCookieDisabled" fromJSON = const . A.Success . const () -- | Parameters of the 'Emulation.setEmitTouchEventsForMouse' command. data PEmulationSetEmitTouchEventsForMouseConfiguration = PEmulationSetEmitTouchEventsForMouseConfigurationMobile | PEmulationSetEmitTouchEventsForMouseConfigurationDesktop deriving (Ord, Eq, Show, Read) instance FromJSON PEmulationSetEmitTouchEventsForMouseConfiguration where parseJSON = A.withText "PEmulationSetEmitTouchEventsForMouseConfiguration" $ \v -> case v of "mobile" -> pure PEmulationSetEmitTouchEventsForMouseConfigurationMobile "desktop" -> pure PEmulationSetEmitTouchEventsForMouseConfigurationDesktop "_" -> fail "failed to parse PEmulationSetEmitTouchEventsForMouseConfiguration" instance ToJSON PEmulationSetEmitTouchEventsForMouseConfiguration where toJSON v = A.String $ case v of PEmulationSetEmitTouchEventsForMouseConfigurationMobile -> "mobile" PEmulationSetEmitTouchEventsForMouseConfigurationDesktop -> "desktop" data PEmulationSetEmitTouchEventsForMouse = PEmulationSetEmitTouchEventsForMouse { -- | Whether touch emulation based on mouse input should be enabled. pEmulationSetEmitTouchEventsForMouseEnabled :: Bool, -- | Touch/gesture events configuration. Default: current platform. pEmulationSetEmitTouchEventsForMouseConfiguration :: Maybe PEmulationSetEmitTouchEventsForMouseConfiguration } deriving (Eq, Show) pEmulationSetEmitTouchEventsForMouse {- -- | Whether touch emulation based on mouse input should be enabled. -} :: Bool -> PEmulationSetEmitTouchEventsForMouse pEmulationSetEmitTouchEventsForMouse arg_pEmulationSetEmitTouchEventsForMouseEnabled = PEmulationSetEmitTouchEventsForMouse arg_pEmulationSetEmitTouchEventsForMouseEnabled Nothing instance ToJSON PEmulationSetEmitTouchEventsForMouse where toJSON p = A.object $ catMaybes [ ("enabled" A..=) <$> Just (pEmulationSetEmitTouchEventsForMouseEnabled p), ("configuration" A..=) <$> (pEmulationSetEmitTouchEventsForMouseConfiguration p) ] instance Command PEmulationSetEmitTouchEventsForMouse where type CommandResponse PEmulationSetEmitTouchEventsForMouse = () commandName _ = "Emulation.setEmitTouchEventsForMouse" fromJSON = const . A.Success . const () -- | Emulates the given media type or media feature for CSS media queries. -- | Parameters of the 'Emulation.setEmulatedMedia' command. data PEmulationSetEmulatedMedia = PEmulationSetEmulatedMedia { -- | Media type to emulate. Empty string disables the override. pEmulationSetEmulatedMediaMedia :: Maybe T.Text, -- | Media features to emulate. pEmulationSetEmulatedMediaFeatures :: Maybe [EmulationMediaFeature] } deriving (Eq, Show) pEmulationSetEmulatedMedia :: PEmulationSetEmulatedMedia pEmulationSetEmulatedMedia = PEmulationSetEmulatedMedia Nothing Nothing instance ToJSON PEmulationSetEmulatedMedia where toJSON p = A.object $ catMaybes [ ("media" A..=) <$> (pEmulationSetEmulatedMediaMedia p), ("features" A..=) <$> (pEmulationSetEmulatedMediaFeatures p) ] instance Command PEmulationSetEmulatedMedia where type CommandResponse PEmulationSetEmulatedMedia = () commandName _ = "Emulation.setEmulatedMedia" fromJSON = const . A.Success . const () -- | Emulates the given vision deficiency. -- | Parameters of the 'Emulation.setEmulatedVisionDeficiency' command. data PEmulationSetEmulatedVisionDeficiencyType = PEmulationSetEmulatedVisionDeficiencyTypeNone | PEmulationSetEmulatedVisionDeficiencyTypeAchromatopsia | PEmulationSetEmulatedVisionDeficiencyTypeBlurredVision | PEmulationSetEmulatedVisionDeficiencyTypeDeuteranopia | PEmulationSetEmulatedVisionDeficiencyTypeProtanopia | PEmulationSetEmulatedVisionDeficiencyTypeTritanopia deriving (Ord, Eq, Show, Read) instance FromJSON PEmulationSetEmulatedVisionDeficiencyType where parseJSON = A.withText "PEmulationSetEmulatedVisionDeficiencyType" $ \v -> case v of "none" -> pure PEmulationSetEmulatedVisionDeficiencyTypeNone "achromatopsia" -> pure PEmulationSetEmulatedVisionDeficiencyTypeAchromatopsia "blurredVision" -> pure PEmulationSetEmulatedVisionDeficiencyTypeBlurredVision "deuteranopia" -> pure PEmulationSetEmulatedVisionDeficiencyTypeDeuteranopia "protanopia" -> pure PEmulationSetEmulatedVisionDeficiencyTypeProtanopia "tritanopia" -> pure PEmulationSetEmulatedVisionDeficiencyTypeTritanopia "_" -> fail "failed to parse PEmulationSetEmulatedVisionDeficiencyType" instance ToJSON PEmulationSetEmulatedVisionDeficiencyType where toJSON v = A.String $ case v of PEmulationSetEmulatedVisionDeficiencyTypeNone -> "none" PEmulationSetEmulatedVisionDeficiencyTypeAchromatopsia -> "achromatopsia" PEmulationSetEmulatedVisionDeficiencyTypeBlurredVision -> "blurredVision" PEmulationSetEmulatedVisionDeficiencyTypeDeuteranopia -> "deuteranopia" PEmulationSetEmulatedVisionDeficiencyTypeProtanopia -> "protanopia" PEmulationSetEmulatedVisionDeficiencyTypeTritanopia -> "tritanopia" data PEmulationSetEmulatedVisionDeficiency = PEmulationSetEmulatedVisionDeficiency { -- | Vision deficiency to emulate. pEmulationSetEmulatedVisionDeficiencyType :: PEmulationSetEmulatedVisionDeficiencyType } deriving (Eq, Show) pEmulationSetEmulatedVisionDeficiency {- -- | Vision deficiency to emulate. -} :: PEmulationSetEmulatedVisionDeficiencyType -> PEmulationSetEmulatedVisionDeficiency pEmulationSetEmulatedVisionDeficiency arg_pEmulationSetEmulatedVisionDeficiencyType = PEmulationSetEmulatedVisionDeficiency arg_pEmulationSetEmulatedVisionDeficiencyType instance ToJSON PEmulationSetEmulatedVisionDeficiency where toJSON p = A.object $ catMaybes [ ("type" A..=) <$> Just (pEmulationSetEmulatedVisionDeficiencyType p) ] instance Command PEmulationSetEmulatedVisionDeficiency where type CommandResponse PEmulationSetEmulatedVisionDeficiency = () commandName _ = "Emulation.setEmulatedVisionDeficiency" fromJSON = const . A.Success . const () -- | Overrides the Geolocation Position or Error. Omitting any of the parameters emulates position -- unavailable. -- | Parameters of the 'Emulation.setGeolocationOverride' command. data PEmulationSetGeolocationOverride = PEmulationSetGeolocationOverride { -- | Mock latitude pEmulationSetGeolocationOverrideLatitude :: Maybe Double, -- | Mock longitude pEmulationSetGeolocationOverrideLongitude :: Maybe Double, -- | Mock accuracy pEmulationSetGeolocationOverrideAccuracy :: Maybe Double } deriving (Eq, Show) pEmulationSetGeolocationOverride :: PEmulationSetGeolocationOverride pEmulationSetGeolocationOverride = PEmulationSetGeolocationOverride Nothing Nothing Nothing instance ToJSON PEmulationSetGeolocationOverride where toJSON p = A.object $ catMaybes [ ("latitude" A..=) <$> (pEmulationSetGeolocationOverrideLatitude p), ("longitude" A..=) <$> (pEmulationSetGeolocationOverrideLongitude p), ("accuracy" A..=) <$> (pEmulationSetGeolocationOverrideAccuracy p) ] instance Command PEmulationSetGeolocationOverride where type CommandResponse PEmulationSetGeolocationOverride = () commandName _ = "Emulation.setGeolocationOverride" fromJSON = const . A.Success . const () -- | Overrides the Idle state. -- | Parameters of the 'Emulation.setIdleOverride' command. data PEmulationSetIdleOverride = PEmulationSetIdleOverride { -- | Mock isUserActive pEmulationSetIdleOverrideIsUserActive :: Bool, -- | Mock isScreenUnlocked pEmulationSetIdleOverrideIsScreenUnlocked :: Bool } deriving (Eq, Show) pEmulationSetIdleOverride {- -- | Mock isUserActive -} :: Bool {- -- | Mock isScreenUnlocked -} -> Bool -> PEmulationSetIdleOverride pEmulationSetIdleOverride arg_pEmulationSetIdleOverrideIsUserActive arg_pEmulationSetIdleOverrideIsScreenUnlocked = PEmulationSetIdleOverride arg_pEmulationSetIdleOverrideIsUserActive arg_pEmulationSetIdleOverrideIsScreenUnlocked instance ToJSON PEmulationSetIdleOverride where toJSON p = A.object $ catMaybes [ ("isUserActive" A..=) <$> Just (pEmulationSetIdleOverrideIsUserActive p), ("isScreenUnlocked" A..=) <$> Just (pEmulationSetIdleOverrideIsScreenUnlocked p) ] instance Command PEmulationSetIdleOverride where type CommandResponse PEmulationSetIdleOverride = () commandName _ = "Emulation.setIdleOverride" fromJSON = const . A.Success . const () -- | Clears Idle state overrides. -- | Parameters of the 'Emulation.clearIdleOverride' command. data PEmulationClearIdleOverride = PEmulationClearIdleOverride deriving (Eq, Show) pEmulationClearIdleOverride :: PEmulationClearIdleOverride pEmulationClearIdleOverride = PEmulationClearIdleOverride instance ToJSON PEmulationClearIdleOverride where toJSON _ = A.Null instance Command PEmulationClearIdleOverride where type CommandResponse PEmulationClearIdleOverride = () commandName _ = "Emulation.clearIdleOverride" fromJSON = const . A.Success . const () -- | Sets a specified page scale factor. -- | Parameters of the 'Emulation.setPageScaleFactor' command. data PEmulationSetPageScaleFactor = PEmulationSetPageScaleFactor { -- | Page scale factor. pEmulationSetPageScaleFactorPageScaleFactor :: Double } deriving (Eq, Show) pEmulationSetPageScaleFactor {- -- | Page scale factor. -} :: Double -> PEmulationSetPageScaleFactor pEmulationSetPageScaleFactor arg_pEmulationSetPageScaleFactorPageScaleFactor = PEmulationSetPageScaleFactor arg_pEmulationSetPageScaleFactorPageScaleFactor instance ToJSON PEmulationSetPageScaleFactor where toJSON p = A.object $ catMaybes [ ("pageScaleFactor" A..=) <$> Just (pEmulationSetPageScaleFactorPageScaleFactor p) ] instance Command PEmulationSetPageScaleFactor where type CommandResponse PEmulationSetPageScaleFactor = () commandName _ = "Emulation.setPageScaleFactor" fromJSON = const . A.Success . const () -- | Switches script execution in the page. -- | Parameters of the 'Emulation.setScriptExecutionDisabled' command. data PEmulationSetScriptExecutionDisabled = PEmulationSetScriptExecutionDisabled { -- | Whether script execution should be disabled in the page. pEmulationSetScriptExecutionDisabledValue :: Bool } deriving (Eq, Show) pEmulationSetScriptExecutionDisabled {- -- | Whether script execution should be disabled in the page. -} :: Bool -> PEmulationSetScriptExecutionDisabled pEmulationSetScriptExecutionDisabled arg_pEmulationSetScriptExecutionDisabledValue = PEmulationSetScriptExecutionDisabled arg_pEmulationSetScriptExecutionDisabledValue instance ToJSON PEmulationSetScriptExecutionDisabled where toJSON p = A.object $ catMaybes [ ("value" A..=) <$> Just (pEmulationSetScriptExecutionDisabledValue p) ] instance Command PEmulationSetScriptExecutionDisabled where type CommandResponse PEmulationSetScriptExecutionDisabled = () commandName _ = "Emulation.setScriptExecutionDisabled" fromJSON = const . A.Success . const () -- | Enables touch on platforms which do not support them. -- | Parameters of the 'Emulation.setTouchEmulationEnabled' command. data PEmulationSetTouchEmulationEnabled = PEmulationSetTouchEmulationEnabled { -- | Whether the touch event emulation should be enabled. pEmulationSetTouchEmulationEnabledEnabled :: Bool, -- | Maximum touch points supported. Defaults to one. pEmulationSetTouchEmulationEnabledMaxTouchPoints :: Maybe Int } deriving (Eq, Show) pEmulationSetTouchEmulationEnabled {- -- | Whether the touch event emulation should be enabled. -} :: Bool -> PEmulationSetTouchEmulationEnabled pEmulationSetTouchEmulationEnabled arg_pEmulationSetTouchEmulationEnabledEnabled = PEmulationSetTouchEmulationEnabled arg_pEmulationSetTouchEmulationEnabledEnabled Nothing instance ToJSON PEmulationSetTouchEmulationEnabled where toJSON p = A.object $ catMaybes [ ("enabled" A..=) <$> Just (pEmulationSetTouchEmulationEnabledEnabled p), ("maxTouchPoints" A..=) <$> (pEmulationSetTouchEmulationEnabledMaxTouchPoints p) ] instance Command PEmulationSetTouchEmulationEnabled where type CommandResponse PEmulationSetTouchEmulationEnabled = () commandName _ = "Emulation.setTouchEmulationEnabled" fromJSON = const . A.Success . const () -- | Turns on virtual time for all frames (replacing real-time with a synthetic time source) and sets -- the current virtual time policy. Note this supersedes any previous time budget. -- | Parameters of the 'Emulation.setVirtualTimePolicy' command. data PEmulationSetVirtualTimePolicy = PEmulationSetVirtualTimePolicy { pEmulationSetVirtualTimePolicyPolicy :: EmulationVirtualTimePolicy, -- | If set, after this many virtual milliseconds have elapsed virtual time will be paused and a -- virtualTimeBudgetExpired event is sent. pEmulationSetVirtualTimePolicyBudget :: Maybe Double, -- | If set this specifies the maximum number of tasks that can be run before virtual is forced -- forwards to prevent deadlock. pEmulationSetVirtualTimePolicyMaxVirtualTimeTaskStarvationCount :: Maybe Int, -- | If set, base::Time::Now will be overridden to initially return this value. pEmulationSetVirtualTimePolicyInitialVirtualTime :: Maybe NetworkTimeSinceEpoch } deriving (Eq, Show) pEmulationSetVirtualTimePolicy :: EmulationVirtualTimePolicy -> PEmulationSetVirtualTimePolicy pEmulationSetVirtualTimePolicy arg_pEmulationSetVirtualTimePolicyPolicy = PEmulationSetVirtualTimePolicy arg_pEmulationSetVirtualTimePolicyPolicy Nothing Nothing Nothing instance ToJSON PEmulationSetVirtualTimePolicy where toJSON p = A.object $ catMaybes [ ("policy" A..=) <$> Just (pEmulationSetVirtualTimePolicyPolicy p), ("budget" A..=) <$> (pEmulationSetVirtualTimePolicyBudget p), ("maxVirtualTimeTaskStarvationCount" A..=) <$> (pEmulationSetVirtualTimePolicyMaxVirtualTimeTaskStarvationCount p), ("initialVirtualTime" A..=) <$> (pEmulationSetVirtualTimePolicyInitialVirtualTime p) ] data EmulationSetVirtualTimePolicy = EmulationSetVirtualTimePolicy { -- | Absolute timestamp at which virtual time was first enabled (up time in milliseconds). emulationSetVirtualTimePolicyVirtualTimeTicksBase :: Double } deriving (Eq, Show) instance FromJSON EmulationSetVirtualTimePolicy where parseJSON = A.withObject "EmulationSetVirtualTimePolicy" $ \o -> EmulationSetVirtualTimePolicy <$> o A..: "virtualTimeTicksBase" instance Command PEmulationSetVirtualTimePolicy where type CommandResponse PEmulationSetVirtualTimePolicy = EmulationSetVirtualTimePolicy commandName _ = "Emulation.setVirtualTimePolicy" -- | Overrides default host system locale with the specified one. -- | Parameters of the 'Emulation.setLocaleOverride' command. data PEmulationSetLocaleOverride = PEmulationSetLocaleOverride { -- | ICU style C locale (e.g. "en_US"). If not specified or empty, disables the override and -- restores default host system locale. pEmulationSetLocaleOverrideLocale :: Maybe T.Text } deriving (Eq, Show) pEmulationSetLocaleOverride :: PEmulationSetLocaleOverride pEmulationSetLocaleOverride = PEmulationSetLocaleOverride Nothing instance ToJSON PEmulationSetLocaleOverride where toJSON p = A.object $ catMaybes [ ("locale" A..=) <$> (pEmulationSetLocaleOverrideLocale p) ] instance Command PEmulationSetLocaleOverride where type CommandResponse PEmulationSetLocaleOverride = () commandName _ = "Emulation.setLocaleOverride" fromJSON = const . A.Success . const () -- | Overrides default host system timezone with the specified one. -- | Parameters of the 'Emulation.setTimezoneOverride' command. data PEmulationSetTimezoneOverride = PEmulationSetTimezoneOverride { -- | The timezone identifier. If empty, disables the override and -- restores default host system timezone. pEmulationSetTimezoneOverrideTimezoneId :: T.Text } deriving (Eq, Show) pEmulationSetTimezoneOverride {- -- | The timezone identifier. If empty, disables the override and -- restores default host system timezone. -} :: T.Text -> PEmulationSetTimezoneOverride pEmulationSetTimezoneOverride arg_pEmulationSetTimezoneOverrideTimezoneId = PEmulationSetTimezoneOverride arg_pEmulationSetTimezoneOverrideTimezoneId instance ToJSON PEmulationSetTimezoneOverride where toJSON p = A.object $ catMaybes [ ("timezoneId" A..=) <$> Just (pEmulationSetTimezoneOverrideTimezoneId p) ] instance Command PEmulationSetTimezoneOverride where type CommandResponse PEmulationSetTimezoneOverride = () commandName _ = "Emulation.setTimezoneOverride" fromJSON = const . A.Success . const () -- | Parameters of the 'Emulation.setDisabledImageTypes' command. data PEmulationSetDisabledImageTypes = PEmulationSetDisabledImageTypes { -- | Image types to disable. pEmulationSetDisabledImageTypesImageTypes :: [EmulationDisabledImageType] } deriving (Eq, Show) pEmulationSetDisabledImageTypes {- -- | Image types to disable. -} :: [EmulationDisabledImageType] -> PEmulationSetDisabledImageTypes pEmulationSetDisabledImageTypes arg_pEmulationSetDisabledImageTypesImageTypes = PEmulationSetDisabledImageTypes arg_pEmulationSetDisabledImageTypesImageTypes instance ToJSON PEmulationSetDisabledImageTypes where toJSON p = A.object $ catMaybes [ ("imageTypes" A..=) <$> Just (pEmulationSetDisabledImageTypesImageTypes p) ] instance Command PEmulationSetDisabledImageTypes where type CommandResponse PEmulationSetDisabledImageTypes = () commandName _ = "Emulation.setDisabledImageTypes" fromJSON = const . A.Success . const () -- | Parameters of the 'Emulation.setHardwareConcurrencyOverride' command. data PEmulationSetHardwareConcurrencyOverride = PEmulationSetHardwareConcurrencyOverride { -- | Hardware concurrency to report pEmulationSetHardwareConcurrencyOverrideHardwareConcurrency :: Int } deriving (Eq, Show) pEmulationSetHardwareConcurrencyOverride {- -- | Hardware concurrency to report -} :: Int -> PEmulationSetHardwareConcurrencyOverride pEmulationSetHardwareConcurrencyOverride arg_pEmulationSetHardwareConcurrencyOverrideHardwareConcurrency = PEmulationSetHardwareConcurrencyOverride arg_pEmulationSetHardwareConcurrencyOverrideHardwareConcurrency instance ToJSON PEmulationSetHardwareConcurrencyOverride where toJSON p = A.object $ catMaybes [ ("hardwareConcurrency" A..=) <$> Just (pEmulationSetHardwareConcurrencyOverrideHardwareConcurrency p) ] instance Command PEmulationSetHardwareConcurrencyOverride where type CommandResponse PEmulationSetHardwareConcurrencyOverride = () commandName _ = "Emulation.setHardwareConcurrencyOverride" fromJSON = const . A.Success . const () -- | Allows overriding user agent with the given string. -- | Parameters of the 'Emulation.setUserAgentOverride' command. data PEmulationSetUserAgentOverride = PEmulationSetUserAgentOverride { -- | User agent to use. pEmulationSetUserAgentOverrideUserAgent :: T.Text, -- | Browser langugage to emulate. pEmulationSetUserAgentOverrideAcceptLanguage :: Maybe T.Text, -- | The platform navigator.platform should return. pEmulationSetUserAgentOverridePlatform :: Maybe T.Text, -- | To be sent in Sec-CH-UA-* headers and returned in navigator.userAgentData pEmulationSetUserAgentOverrideUserAgentMetadata :: Maybe EmulationUserAgentMetadata } deriving (Eq, Show) pEmulationSetUserAgentOverride {- -- | User agent to use. -} :: T.Text -> PEmulationSetUserAgentOverride pEmulationSetUserAgentOverride arg_pEmulationSetUserAgentOverrideUserAgent = PEmulationSetUserAgentOverride arg_pEmulationSetUserAgentOverrideUserAgent Nothing Nothing Nothing instance ToJSON PEmulationSetUserAgentOverride where toJSON p = A.object $ catMaybes [ ("userAgent" A..=) <$> Just (pEmulationSetUserAgentOverrideUserAgent p), ("acceptLanguage" A..=) <$> (pEmulationSetUserAgentOverrideAcceptLanguage p), ("platform" A..=) <$> (pEmulationSetUserAgentOverridePlatform p), ("userAgentMetadata" A..=) <$> (pEmulationSetUserAgentOverrideUserAgentMetadata p) ] instance Command PEmulationSetUserAgentOverride where type CommandResponse PEmulationSetUserAgentOverride = () commandName _ = "Emulation.setUserAgentOverride" fromJSON = const . A.Success . const () -- | Allows overriding the automation flag. -- | Parameters of the 'Emulation.setAutomationOverride' command. data PEmulationSetAutomationOverride = PEmulationSetAutomationOverride { -- | Whether the override should be enabled. pEmulationSetAutomationOverrideEnabled :: Bool } deriving (Eq, Show) pEmulationSetAutomationOverride {- -- | Whether the override should be enabled. -} :: Bool -> PEmulationSetAutomationOverride pEmulationSetAutomationOverride arg_pEmulationSetAutomationOverrideEnabled = PEmulationSetAutomationOverride arg_pEmulationSetAutomationOverrideEnabled instance ToJSON PEmulationSetAutomationOverride where toJSON p = A.object $ catMaybes [ ("enabled" A..=) <$> Just (pEmulationSetAutomationOverrideEnabled p) ] instance Command PEmulationSetAutomationOverride where type CommandResponse PEmulationSetAutomationOverride = () commandName _ = "Emulation.setAutomationOverride" fromJSON = const . A.Success . const () -- | Type 'Network.ResourceType'. -- Resource type as it was perceived by the rendering engine. data NetworkResourceType = NetworkResourceTypeDocument | NetworkResourceTypeStylesheet | NetworkResourceTypeImage | NetworkResourceTypeMedia | NetworkResourceTypeFont | NetworkResourceTypeScript | NetworkResourceTypeTextTrack | NetworkResourceTypeXHR | NetworkResourceTypeFetch | NetworkResourceTypePrefetch | NetworkResourceTypeEventSource | NetworkResourceTypeWebSocket | NetworkResourceTypeManifest | NetworkResourceTypeSignedExchange | NetworkResourceTypePing | NetworkResourceTypeCSPViolationReport | NetworkResourceTypePreflight | NetworkResourceTypeOther deriving (Ord, Eq, Show, Read) instance FromJSON NetworkResourceType where parseJSON = A.withText "NetworkResourceType" $ \v -> case v of "Document" -> pure NetworkResourceTypeDocument "Stylesheet" -> pure NetworkResourceTypeStylesheet "Image" -> pure NetworkResourceTypeImage "Media" -> pure NetworkResourceTypeMedia "Font" -> pure NetworkResourceTypeFont "Script" -> pure NetworkResourceTypeScript "TextTrack" -> pure NetworkResourceTypeTextTrack "XHR" -> pure NetworkResourceTypeXHR "Fetch" -> pure NetworkResourceTypeFetch "Prefetch" -> pure NetworkResourceTypePrefetch "EventSource" -> pure NetworkResourceTypeEventSource "WebSocket" -> pure NetworkResourceTypeWebSocket "Manifest" -> pure NetworkResourceTypeManifest "SignedExchange" -> pure NetworkResourceTypeSignedExchange "Ping" -> pure NetworkResourceTypePing "CSPViolationReport" -> pure NetworkResourceTypeCSPViolationReport "Preflight" -> pure NetworkResourceTypePreflight "Other" -> pure NetworkResourceTypeOther "_" -> fail "failed to parse NetworkResourceType" instance ToJSON NetworkResourceType where toJSON v = A.String $ case v of NetworkResourceTypeDocument -> "Document" NetworkResourceTypeStylesheet -> "Stylesheet" NetworkResourceTypeImage -> "Image" NetworkResourceTypeMedia -> "Media" NetworkResourceTypeFont -> "Font" NetworkResourceTypeScript -> "Script" NetworkResourceTypeTextTrack -> "TextTrack" NetworkResourceTypeXHR -> "XHR" NetworkResourceTypeFetch -> "Fetch" NetworkResourceTypePrefetch -> "Prefetch" NetworkResourceTypeEventSource -> "EventSource" NetworkResourceTypeWebSocket -> "WebSocket" NetworkResourceTypeManifest -> "Manifest" NetworkResourceTypeSignedExchange -> "SignedExchange" NetworkResourceTypePing -> "Ping" NetworkResourceTypeCSPViolationReport -> "CSPViolationReport" NetworkResourceTypePreflight -> "Preflight" NetworkResourceTypeOther -> "Other" -- | Type 'Network.LoaderId'. -- Unique loader identifier. type NetworkLoaderId = T.Text -- | Type 'Network.RequestId'. -- Unique request identifier. type NetworkRequestId = T.Text -- | Type 'Network.InterceptionId'. -- Unique intercepted request identifier. type NetworkInterceptionId = T.Text -- | Type 'Network.ErrorReason'. -- Network level fetch failure reason. data NetworkErrorReason = NetworkErrorReasonFailed | NetworkErrorReasonAborted | NetworkErrorReasonTimedOut | NetworkErrorReasonAccessDenied | NetworkErrorReasonConnectionClosed | NetworkErrorReasonConnectionReset | NetworkErrorReasonConnectionRefused | NetworkErrorReasonConnectionAborted | NetworkErrorReasonConnectionFailed | NetworkErrorReasonNameNotResolved | NetworkErrorReasonInternetDisconnected | NetworkErrorReasonAddressUnreachable | NetworkErrorReasonBlockedByClient | NetworkErrorReasonBlockedByResponse deriving (Ord, Eq, Show, Read) instance FromJSON NetworkErrorReason where parseJSON = A.withText "NetworkErrorReason" $ \v -> case v of "Failed" -> pure NetworkErrorReasonFailed "Aborted" -> pure NetworkErrorReasonAborted "TimedOut" -> pure NetworkErrorReasonTimedOut "AccessDenied" -> pure NetworkErrorReasonAccessDenied "ConnectionClosed" -> pure NetworkErrorReasonConnectionClosed "ConnectionReset" -> pure NetworkErrorReasonConnectionReset "ConnectionRefused" -> pure NetworkErrorReasonConnectionRefused "ConnectionAborted" -> pure NetworkErrorReasonConnectionAborted "ConnectionFailed" -> pure NetworkErrorReasonConnectionFailed "NameNotResolved" -> pure NetworkErrorReasonNameNotResolved "InternetDisconnected" -> pure NetworkErrorReasonInternetDisconnected "AddressUnreachable" -> pure NetworkErrorReasonAddressUnreachable "BlockedByClient" -> pure NetworkErrorReasonBlockedByClient "BlockedByResponse" -> pure NetworkErrorReasonBlockedByResponse "_" -> fail "failed to parse NetworkErrorReason" instance ToJSON NetworkErrorReason where toJSON v = A.String $ case v of NetworkErrorReasonFailed -> "Failed" NetworkErrorReasonAborted -> "Aborted" NetworkErrorReasonTimedOut -> "TimedOut" NetworkErrorReasonAccessDenied -> "AccessDenied" NetworkErrorReasonConnectionClosed -> "ConnectionClosed" NetworkErrorReasonConnectionReset -> "ConnectionReset" NetworkErrorReasonConnectionRefused -> "ConnectionRefused" NetworkErrorReasonConnectionAborted -> "ConnectionAborted" NetworkErrorReasonConnectionFailed -> "ConnectionFailed" NetworkErrorReasonNameNotResolved -> "NameNotResolved" NetworkErrorReasonInternetDisconnected -> "InternetDisconnected" NetworkErrorReasonAddressUnreachable -> "AddressUnreachable" NetworkErrorReasonBlockedByClient -> "BlockedByClient" NetworkErrorReasonBlockedByResponse -> "BlockedByResponse" -- | Type 'Network.TimeSinceEpoch'. -- UTC time in seconds, counted from January 1, 1970. type NetworkTimeSinceEpoch = Double -- | Type 'Network.MonotonicTime'. -- Monotonically increasing time in seconds since an arbitrary point in the past. type NetworkMonotonicTime = Double -- | Type 'Network.Headers'. -- Request / response headers as keys / values of JSON object. type NetworkHeaders = [(T.Text, T.Text)] -- | Type 'Network.ConnectionType'. -- The underlying connection technology that the browser is supposedly using. data NetworkConnectionType = NetworkConnectionTypeNone | NetworkConnectionTypeCellular2g | NetworkConnectionTypeCellular3g | NetworkConnectionTypeCellular4g | NetworkConnectionTypeBluetooth | NetworkConnectionTypeEthernet | NetworkConnectionTypeWifi | NetworkConnectionTypeWimax | NetworkConnectionTypeOther deriving (Ord, Eq, Show, Read) instance FromJSON NetworkConnectionType where parseJSON = A.withText "NetworkConnectionType" $ \v -> case v of "none" -> pure NetworkConnectionTypeNone "cellular2g" -> pure NetworkConnectionTypeCellular2g "cellular3g" -> pure NetworkConnectionTypeCellular3g "cellular4g" -> pure NetworkConnectionTypeCellular4g "bluetooth" -> pure NetworkConnectionTypeBluetooth "ethernet" -> pure NetworkConnectionTypeEthernet "wifi" -> pure NetworkConnectionTypeWifi "wimax" -> pure NetworkConnectionTypeWimax "other" -> pure NetworkConnectionTypeOther "_" -> fail "failed to parse NetworkConnectionType" instance ToJSON NetworkConnectionType where toJSON v = A.String $ case v of NetworkConnectionTypeNone -> "none" NetworkConnectionTypeCellular2g -> "cellular2g" NetworkConnectionTypeCellular3g -> "cellular3g" NetworkConnectionTypeCellular4g -> "cellular4g" NetworkConnectionTypeBluetooth -> "bluetooth" NetworkConnectionTypeEthernet -> "ethernet" NetworkConnectionTypeWifi -> "wifi" NetworkConnectionTypeWimax -> "wimax" NetworkConnectionTypeOther -> "other" -- | Type 'Network.CookieSameSite'. -- Represents the cookie's 'SameSite' status: -- https://tools.ietf.org/html/draft-west-first-party-cookies data NetworkCookieSameSite = NetworkCookieSameSiteStrict | NetworkCookieSameSiteLax | NetworkCookieSameSiteNone deriving (Ord, Eq, Show, Read) instance FromJSON NetworkCookieSameSite where parseJSON = A.withText "NetworkCookieSameSite" $ \v -> case v of "Strict" -> pure NetworkCookieSameSiteStrict "Lax" -> pure NetworkCookieSameSiteLax "None" -> pure NetworkCookieSameSiteNone "_" -> fail "failed to parse NetworkCookieSameSite" instance ToJSON NetworkCookieSameSite where toJSON v = A.String $ case v of NetworkCookieSameSiteStrict -> "Strict" NetworkCookieSameSiteLax -> "Lax" NetworkCookieSameSiteNone -> "None" -- | Type 'Network.CookiePriority'. -- Represents the cookie's 'Priority' status: -- https://tools.ietf.org/html/draft-west-cookie-priority-00 data NetworkCookiePriority = NetworkCookiePriorityLow | NetworkCookiePriorityMedium | NetworkCookiePriorityHigh deriving (Ord, Eq, Show, Read) instance FromJSON NetworkCookiePriority where parseJSON = A.withText "NetworkCookiePriority" $ \v -> case v of "Low" -> pure NetworkCookiePriorityLow "Medium" -> pure NetworkCookiePriorityMedium "High" -> pure NetworkCookiePriorityHigh "_" -> fail "failed to parse NetworkCookiePriority" instance ToJSON NetworkCookiePriority where toJSON v = A.String $ case v of NetworkCookiePriorityLow -> "Low" NetworkCookiePriorityMedium -> "Medium" NetworkCookiePriorityHigh -> "High" -- | Type 'Network.CookieSourceScheme'. -- Represents the source scheme of the origin that originally set the cookie. -- A value of "Unset" allows protocol clients to emulate legacy cookie scope for the scheme. -- This is a temporary ability and it will be removed in the future. data NetworkCookieSourceScheme = NetworkCookieSourceSchemeUnset | NetworkCookieSourceSchemeNonSecure | NetworkCookieSourceSchemeSecure deriving (Ord, Eq, Show, Read) instance FromJSON NetworkCookieSourceScheme where parseJSON = A.withText "NetworkCookieSourceScheme" $ \v -> case v of "Unset" -> pure NetworkCookieSourceSchemeUnset "NonSecure" -> pure NetworkCookieSourceSchemeNonSecure "Secure" -> pure NetworkCookieSourceSchemeSecure "_" -> fail "failed to parse NetworkCookieSourceScheme" instance ToJSON NetworkCookieSourceScheme where toJSON v = A.String $ case v of NetworkCookieSourceSchemeUnset -> "Unset" NetworkCookieSourceSchemeNonSecure -> "NonSecure" NetworkCookieSourceSchemeSecure -> "Secure" -- | Type 'Network.ResourceTiming'. -- Timing information for the request. data NetworkResourceTiming = NetworkResourceTiming { -- | Timing's requestTime is a baseline in seconds, while the other numbers are ticks in -- milliseconds relatively to this requestTime. networkResourceTimingRequestTime :: Double, -- | Started resolving proxy. networkResourceTimingProxyStart :: Double, -- | Finished resolving proxy. networkResourceTimingProxyEnd :: Double, -- | Started DNS address resolve. networkResourceTimingDnsStart :: Double, -- | Finished DNS address resolve. networkResourceTimingDnsEnd :: Double, -- | Started connecting to the remote host. networkResourceTimingConnectStart :: Double, -- | Connected to the remote host. networkResourceTimingConnectEnd :: Double, -- | Started SSL handshake. networkResourceTimingSslStart :: Double, -- | Finished SSL handshake. networkResourceTimingSslEnd :: Double, -- | Started running ServiceWorker. networkResourceTimingWorkerStart :: Double, -- | Finished Starting ServiceWorker. networkResourceTimingWorkerReady :: Double, -- | Started fetch event. networkResourceTimingWorkerFetchStart :: Double, -- | Settled fetch event respondWith promise. networkResourceTimingWorkerRespondWithSettled :: Double, -- | Started sending request. networkResourceTimingSendStart :: Double, -- | Finished sending request. networkResourceTimingSendEnd :: Double, -- | Time the server started pushing request. networkResourceTimingPushStart :: Double, -- | Time the server finished pushing request. networkResourceTimingPushEnd :: Double, -- | Finished receiving response headers. networkResourceTimingReceiveHeadersEnd :: Double } deriving (Eq, Show) instance FromJSON NetworkResourceTiming where parseJSON = A.withObject "NetworkResourceTiming" $ \o -> NetworkResourceTiming <$> o A..: "requestTime" <*> o A..: "proxyStart" <*> o A..: "proxyEnd" <*> o A..: "dnsStart" <*> o A..: "dnsEnd" <*> o A..: "connectStart" <*> o A..: "connectEnd" <*> o A..: "sslStart" <*> o A..: "sslEnd" <*> o A..: "workerStart" <*> o A..: "workerReady" <*> o A..: "workerFetchStart" <*> o A..: "workerRespondWithSettled" <*> o A..: "sendStart" <*> o A..: "sendEnd" <*> o A..: "pushStart" <*> o A..: "pushEnd" <*> o A..: "receiveHeadersEnd" instance ToJSON NetworkResourceTiming where toJSON p = A.object $ catMaybes [ ("requestTime" A..=) <$> Just (networkResourceTimingRequestTime p), ("proxyStart" A..=) <$> Just (networkResourceTimingProxyStart p), ("proxyEnd" A..=) <$> Just (networkResourceTimingProxyEnd p), ("dnsStart" A..=) <$> Just (networkResourceTimingDnsStart p), ("dnsEnd" A..=) <$> Just (networkResourceTimingDnsEnd p), ("connectStart" A..=) <$> Just (networkResourceTimingConnectStart p), ("connectEnd" A..=) <$> Just (networkResourceTimingConnectEnd p), ("sslStart" A..=) <$> Just (networkResourceTimingSslStart p), ("sslEnd" A..=) <$> Just (networkResourceTimingSslEnd p), ("workerStart" A..=) <$> Just (networkResourceTimingWorkerStart p), ("workerReady" A..=) <$> Just (networkResourceTimingWorkerReady p), ("workerFetchStart" A..=) <$> Just (networkResourceTimingWorkerFetchStart p), ("workerRespondWithSettled" A..=) <$> Just (networkResourceTimingWorkerRespondWithSettled p), ("sendStart" A..=) <$> Just (networkResourceTimingSendStart p), ("sendEnd" A..=) <$> Just (networkResourceTimingSendEnd p), ("pushStart" A..=) <$> Just (networkResourceTimingPushStart p), ("pushEnd" A..=) <$> Just (networkResourceTimingPushEnd p), ("receiveHeadersEnd" A..=) <$> Just (networkResourceTimingReceiveHeadersEnd p) ] -- | Type 'Network.ResourcePriority'. -- Loading priority of a resource request. data NetworkResourcePriority = NetworkResourcePriorityVeryLow | NetworkResourcePriorityLow | NetworkResourcePriorityMedium | NetworkResourcePriorityHigh | NetworkResourcePriorityVeryHigh deriving (Ord, Eq, Show, Read) instance FromJSON NetworkResourcePriority where parseJSON = A.withText "NetworkResourcePriority" $ \v -> case v of "VeryLow" -> pure NetworkResourcePriorityVeryLow "Low" -> pure NetworkResourcePriorityLow "Medium" -> pure NetworkResourcePriorityMedium "High" -> pure NetworkResourcePriorityHigh "VeryHigh" -> pure NetworkResourcePriorityVeryHigh "_" -> fail "failed to parse NetworkResourcePriority" instance ToJSON NetworkResourcePriority where toJSON v = A.String $ case v of NetworkResourcePriorityVeryLow -> "VeryLow" NetworkResourcePriorityLow -> "Low" NetworkResourcePriorityMedium -> "Medium" NetworkResourcePriorityHigh -> "High" NetworkResourcePriorityVeryHigh -> "VeryHigh" -- | Type 'Network.PostDataEntry'. -- Post data entry for HTTP request data NetworkPostDataEntry = NetworkPostDataEntry { networkPostDataEntryBytes :: Maybe T.Text } deriving (Eq, Show) instance FromJSON NetworkPostDataEntry where parseJSON = A.withObject "NetworkPostDataEntry" $ \o -> NetworkPostDataEntry <$> o A..:? "bytes" instance ToJSON NetworkPostDataEntry where toJSON p = A.object $ catMaybes [ ("bytes" A..=) <$> (networkPostDataEntryBytes p) ] -- | Type 'Network.Request'. -- HTTP request data. data NetworkRequestReferrerPolicy = NetworkRequestReferrerPolicyUnsafeUrl | NetworkRequestReferrerPolicyNoReferrerWhenDowngrade | NetworkRequestReferrerPolicyNoReferrer | NetworkRequestReferrerPolicyOrigin | NetworkRequestReferrerPolicyOriginWhenCrossOrigin | NetworkRequestReferrerPolicySameOrigin | NetworkRequestReferrerPolicyStrictOrigin | NetworkRequestReferrerPolicyStrictOriginWhenCrossOrigin deriving (Ord, Eq, Show, Read) instance FromJSON NetworkRequestReferrerPolicy where parseJSON = A.withText "NetworkRequestReferrerPolicy" $ \v -> case v of "unsafe-url" -> pure NetworkRequestReferrerPolicyUnsafeUrl "no-referrer-when-downgrade" -> pure NetworkRequestReferrerPolicyNoReferrerWhenDowngrade "no-referrer" -> pure NetworkRequestReferrerPolicyNoReferrer "origin" -> pure NetworkRequestReferrerPolicyOrigin "origin-when-cross-origin" -> pure NetworkRequestReferrerPolicyOriginWhenCrossOrigin "same-origin" -> pure NetworkRequestReferrerPolicySameOrigin "strict-origin" -> pure NetworkRequestReferrerPolicyStrictOrigin "strict-origin-when-cross-origin" -> pure NetworkRequestReferrerPolicyStrictOriginWhenCrossOrigin "_" -> fail "failed to parse NetworkRequestReferrerPolicy" instance ToJSON NetworkRequestReferrerPolicy where toJSON v = A.String $ case v of NetworkRequestReferrerPolicyUnsafeUrl -> "unsafe-url" NetworkRequestReferrerPolicyNoReferrerWhenDowngrade -> "no-referrer-when-downgrade" NetworkRequestReferrerPolicyNoReferrer -> "no-referrer" NetworkRequestReferrerPolicyOrigin -> "origin" NetworkRequestReferrerPolicyOriginWhenCrossOrigin -> "origin-when-cross-origin" NetworkRequestReferrerPolicySameOrigin -> "same-origin" NetworkRequestReferrerPolicyStrictOrigin -> "strict-origin" NetworkRequestReferrerPolicyStrictOriginWhenCrossOrigin -> "strict-origin-when-cross-origin" data NetworkRequest = NetworkRequest { -- | Request URL (without fragment). networkRequestUrl :: T.Text, -- | Fragment of the requested URL starting with hash, if present. networkRequestUrlFragment :: Maybe T.Text, -- | HTTP request method. networkRequestMethod :: T.Text, -- | HTTP request headers. networkRequestHeaders :: NetworkHeaders, -- | HTTP POST request data. networkRequestPostData :: Maybe T.Text, -- | True when the request has POST data. Note that postData might still be omitted when this flag is true when the data is too long. networkRequestHasPostData :: Maybe Bool, -- | Request body elements. This will be converted from base64 to binary networkRequestPostDataEntries :: Maybe [NetworkPostDataEntry], -- | The mixed content type of the request. networkRequestMixedContentType :: Maybe SecurityMixedContentType, -- | Priority of the resource request at the time request is sent. networkRequestInitialPriority :: NetworkResourcePriority, -- | The referrer policy of the request, as defined in https://www.w3.org/TR/referrer-policy/ networkRequestReferrerPolicy :: NetworkRequestReferrerPolicy, -- | Whether is loaded via link preload. networkRequestIsLinkPreload :: Maybe Bool, -- | Set for requests when the TrustToken API is used. Contains the parameters -- passed by the developer (e.g. via "fetch") as understood by the backend. networkRequestTrustTokenParams :: Maybe NetworkTrustTokenParams, -- | True if this resource request is considered to be the 'same site' as the -- request correspondinfg to the main frame. networkRequestIsSameSite :: Maybe Bool } deriving (Eq, Show) instance FromJSON NetworkRequest where parseJSON = A.withObject "NetworkRequest" $ \o -> NetworkRequest <$> o A..: "url" <*> o A..:? "urlFragment" <*> o A..: "method" <*> o A..: "headers" <*> o A..:? "postData" <*> o A..:? "hasPostData" <*> o A..:? "postDataEntries" <*> o A..:? "mixedContentType" <*> o A..: "initialPriority" <*> o A..: "referrerPolicy" <*> o A..:? "isLinkPreload" <*> o A..:? "trustTokenParams" <*> o A..:? "isSameSite" instance ToJSON NetworkRequest where toJSON p = A.object $ catMaybes [ ("url" A..=) <$> Just (networkRequestUrl p), ("urlFragment" A..=) <$> (networkRequestUrlFragment p), ("method" A..=) <$> Just (networkRequestMethod p), ("headers" A..=) <$> Just (networkRequestHeaders p), ("postData" A..=) <$> (networkRequestPostData p), ("hasPostData" A..=) <$> (networkRequestHasPostData p), ("postDataEntries" A..=) <$> (networkRequestPostDataEntries p), ("mixedContentType" A..=) <$> (networkRequestMixedContentType p), ("initialPriority" A..=) <$> Just (networkRequestInitialPriority p), ("referrerPolicy" A..=) <$> Just (networkRequestReferrerPolicy p), ("isLinkPreload" A..=) <$> (networkRequestIsLinkPreload p), ("trustTokenParams" A..=) <$> (networkRequestTrustTokenParams p), ("isSameSite" A..=) <$> (networkRequestIsSameSite p) ] -- | Type 'Network.SignedCertificateTimestamp'. -- Details of a signed certificate timestamp (SCT). data NetworkSignedCertificateTimestamp = NetworkSignedCertificateTimestamp { -- | Validation status. networkSignedCertificateTimestampStatus :: T.Text, -- | Origin. networkSignedCertificateTimestampOrigin :: T.Text, -- | Log name / description. networkSignedCertificateTimestampLogDescription :: T.Text, -- | Log ID. networkSignedCertificateTimestampLogId :: T.Text, -- | Issuance date. Unlike TimeSinceEpoch, this contains the number of -- milliseconds since January 1, 1970, UTC, not the number of seconds. networkSignedCertificateTimestampTimestamp :: Double, -- | Hash algorithm. networkSignedCertificateTimestampHashAlgorithm :: T.Text, -- | Signature algorithm. networkSignedCertificateTimestampSignatureAlgorithm :: T.Text, -- | Signature data. networkSignedCertificateTimestampSignatureData :: T.Text } deriving (Eq, Show) instance FromJSON NetworkSignedCertificateTimestamp where parseJSON = A.withObject "NetworkSignedCertificateTimestamp" $ \o -> NetworkSignedCertificateTimestamp <$> o A..: "status" <*> o A..: "origin" <*> o A..: "logDescription" <*> o A..: "logId" <*> o A..: "timestamp" <*> o A..: "hashAlgorithm" <*> o A..: "signatureAlgorithm" <*> o A..: "signatureData" instance ToJSON NetworkSignedCertificateTimestamp where toJSON p = A.object $ catMaybes [ ("status" A..=) <$> Just (networkSignedCertificateTimestampStatus p), ("origin" A..=) <$> Just (networkSignedCertificateTimestampOrigin p), ("logDescription" A..=) <$> Just (networkSignedCertificateTimestampLogDescription p), ("logId" A..=) <$> Just (networkSignedCertificateTimestampLogId p), ("timestamp" A..=) <$> Just (networkSignedCertificateTimestampTimestamp p), ("hashAlgorithm" A..=) <$> Just (networkSignedCertificateTimestampHashAlgorithm p), ("signatureAlgorithm" A..=) <$> Just (networkSignedCertificateTimestampSignatureAlgorithm p), ("signatureData" A..=) <$> Just (networkSignedCertificateTimestampSignatureData p) ] -- | Type 'Network.SecurityDetails'. -- Security details about a request. data NetworkSecurityDetails = NetworkSecurityDetails { -- | Protocol name (e.g. "TLS 1.2" or "QUIC"). networkSecurityDetailsProtocol :: T.Text, -- | Key Exchange used by the connection, or the empty string if not applicable. networkSecurityDetailsKeyExchange :: T.Text, -- | (EC)DH group used by the connection, if applicable. networkSecurityDetailsKeyExchangeGroup :: Maybe T.Text, -- | Cipher name. networkSecurityDetailsCipher :: T.Text, -- | TLS MAC. Note that AEAD ciphers do not have separate MACs. networkSecurityDetailsMac :: Maybe T.Text, -- | Certificate ID value. networkSecurityDetailsCertificateId :: SecurityCertificateId, -- | Certificate subject name. networkSecurityDetailsSubjectName :: T.Text, -- | Subject Alternative Name (SAN) DNS names and IP addresses. networkSecurityDetailsSanList :: [T.Text], -- | Name of the issuing CA. networkSecurityDetailsIssuer :: T.Text, -- | Certificate valid from date. networkSecurityDetailsValidFrom :: NetworkTimeSinceEpoch, -- | Certificate valid to (expiration) date networkSecurityDetailsValidTo :: NetworkTimeSinceEpoch, -- | List of signed certificate timestamps (SCTs). networkSecurityDetailsSignedCertificateTimestampList :: [NetworkSignedCertificateTimestamp], -- | Whether the request complied with Certificate Transparency policy networkSecurityDetailsCertificateTransparencyCompliance :: NetworkCertificateTransparencyCompliance, -- | The signature algorithm used by the server in the TLS server signature, -- represented as a TLS SignatureScheme code point. Omitted if not -- applicable or not known. networkSecurityDetailsServerSignatureAlgorithm :: Maybe Int, -- | Whether the connection used Encrypted ClientHello networkSecurityDetailsEncryptedClientHello :: Bool } deriving (Eq, Show) instance FromJSON NetworkSecurityDetails where parseJSON = A.withObject "NetworkSecurityDetails" $ \o -> NetworkSecurityDetails <$> o A..: "protocol" <*> o A..: "keyExchange" <*> o A..:? "keyExchangeGroup" <*> o A..: "cipher" <*> o A..:? "mac" <*> o A..: "certificateId" <*> o A..: "subjectName" <*> o A..: "sanList" <*> o A..: "issuer" <*> o A..: "validFrom" <*> o A..: "validTo" <*> o A..: "signedCertificateTimestampList" <*> o A..: "certificateTransparencyCompliance" <*> o A..:? "serverSignatureAlgorithm" <*> o A..: "encryptedClientHello" instance ToJSON NetworkSecurityDetails where toJSON p = A.object $ catMaybes [ ("protocol" A..=) <$> Just (networkSecurityDetailsProtocol p), ("keyExchange" A..=) <$> Just (networkSecurityDetailsKeyExchange p), ("keyExchangeGroup" A..=) <$> (networkSecurityDetailsKeyExchangeGroup p), ("cipher" A..=) <$> Just (networkSecurityDetailsCipher p), ("mac" A..=) <$> (networkSecurityDetailsMac p), ("certificateId" A..=) <$> Just (networkSecurityDetailsCertificateId p), ("subjectName" A..=) <$> Just (networkSecurityDetailsSubjectName p), ("sanList" A..=) <$> Just (networkSecurityDetailsSanList p), ("issuer" A..=) <$> Just (networkSecurityDetailsIssuer p), ("validFrom" A..=) <$> Just (networkSecurityDetailsValidFrom p), ("validTo" A..=) <$> Just (networkSecurityDetailsValidTo p), ("signedCertificateTimestampList" A..=) <$> Just (networkSecurityDetailsSignedCertificateTimestampList p), ("certificateTransparencyCompliance" A..=) <$> Just (networkSecurityDetailsCertificateTransparencyCompliance p), ("serverSignatureAlgorithm" A..=) <$> (networkSecurityDetailsServerSignatureAlgorithm p), ("encryptedClientHello" A..=) <$> Just (networkSecurityDetailsEncryptedClientHello p) ] -- | Type 'Network.CertificateTransparencyCompliance'. -- Whether the request complied with Certificate Transparency policy. data NetworkCertificateTransparencyCompliance = NetworkCertificateTransparencyComplianceUnknown | NetworkCertificateTransparencyComplianceNotCompliant | NetworkCertificateTransparencyComplianceCompliant deriving (Ord, Eq, Show, Read) instance FromJSON NetworkCertificateTransparencyCompliance where parseJSON = A.withText "NetworkCertificateTransparencyCompliance" $ \v -> case v of "unknown" -> pure NetworkCertificateTransparencyComplianceUnknown "not-compliant" -> pure NetworkCertificateTransparencyComplianceNotCompliant "compliant" -> pure NetworkCertificateTransparencyComplianceCompliant "_" -> fail "failed to parse NetworkCertificateTransparencyCompliance" instance ToJSON NetworkCertificateTransparencyCompliance where toJSON v = A.String $ case v of NetworkCertificateTransparencyComplianceUnknown -> "unknown" NetworkCertificateTransparencyComplianceNotCompliant -> "not-compliant" NetworkCertificateTransparencyComplianceCompliant -> "compliant" -- | Type 'Network.BlockedReason'. -- The reason why request was blocked. data NetworkBlockedReason = NetworkBlockedReasonOther | NetworkBlockedReasonCsp | NetworkBlockedReasonMixedContent | NetworkBlockedReasonOrigin | NetworkBlockedReasonInspector | NetworkBlockedReasonSubresourceFilter | NetworkBlockedReasonContentType | NetworkBlockedReasonCoepFrameResourceNeedsCoepHeader | NetworkBlockedReasonCoopSandboxedIframeCannotNavigateToCoopPage | NetworkBlockedReasonCorpNotSameOrigin | NetworkBlockedReasonCorpNotSameOriginAfterDefaultedToSameOriginByCoep | NetworkBlockedReasonCorpNotSameSite deriving (Ord, Eq, Show, Read) instance FromJSON NetworkBlockedReason where parseJSON = A.withText "NetworkBlockedReason" $ \v -> case v of "other" -> pure NetworkBlockedReasonOther "csp" -> pure NetworkBlockedReasonCsp "mixed-content" -> pure NetworkBlockedReasonMixedContent "origin" -> pure NetworkBlockedReasonOrigin "inspector" -> pure NetworkBlockedReasonInspector "subresource-filter" -> pure NetworkBlockedReasonSubresourceFilter "content-type" -> pure NetworkBlockedReasonContentType "coep-frame-resource-needs-coep-header" -> pure NetworkBlockedReasonCoepFrameResourceNeedsCoepHeader "coop-sandboxed-iframe-cannot-navigate-to-coop-page" -> pure NetworkBlockedReasonCoopSandboxedIframeCannotNavigateToCoopPage "corp-not-same-origin" -> pure NetworkBlockedReasonCorpNotSameOrigin "corp-not-same-origin-after-defaulted-to-same-origin-by-coep" -> pure NetworkBlockedReasonCorpNotSameOriginAfterDefaultedToSameOriginByCoep "corp-not-same-site" -> pure NetworkBlockedReasonCorpNotSameSite "_" -> fail "failed to parse NetworkBlockedReason" instance ToJSON NetworkBlockedReason where toJSON v = A.String $ case v of NetworkBlockedReasonOther -> "other" NetworkBlockedReasonCsp -> "csp" NetworkBlockedReasonMixedContent -> "mixed-content" NetworkBlockedReasonOrigin -> "origin" NetworkBlockedReasonInspector -> "inspector" NetworkBlockedReasonSubresourceFilter -> "subresource-filter" NetworkBlockedReasonContentType -> "content-type" NetworkBlockedReasonCoepFrameResourceNeedsCoepHeader -> "coep-frame-resource-needs-coep-header" NetworkBlockedReasonCoopSandboxedIframeCannotNavigateToCoopPage -> "coop-sandboxed-iframe-cannot-navigate-to-coop-page" NetworkBlockedReasonCorpNotSameOrigin -> "corp-not-same-origin" NetworkBlockedReasonCorpNotSameOriginAfterDefaultedToSameOriginByCoep -> "corp-not-same-origin-after-defaulted-to-same-origin-by-coep" NetworkBlockedReasonCorpNotSameSite -> "corp-not-same-site" -- | Type 'Network.CorsError'. -- The reason why request was blocked. data NetworkCorsError = NetworkCorsErrorDisallowedByMode | NetworkCorsErrorInvalidResponse | NetworkCorsErrorWildcardOriginNotAllowed | NetworkCorsErrorMissingAllowOriginHeader | NetworkCorsErrorMultipleAllowOriginValues | NetworkCorsErrorInvalidAllowOriginValue | NetworkCorsErrorAllowOriginMismatch | NetworkCorsErrorInvalidAllowCredentials | NetworkCorsErrorCorsDisabledScheme | NetworkCorsErrorPreflightInvalidStatus | NetworkCorsErrorPreflightDisallowedRedirect | NetworkCorsErrorPreflightWildcardOriginNotAllowed | NetworkCorsErrorPreflightMissingAllowOriginHeader | NetworkCorsErrorPreflightMultipleAllowOriginValues | NetworkCorsErrorPreflightInvalidAllowOriginValue | NetworkCorsErrorPreflightAllowOriginMismatch | NetworkCorsErrorPreflightInvalidAllowCredentials | NetworkCorsErrorPreflightMissingAllowExternal | NetworkCorsErrorPreflightInvalidAllowExternal | NetworkCorsErrorPreflightMissingAllowPrivateNetwork | NetworkCorsErrorPreflightInvalidAllowPrivateNetwork | NetworkCorsErrorInvalidAllowMethodsPreflightResponse | NetworkCorsErrorInvalidAllowHeadersPreflightResponse | NetworkCorsErrorMethodDisallowedByPreflightResponse | NetworkCorsErrorHeaderDisallowedByPreflightResponse | NetworkCorsErrorRedirectContainsCredentials | NetworkCorsErrorInsecurePrivateNetwork | NetworkCorsErrorInvalidPrivateNetworkAccess | NetworkCorsErrorUnexpectedPrivateNetworkAccess | NetworkCorsErrorNoCorsRedirectModeNotFollow deriving (Ord, Eq, Show, Read) instance FromJSON NetworkCorsError where parseJSON = A.withText "NetworkCorsError" $ \v -> case v of "DisallowedByMode" -> pure NetworkCorsErrorDisallowedByMode "InvalidResponse" -> pure NetworkCorsErrorInvalidResponse "WildcardOriginNotAllowed" -> pure NetworkCorsErrorWildcardOriginNotAllowed "MissingAllowOriginHeader" -> pure NetworkCorsErrorMissingAllowOriginHeader "MultipleAllowOriginValues" -> pure NetworkCorsErrorMultipleAllowOriginValues "InvalidAllowOriginValue" -> pure NetworkCorsErrorInvalidAllowOriginValue "AllowOriginMismatch" -> pure NetworkCorsErrorAllowOriginMismatch "InvalidAllowCredentials" -> pure NetworkCorsErrorInvalidAllowCredentials "CorsDisabledScheme" -> pure NetworkCorsErrorCorsDisabledScheme "PreflightInvalidStatus" -> pure NetworkCorsErrorPreflightInvalidStatus "PreflightDisallowedRedirect" -> pure NetworkCorsErrorPreflightDisallowedRedirect "PreflightWildcardOriginNotAllowed" -> pure NetworkCorsErrorPreflightWildcardOriginNotAllowed "PreflightMissingAllowOriginHeader" -> pure NetworkCorsErrorPreflightMissingAllowOriginHeader "PreflightMultipleAllowOriginValues" -> pure NetworkCorsErrorPreflightMultipleAllowOriginValues "PreflightInvalidAllowOriginValue" -> pure NetworkCorsErrorPreflightInvalidAllowOriginValue "PreflightAllowOriginMismatch" -> pure NetworkCorsErrorPreflightAllowOriginMismatch "PreflightInvalidAllowCredentials" -> pure NetworkCorsErrorPreflightInvalidAllowCredentials "PreflightMissingAllowExternal" -> pure NetworkCorsErrorPreflightMissingAllowExternal "PreflightInvalidAllowExternal" -> pure NetworkCorsErrorPreflightInvalidAllowExternal "PreflightMissingAllowPrivateNetwork" -> pure NetworkCorsErrorPreflightMissingAllowPrivateNetwork "PreflightInvalidAllowPrivateNetwork" -> pure NetworkCorsErrorPreflightInvalidAllowPrivateNetwork "InvalidAllowMethodsPreflightResponse" -> pure NetworkCorsErrorInvalidAllowMethodsPreflightResponse "InvalidAllowHeadersPreflightResponse" -> pure NetworkCorsErrorInvalidAllowHeadersPreflightResponse "MethodDisallowedByPreflightResponse" -> pure NetworkCorsErrorMethodDisallowedByPreflightResponse "HeaderDisallowedByPreflightResponse" -> pure NetworkCorsErrorHeaderDisallowedByPreflightResponse "RedirectContainsCredentials" -> pure NetworkCorsErrorRedirectContainsCredentials "InsecurePrivateNetwork" -> pure NetworkCorsErrorInsecurePrivateNetwork "InvalidPrivateNetworkAccess" -> pure NetworkCorsErrorInvalidPrivateNetworkAccess "UnexpectedPrivateNetworkAccess" -> pure NetworkCorsErrorUnexpectedPrivateNetworkAccess "NoCorsRedirectModeNotFollow" -> pure NetworkCorsErrorNoCorsRedirectModeNotFollow "_" -> fail "failed to parse NetworkCorsError" instance ToJSON NetworkCorsError where toJSON v = A.String $ case v of NetworkCorsErrorDisallowedByMode -> "DisallowedByMode" NetworkCorsErrorInvalidResponse -> "InvalidResponse" NetworkCorsErrorWildcardOriginNotAllowed -> "WildcardOriginNotAllowed" NetworkCorsErrorMissingAllowOriginHeader -> "MissingAllowOriginHeader" NetworkCorsErrorMultipleAllowOriginValues -> "MultipleAllowOriginValues" NetworkCorsErrorInvalidAllowOriginValue -> "InvalidAllowOriginValue" NetworkCorsErrorAllowOriginMismatch -> "AllowOriginMismatch" NetworkCorsErrorInvalidAllowCredentials -> "InvalidAllowCredentials" NetworkCorsErrorCorsDisabledScheme -> "CorsDisabledScheme" NetworkCorsErrorPreflightInvalidStatus -> "PreflightInvalidStatus" NetworkCorsErrorPreflightDisallowedRedirect -> "PreflightDisallowedRedirect" NetworkCorsErrorPreflightWildcardOriginNotAllowed -> "PreflightWildcardOriginNotAllowed" NetworkCorsErrorPreflightMissingAllowOriginHeader -> "PreflightMissingAllowOriginHeader" NetworkCorsErrorPreflightMultipleAllowOriginValues -> "PreflightMultipleAllowOriginValues" NetworkCorsErrorPreflightInvalidAllowOriginValue -> "PreflightInvalidAllowOriginValue" NetworkCorsErrorPreflightAllowOriginMismatch -> "PreflightAllowOriginMismatch" NetworkCorsErrorPreflightInvalidAllowCredentials -> "PreflightInvalidAllowCredentials" NetworkCorsErrorPreflightMissingAllowExternal -> "PreflightMissingAllowExternal" NetworkCorsErrorPreflightInvalidAllowExternal -> "PreflightInvalidAllowExternal" NetworkCorsErrorPreflightMissingAllowPrivateNetwork -> "PreflightMissingAllowPrivateNetwork" NetworkCorsErrorPreflightInvalidAllowPrivateNetwork -> "PreflightInvalidAllowPrivateNetwork" NetworkCorsErrorInvalidAllowMethodsPreflightResponse -> "InvalidAllowMethodsPreflightResponse" NetworkCorsErrorInvalidAllowHeadersPreflightResponse -> "InvalidAllowHeadersPreflightResponse" NetworkCorsErrorMethodDisallowedByPreflightResponse -> "MethodDisallowedByPreflightResponse" NetworkCorsErrorHeaderDisallowedByPreflightResponse -> "HeaderDisallowedByPreflightResponse" NetworkCorsErrorRedirectContainsCredentials -> "RedirectContainsCredentials" NetworkCorsErrorInsecurePrivateNetwork -> "InsecurePrivateNetwork" NetworkCorsErrorInvalidPrivateNetworkAccess -> "InvalidPrivateNetworkAccess" NetworkCorsErrorUnexpectedPrivateNetworkAccess -> "UnexpectedPrivateNetworkAccess" NetworkCorsErrorNoCorsRedirectModeNotFollow -> "NoCorsRedirectModeNotFollow" -- | Type 'Network.CorsErrorStatus'. data NetworkCorsErrorStatus = NetworkCorsErrorStatus { networkCorsErrorStatusCorsError :: NetworkCorsError, networkCorsErrorStatusFailedParameter :: T.Text } deriving (Eq, Show) instance FromJSON NetworkCorsErrorStatus where parseJSON = A.withObject "NetworkCorsErrorStatus" $ \o -> NetworkCorsErrorStatus <$> o A..: "corsError" <*> o A..: "failedParameter" instance ToJSON NetworkCorsErrorStatus where toJSON p = A.object $ catMaybes [ ("corsError" A..=) <$> Just (networkCorsErrorStatusCorsError p), ("failedParameter" A..=) <$> Just (networkCorsErrorStatusFailedParameter p) ] -- | Type 'Network.ServiceWorkerResponseSource'. -- Source of serviceworker response. data NetworkServiceWorkerResponseSource = NetworkServiceWorkerResponseSourceCacheStorage | NetworkServiceWorkerResponseSourceHttpCache | NetworkServiceWorkerResponseSourceFallbackCode | NetworkServiceWorkerResponseSourceNetwork deriving (Ord, Eq, Show, Read) instance FromJSON NetworkServiceWorkerResponseSource where parseJSON = A.withText "NetworkServiceWorkerResponseSource" $ \v -> case v of "cache-storage" -> pure NetworkServiceWorkerResponseSourceCacheStorage "http-cache" -> pure NetworkServiceWorkerResponseSourceHttpCache "fallback-code" -> pure NetworkServiceWorkerResponseSourceFallbackCode "network" -> pure NetworkServiceWorkerResponseSourceNetwork "_" -> fail "failed to parse NetworkServiceWorkerResponseSource" instance ToJSON NetworkServiceWorkerResponseSource where toJSON v = A.String $ case v of NetworkServiceWorkerResponseSourceCacheStorage -> "cache-storage" NetworkServiceWorkerResponseSourceHttpCache -> "http-cache" NetworkServiceWorkerResponseSourceFallbackCode -> "fallback-code" NetworkServiceWorkerResponseSourceNetwork -> "network" -- | Type 'Network.TrustTokenParams'. -- Determines what type of Trust Token operation is executed and -- depending on the type, some additional parameters. The values -- are specified in third_party/blink/renderer/core/fetch/trust_token.idl. data NetworkTrustTokenParamsRefreshPolicy = NetworkTrustTokenParamsRefreshPolicyUseCached | NetworkTrustTokenParamsRefreshPolicyRefresh deriving (Ord, Eq, Show, Read) instance FromJSON NetworkTrustTokenParamsRefreshPolicy where parseJSON = A.withText "NetworkTrustTokenParamsRefreshPolicy" $ \v -> case v of "UseCached" -> pure NetworkTrustTokenParamsRefreshPolicyUseCached "Refresh" -> pure NetworkTrustTokenParamsRefreshPolicyRefresh "_" -> fail "failed to parse NetworkTrustTokenParamsRefreshPolicy" instance ToJSON NetworkTrustTokenParamsRefreshPolicy where toJSON v = A.String $ case v of NetworkTrustTokenParamsRefreshPolicyUseCached -> "UseCached" NetworkTrustTokenParamsRefreshPolicyRefresh -> "Refresh" data NetworkTrustTokenParams = NetworkTrustTokenParams { networkTrustTokenParamsType :: NetworkTrustTokenOperationType, -- | Only set for "token-redemption" type and determine whether -- to request a fresh SRR or use a still valid cached SRR. networkTrustTokenParamsRefreshPolicy :: NetworkTrustTokenParamsRefreshPolicy, -- | Origins of issuers from whom to request tokens or redemption -- records. networkTrustTokenParamsIssuers :: Maybe [T.Text] } deriving (Eq, Show) instance FromJSON NetworkTrustTokenParams where parseJSON = A.withObject "NetworkTrustTokenParams" $ \o -> NetworkTrustTokenParams <$> o A..: "type" <*> o A..: "refreshPolicy" <*> o A..:? "issuers" instance ToJSON NetworkTrustTokenParams where toJSON p = A.object $ catMaybes [ ("type" A..=) <$> Just (networkTrustTokenParamsType p), ("refreshPolicy" A..=) <$> Just (networkTrustTokenParamsRefreshPolicy p), ("issuers" A..=) <$> (networkTrustTokenParamsIssuers p) ] -- | Type 'Network.TrustTokenOperationType'. data NetworkTrustTokenOperationType = NetworkTrustTokenOperationTypeIssuance | NetworkTrustTokenOperationTypeRedemption | NetworkTrustTokenOperationTypeSigning deriving (Ord, Eq, Show, Read) instance FromJSON NetworkTrustTokenOperationType where parseJSON = A.withText "NetworkTrustTokenOperationType" $ \v -> case v of "Issuance" -> pure NetworkTrustTokenOperationTypeIssuance "Redemption" -> pure NetworkTrustTokenOperationTypeRedemption "Signing" -> pure NetworkTrustTokenOperationTypeSigning "_" -> fail "failed to parse NetworkTrustTokenOperationType" instance ToJSON NetworkTrustTokenOperationType where toJSON v = A.String $ case v of NetworkTrustTokenOperationTypeIssuance -> "Issuance" NetworkTrustTokenOperationTypeRedemption -> "Redemption" NetworkTrustTokenOperationTypeSigning -> "Signing" -- | Type 'Network.AlternateProtocolUsage'. -- The reason why Chrome uses a specific transport protocol for HTTP semantics. data NetworkAlternateProtocolUsage = NetworkAlternateProtocolUsageAlternativeJobWonWithoutRace | NetworkAlternateProtocolUsageAlternativeJobWonRace | NetworkAlternateProtocolUsageMainJobWonRace | NetworkAlternateProtocolUsageMappingMissing | NetworkAlternateProtocolUsageBroken | NetworkAlternateProtocolUsageDnsAlpnH3JobWonWithoutRace | NetworkAlternateProtocolUsageDnsAlpnH3JobWonRace | NetworkAlternateProtocolUsageUnspecifiedReason deriving (Ord, Eq, Show, Read) instance FromJSON NetworkAlternateProtocolUsage where parseJSON = A.withText "NetworkAlternateProtocolUsage" $ \v -> case v of "alternativeJobWonWithoutRace" -> pure NetworkAlternateProtocolUsageAlternativeJobWonWithoutRace "alternativeJobWonRace" -> pure NetworkAlternateProtocolUsageAlternativeJobWonRace "mainJobWonRace" -> pure NetworkAlternateProtocolUsageMainJobWonRace "mappingMissing" -> pure NetworkAlternateProtocolUsageMappingMissing "broken" -> pure NetworkAlternateProtocolUsageBroken "dnsAlpnH3JobWonWithoutRace" -> pure NetworkAlternateProtocolUsageDnsAlpnH3JobWonWithoutRace "dnsAlpnH3JobWonRace" -> pure NetworkAlternateProtocolUsageDnsAlpnH3JobWonRace "unspecifiedReason" -> pure NetworkAlternateProtocolUsageUnspecifiedReason "_" -> fail "failed to parse NetworkAlternateProtocolUsage" instance ToJSON NetworkAlternateProtocolUsage where toJSON v = A.String $ case v of NetworkAlternateProtocolUsageAlternativeJobWonWithoutRace -> "alternativeJobWonWithoutRace" NetworkAlternateProtocolUsageAlternativeJobWonRace -> "alternativeJobWonRace" NetworkAlternateProtocolUsageMainJobWonRace -> "mainJobWonRace" NetworkAlternateProtocolUsageMappingMissing -> "mappingMissing" NetworkAlternateProtocolUsageBroken -> "broken" NetworkAlternateProtocolUsageDnsAlpnH3JobWonWithoutRace -> "dnsAlpnH3JobWonWithoutRace" NetworkAlternateProtocolUsageDnsAlpnH3JobWonRace -> "dnsAlpnH3JobWonRace" NetworkAlternateProtocolUsageUnspecifiedReason -> "unspecifiedReason" -- | Type 'Network.Response'. -- HTTP response data. data NetworkResponse = NetworkResponse { -- | Response URL. This URL can be different from CachedResource.url in case of redirect. networkResponseUrl :: T.Text, -- | HTTP response status code. networkResponseStatus :: Int, -- | HTTP response status text. networkResponseStatusText :: T.Text, -- | HTTP response headers. networkResponseHeaders :: NetworkHeaders, -- | Resource mimeType as determined by the browser. networkResponseMimeType :: T.Text, -- | Refined HTTP request headers that were actually transmitted over the network. networkResponseRequestHeaders :: Maybe NetworkHeaders, -- | Specifies whether physical connection was actually reused for this request. networkResponseConnectionReused :: Bool, -- | Physical connection id that was actually used for this request. networkResponseConnectionId :: Double, -- | Remote IP address. networkResponseRemoteIPAddress :: Maybe T.Text, -- | Remote port. networkResponseRemotePort :: Maybe Int, -- | Specifies that the request was served from the disk cache. networkResponseFromDiskCache :: Maybe Bool, -- | Specifies that the request was served from the ServiceWorker. networkResponseFromServiceWorker :: Maybe Bool, -- | Specifies that the request was served from the prefetch cache. networkResponseFromPrefetchCache :: Maybe Bool, -- | Total number of bytes received for this request so far. networkResponseEncodedDataLength :: Double, -- | Timing information for the given request. networkResponseTiming :: Maybe NetworkResourceTiming, -- | Response source of response from ServiceWorker. networkResponseServiceWorkerResponseSource :: Maybe NetworkServiceWorkerResponseSource, -- | The time at which the returned response was generated. networkResponseResponseTime :: Maybe NetworkTimeSinceEpoch, -- | Cache Storage Cache Name. networkResponseCacheStorageCacheName :: Maybe T.Text, -- | Protocol used to fetch this request. networkResponseProtocol :: Maybe T.Text, -- | The reason why Chrome uses a specific transport protocol for HTTP semantics. networkResponseAlternateProtocolUsage :: Maybe NetworkAlternateProtocolUsage, -- | Security state of the request resource. networkResponseSecurityState :: SecuritySecurityState, -- | Security details for the request. networkResponseSecurityDetails :: Maybe NetworkSecurityDetails } deriving (Eq, Show) instance FromJSON NetworkResponse where parseJSON = A.withObject "NetworkResponse" $ \o -> NetworkResponse <$> o A..: "url" <*> o A..: "status" <*> o A..: "statusText" <*> o A..: "headers" <*> o A..: "mimeType" <*> o A..:? "requestHeaders" <*> o A..: "connectionReused" <*> o A..: "connectionId" <*> o A..:? "remoteIPAddress" <*> o A..:? "remotePort" <*> o A..:? "fromDiskCache" <*> o A..:? "fromServiceWorker" <*> o A..:? "fromPrefetchCache" <*> o A..: "encodedDataLength" <*> o A..:? "timing" <*> o A..:? "serviceWorkerResponseSource" <*> o A..:? "responseTime" <*> o A..:? "cacheStorageCacheName" <*> o A..:? "protocol" <*> o A..:? "alternateProtocolUsage" <*> o A..: "securityState" <*> o A..:? "securityDetails" instance ToJSON NetworkResponse where toJSON p = A.object $ catMaybes [ ("url" A..=) <$> Just (networkResponseUrl p), ("status" A..=) <$> Just (networkResponseStatus p), ("statusText" A..=) <$> Just (networkResponseStatusText p), ("headers" A..=) <$> Just (networkResponseHeaders p), ("mimeType" A..=) <$> Just (networkResponseMimeType p), ("requestHeaders" A..=) <$> (networkResponseRequestHeaders p), ("connectionReused" A..=) <$> Just (networkResponseConnectionReused p), ("connectionId" A..=) <$> Just (networkResponseConnectionId p), ("remoteIPAddress" A..=) <$> (networkResponseRemoteIPAddress p), ("remotePort" A..=) <$> (networkResponseRemotePort p), ("fromDiskCache" A..=) <$> (networkResponseFromDiskCache p), ("fromServiceWorker" A..=) <$> (networkResponseFromServiceWorker p), ("fromPrefetchCache" A..=) <$> (networkResponseFromPrefetchCache p), ("encodedDataLength" A..=) <$> Just (networkResponseEncodedDataLength p), ("timing" A..=) <$> (networkResponseTiming p), ("serviceWorkerResponseSource" A..=) <$> (networkResponseServiceWorkerResponseSource p), ("responseTime" A..=) <$> (networkResponseResponseTime p), ("cacheStorageCacheName" A..=) <$> (networkResponseCacheStorageCacheName p), ("protocol" A..=) <$> (networkResponseProtocol p), ("alternateProtocolUsage" A..=) <$> (networkResponseAlternateProtocolUsage p), ("securityState" A..=) <$> Just (networkResponseSecurityState p), ("securityDetails" A..=) <$> (networkResponseSecurityDetails p) ] -- | Type 'Network.WebSocketRequest'. -- WebSocket request data. data NetworkWebSocketRequest = NetworkWebSocketRequest { -- | HTTP request headers. networkWebSocketRequestHeaders :: NetworkHeaders } deriving (Eq, Show) instance FromJSON NetworkWebSocketRequest where parseJSON = A.withObject "NetworkWebSocketRequest" $ \o -> NetworkWebSocketRequest <$> o A..: "headers" instance ToJSON NetworkWebSocketRequest where toJSON p = A.object $ catMaybes [ ("headers" A..=) <$> Just (networkWebSocketRequestHeaders p) ] -- | Type 'Network.WebSocketResponse'. -- WebSocket response data. data NetworkWebSocketResponse = NetworkWebSocketResponse { -- | HTTP response status code. networkWebSocketResponseStatus :: Int, -- | HTTP response status text. networkWebSocketResponseStatusText :: T.Text, -- | HTTP response headers. networkWebSocketResponseHeaders :: NetworkHeaders, -- | HTTP response headers text. networkWebSocketResponseHeadersText :: Maybe T.Text, -- | HTTP request headers. networkWebSocketResponseRequestHeaders :: Maybe NetworkHeaders, -- | HTTP request headers text. networkWebSocketResponseRequestHeadersText :: Maybe T.Text } deriving (Eq, Show) instance FromJSON NetworkWebSocketResponse where parseJSON = A.withObject "NetworkWebSocketResponse" $ \o -> NetworkWebSocketResponse <$> o A..: "status" <*> o A..: "statusText" <*> o A..: "headers" <*> o A..:? "headersText" <*> o A..:? "requestHeaders" <*> o A..:? "requestHeadersText" instance ToJSON NetworkWebSocketResponse where toJSON p = A.object $ catMaybes [ ("status" A..=) <$> Just (networkWebSocketResponseStatus p), ("statusText" A..=) <$> Just (networkWebSocketResponseStatusText p), ("headers" A..=) <$> Just (networkWebSocketResponseHeaders p), ("headersText" A..=) <$> (networkWebSocketResponseHeadersText p), ("requestHeaders" A..=) <$> (networkWebSocketResponseRequestHeaders p), ("requestHeadersText" A..=) <$> (networkWebSocketResponseRequestHeadersText p) ] -- | Type 'Network.WebSocketFrame'. -- WebSocket message data. This represents an entire WebSocket message, not just a fragmented frame as the name suggests. data NetworkWebSocketFrame = NetworkWebSocketFrame { -- | WebSocket message opcode. networkWebSocketFrameOpcode :: Double, -- | WebSocket message mask. networkWebSocketFrameMask :: Bool, -- | WebSocket message payload data. -- If the opcode is 1, this is a text message and payloadData is a UTF-8 string. -- If the opcode isn't 1, then payloadData is a base64 encoded string representing binary data. networkWebSocketFramePayloadData :: T.Text } deriving (Eq, Show) instance FromJSON NetworkWebSocketFrame where parseJSON = A.withObject "NetworkWebSocketFrame" $ \o -> NetworkWebSocketFrame <$> o A..: "opcode" <*> o A..: "mask" <*> o A..: "payloadData" instance ToJSON NetworkWebSocketFrame where toJSON p = A.object $ catMaybes [ ("opcode" A..=) <$> Just (networkWebSocketFrameOpcode p), ("mask" A..=) <$> Just (networkWebSocketFrameMask p), ("payloadData" A..=) <$> Just (networkWebSocketFramePayloadData p) ] -- | Type 'Network.CachedResource'. -- Information about the cached resource. data NetworkCachedResource = NetworkCachedResource { -- | Resource URL. This is the url of the original network request. networkCachedResourceUrl :: T.Text, -- | Type of this resource. networkCachedResourceType :: NetworkResourceType, -- | Cached response data. networkCachedResourceResponse :: Maybe NetworkResponse, -- | Cached response body size. networkCachedResourceBodySize :: Double } deriving (Eq, Show) instance FromJSON NetworkCachedResource where parseJSON = A.withObject "NetworkCachedResource" $ \o -> NetworkCachedResource <$> o A..: "url" <*> o A..: "type" <*> o A..:? "response" <*> o A..: "bodySize" instance ToJSON NetworkCachedResource where toJSON p = A.object $ catMaybes [ ("url" A..=) <$> Just (networkCachedResourceUrl p), ("type" A..=) <$> Just (networkCachedResourceType p), ("response" A..=) <$> (networkCachedResourceResponse p), ("bodySize" A..=) <$> Just (networkCachedResourceBodySize p) ] -- | Type 'Network.Initiator'. -- Information about the request initiator. data NetworkInitiatorType = NetworkInitiatorTypeParser | NetworkInitiatorTypeScript | NetworkInitiatorTypePreload | NetworkInitiatorTypeSignedExchange | NetworkInitiatorTypePreflight | NetworkInitiatorTypeOther deriving (Ord, Eq, Show, Read) instance FromJSON NetworkInitiatorType where parseJSON = A.withText "NetworkInitiatorType" $ \v -> case v of "parser" -> pure NetworkInitiatorTypeParser "script" -> pure NetworkInitiatorTypeScript "preload" -> pure NetworkInitiatorTypePreload "SignedExchange" -> pure NetworkInitiatorTypeSignedExchange "preflight" -> pure NetworkInitiatorTypePreflight "other" -> pure NetworkInitiatorTypeOther "_" -> fail "failed to parse NetworkInitiatorType" instance ToJSON NetworkInitiatorType where toJSON v = A.String $ case v of NetworkInitiatorTypeParser -> "parser" NetworkInitiatorTypeScript -> "script" NetworkInitiatorTypePreload -> "preload" NetworkInitiatorTypeSignedExchange -> "SignedExchange" NetworkInitiatorTypePreflight -> "preflight" NetworkInitiatorTypeOther -> "other" data NetworkInitiator = NetworkInitiator { -- | Type of this initiator. networkInitiatorType :: NetworkInitiatorType, -- | Initiator JavaScript stack trace, set for Script only. networkInitiatorStack :: Maybe Runtime.RuntimeStackTrace, -- | Initiator URL, set for Parser type or for Script type (when script is importing module) or for SignedExchange type. networkInitiatorUrl :: Maybe T.Text, -- | Initiator line number, set for Parser type or for Script type (when script is importing -- module) (0-based). networkInitiatorLineNumber :: Maybe Double, -- | Initiator column number, set for Parser type or for Script type (when script is importing -- module) (0-based). networkInitiatorColumnNumber :: Maybe Double, -- | Set if another request triggered this request (e.g. preflight). networkInitiatorRequestId :: Maybe NetworkRequestId } deriving (Eq, Show) instance FromJSON NetworkInitiator where parseJSON = A.withObject "NetworkInitiator" $ \o -> NetworkInitiator <$> o A..: "type" <*> o A..:? "stack" <*> o A..:? "url" <*> o A..:? "lineNumber" <*> o A..:? "columnNumber" <*> o A..:? "requestId" instance ToJSON NetworkInitiator where toJSON p = A.object $ catMaybes [ ("type" A..=) <$> Just (networkInitiatorType p), ("stack" A..=) <$> (networkInitiatorStack p), ("url" A..=) <$> (networkInitiatorUrl p), ("lineNumber" A..=) <$> (networkInitiatorLineNumber p), ("columnNumber" A..=) <$> (networkInitiatorColumnNumber p), ("requestId" A..=) <$> (networkInitiatorRequestId p) ] -- | Type 'Network.Cookie'. -- Cookie object data NetworkCookie = NetworkCookie { -- | Cookie name. networkCookieName :: T.Text, -- | Cookie value. networkCookieValue :: T.Text, -- | Cookie domain. networkCookieDomain :: T.Text, -- | Cookie path. networkCookiePath :: T.Text, -- | Cookie expiration date as the number of seconds since the UNIX epoch. networkCookieExpires :: Double, -- | Cookie size. networkCookieSize :: Int, -- | True if cookie is http-only. networkCookieHttpOnly :: Bool, -- | True if cookie is secure. networkCookieSecure :: Bool, -- | True in case of session cookie. networkCookieSession :: Bool, -- | Cookie SameSite type. networkCookieSameSite :: Maybe NetworkCookieSameSite, -- | Cookie Priority networkCookiePriority :: NetworkCookiePriority, -- | True if cookie is SameParty. networkCookieSameParty :: Bool, -- | Cookie source scheme type. networkCookieSourceScheme :: NetworkCookieSourceScheme, -- | Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. -- An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. -- This is a temporary ability and it will be removed in the future. networkCookieSourcePort :: Int, -- | Cookie partition key. The site of the top-level URL the browser was visiting at the start -- of the request to the endpoint that set the cookie. networkCookiePartitionKey :: Maybe T.Text, -- | True if cookie partition key is opaque. networkCookiePartitionKeyOpaque :: Maybe Bool } deriving (Eq, Show) instance FromJSON NetworkCookie where parseJSON = A.withObject "NetworkCookie" $ \o -> NetworkCookie <$> o A..: "name" <*> o A..: "value" <*> o A..: "domain" <*> o A..: "path" <*> o A..: "expires" <*> o A..: "size" <*> o A..: "httpOnly" <*> o A..: "secure" <*> o A..: "session" <*> o A..:? "sameSite" <*> o A..: "priority" <*> o A..: "sameParty" <*> o A..: "sourceScheme" <*> o A..: "sourcePort" <*> o A..:? "partitionKey" <*> o A..:? "partitionKeyOpaque" instance ToJSON NetworkCookie where toJSON p = A.object $ catMaybes [ ("name" A..=) <$> Just (networkCookieName p), ("value" A..=) <$> Just (networkCookieValue p), ("domain" A..=) <$> Just (networkCookieDomain p), ("path" A..=) <$> Just (networkCookiePath p), ("expires" A..=) <$> Just (networkCookieExpires p), ("size" A..=) <$> Just (networkCookieSize p), ("httpOnly" A..=) <$> Just (networkCookieHttpOnly p), ("secure" A..=) <$> Just (networkCookieSecure p), ("session" A..=) <$> Just (networkCookieSession p), ("sameSite" A..=) <$> (networkCookieSameSite p), ("priority" A..=) <$> Just (networkCookiePriority p), ("sameParty" A..=) <$> Just (networkCookieSameParty p), ("sourceScheme" A..=) <$> Just (networkCookieSourceScheme p), ("sourcePort" A..=) <$> Just (networkCookieSourcePort p), ("partitionKey" A..=) <$> (networkCookiePartitionKey p), ("partitionKeyOpaque" A..=) <$> (networkCookiePartitionKeyOpaque p) ] -- | Type 'Network.SetCookieBlockedReason'. -- Types of reasons why a cookie may not be stored from a response. data NetworkSetCookieBlockedReason = NetworkSetCookieBlockedReasonSecureOnly | NetworkSetCookieBlockedReasonSameSiteStrict | NetworkSetCookieBlockedReasonSameSiteLax | NetworkSetCookieBlockedReasonSameSiteUnspecifiedTreatedAsLax | NetworkSetCookieBlockedReasonSameSiteNoneInsecure | NetworkSetCookieBlockedReasonUserPreferences | NetworkSetCookieBlockedReasonSyntaxError | NetworkSetCookieBlockedReasonSchemeNotSupported | NetworkSetCookieBlockedReasonOverwriteSecure | NetworkSetCookieBlockedReasonInvalidDomain | NetworkSetCookieBlockedReasonInvalidPrefix | NetworkSetCookieBlockedReasonUnknownError | NetworkSetCookieBlockedReasonSchemefulSameSiteStrict | NetworkSetCookieBlockedReasonSchemefulSameSiteLax | NetworkSetCookieBlockedReasonSchemefulSameSiteUnspecifiedTreatedAsLax | NetworkSetCookieBlockedReasonSamePartyFromCrossPartyContext | NetworkSetCookieBlockedReasonSamePartyConflictsWithOtherAttributes | NetworkSetCookieBlockedReasonNameValuePairExceedsMaxSize deriving (Ord, Eq, Show, Read) instance FromJSON NetworkSetCookieBlockedReason where parseJSON = A.withText "NetworkSetCookieBlockedReason" $ \v -> case v of "SecureOnly" -> pure NetworkSetCookieBlockedReasonSecureOnly "SameSiteStrict" -> pure NetworkSetCookieBlockedReasonSameSiteStrict "SameSiteLax" -> pure NetworkSetCookieBlockedReasonSameSiteLax "SameSiteUnspecifiedTreatedAsLax" -> pure NetworkSetCookieBlockedReasonSameSiteUnspecifiedTreatedAsLax "SameSiteNoneInsecure" -> pure NetworkSetCookieBlockedReasonSameSiteNoneInsecure "UserPreferences" -> pure NetworkSetCookieBlockedReasonUserPreferences "SyntaxError" -> pure NetworkSetCookieBlockedReasonSyntaxError "SchemeNotSupported" -> pure NetworkSetCookieBlockedReasonSchemeNotSupported "OverwriteSecure" -> pure NetworkSetCookieBlockedReasonOverwriteSecure "InvalidDomain" -> pure NetworkSetCookieBlockedReasonInvalidDomain "InvalidPrefix" -> pure NetworkSetCookieBlockedReasonInvalidPrefix "UnknownError" -> pure NetworkSetCookieBlockedReasonUnknownError "SchemefulSameSiteStrict" -> pure NetworkSetCookieBlockedReasonSchemefulSameSiteStrict "SchemefulSameSiteLax" -> pure NetworkSetCookieBlockedReasonSchemefulSameSiteLax "SchemefulSameSiteUnspecifiedTreatedAsLax" -> pure NetworkSetCookieBlockedReasonSchemefulSameSiteUnspecifiedTreatedAsLax "SamePartyFromCrossPartyContext" -> pure NetworkSetCookieBlockedReasonSamePartyFromCrossPartyContext "SamePartyConflictsWithOtherAttributes" -> pure NetworkSetCookieBlockedReasonSamePartyConflictsWithOtherAttributes "NameValuePairExceedsMaxSize" -> pure NetworkSetCookieBlockedReasonNameValuePairExceedsMaxSize "_" -> fail "failed to parse NetworkSetCookieBlockedReason" instance ToJSON NetworkSetCookieBlockedReason where toJSON v = A.String $ case v of NetworkSetCookieBlockedReasonSecureOnly -> "SecureOnly" NetworkSetCookieBlockedReasonSameSiteStrict -> "SameSiteStrict" NetworkSetCookieBlockedReasonSameSiteLax -> "SameSiteLax" NetworkSetCookieBlockedReasonSameSiteUnspecifiedTreatedAsLax -> "SameSiteUnspecifiedTreatedAsLax" NetworkSetCookieBlockedReasonSameSiteNoneInsecure -> "SameSiteNoneInsecure" NetworkSetCookieBlockedReasonUserPreferences -> "UserPreferences" NetworkSetCookieBlockedReasonSyntaxError -> "SyntaxError" NetworkSetCookieBlockedReasonSchemeNotSupported -> "SchemeNotSupported" NetworkSetCookieBlockedReasonOverwriteSecure -> "OverwriteSecure" NetworkSetCookieBlockedReasonInvalidDomain -> "InvalidDomain" NetworkSetCookieBlockedReasonInvalidPrefix -> "InvalidPrefix" NetworkSetCookieBlockedReasonUnknownError -> "UnknownError" NetworkSetCookieBlockedReasonSchemefulSameSiteStrict -> "SchemefulSameSiteStrict" NetworkSetCookieBlockedReasonSchemefulSameSiteLax -> "SchemefulSameSiteLax" NetworkSetCookieBlockedReasonSchemefulSameSiteUnspecifiedTreatedAsLax -> "SchemefulSameSiteUnspecifiedTreatedAsLax" NetworkSetCookieBlockedReasonSamePartyFromCrossPartyContext -> "SamePartyFromCrossPartyContext" NetworkSetCookieBlockedReasonSamePartyConflictsWithOtherAttributes -> "SamePartyConflictsWithOtherAttributes" NetworkSetCookieBlockedReasonNameValuePairExceedsMaxSize -> "NameValuePairExceedsMaxSize" -- | Type 'Network.CookieBlockedReason'. -- Types of reasons why a cookie may not be sent with a request. data NetworkCookieBlockedReason = NetworkCookieBlockedReasonSecureOnly | NetworkCookieBlockedReasonNotOnPath | NetworkCookieBlockedReasonDomainMismatch | NetworkCookieBlockedReasonSameSiteStrict | NetworkCookieBlockedReasonSameSiteLax | NetworkCookieBlockedReasonSameSiteUnspecifiedTreatedAsLax | NetworkCookieBlockedReasonSameSiteNoneInsecure | NetworkCookieBlockedReasonUserPreferences | NetworkCookieBlockedReasonUnknownError | NetworkCookieBlockedReasonSchemefulSameSiteStrict | NetworkCookieBlockedReasonSchemefulSameSiteLax | NetworkCookieBlockedReasonSchemefulSameSiteUnspecifiedTreatedAsLax | NetworkCookieBlockedReasonSamePartyFromCrossPartyContext | NetworkCookieBlockedReasonNameValuePairExceedsMaxSize deriving (Ord, Eq, Show, Read) instance FromJSON NetworkCookieBlockedReason where parseJSON = A.withText "NetworkCookieBlockedReason" $ \v -> case v of "SecureOnly" -> pure NetworkCookieBlockedReasonSecureOnly "NotOnPath" -> pure NetworkCookieBlockedReasonNotOnPath "DomainMismatch" -> pure NetworkCookieBlockedReasonDomainMismatch "SameSiteStrict" -> pure NetworkCookieBlockedReasonSameSiteStrict "SameSiteLax" -> pure NetworkCookieBlockedReasonSameSiteLax "SameSiteUnspecifiedTreatedAsLax" -> pure NetworkCookieBlockedReasonSameSiteUnspecifiedTreatedAsLax "SameSiteNoneInsecure" -> pure NetworkCookieBlockedReasonSameSiteNoneInsecure "UserPreferences" -> pure NetworkCookieBlockedReasonUserPreferences "UnknownError" -> pure NetworkCookieBlockedReasonUnknownError "SchemefulSameSiteStrict" -> pure NetworkCookieBlockedReasonSchemefulSameSiteStrict "SchemefulSameSiteLax" -> pure NetworkCookieBlockedReasonSchemefulSameSiteLax "SchemefulSameSiteUnspecifiedTreatedAsLax" -> pure NetworkCookieBlockedReasonSchemefulSameSiteUnspecifiedTreatedAsLax "SamePartyFromCrossPartyContext" -> pure NetworkCookieBlockedReasonSamePartyFromCrossPartyContext "NameValuePairExceedsMaxSize" -> pure NetworkCookieBlockedReasonNameValuePairExceedsMaxSize "_" -> fail "failed to parse NetworkCookieBlockedReason" instance ToJSON NetworkCookieBlockedReason where toJSON v = A.String $ case v of NetworkCookieBlockedReasonSecureOnly -> "SecureOnly" NetworkCookieBlockedReasonNotOnPath -> "NotOnPath" NetworkCookieBlockedReasonDomainMismatch -> "DomainMismatch" NetworkCookieBlockedReasonSameSiteStrict -> "SameSiteStrict" NetworkCookieBlockedReasonSameSiteLax -> "SameSiteLax" NetworkCookieBlockedReasonSameSiteUnspecifiedTreatedAsLax -> "SameSiteUnspecifiedTreatedAsLax" NetworkCookieBlockedReasonSameSiteNoneInsecure -> "SameSiteNoneInsecure" NetworkCookieBlockedReasonUserPreferences -> "UserPreferences" NetworkCookieBlockedReasonUnknownError -> "UnknownError" NetworkCookieBlockedReasonSchemefulSameSiteStrict -> "SchemefulSameSiteStrict" NetworkCookieBlockedReasonSchemefulSameSiteLax -> "SchemefulSameSiteLax" NetworkCookieBlockedReasonSchemefulSameSiteUnspecifiedTreatedAsLax -> "SchemefulSameSiteUnspecifiedTreatedAsLax" NetworkCookieBlockedReasonSamePartyFromCrossPartyContext -> "SamePartyFromCrossPartyContext" NetworkCookieBlockedReasonNameValuePairExceedsMaxSize -> "NameValuePairExceedsMaxSize" -- | Type 'Network.BlockedSetCookieWithReason'. -- A cookie which was not stored from a response with the corresponding reason. data NetworkBlockedSetCookieWithReason = NetworkBlockedSetCookieWithReason { -- | The reason(s) this cookie was blocked. networkBlockedSetCookieWithReasonBlockedReasons :: [NetworkSetCookieBlockedReason], -- | The string representing this individual cookie as it would appear in the header. -- This is not the entire "cookie" or "set-cookie" header which could have multiple cookies. networkBlockedSetCookieWithReasonCookieLine :: T.Text, -- | The cookie object which represents the cookie which was not stored. It is optional because -- sometimes complete cookie information is not available, such as in the case of parsing -- errors. networkBlockedSetCookieWithReasonCookie :: Maybe NetworkCookie } deriving (Eq, Show) instance FromJSON NetworkBlockedSetCookieWithReason where parseJSON = A.withObject "NetworkBlockedSetCookieWithReason" $ \o -> NetworkBlockedSetCookieWithReason <$> o A..: "blockedReasons" <*> o A..: "cookieLine" <*> o A..:? "cookie" instance ToJSON NetworkBlockedSetCookieWithReason where toJSON p = A.object $ catMaybes [ ("blockedReasons" A..=) <$> Just (networkBlockedSetCookieWithReasonBlockedReasons p), ("cookieLine" A..=) <$> Just (networkBlockedSetCookieWithReasonCookieLine p), ("cookie" A..=) <$> (networkBlockedSetCookieWithReasonCookie p) ] -- | Type 'Network.BlockedCookieWithReason'. -- A cookie with was not sent with a request with the corresponding reason. data NetworkBlockedCookieWithReason = NetworkBlockedCookieWithReason { -- | The reason(s) the cookie was blocked. networkBlockedCookieWithReasonBlockedReasons :: [NetworkCookieBlockedReason], -- | The cookie object representing the cookie which was not sent. networkBlockedCookieWithReasonCookie :: NetworkCookie } deriving (Eq, Show) instance FromJSON NetworkBlockedCookieWithReason where parseJSON = A.withObject "NetworkBlockedCookieWithReason" $ \o -> NetworkBlockedCookieWithReason <$> o A..: "blockedReasons" <*> o A..: "cookie" instance ToJSON NetworkBlockedCookieWithReason where toJSON p = A.object $ catMaybes [ ("blockedReasons" A..=) <$> Just (networkBlockedCookieWithReasonBlockedReasons p), ("cookie" A..=) <$> Just (networkBlockedCookieWithReasonCookie p) ] -- | Type 'Network.CookieParam'. -- Cookie parameter object data NetworkCookieParam = NetworkCookieParam { -- | Cookie name. networkCookieParamName :: T.Text, -- | Cookie value. networkCookieParamValue :: T.Text, -- | The request-URI to associate with the setting of the cookie. This value can affect the -- default domain, path, source port, and source scheme values of the created cookie. networkCookieParamUrl :: Maybe T.Text, -- | Cookie domain. networkCookieParamDomain :: Maybe T.Text, -- | Cookie path. networkCookieParamPath :: Maybe T.Text, -- | True if cookie is secure. networkCookieParamSecure :: Maybe Bool, -- | True if cookie is http-only. networkCookieParamHttpOnly :: Maybe Bool, -- | Cookie SameSite type. networkCookieParamSameSite :: Maybe NetworkCookieSameSite, -- | Cookie expiration date, session cookie if not set networkCookieParamExpires :: Maybe NetworkTimeSinceEpoch, -- | Cookie Priority. networkCookieParamPriority :: Maybe NetworkCookiePriority, -- | True if cookie is SameParty. networkCookieParamSameParty :: Maybe Bool, -- | Cookie source scheme type. networkCookieParamSourceScheme :: Maybe NetworkCookieSourceScheme, -- | Cookie source port. Valid values are {-1, [1, 65535]}, -1 indicates an unspecified port. -- An unspecified port value allows protocol clients to emulate legacy cookie scope for the port. -- This is a temporary ability and it will be removed in the future. networkCookieParamSourcePort :: Maybe Int, -- | Cookie partition key. The site of the top-level URL the browser was visiting at the start -- of the request to the endpoint that set the cookie. -- If not set, the cookie will be set as not partitioned. networkCookieParamPartitionKey :: Maybe T.Text } deriving (Eq, Show) instance FromJSON NetworkCookieParam where parseJSON = A.withObject "NetworkCookieParam" $ \o -> NetworkCookieParam <$> o A..: "name" <*> o A..: "value" <*> o A..:? "url" <*> o A..:? "domain" <*> o A..:? "path" <*> o A..:? "secure" <*> o A..:? "httpOnly" <*> o A..:? "sameSite" <*> o A..:? "expires" <*> o A..:? "priority" <*> o A..:? "sameParty" <*> o A..:? "sourceScheme" <*> o A..:? "sourcePort" <*> o A..:? "partitionKey" instance ToJSON NetworkCookieParam where toJSON p = A.object $ catMaybes [ ("name" A..=) <$> Just (networkCookieParamName p), ("value" A..=) <$> Just (networkCookieParamValue p), ("url" A..=) <$> (networkCookieParamUrl p), ("domain" A..=) <$> (networkCookieParamDomain p), ("path" A..=) <$> (networkCookieParamPath p), ("secure" A..=) <$> (networkCookieParamSecure p), ("httpOnly" A..=) <$> (networkCookieParamHttpOnly p), ("sameSite" A..=) <$> (networkCookieParamSameSite p), ("expires" A..=) <$> (networkCookieParamExpires p), ("priority" A..=) <$> (networkCookieParamPriority p), ("sameParty" A..=) <$> (networkCookieParamSameParty p), ("sourceScheme" A..=) <$> (networkCookieParamSourceScheme p), ("sourcePort" A..=) <$> (networkCookieParamSourcePort p), ("partitionKey" A..=) <$> (networkCookieParamPartitionKey p) ] -- | Type 'Network.AuthChallenge'. -- Authorization challenge for HTTP status code 401 or 407. data NetworkAuthChallengeSource = NetworkAuthChallengeSourceServer | NetworkAuthChallengeSourceProxy deriving (Ord, Eq, Show, Read) instance FromJSON NetworkAuthChallengeSource where parseJSON = A.withText "NetworkAuthChallengeSource" $ \v -> case v of "Server" -> pure NetworkAuthChallengeSourceServer "Proxy" -> pure NetworkAuthChallengeSourceProxy "_" -> fail "failed to parse NetworkAuthChallengeSource" instance ToJSON NetworkAuthChallengeSource where toJSON v = A.String $ case v of NetworkAuthChallengeSourceServer -> "Server" NetworkAuthChallengeSourceProxy -> "Proxy" data NetworkAuthChallenge = NetworkAuthChallenge { -- | Source of the authentication challenge. networkAuthChallengeSource :: Maybe NetworkAuthChallengeSource, -- | Origin of the challenger. networkAuthChallengeOrigin :: T.Text, -- | The authentication scheme used, such as basic or digest networkAuthChallengeScheme :: T.Text, -- | The realm of the challenge. May be empty. networkAuthChallengeRealm :: T.Text } deriving (Eq, Show) instance FromJSON NetworkAuthChallenge where parseJSON = A.withObject "NetworkAuthChallenge" $ \o -> NetworkAuthChallenge <$> o A..:? "source" <*> o A..: "origin" <*> o A..: "scheme" <*> o A..: "realm" instance ToJSON NetworkAuthChallenge where toJSON p = A.object $ catMaybes [ ("source" A..=) <$> (networkAuthChallengeSource p), ("origin" A..=) <$> Just (networkAuthChallengeOrigin p), ("scheme" A..=) <$> Just (networkAuthChallengeScheme p), ("realm" A..=) <$> Just (networkAuthChallengeRealm p) ] -- | Type 'Network.AuthChallengeResponse'. -- Response to an AuthChallenge. data NetworkAuthChallengeResponseResponse = NetworkAuthChallengeResponseResponseDefault | NetworkAuthChallengeResponseResponseCancelAuth | NetworkAuthChallengeResponseResponseProvideCredentials deriving (Ord, Eq, Show, Read) instance FromJSON NetworkAuthChallengeResponseResponse where parseJSON = A.withText "NetworkAuthChallengeResponseResponse" $ \v -> case v of "Default" -> pure NetworkAuthChallengeResponseResponseDefault "CancelAuth" -> pure NetworkAuthChallengeResponseResponseCancelAuth "ProvideCredentials" -> pure NetworkAuthChallengeResponseResponseProvideCredentials "_" -> fail "failed to parse NetworkAuthChallengeResponseResponse" instance ToJSON NetworkAuthChallengeResponseResponse where toJSON v = A.String $ case v of NetworkAuthChallengeResponseResponseDefault -> "Default" NetworkAuthChallengeResponseResponseCancelAuth -> "CancelAuth" NetworkAuthChallengeResponseResponseProvideCredentials -> "ProvideCredentials" data NetworkAuthChallengeResponse = NetworkAuthChallengeResponse { -- | The decision on what to do in response to the authorization challenge. Default means -- deferring to the default behavior of the net stack, which will likely either the Cancel -- authentication or display a popup dialog box. networkAuthChallengeResponseResponse :: NetworkAuthChallengeResponseResponse, -- | The username to provide, possibly empty. Should only be set if response is -- ProvideCredentials. networkAuthChallengeResponseUsername :: Maybe T.Text, -- | The password to provide, possibly empty. Should only be set if response is -- ProvideCredentials. networkAuthChallengeResponsePassword :: Maybe T.Text } deriving (Eq, Show) instance FromJSON NetworkAuthChallengeResponse where parseJSON = A.withObject "NetworkAuthChallengeResponse" $ \o -> NetworkAuthChallengeResponse <$> o A..: "response" <*> o A..:? "username" <*> o A..:? "password" instance ToJSON NetworkAuthChallengeResponse where toJSON p = A.object $ catMaybes [ ("response" A..=) <$> Just (networkAuthChallengeResponseResponse p), ("username" A..=) <$> (networkAuthChallengeResponseUsername p), ("password" A..=) <$> (networkAuthChallengeResponsePassword p) ] -- | Type 'Network.InterceptionStage'. -- Stages of the interception to begin intercepting. Request will intercept before the request is -- sent. Response will intercept after the response is received. data NetworkInterceptionStage = NetworkInterceptionStageRequest | NetworkInterceptionStageHeadersReceived deriving (Ord, Eq, Show, Read) instance FromJSON NetworkInterceptionStage where parseJSON = A.withText "NetworkInterceptionStage" $ \v -> case v of "Request" -> pure NetworkInterceptionStageRequest "HeadersReceived" -> pure NetworkInterceptionStageHeadersReceived "_" -> fail "failed to parse NetworkInterceptionStage" instance ToJSON NetworkInterceptionStage where toJSON v = A.String $ case v of NetworkInterceptionStageRequest -> "Request" NetworkInterceptionStageHeadersReceived -> "HeadersReceived" -- | Type 'Network.RequestPattern'. -- Request pattern for interception. data NetworkRequestPattern = NetworkRequestPattern { -- | Wildcards (`'*'` -> zero or more, `'?'` -> exactly one) are allowed. Escape character is -- backslash. Omitting is equivalent to `"*"`. networkRequestPatternUrlPattern :: Maybe T.Text, -- | If set, only requests for matching resource types will be intercepted. networkRequestPatternResourceType :: Maybe NetworkResourceType, -- | Stage at which to begin intercepting requests. Default is Request. networkRequestPatternInterceptionStage :: Maybe NetworkInterceptionStage } deriving (Eq, Show) instance FromJSON NetworkRequestPattern where parseJSON = A.withObject "NetworkRequestPattern" $ \o -> NetworkRequestPattern <$> o A..:? "urlPattern" <*> o A..:? "resourceType" <*> o A..:? "interceptionStage" instance ToJSON NetworkRequestPattern where toJSON p = A.object $ catMaybes [ ("urlPattern" A..=) <$> (networkRequestPatternUrlPattern p), ("resourceType" A..=) <$> (networkRequestPatternResourceType p), ("interceptionStage" A..=) <$> (networkRequestPatternInterceptionStage p) ] -- | Type 'Network.SignedExchangeSignature'. -- Information about a signed exchange signature. -- https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#rfc.section.3.1 data NetworkSignedExchangeSignature = NetworkSignedExchangeSignature { -- | Signed exchange signature label. networkSignedExchangeSignatureLabel :: T.Text, -- | The hex string of signed exchange signature. networkSignedExchangeSignatureSignature :: T.Text, -- | Signed exchange signature integrity. networkSignedExchangeSignatureIntegrity :: T.Text, -- | Signed exchange signature cert Url. networkSignedExchangeSignatureCertUrl :: Maybe T.Text, -- | The hex string of signed exchange signature cert sha256. networkSignedExchangeSignatureCertSha256 :: Maybe T.Text, -- | Signed exchange signature validity Url. networkSignedExchangeSignatureValidityUrl :: T.Text, -- | Signed exchange signature date. networkSignedExchangeSignatureDate :: Int, -- | Signed exchange signature expires. networkSignedExchangeSignatureExpires :: Int, -- | The encoded certificates. networkSignedExchangeSignatureCertificates :: Maybe [T.Text] } deriving (Eq, Show) instance FromJSON NetworkSignedExchangeSignature where parseJSON = A.withObject "NetworkSignedExchangeSignature" $ \o -> NetworkSignedExchangeSignature <$> o A..: "label" <*> o A..: "signature" <*> o A..: "integrity" <*> o A..:? "certUrl" <*> o A..:? "certSha256" <*> o A..: "validityUrl" <*> o A..: "date" <*> o A..: "expires" <*> o A..:? "certificates" instance ToJSON NetworkSignedExchangeSignature where toJSON p = A.object $ catMaybes [ ("label" A..=) <$> Just (networkSignedExchangeSignatureLabel p), ("signature" A..=) <$> Just (networkSignedExchangeSignatureSignature p), ("integrity" A..=) <$> Just (networkSignedExchangeSignatureIntegrity p), ("certUrl" A..=) <$> (networkSignedExchangeSignatureCertUrl p), ("certSha256" A..=) <$> (networkSignedExchangeSignatureCertSha256 p), ("validityUrl" A..=) <$> Just (networkSignedExchangeSignatureValidityUrl p), ("date" A..=) <$> Just (networkSignedExchangeSignatureDate p), ("expires" A..=) <$> Just (networkSignedExchangeSignatureExpires p), ("certificates" A..=) <$> (networkSignedExchangeSignatureCertificates p) ] -- | Type 'Network.SignedExchangeHeader'. -- Information about a signed exchange header. -- https://wicg.github.io/webpackage/draft-yasskin-httpbis-origin-signed-exchanges-impl.html#cbor-representation data NetworkSignedExchangeHeader = NetworkSignedExchangeHeader { -- | Signed exchange request URL. networkSignedExchangeHeaderRequestUrl :: T.Text, -- | Signed exchange response code. networkSignedExchangeHeaderResponseCode :: Int, -- | Signed exchange response headers. networkSignedExchangeHeaderResponseHeaders :: NetworkHeaders, -- | Signed exchange response signature. networkSignedExchangeHeaderSignatures :: [NetworkSignedExchangeSignature], -- | Signed exchange header integrity hash in the form of "sha256-