mithwire 0.50.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mithwire/__init__.py +32 -0
- mithwire/cdp/README.md +4 -0
- mithwire/cdp/__init__.py +6 -0
- mithwire/cdp/accessibility.py +668 -0
- mithwire/cdp/animation.py +494 -0
- mithwire/cdp/audits.py +1995 -0
- mithwire/cdp/autofill.py +292 -0
- mithwire/cdp/background_service.py +215 -0
- mithwire/cdp/bluetooth_emulation.py +626 -0
- mithwire/cdp/browser.py +821 -0
- mithwire/cdp/cache_storage.py +311 -0
- mithwire/cdp/cast.py +172 -0
- mithwire/cdp/console.py +107 -0
- mithwire/cdp/crash_report_context.py +55 -0
- mithwire/cdp/css.py +2750 -0
- mithwire/cdp/database.py +179 -0
- mithwire/cdp/debugger.py +1405 -0
- mithwire/cdp/device_access.py +141 -0
- mithwire/cdp/device_orientation.py +45 -0
- mithwire/cdp/dom.py +2257 -0
- mithwire/cdp/dom_debugger.py +321 -0
- mithwire/cdp/dom_snapshot.py +876 -0
- mithwire/cdp/dom_storage.py +222 -0
- mithwire/cdp/emulation.py +1779 -0
- mithwire/cdp/event_breakpoints.py +56 -0
- mithwire/cdp/extensions.py +238 -0
- mithwire/cdp/fed_cm.py +283 -0
- mithwire/cdp/fetch.py +507 -0
- mithwire/cdp/file_system.py +115 -0
- mithwire/cdp/headless_experimental.py +115 -0
- mithwire/cdp/heap_profiler.py +401 -0
- mithwire/cdp/indexed_db.py +528 -0
- mithwire/cdp/input_.py +701 -0
- mithwire/cdp/inspector.py +95 -0
- mithwire/cdp/io.py +101 -0
- mithwire/cdp/layer_tree.py +464 -0
- mithwire/cdp/log.py +190 -0
- mithwire/cdp/media.py +313 -0
- mithwire/cdp/memory.py +305 -0
- mithwire/cdp/network.py +5342 -0
- mithwire/cdp/overlay.py +1468 -0
- mithwire/cdp/page.py +3972 -0
- mithwire/cdp/performance.py +124 -0
- mithwire/cdp/performance_timeline.py +200 -0
- mithwire/cdp/preload.py +575 -0
- mithwire/cdp/profiler.py +420 -0
- mithwire/cdp/pwa.py +278 -0
- mithwire/cdp/py.typed +0 -0
- mithwire/cdp/runtime.py +1589 -0
- mithwire/cdp/schema.py +50 -0
- mithwire/cdp/security.py +518 -0
- mithwire/cdp/service_worker.py +401 -0
- mithwire/cdp/smart_card_emulation.py +891 -0
- mithwire/cdp/storage.py +1573 -0
- mithwire/cdp/system_info.py +327 -0
- mithwire/cdp/target.py +829 -0
- mithwire/cdp/tethering.py +65 -0
- mithwire/cdp/tracing.py +377 -0
- mithwire/cdp/util.py +18 -0
- mithwire/cdp/web_audio.py +606 -0
- mithwire/cdp/web_authn.py +598 -0
- mithwire/cdp/web_mcp.py +293 -0
- mithwire/core/_contradict.py +142 -0
- mithwire/core/browser.py +923 -0
- mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
- mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
- mithwire/core/config.py +323 -0
- mithwire/core/connection.py +564 -0
- mithwire/core/element.py +1205 -0
- mithwire/core/tab.py +2202 -0
- mithwire/core/util.py +5063 -0
- mithwire-0.50.3.dist-info/METADATA +1049 -0
- mithwire-0.50.3.dist-info/RECORD +76 -0
- mithwire-0.50.3.dist-info/WHEEL +5 -0
- mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
- mithwire-0.50.3.dist-info/top_level.txt +1 -0
mithwire/cdp/log.py
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE!
|
|
2
|
+
#
|
|
3
|
+
# This file is generated from the CDP specification. If you need to make
|
|
4
|
+
# changes, edit the generator and regenerate all of the modules.
|
|
5
|
+
#
|
|
6
|
+
# CDP domain: Log
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
import enum
|
|
10
|
+
import typing
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from .util import event_class, T_JSON_DICT
|
|
13
|
+
|
|
14
|
+
from . import network
|
|
15
|
+
from . import runtime
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@dataclass
|
|
19
|
+
class LogEntry:
|
|
20
|
+
'''
|
|
21
|
+
Log entry.
|
|
22
|
+
'''
|
|
23
|
+
#: Log entry source.
|
|
24
|
+
source: str
|
|
25
|
+
|
|
26
|
+
#: Log entry severity.
|
|
27
|
+
level: str
|
|
28
|
+
|
|
29
|
+
#: Logged text.
|
|
30
|
+
text: str
|
|
31
|
+
|
|
32
|
+
#: Timestamp when this entry was added.
|
|
33
|
+
timestamp: runtime.Timestamp
|
|
34
|
+
|
|
35
|
+
category: typing.Optional[str] = None
|
|
36
|
+
|
|
37
|
+
#: URL of the resource if known.
|
|
38
|
+
url: typing.Optional[str] = None
|
|
39
|
+
|
|
40
|
+
#: Line number in the resource.
|
|
41
|
+
line_number: typing.Optional[int] = None
|
|
42
|
+
|
|
43
|
+
#: JavaScript stack trace.
|
|
44
|
+
stack_trace: typing.Optional[runtime.StackTrace] = None
|
|
45
|
+
|
|
46
|
+
#: Identifier of the network request associated with this entry.
|
|
47
|
+
network_request_id: typing.Optional[network.RequestId] = None
|
|
48
|
+
|
|
49
|
+
#: Identifier of the worker associated with this entry.
|
|
50
|
+
worker_id: typing.Optional[str] = None
|
|
51
|
+
|
|
52
|
+
#: Call arguments.
|
|
53
|
+
args: typing.Optional[typing.List[runtime.RemoteObject]] = None
|
|
54
|
+
|
|
55
|
+
def to_json(self) -> T_JSON_DICT:
|
|
56
|
+
json: T_JSON_DICT = dict()
|
|
57
|
+
json['source'] = self.source
|
|
58
|
+
json['level'] = self.level
|
|
59
|
+
json['text'] = self.text
|
|
60
|
+
json['timestamp'] = self.timestamp.to_json()
|
|
61
|
+
if self.category is not None:
|
|
62
|
+
json['category'] = self.category
|
|
63
|
+
if self.url is not None:
|
|
64
|
+
json['url'] = self.url
|
|
65
|
+
if self.line_number is not None:
|
|
66
|
+
json['lineNumber'] = self.line_number
|
|
67
|
+
if self.stack_trace is not None:
|
|
68
|
+
json['stackTrace'] = self.stack_trace.to_json()
|
|
69
|
+
if self.network_request_id is not None:
|
|
70
|
+
json['networkRequestId'] = self.network_request_id.to_json()
|
|
71
|
+
if self.worker_id is not None:
|
|
72
|
+
json['workerId'] = self.worker_id
|
|
73
|
+
if self.args is not None:
|
|
74
|
+
json['args'] = [i.to_json() for i in self.args]
|
|
75
|
+
return json
|
|
76
|
+
|
|
77
|
+
@classmethod
|
|
78
|
+
def from_json(cls, json: T_JSON_DICT) -> LogEntry:
|
|
79
|
+
return cls(
|
|
80
|
+
source=str(json['source']),
|
|
81
|
+
level=str(json['level']),
|
|
82
|
+
text=str(json['text']),
|
|
83
|
+
timestamp=runtime.Timestamp.from_json(json['timestamp']),
|
|
84
|
+
category=str(json['category']) if json.get('category', None) is not None else None,
|
|
85
|
+
url=str(json['url']) if json.get('url', None) is not None else None,
|
|
86
|
+
line_number=int(json['lineNumber']) if json.get('lineNumber', None) is not None else None,
|
|
87
|
+
stack_trace=runtime.StackTrace.from_json(json['stackTrace']) if json.get('stackTrace', None) is not None else None,
|
|
88
|
+
network_request_id=network.RequestId.from_json(json['networkRequestId']) if json.get('networkRequestId', None) is not None else None,
|
|
89
|
+
worker_id=str(json['workerId']) if json.get('workerId', None) is not None else None,
|
|
90
|
+
args=[runtime.RemoteObject.from_json(i) for i in json['args']] if json.get('args', None) is not None else None,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
@dataclass
|
|
95
|
+
class ViolationSetting:
|
|
96
|
+
'''
|
|
97
|
+
Violation configuration setting.
|
|
98
|
+
'''
|
|
99
|
+
#: Violation type.
|
|
100
|
+
name: str
|
|
101
|
+
|
|
102
|
+
#: Time threshold to trigger upon.
|
|
103
|
+
threshold: float
|
|
104
|
+
|
|
105
|
+
def to_json(self) -> T_JSON_DICT:
|
|
106
|
+
json: T_JSON_DICT = dict()
|
|
107
|
+
json['name'] = self.name
|
|
108
|
+
json['threshold'] = self.threshold
|
|
109
|
+
return json
|
|
110
|
+
|
|
111
|
+
@classmethod
|
|
112
|
+
def from_json(cls, json: T_JSON_DICT) -> ViolationSetting:
|
|
113
|
+
return cls(
|
|
114
|
+
name=str(json['name']),
|
|
115
|
+
threshold=float(json['threshold']),
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def clear() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
120
|
+
'''
|
|
121
|
+
Clears the log.
|
|
122
|
+
'''
|
|
123
|
+
cmd_dict: T_JSON_DICT = {
|
|
124
|
+
'method': 'Log.clear',
|
|
125
|
+
}
|
|
126
|
+
json = yield cmd_dict
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
130
|
+
'''
|
|
131
|
+
Disables log domain, prevents further log entries from being reported to the client.
|
|
132
|
+
'''
|
|
133
|
+
cmd_dict: T_JSON_DICT = {
|
|
134
|
+
'method': 'Log.disable',
|
|
135
|
+
}
|
|
136
|
+
json = yield cmd_dict
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
140
|
+
'''
|
|
141
|
+
Enables log domain, sends the entries collected so far to the client by means of the
|
|
142
|
+
``entryAdded`` notification.
|
|
143
|
+
'''
|
|
144
|
+
cmd_dict: T_JSON_DICT = {
|
|
145
|
+
'method': 'Log.enable',
|
|
146
|
+
}
|
|
147
|
+
json = yield cmd_dict
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
def start_violations_report(
|
|
151
|
+
config: typing.List[ViolationSetting]
|
|
152
|
+
) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
153
|
+
'''
|
|
154
|
+
start violation reporting.
|
|
155
|
+
|
|
156
|
+
:param config: Configuration for violations.
|
|
157
|
+
'''
|
|
158
|
+
params: T_JSON_DICT = dict()
|
|
159
|
+
params['config'] = [i.to_json() for i in config]
|
|
160
|
+
cmd_dict: T_JSON_DICT = {
|
|
161
|
+
'method': 'Log.startViolationsReport',
|
|
162
|
+
'params': params,
|
|
163
|
+
}
|
|
164
|
+
json = yield cmd_dict
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def stop_violations_report() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
168
|
+
'''
|
|
169
|
+
Stop violation reporting.
|
|
170
|
+
'''
|
|
171
|
+
cmd_dict: T_JSON_DICT = {
|
|
172
|
+
'method': 'Log.stopViolationsReport',
|
|
173
|
+
}
|
|
174
|
+
json = yield cmd_dict
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
@event_class('Log.entryAdded')
|
|
178
|
+
@dataclass
|
|
179
|
+
class EntryAdded:
|
|
180
|
+
'''
|
|
181
|
+
Issued when new message was logged.
|
|
182
|
+
'''
|
|
183
|
+
#: The entry.
|
|
184
|
+
entry: LogEntry
|
|
185
|
+
|
|
186
|
+
@classmethod
|
|
187
|
+
def from_json(cls, json: T_JSON_DICT) -> EntryAdded:
|
|
188
|
+
return cls(
|
|
189
|
+
entry=LogEntry.from_json(json['entry'])
|
|
190
|
+
)
|
mithwire/cdp/media.py
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# DO NOT EDIT THIS FILE!
|
|
2
|
+
#
|
|
3
|
+
# This file is generated from the CDP specification. If you need to make
|
|
4
|
+
# changes, edit the generator and regenerate all of the modules.
|
|
5
|
+
#
|
|
6
|
+
# CDP domain: Media (experimental)
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
import enum
|
|
10
|
+
import typing
|
|
11
|
+
from dataclasses import dataclass
|
|
12
|
+
from .util import event_class, T_JSON_DICT
|
|
13
|
+
|
|
14
|
+
from . import dom
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class PlayerId(str):
|
|
18
|
+
'''
|
|
19
|
+
Players will get an ID that is unique within the agent context.
|
|
20
|
+
'''
|
|
21
|
+
def to_json(self) -> str:
|
|
22
|
+
return self
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def from_json(cls, json: str) -> PlayerId:
|
|
26
|
+
return cls(json)
|
|
27
|
+
|
|
28
|
+
def __repr__(self):
|
|
29
|
+
return 'PlayerId({})'.format(super().__repr__())
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Timestamp(float):
|
|
33
|
+
def to_json(self) -> float:
|
|
34
|
+
return self
|
|
35
|
+
|
|
36
|
+
@classmethod
|
|
37
|
+
def from_json(cls, json: float) -> Timestamp:
|
|
38
|
+
return cls(json)
|
|
39
|
+
|
|
40
|
+
def __repr__(self):
|
|
41
|
+
return 'Timestamp({})'.format(super().__repr__())
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass
|
|
45
|
+
class PlayerMessage:
|
|
46
|
+
'''
|
|
47
|
+
Have one type per entry in MediaLogRecord::Type
|
|
48
|
+
Corresponds to kMessage
|
|
49
|
+
'''
|
|
50
|
+
#: Keep in sync with MediaLogMessageLevel
|
|
51
|
+
#: We are currently keeping the message level 'error' separate from the
|
|
52
|
+
#: PlayerError type because right now they represent different things,
|
|
53
|
+
#: this one being a DVLOG(ERROR) style log message that gets printed
|
|
54
|
+
#: based on what log level is selected in the UI, and the other is a
|
|
55
|
+
#: representation of a media::PipelineStatus object. Soon however we're
|
|
56
|
+
#: going to be moving away from using PipelineStatus for errors and
|
|
57
|
+
#: introducing a new error type which should hopefully let us integrate
|
|
58
|
+
#: the error log level into the PlayerError type.
|
|
59
|
+
level: str
|
|
60
|
+
|
|
61
|
+
message: str
|
|
62
|
+
|
|
63
|
+
def to_json(self) -> T_JSON_DICT:
|
|
64
|
+
json: T_JSON_DICT = dict()
|
|
65
|
+
json['level'] = self.level
|
|
66
|
+
json['message'] = self.message
|
|
67
|
+
return json
|
|
68
|
+
|
|
69
|
+
@classmethod
|
|
70
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerMessage:
|
|
71
|
+
return cls(
|
|
72
|
+
level=str(json['level']),
|
|
73
|
+
message=str(json['message']),
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@dataclass
|
|
78
|
+
class PlayerProperty:
|
|
79
|
+
'''
|
|
80
|
+
Corresponds to kMediaPropertyChange
|
|
81
|
+
'''
|
|
82
|
+
name: str
|
|
83
|
+
|
|
84
|
+
value: str
|
|
85
|
+
|
|
86
|
+
def to_json(self) -> T_JSON_DICT:
|
|
87
|
+
json: T_JSON_DICT = dict()
|
|
88
|
+
json['name'] = self.name
|
|
89
|
+
json['value'] = self.value
|
|
90
|
+
return json
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerProperty:
|
|
94
|
+
return cls(
|
|
95
|
+
name=str(json['name']),
|
|
96
|
+
value=str(json['value']),
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass
|
|
101
|
+
class PlayerEvent:
|
|
102
|
+
'''
|
|
103
|
+
Corresponds to kMediaEventTriggered
|
|
104
|
+
'''
|
|
105
|
+
timestamp: Timestamp
|
|
106
|
+
|
|
107
|
+
value: str
|
|
108
|
+
|
|
109
|
+
def to_json(self) -> T_JSON_DICT:
|
|
110
|
+
json: T_JSON_DICT = dict()
|
|
111
|
+
json['timestamp'] = self.timestamp.to_json()
|
|
112
|
+
json['value'] = self.value
|
|
113
|
+
return json
|
|
114
|
+
|
|
115
|
+
@classmethod
|
|
116
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerEvent:
|
|
117
|
+
return cls(
|
|
118
|
+
timestamp=Timestamp.from_json(json['timestamp']),
|
|
119
|
+
value=str(json['value']),
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass
|
|
124
|
+
class PlayerErrorSourceLocation:
|
|
125
|
+
'''
|
|
126
|
+
Represents logged source line numbers reported in an error.
|
|
127
|
+
NOTE: file and line are from chromium c++ implementation code, not js.
|
|
128
|
+
'''
|
|
129
|
+
file: str
|
|
130
|
+
|
|
131
|
+
line: int
|
|
132
|
+
|
|
133
|
+
def to_json(self) -> T_JSON_DICT:
|
|
134
|
+
json: T_JSON_DICT = dict()
|
|
135
|
+
json['file'] = self.file
|
|
136
|
+
json['line'] = self.line
|
|
137
|
+
return json
|
|
138
|
+
|
|
139
|
+
@classmethod
|
|
140
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerErrorSourceLocation:
|
|
141
|
+
return cls(
|
|
142
|
+
file=str(json['file']),
|
|
143
|
+
line=int(json['line']),
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@dataclass
|
|
148
|
+
class PlayerError:
|
|
149
|
+
'''
|
|
150
|
+
Corresponds to kMediaError
|
|
151
|
+
'''
|
|
152
|
+
error_type: str
|
|
153
|
+
|
|
154
|
+
#: Code is the numeric enum entry for a specific set of error codes, such
|
|
155
|
+
#: as PipelineStatusCodes in media/base/pipeline_status.h
|
|
156
|
+
code: int
|
|
157
|
+
|
|
158
|
+
#: A trace of where this error was caused / where it passed through.
|
|
159
|
+
stack: typing.List[PlayerErrorSourceLocation]
|
|
160
|
+
|
|
161
|
+
#: Errors potentially have a root cause error, ie, a DecoderError might be
|
|
162
|
+
#: caused by an WindowsError
|
|
163
|
+
cause: typing.List[PlayerError]
|
|
164
|
+
|
|
165
|
+
#: Extra data attached to an error, such as an HRESULT, Video Codec, etc.
|
|
166
|
+
data: dict
|
|
167
|
+
|
|
168
|
+
def to_json(self) -> T_JSON_DICT:
|
|
169
|
+
json: T_JSON_DICT = dict()
|
|
170
|
+
json['errorType'] = self.error_type
|
|
171
|
+
json['code'] = self.code
|
|
172
|
+
json['stack'] = [i.to_json() for i in self.stack]
|
|
173
|
+
json['cause'] = [i.to_json() for i in self.cause]
|
|
174
|
+
json['data'] = self.data
|
|
175
|
+
return json
|
|
176
|
+
|
|
177
|
+
@classmethod
|
|
178
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerError:
|
|
179
|
+
return cls(
|
|
180
|
+
error_type=str(json['errorType']),
|
|
181
|
+
code=int(json['code']),
|
|
182
|
+
stack=[PlayerErrorSourceLocation.from_json(i) for i in json['stack']],
|
|
183
|
+
cause=[PlayerError.from_json(i) for i in json['cause']],
|
|
184
|
+
data=dict(json['data']),
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
@dataclass
|
|
189
|
+
class Player:
|
|
190
|
+
player_id: PlayerId
|
|
191
|
+
|
|
192
|
+
dom_node_id: typing.Optional[dom.BackendNodeId] = None
|
|
193
|
+
|
|
194
|
+
def to_json(self) -> T_JSON_DICT:
|
|
195
|
+
json: T_JSON_DICT = dict()
|
|
196
|
+
json['playerId'] = self.player_id.to_json()
|
|
197
|
+
if self.dom_node_id is not None:
|
|
198
|
+
json['domNodeId'] = self.dom_node_id.to_json()
|
|
199
|
+
return json
|
|
200
|
+
|
|
201
|
+
@classmethod
|
|
202
|
+
def from_json(cls, json: T_JSON_DICT) -> Player:
|
|
203
|
+
return cls(
|
|
204
|
+
player_id=PlayerId.from_json(json['playerId']),
|
|
205
|
+
dom_node_id=dom.BackendNodeId.from_json(json['domNodeId']) if json.get('domNodeId', None) is not None else None,
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
210
|
+
'''
|
|
211
|
+
Enables the Media domain
|
|
212
|
+
'''
|
|
213
|
+
cmd_dict: T_JSON_DICT = {
|
|
214
|
+
'method': 'Media.enable',
|
|
215
|
+
}
|
|
216
|
+
json = yield cmd_dict
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
|
|
220
|
+
'''
|
|
221
|
+
Disables the Media domain.
|
|
222
|
+
'''
|
|
223
|
+
cmd_dict: T_JSON_DICT = {
|
|
224
|
+
'method': 'Media.disable',
|
|
225
|
+
}
|
|
226
|
+
json = yield cmd_dict
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
@event_class('Media.playerPropertiesChanged')
|
|
230
|
+
@dataclass
|
|
231
|
+
class PlayerPropertiesChanged:
|
|
232
|
+
'''
|
|
233
|
+
This can be called multiple times, and can be used to set / override /
|
|
234
|
+
remove player properties. A null propValue indicates removal.
|
|
235
|
+
'''
|
|
236
|
+
player_id: PlayerId
|
|
237
|
+
properties: typing.List[PlayerProperty]
|
|
238
|
+
|
|
239
|
+
@classmethod
|
|
240
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerPropertiesChanged:
|
|
241
|
+
return cls(
|
|
242
|
+
player_id=PlayerId.from_json(json['playerId']),
|
|
243
|
+
properties=[PlayerProperty.from_json(i) for i in json['properties']]
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@event_class('Media.playerEventsAdded')
|
|
248
|
+
@dataclass
|
|
249
|
+
class PlayerEventsAdded:
|
|
250
|
+
'''
|
|
251
|
+
Send events as a list, allowing them to be batched on the browser for less
|
|
252
|
+
congestion. If batched, events must ALWAYS be in chronological order.
|
|
253
|
+
'''
|
|
254
|
+
player_id: PlayerId
|
|
255
|
+
events: typing.List[PlayerEvent]
|
|
256
|
+
|
|
257
|
+
@classmethod
|
|
258
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerEventsAdded:
|
|
259
|
+
return cls(
|
|
260
|
+
player_id=PlayerId.from_json(json['playerId']),
|
|
261
|
+
events=[PlayerEvent.from_json(i) for i in json['events']]
|
|
262
|
+
)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
@event_class('Media.playerMessagesLogged')
|
|
266
|
+
@dataclass
|
|
267
|
+
class PlayerMessagesLogged:
|
|
268
|
+
'''
|
|
269
|
+
Send a list of any messages that need to be delivered.
|
|
270
|
+
'''
|
|
271
|
+
player_id: PlayerId
|
|
272
|
+
messages: typing.List[PlayerMessage]
|
|
273
|
+
|
|
274
|
+
@classmethod
|
|
275
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerMessagesLogged:
|
|
276
|
+
return cls(
|
|
277
|
+
player_id=PlayerId.from_json(json['playerId']),
|
|
278
|
+
messages=[PlayerMessage.from_json(i) for i in json['messages']]
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
@event_class('Media.playerErrorsRaised')
|
|
283
|
+
@dataclass
|
|
284
|
+
class PlayerErrorsRaised:
|
|
285
|
+
'''
|
|
286
|
+
Send a list of any errors that need to be delivered.
|
|
287
|
+
'''
|
|
288
|
+
player_id: PlayerId
|
|
289
|
+
errors: typing.List[PlayerError]
|
|
290
|
+
|
|
291
|
+
@classmethod
|
|
292
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerErrorsRaised:
|
|
293
|
+
return cls(
|
|
294
|
+
player_id=PlayerId.from_json(json['playerId']),
|
|
295
|
+
errors=[PlayerError.from_json(i) for i in json['errors']]
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
@event_class('Media.playerCreated')
|
|
300
|
+
@dataclass
|
|
301
|
+
class PlayerCreated:
|
|
302
|
+
'''
|
|
303
|
+
Called whenever a player is created, or when a new agent joins and receives
|
|
304
|
+
a list of active players. If an agent is restored, it will receive one
|
|
305
|
+
event for each active player.
|
|
306
|
+
'''
|
|
307
|
+
player: Player
|
|
308
|
+
|
|
309
|
+
@classmethod
|
|
310
|
+
def from_json(cls, json: T_JSON_DICT) -> PlayerCreated:
|
|
311
|
+
return cls(
|
|
312
|
+
player=Player.from_json(json['player'])
|
|
313
|
+
)
|