Skip to content

Commit 954303e

Browse files
committed
refactor: update command responses to use Response for empty responses
1 parent 77a67ad commit 954303e

File tree

9 files changed

+180
-160
lines changed

9 files changed

+180
-160
lines changed

pydoll/protocol/browser/methods.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,26 +203,26 @@ class GetWindowForTargetResult(TypedDict):
203203

204204
# Command types
205205
AddPrivacySandboxCoordinatorKeyConfigCommand = Command[
206-
AddPrivacySandboxCoordinatorKeyConfigParams, EmptyResponse
206+
AddPrivacySandboxCoordinatorKeyConfigParams, Response[EmptyResponse]
207207
]
208208
AddPrivacySandboxEnrollmentOverrideCommand = Command[
209-
AddPrivacySandboxEnrollmentOverrideParams, EmptyResponse
209+
AddPrivacySandboxEnrollmentOverrideParams, Response[EmptyResponse]
210210
]
211-
CancelDownloadCommand = Command[CancelDownloadParams, EmptyResponse]
212-
CloseCommand = Command[EmptyParams, EmptyResponse]
213-
CrashCommand = Command[EmptyParams, EmptyResponse]
214-
CrashGpuProcessCommand = Command[EmptyParams, EmptyResponse]
215-
ExecuteBrowserCommandCommand = Command[ExecuteBrowserCommandParams, EmptyResponse]
211+
CancelDownloadCommand = Command[CancelDownloadParams, Response[EmptyResponse]]
212+
CloseCommand = Command[EmptyParams, Response[EmptyResponse]]
213+
CrashCommand = Command[EmptyParams, Response[EmptyResponse]]
214+
CrashGpuProcessCommand = Command[EmptyParams, Response[EmptyResponse]]
215+
ExecuteBrowserCommandCommand = Command[ExecuteBrowserCommandParams, Response[EmptyResponse]]
216216
GetBrowserCommandLineCommand = Command[EmptyParams, GetBrowserCommandLineResponse]
217217
GetHistogramCommand = Command[GetHistogramParams, GetHistogramResponse]
218218
GetHistogramsCommand = Command[GetHistogramsParams, GetHistogramsResponse]
219219
GetVersionCommand = Command[EmptyParams, GetVersionResponse]
220220
GetWindowBoundsCommand = Command[GetWindowBoundsParams, GetWindowBoundsResponse]
221221
GetWindowForTargetCommand = Command[GetWindowForTargetParams, GetWindowForTargetResponse]
222-
GrantPermissionsCommand = Command[GrantPermissionsParams, EmptyResponse]
223-
ResetPermissionsCommand = Command[ResetPermissionsParams, EmptyResponse]
224-
SetContentsSizeCommand = Command[SetContentsSizeParams, EmptyResponse]
225-
SetDockTileCommand = Command[SetDockTileParams, EmptyResponse]
226-
SetDownloadBehaviorCommand = Command[SetDownloadBehaviorParams, EmptyResponse]
227-
SetPermissionCommand = Command[SetPermissionParams, EmptyResponse]
228-
SetWindowBoundsCommand = Command[SetWindowBoundsParams, EmptyResponse]
222+
GrantPermissionsCommand = Command[GrantPermissionsParams, Response[EmptyResponse]]
223+
ResetPermissionsCommand = Command[ResetPermissionsParams, Response[EmptyResponse]]
224+
SetContentsSizeCommand = Command[SetContentsSizeParams, Response[EmptyResponse]]
225+
SetDockTileCommand = Command[SetDockTileParams, Response[EmptyResponse]]
226+
SetDownloadBehaviorCommand = Command[SetDownloadBehaviorParams, Response[EmptyResponse]]
227+
SetPermissionCommand = Command[SetPermissionParams, Response[EmptyResponse]]
228+
SetWindowBoundsCommand = Command[SetWindowBoundsParams, Response[EmptyResponse]]

pydoll/protocol/dom/methods.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -642,17 +642,17 @@ class ForceShowPopoverResult(TypedDict):
642642
]
643643
CopyToCommand = Command[CopyToParams, CopyToResponse]
644644
DescribeNodeCommand = Command[DescribeNodeParams, DescribeNodeResponse]
645-
DisableCommand = Command[EmptyParams, EmptyResponse]
646-
DiscardSearchResultsCommand = Command[DiscardSearchResultsParams, EmptyResponse]
647-
EnableCommand = Command[EnableParams, EmptyResponse]
648-
FocusCommand = Command[FocusParams, EmptyResponse]
645+
DisableCommand = Command[EmptyParams, Response[EmptyResponse]]
646+
DiscardSearchResultsCommand = Command[DiscardSearchResultsParams, Response[EmptyResponse]]
647+
EnableCommand = Command[EnableParams, Response[EmptyResponse]]
648+
FocusCommand = Command[FocusParams, Response[EmptyResponse]]
649649
ForceShowPopoverCommand = Command[ForceShowPopoverParams, ForceShowPopoverResponse]
650650
GetAnchorElementCommand = Command[GetAnchorElementParams, GetAnchorElementResponse]
651651
GetAttributesCommand = Command[GetAttributesParams, GetAttributesResponse]
652652
GetBoxModelCommand = Command[GetBoxModelParams, GetBoxModelResponse]
653653
GetContainerForNodeCommand = Command[GetContainerForNodeParams, GetContainerForNodeResponse]
654654
GetContentQuadsCommand = Command[GetContentQuadsParams, GetContentQuadsResponse]
655-
GetDetachedDomNodesCommand = Command[EmptyParams, GetDetachedDomNodesResponse]
655+
GetDetachedDomNodesCommand = Command[EmptyParams, Response[GetDetachedDomNodesResponse]]
656656
GetDocumentCommand = Command[GetDocumentParams, GetDocumentResponse]
657657
GetElementByRelationCommand = Command[GetElementByRelationParams, GetElementByRelationResponse]
658658
GetFileInfoCommand = Command[GetFileInfoParams, GetFileInfoResponse]
@@ -670,10 +670,10 @@ class ForceShowPopoverResult(TypedDict):
670670
GetRelayoutBoundaryCommand = Command[GetRelayoutBoundaryParams, GetRelayoutBoundaryResponse]
671671
GetSearchResultsCommand = Command[GetSearchResultsParams, GetSearchResultsResponse]
672672
GetTopLayerElementsCommand = Command[EmptyParams, GetTopLayerElementsResponse]
673-
HideHighlightCommand = Command[EmptyParams, EmptyResponse]
674-
HighlightNodeCommand = Command[EmptyParams, EmptyResponse] # redirect to Overlay
675-
HighlightRectCommand = Command[EmptyParams, EmptyResponse] # redirect to Overlay
676-
MarkUndoableStateCommand = Command[EmptyParams, EmptyResponse]
673+
HideHighlightCommand = Command[EmptyParams, Response[EmptyResponse]]
674+
HighlightNodeCommand = Command[EmptyParams, Response[EmptyResponse]] # redirect to Overlay
675+
HighlightRectCommand = Command[EmptyParams, Response[EmptyResponse]] # redirect to Overlay
676+
MarkUndoableStateCommand = Command[EmptyParams, Response[EmptyResponse]]
677677
MoveToCommand = Command[MoveToParams, MoveToResponse]
678678
PerformSearchCommand = Command[PerformSearchParams, PerformSearchResponse]
679679
PushNodeByPathToFrontendCommand = Command[
@@ -684,19 +684,19 @@ class ForceShowPopoverResult(TypedDict):
684684
]
685685
QuerySelectorCommand = Command[QuerySelectorParams, QuerySelectorResponse]
686686
QuerySelectorAllCommand = Command[QuerySelectorAllParams, QuerySelectorAllResponse]
687-
RedoCommand = Command[EmptyParams, EmptyResponse]
688-
RemoveAttributeCommand = Command[RemoveAttributeParams, EmptyResponse]
689-
RemoveNodeCommand = Command[RemoveNodeParams, EmptyResponse]
690-
RequestChildNodesCommand = Command[RequestChildNodesParams, EmptyResponse]
687+
RedoCommand = Command[EmptyParams, Response[EmptyResponse]]
688+
RemoveAttributeCommand = Command[RemoveAttributeParams, Response[EmptyResponse]]
689+
RemoveNodeCommand = Command[RemoveNodeParams, Response[EmptyResponse]]
690+
RequestChildNodesCommand = Command[RequestChildNodesParams, Response[EmptyResponse]]
691691
RequestNodeCommand = Command[RequestNodeParams, RequestNodeResponse]
692692
ResolveNodeCommand = Command[ResolveNodeParams, ResolveNodeResponse]
693-
ScrollIntoViewIfNeededCommand = Command[ScrollIntoViewIfNeededParams, EmptyResponse]
694-
SetAttributeValueCommand = Command[SetAttributeValueParams, EmptyResponse]
695-
SetAttributesAsTextCommand = Command[SetAttributesAsTextParams, EmptyResponse]
696-
SetFileInputFilesCommand = Command[SetFileInputFilesParams, EmptyResponse]
697-
SetInspectedNodeCommand = Command[SetInspectedNodeParams, EmptyResponse]
693+
ScrollIntoViewIfNeededCommand = Command[ScrollIntoViewIfNeededParams, Response[EmptyResponse]]
694+
SetAttributeValueCommand = Command[SetAttributeValueParams, Response[EmptyResponse]]
695+
SetAttributesAsTextCommand = Command[SetAttributesAsTextParams, Response[EmptyResponse]]
696+
SetFileInputFilesCommand = Command[SetFileInputFilesParams, Response[EmptyResponse]]
697+
SetInspectedNodeCommand = Command[SetInspectedNodeParams, Response[EmptyResponse]]
698698
SetNodeNameCommand = Command[SetNodeNameParams, SetNodeNameResponse]
699-
SetNodeStackTracesEnabledCommand = Command[SetNodeStackTracesEnabledParams, EmptyResponse]
700-
SetNodeValueCommand = Command[SetNodeValueParams, EmptyResponse]
701-
SetOuterHTMLCommand = Command[SetOuterHTMLParams, EmptyResponse]
702-
UndoCommand = Command[EmptyParams, EmptyResponse]
699+
SetNodeStackTracesEnabledCommand = Command[SetNodeStackTracesEnabledParams, Response[EmptyResponse]]
700+
SetNodeValueCommand = Command[SetNodeValueParams, Response[EmptyResponse]]
701+
SetOuterHTMLCommand = Command[SetOuterHTMLParams, Response[EmptyResponse]]
702+
UndoCommand = Command[EmptyParams, Response[EmptyResponse]]

pydoll/protocol/fetch/methods.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,13 @@ class TakeResponseBodyAsStreamResult(TypedDict):
115115

116116

117117
# Command types
118-
ContinueRequestCommand = Command[ContinueRequestParams, EmptyResponse]
119-
ContinueResponseCommand = Command[ContinueResponseParams, EmptyResponse]
120-
ContinueWithAuthCommand = Command[ContinueWithAuthParams, EmptyResponse]
121-
DisableCommand = Command[EmptyParams, EmptyResponse]
122-
EnableCommand = Command[EnableParams, EmptyResponse]
123-
FailRequestCommand = Command[FailRequestParams, EmptyResponse]
124-
FulfillRequestCommand = Command[FulfillRequestParams, EmptyResponse]
118+
ContinueRequestCommand = Command[ContinueRequestParams, Response[EmptyResponse]]
119+
ContinueResponseCommand = Command[ContinueResponseParams, Response[EmptyResponse]]
120+
ContinueWithAuthCommand = Command[ContinueWithAuthParams, Response[EmptyResponse]]
121+
DisableCommand = Command[EmptyParams, Response[EmptyResponse]]
122+
EnableCommand = Command[EnableParams, Response[EmptyResponse]]
123+
FailRequestCommand = Command[FailRequestParams, Response[EmptyResponse]]
124+
FulfillRequestCommand = Command[FulfillRequestParams, Response[EmptyResponse]]
125125
GetResponseBodyCommand = Command[GetResponseBodyParams, GetResponseBodyResponse]
126126
TakeResponseBodyAsStreamCommand = Command[
127127
TakeResponseBodyAsStreamParams, TakeResponseBodyAsStreamResponse

pydoll/protocol/input/methods.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from typing_extensions import NotRequired, TypedDict
44

5-
from pydoll.protocol.base import Command, EmptyParams, EmptyResponse
5+
from pydoll.protocol.base import Command, EmptyParams, EmptyResponse, Response
66
from pydoll.protocol.input.types import (
77
DragData,
88
DragEventType,
@@ -179,16 +179,18 @@ class SynthesizeTapGestureParams(TypedDict):
179179

180180

181181
# Command types
182-
CancelDraggingCommand = Command[EmptyParams, EmptyResponse]
183-
DispatchDragEventCommand = Command[DispatchDragEventParams, EmptyResponse]
184-
DispatchKeyEventCommand = Command[DispatchKeyEventParams, EmptyResponse]
185-
DispatchMouseEventCommand = Command[DispatchMouseEventParams, EmptyResponse]
186-
DispatchTouchEventCommand = Command[DispatchTouchEventParams, EmptyResponse]
187-
EmulateTouchFromMouseEventCommand = Command[EmulateTouchFromMouseEventParams, EmptyResponse]
188-
ImeSetCompositionCommand = Command[ImeSetCompositionParams, EmptyResponse]
189-
InsertTextCommand = Command[InsertTextParams, EmptyResponse]
190-
SetIgnoreInputEventsCommand = Command[SetIgnoreInputEventsParams, EmptyResponse]
191-
SetInterceptDragsCommand = Command[SetInterceptDragsParams, EmptyResponse]
192-
SynthesizePinchGestureCommand = Command[SynthesizePinchGestureParams, EmptyResponse]
193-
SynthesizeScrollGestureCommand = Command[SynthesizeScrollGestureParams, EmptyResponse]
194-
SynthesizeTapGestureCommand = Command[SynthesizeTapGestureParams, EmptyResponse]
182+
CancelDraggingCommand = Command[EmptyParams, Response[EmptyResponse]]
183+
DispatchDragEventCommand = Command[DispatchDragEventParams, Response[EmptyResponse]]
184+
DispatchKeyEventCommand = Command[DispatchKeyEventParams, Response[EmptyResponse]]
185+
DispatchMouseEventCommand = Command[DispatchMouseEventParams, Response[EmptyResponse]]
186+
DispatchTouchEventCommand = Command[DispatchTouchEventParams, Response[EmptyResponse]]
187+
EmulateTouchFromMouseEventCommand = Command[
188+
EmulateTouchFromMouseEventParams, Response[EmptyResponse]
189+
]
190+
ImeSetCompositionCommand = Command[ImeSetCompositionParams, Response[EmptyResponse]]
191+
InsertTextCommand = Command[InsertTextParams, Response[EmptyResponse]]
192+
SetIgnoreInputEventsCommand = Command[SetIgnoreInputEventsParams, Response[EmptyResponse]]
193+
SetInterceptDragsCommand = Command[SetInterceptDragsParams, Response[EmptyResponse]]
194+
SynthesizePinchGestureCommand = Command[SynthesizePinchGestureParams, Response[EmptyResponse]]
195+
SynthesizeScrollGestureCommand = Command[SynthesizeScrollGestureParams, Response[EmptyResponse]]
196+
SynthesizeTapGestureCommand = Command[SynthesizeTapGestureParams, Response[EmptyResponse]]

pydoll/protocol/network/methods.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -360,32 +360,32 @@ class LoadNetworkResourceResult(TypedDict):
360360
LoadNetworkResourceResponse = Response[LoadNetworkResourceResult]
361361

362362

363-
ClearBrowserCacheCommand = Command[EmptyParams, EmptyResponse]
364-
ClearBrowserCookiesCommand = Command[EmptyParams, EmptyResponse]
365-
ClearCookiesCommand = Command[DeleteCookiesParams, EmptyResponse]
366-
DisableCommand = Command[EmptyParams, EmptyResponse]
367-
EmulateNetworkConditionsCommand = Command[EmulateNetworkConditionsParams, EmptyResponse]
368-
EnableCommand = Command[NetworkEnableParams, EmptyResponse]
363+
ClearBrowserCacheCommand = Command[EmptyParams, Response[EmptyResponse]]
364+
ClearBrowserCookiesCommand = Command[EmptyParams, Response[EmptyResponse]]
365+
ClearCookiesCommand = Command[DeleteCookiesParams, Response[EmptyResponse]]
366+
DisableCommand = Command[EmptyParams, Response[EmptyResponse]]
367+
EmulateNetworkConditionsCommand = Command[EmulateNetworkConditionsParams, Response[EmptyResponse]]
368+
EnableCommand = Command[NetworkEnableParams, Response[EmptyResponse]]
369369
GetCookiesCommand = Command[GetCookiesParams, GetCookiesResponse]
370370
GetRequestPostDataCommand = Command[GetRequestPostDataParams, GetRequestPostDataResponse]
371371
GetResponseBodyCommand = Command[GetResponseBodyParams, GetResponseBodyResponse]
372-
SetCacheDisabledCommand = Command[SetCacheDisabledParams, EmptyResponse]
372+
SetCacheDisabledCommand = Command[SetCacheDisabledParams, Response[EmptyResponse]]
373373
SetCookieCommand = Command[SetCookieParams, SetCookieResponse]
374-
SetCookiesCommand = Command[SetCookiesParams, EmptyResponse]
375-
SetExtraHTTPHeadersCommand = Command[SetExtraHTTPHeadersParams, EmptyResponse]
376-
SetUserAgentOverrideCommand = Command[SetUserAgentOverrideParams, EmptyResponse]
377-
ClearAcceptedEncodingsOverrideCommand = Command[EmptyParams, EmptyResponse]
378-
EnableReportingApiCommand = Command[EnableReportingApiParams, EmptyResponse]
374+
SetCookiesCommand = Command[SetCookiesParams, Response[EmptyResponse]]
375+
SetExtraHTTPHeadersCommand = Command[SetExtraHTTPHeadersParams, Response[EmptyResponse]]
376+
SetUserAgentOverrideCommand = Command[SetUserAgentOverrideParams, Response[EmptyResponse]]
377+
ClearAcceptedEncodingsOverrideCommand = Command[EmptyParams, Response[EmptyResponse]]
378+
EnableReportingApiCommand = Command[EnableReportingApiParams, Response[EmptyResponse]]
379379
SearchInResponseBodyCommand = Command[SearchInResponseBodyParams, SearchInResponseBodyResponse]
380-
SetBlockedURLsCommand = Command[SetBlockedURLsParams, EmptyResponse]
381-
SetBypassServiceWorkerCommand = Command[SetBypassServiceWorkerParams, EmptyResponse]
380+
SetBlockedURLsCommand = Command[SetBlockedURLsParams, Response[EmptyResponse]]
381+
SetBypassServiceWorkerCommand = Command[SetBypassServiceWorkerParams, Response[EmptyResponse]]
382382
GetCertificateCommand = Command[GetCertificateParams, GetCertificateResponse]
383383
GetResponseBodyForInterceptionCommand = Command[
384384
GetResponseBodyForInterceptionParams, GetResponseBodyForInterceptionResponse
385385
]
386-
SetAcceptedEncodingsCommand = Command[SetAcceptedEncodingsParams, EmptyResponse]
387-
SetAttachDebugStackCommand = Command[SetAttachDebugStackParams, EmptyResponse]
388-
SetCookieControlsCommand = Command[SetCookieControlsParams, EmptyResponse]
386+
SetAcceptedEncodingsCommand = Command[SetAcceptedEncodingsParams, Response[EmptyResponse]]
387+
SetAttachDebugStackCommand = Command[SetAttachDebugStackParams, Response[EmptyResponse]]
388+
SetCookieControlsCommand = Command[SetCookieControlsParams, Response[EmptyResponse]]
389389
StreamResourceContentCommand = Command[StreamResourceContentParams, StreamResourceContentResponse]
390390
TakeResponseBodyForInterceptionAsStreamCommand = Command[
391391
TakeResponseBodyForInterceptionAsStreamParams, TakeResponseBodyForInterceptionAsStreamResponse
@@ -394,4 +394,4 @@ class LoadNetworkResourceResult(TypedDict):
394394
GetSecurityIsolationStatusParams, GetSecurityIsolationStatusResponse
395395
]
396396
LoadNetworkResourceCommand = Command[LoadNetworkResourceParams, LoadNetworkResourceResponse]
397-
ReplayXHRCommand = Command[ReplayXHRParams, EmptyResponse]
397+
ReplayXHRCommand = Command[ReplayXHRParams, Response[EmptyResponse]]

0 commit comments

Comments
 (0)