1#[derive(Clone, Copy, PartialEq, ::prost::Message)]
3pub struct PingRequest {}
4#[derive(Clone, PartialEq, ::prost::Message)]
5pub struct PingResponse {
6 #[prost(string, tag = "1")]
7 pub message: ::prost::alloc::string::String,
8 #[prost(string, tag = "2")]
9 pub version: ::prost::alloc::string::String,
10}
11#[derive(Clone, Copy, PartialEq, ::prost::Message)]
12pub struct CommandRetryOptions {
13 #[prost(uint32, optional, tag = "1")]
14 pub timeout_ms: ::core::option::Option<u32>,
15 #[prost(uint32, optional, tag = "2")]
16 pub retry_interval_ms: ::core::option::Option<u32>,
17}
18#[derive(Clone, PartialEq, ::prost::Message)]
19pub struct ConnectMobileCommand {
20 #[prost(enumeration = "MobilePlatform", tag = "1")]
21 pub platform: i32,
22 #[prost(string, optional, tag = "2")]
23 pub device: ::core::option::Option<::prost::alloc::string::String>,
24 #[prost(string, optional, tag = "3")]
25 pub adb_endpoint: ::core::option::Option<::prost::alloc::string::String>,
26 #[prost(bool, tag = "4")]
27 pub preserve_app_state: bool,
28 #[prost(message, optional, tag = "5")]
29 pub retry_options: ::core::option::Option<CommandRetryOptions>,
30}
31#[derive(Clone, PartialEq, ::prost::Message)]
32pub struct MobileConnectedEvent {
33 #[prost(enumeration = "MobilePlatform", tag = "1")]
34 pub platform: i32,
35 #[prost(string, tag = "2")]
36 pub device_name: ::prost::alloc::string::String,
37 #[prost(string, tag = "3")]
38 pub note: ::prost::alloc::string::String,
39 #[prost(string, tag = "4")]
40 pub device_id: ::prost::alloc::string::String,
41 #[prost(enumeration = "DeviceConnectionKind", tag = "5")]
42 pub connection_kind: i32,
43 #[prost(string, tag = "6")]
44 pub backend: ::prost::alloc::string::String,
45 #[prost(string, tag = "7")]
46 pub device_session_id: ::prost::alloc::string::String,
47 #[prost(string, tag = "8")]
48 pub initial_app_session_id: ::prost::alloc::string::String,
49 #[prost(string, optional, tag = "9")]
50 pub package_name: ::core::option::Option<::prost::alloc::string::String>,
51 #[prost(string, optional, tag = "10")]
52 pub activity_name: ::core::option::Option<::prost::alloc::string::String>,
53}
54#[derive(Clone, PartialEq, ::prost::Message)]
55pub struct LaunchAppCommand {
56 #[prost(string, optional, tag = "1")]
57 pub apk_path: ::core::option::Option<::prost::alloc::string::String>,
58 #[prost(string, optional, tag = "2")]
59 pub app_id: ::core::option::Option<::prost::alloc::string::String>,
60 #[prost(string, optional, tag = "3")]
61 pub launch_activity: ::core::option::Option<::prost::alloc::string::String>,
62 #[prost(bool, tag = "4")]
63 pub stop_before_launch: bool,
64 #[prost(message, optional, tag = "5")]
65 pub retry_options: ::core::option::Option<CommandRetryOptions>,
66}
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct AppLaunchedEvent {
69 #[prost(string, tag = "1")]
70 pub app_session_id: ::prost::alloc::string::String,
71 #[prost(string, tag = "2")]
72 pub note: ::prost::alloc::string::String,
73 #[prost(string, optional, tag = "3")]
74 pub package_name: ::core::option::Option<::prost::alloc::string::String>,
75 #[prost(string, optional, tag = "4")]
76 pub activity_name: ::core::option::Option<::prost::alloc::string::String>,
77 #[prost(string, optional, tag = "5")]
78 pub webview_context: ::core::option::Option<::prost::alloc::string::String>,
79}
80#[derive(Clone, Copy, PartialEq, ::prost::Message)]
81pub struct RegisterMobileFileChooserHook {}
82#[derive(Clone, PartialEq, ::prost::Message)]
83pub struct MobileFileChooserHookResult {
84 #[prost(string, tag = "1")]
85 pub file_chooser_id: ::prost::alloc::string::String,
86 #[prost(bool, tag = "2")]
87 pub is_multiple: bool,
88 #[prost(string, tag = "3")]
89 pub note: ::prost::alloc::string::String,
90}
91#[derive(Clone, PartialEq, ::prost::Message)]
92pub struct SetMobileFileChooserFilesCommand {
93 #[prost(string, tag = "1")]
94 pub file_chooser_id: ::prost::alloc::string::String,
95 #[prost(string, repeated, tag = "2")]
96 pub file_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
97 #[prost(message, optional, tag = "3")]
98 pub retry_options: ::core::option::Option<CommandRetryOptions>,
99}
100#[derive(Clone, PartialEq, ::prost::Message)]
101pub struct MobileFileChooserFilesSetEvent {
102 #[prost(string, tag = "1")]
103 pub file_chooser_id: ::prost::alloc::string::String,
104 #[prost(string, repeated, tag = "2")]
105 pub file_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
106 #[prost(string, tag = "3")]
107 pub note: ::prost::alloc::string::String,
108}
109#[derive(Clone, Copy, PartialEq, ::prost::Message)]
110pub struct RegisterMobileDownloadHook {}
111#[derive(Clone, PartialEq, ::prost::Message)]
112pub struct MobileDownloadHookResult {
113 #[prost(string, tag = "1")]
114 pub download_id: ::prost::alloc::string::String,
115 #[prost(string, tag = "2")]
116 pub suggested_filename: ::prost::alloc::string::String,
117 #[prost(string, tag = "3")]
118 pub note: ::prost::alloc::string::String,
119}
120#[derive(Clone, PartialEq, ::prost::Message)]
121pub struct SaveMobileDownloadCommand {
122 #[prost(string, tag = "1")]
123 pub download_id: ::prost::alloc::string::String,
124 #[prost(message, optional, tag = "2")]
125 pub retry_options: ::core::option::Option<CommandRetryOptions>,
126}
127#[derive(Clone, PartialEq, ::prost::Message)]
128pub struct MobileDownloadSavedEvent {
129 #[prost(string, tag = "1")]
130 pub download_id: ::prost::alloc::string::String,
131 #[prost(string, tag = "2")]
132 pub file_id: ::prost::alloc::string::String,
133 #[prost(string, tag = "3")]
134 pub suggested_filename: ::prost::alloc::string::String,
135 #[prost(uint64, tag = "4")]
136 pub size: u64,
137 #[prost(string, tag = "5")]
138 pub note: ::prost::alloc::string::String,
139}
140#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
141#[repr(i32)]
142pub enum MobilePlatform {
143 Unspecified = 0,
144 Android = 1,
145 Ios = 2,
146}
147impl MobilePlatform {
148 pub fn as_str_name(&self) -> &'static str {
153 match self {
154 Self::Unspecified => "MOBILE_PLATFORM_UNSPECIFIED",
155 Self::Android => "MOBILE_PLATFORM_ANDROID",
156 Self::Ios => "MOBILE_PLATFORM_IOS",
157 }
158 }
159 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
161 match value {
162 "MOBILE_PLATFORM_UNSPECIFIED" => Some(Self::Unspecified),
163 "MOBILE_PLATFORM_ANDROID" => Some(Self::Android),
164 "MOBILE_PLATFORM_IOS" => Some(Self::Ios),
165 _ => None,
166 }
167 }
168}
169#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
170#[repr(i32)]
171pub enum DeviceConnectionKind {
172 Unspecified = 0,
173 Usb = 1,
174 Emulator = 2,
175 RemoteAdb = 3,
176}
177impl DeviceConnectionKind {
178 pub fn as_str_name(&self) -> &'static str {
183 match self {
184 Self::Unspecified => "DEVICE_CONNECTION_KIND_UNSPECIFIED",
185 Self::Usb => "DEVICE_CONNECTION_KIND_USB",
186 Self::Emulator => "DEVICE_CONNECTION_KIND_EMULATOR",
187 Self::RemoteAdb => "DEVICE_CONNECTION_KIND_REMOTE_ADB",
188 }
189 }
190 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
192 match value {
193 "DEVICE_CONNECTION_KIND_UNSPECIFIED" => Some(Self::Unspecified),
194 "DEVICE_CONNECTION_KIND_USB" => Some(Self::Usb),
195 "DEVICE_CONNECTION_KIND_EMULATOR" => Some(Self::Emulator),
196 "DEVICE_CONNECTION_KIND_REMOTE_ADB" => Some(Self::RemoteAdb),
197 _ => None,
198 }
199 }
200}
201#[derive(Clone, PartialEq, ::prost::Message)]
202pub struct LaunchBrowserCommand {
203 #[prost(enumeration = "BrowserKind", tag = "1")]
204 pub browser_kind: i32,
205 #[prost(string, optional, tag = "2")]
206 pub browser_binary: ::core::option::Option<::prost::alloc::string::String>,
207 #[prost(message, optional, tag = "3")]
208 pub retry_options: ::core::option::Option<CommandRetryOptions>,
209}
210#[derive(Clone, PartialEq, ::prost::Message)]
211pub struct BrowserLaunchedEvent {
212 #[prost(enumeration = "BrowserKind", tag = "1")]
213 pub browser_kind: i32,
214 #[prost(string, tag = "2")]
215 pub browser: ::prost::alloc::string::String,
216 #[prost(string, tag = "3")]
217 pub note: ::prost::alloc::string::String,
218 #[prost(string, tag = "4")]
219 pub user_data_dir: ::prost::alloc::string::String,
220 #[prost(string, tag = "5")]
221 pub initial_page_session_id: ::prost::alloc::string::String,
222}
223#[derive(Clone, PartialEq, ::prost::Message)]
224pub struct LaunchChromeCommand {
225 #[prost(string, optional, tag = "1")]
226 pub chrome_binary: ::core::option::Option<::prost::alloc::string::String>,
227 #[prost(message, optional, tag = "2")]
228 pub retry_options: ::core::option::Option<CommandRetryOptions>,
229}
230#[derive(Clone, PartialEq, ::prost::Message)]
231pub struct ChromeLaunchedEvent {
232 #[prost(string, tag = "1")]
233 pub browser: ::prost::alloc::string::String,
234 #[prost(string, tag = "2")]
235 pub note: ::prost::alloc::string::String,
236 #[prost(string, tag = "3")]
237 pub cdp_websocket_url: ::prost::alloc::string::String,
238 #[prost(string, tag = "4")]
239 pub user_data_dir: ::prost::alloc::string::String,
240 #[prost(string, tag = "5")]
241 pub initial_page_session_id: ::prost::alloc::string::String,
242}
243#[derive(Clone, Copy, PartialEq, ::prost::Message)]
244pub struct RegisterNewPageHook {}
245#[derive(Clone, PartialEq, ::prost::Message)]
246pub struct NewPageHookResult {
247 #[prost(string, tag = "1")]
248 pub context_session_id: ::prost::alloc::string::String,
249 #[prost(string, tag = "2")]
250 pub note: ::prost::alloc::string::String,
251}
252#[derive(Clone, Copy, PartialEq, ::prost::Message)]
253pub struct RegisterFileChooserHook {}
254#[derive(Clone, PartialEq, ::prost::Message)]
255pub struct FileChooserHookResult {
256 #[prost(string, tag = "1")]
257 pub file_chooser_id: ::prost::alloc::string::String,
258 #[prost(bool, tag = "2")]
259 pub is_multiple: bool,
260 #[prost(string, tag = "3")]
261 pub note: ::prost::alloc::string::String,
262}
263#[derive(Clone, PartialEq, ::prost::Message)]
264pub struct SetFileChooserFilesCommand {
265 #[prost(string, tag = "1")]
266 pub file_chooser_id: ::prost::alloc::string::String,
267 #[prost(string, repeated, tag = "2")]
268 pub file_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
269 #[prost(message, optional, tag = "3")]
270 pub retry_options: ::core::option::Option<CommandRetryOptions>,
271}
272#[derive(Clone, PartialEq, ::prost::Message)]
273pub struct FileChooserFilesSetEvent {
274 #[prost(string, tag = "1")]
275 pub file_chooser_id: ::prost::alloc::string::String,
276 #[prost(string, repeated, tag = "2")]
277 pub file_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
278 #[prost(string, tag = "3")]
279 pub note: ::prost::alloc::string::String,
280}
281#[derive(Clone, Copy, PartialEq, ::prost::Message)]
282pub struct RegisterDownloadHook {}
283#[derive(Clone, PartialEq, ::prost::Message)]
284pub struct DownloadHookResult {
285 #[prost(string, tag = "1")]
286 pub download_id: ::prost::alloc::string::String,
287 #[prost(string, tag = "2")]
288 pub url: ::prost::alloc::string::String,
289 #[prost(string, tag = "3")]
290 pub suggested_filename: ::prost::alloc::string::String,
291 #[prost(string, tag = "4")]
292 pub note: ::prost::alloc::string::String,
293}
294#[derive(Clone, PartialEq, ::prost::Message)]
295pub struct SaveDownloadCommand {
296 #[prost(string, tag = "1")]
297 pub download_id: ::prost::alloc::string::String,
298 #[prost(message, optional, tag = "2")]
299 pub retry_options: ::core::option::Option<CommandRetryOptions>,
300}
301#[derive(Clone, PartialEq, ::prost::Message)]
302pub struct DownloadSavedEvent {
303 #[prost(string, tag = "1")]
304 pub download_id: ::prost::alloc::string::String,
305 #[prost(string, tag = "2")]
306 pub file_id: ::prost::alloc::string::String,
307 #[prost(string, tag = "3")]
308 pub suggested_filename: ::prost::alloc::string::String,
309 #[prost(uint64, tag = "4")]
310 pub size: u64,
311 #[prost(string, tag = "5")]
312 pub note: ::prost::alloc::string::String,
313}
314#[derive(Clone, PartialEq, ::prost::Message)]
316pub struct ResolveFrameCommand {
317 #[prost(string, tag = "1")]
318 pub css_selector: ::prost::alloc::string::String,
319 #[prost(message, optional, tag = "2")]
320 pub retry_options: ::core::option::Option<CommandRetryOptions>,
321}
322#[derive(Clone, PartialEq, ::prost::Message)]
323pub struct FrameResolvedEvent {
324 #[prost(string, tag = "1")]
325 pub context_session_id: ::prost::alloc::string::String,
326}
327#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
328#[repr(i32)]
329pub enum BrowserKind {
330 Unspecified = 0,
331 Chromium = 1,
332 Firefox = 2,
333}
334impl BrowserKind {
335 pub fn as_str_name(&self) -> &'static str {
340 match self {
341 Self::Unspecified => "BROWSER_KIND_UNSPECIFIED",
342 Self::Chromium => "BROWSER_KIND_CHROMIUM",
343 Self::Firefox => "BROWSER_KIND_FIREFOX",
344 }
345 }
346 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
348 match value {
349 "BROWSER_KIND_UNSPECIFIED" => Some(Self::Unspecified),
350 "BROWSER_KIND_CHROMIUM" => Some(Self::Chromium),
351 "BROWSER_KIND_FIREFOX" => Some(Self::Firefox),
352 _ => None,
353 }
354 }
355}
356#[derive(Clone, PartialEq, ::prost::Message)]
357pub struct SurfaceSessionCommand {
358 #[prost(oneof = "surface_session_command::Command", tags = "1, 2, 3, 4, 5, 6, 7")]
359 pub command: ::core::option::Option<surface_session_command::Command>,
360}
361pub mod surface_session_command {
363 #[derive(Clone, PartialEq, ::prost::Oneof)]
364 pub enum Command {
365 #[prost(message, tag = "1")]
366 LaunchChrome(super::LaunchChromeCommand),
367 #[prost(message, tag = "2")]
368 OpenContext(super::OpenContextCommand),
369 #[prost(message, tag = "3")]
370 Ping(super::SessionPingCommand),
371 #[prost(message, tag = "4")]
372 Close(super::CloseSurfaceSessionCommand),
373 #[prost(message, tag = "5")]
374 LaunchBrowser(super::LaunchBrowserCommand),
375 #[prost(message, tag = "6")]
376 ConnectMobile(super::ConnectMobileCommand),
377 #[prost(message, tag = "7")]
378 LaunchApp(super::LaunchAppCommand),
379 }
380}
381#[derive(Clone, Copy, PartialEq, ::prost::Message)]
382pub struct OpenContextCommand {
383 #[prost(message, optional, tag = "1")]
384 pub retry_options: ::core::option::Option<CommandRetryOptions>,
385}
386#[derive(Clone, PartialEq, ::prost::Message)]
387pub struct SessionPingCommand {
388 #[prost(string, tag = "1")]
389 pub message: ::prost::alloc::string::String,
390}
391#[derive(Clone, Copy, PartialEq, ::prost::Message)]
392pub struct CloseSurfaceSessionCommand {}
393#[derive(Clone, PartialEq, ::prost::Message)]
394pub struct SurfaceSessionEvent {
395 #[prost(string, tag = "1")]
396 pub session_id: ::prost::alloc::string::String,
397 #[prost(oneof = "surface_session_event::Event", tags = "2, 3, 4, 5, 6, 7, 8, 9")]
398 pub event: ::core::option::Option<surface_session_event::Event>,
399}
400pub mod surface_session_event {
402 #[derive(Clone, PartialEq, ::prost::Oneof)]
403 pub enum Event {
404 #[prost(message, tag = "2")]
405 ChromeLaunched(super::ChromeLaunchedEvent),
406 #[prost(message, tag = "3")]
407 ContextOpened(super::ContextOpenedEvent),
408 #[prost(message, tag = "4")]
409 Pong(super::SessionPongEvent),
410 #[prost(message, tag = "5")]
411 Closed(super::SurfaceSessionClosedEvent),
412 #[prost(message, tag = "6")]
413 Error(super::SurfaceSessionErrorEvent),
414 #[prost(message, tag = "7")]
415 BrowserLaunched(super::BrowserLaunchedEvent),
416 #[prost(message, tag = "8")]
417 MobileConnected(super::MobileConnectedEvent),
418 #[prost(message, tag = "9")]
419 AppLaunched(super::AppLaunchedEvent),
420 }
421}
422#[derive(Clone, PartialEq, ::prost::Message)]
423pub struct ContextOpenedEvent {
424 #[prost(string, tag = "1")]
425 pub context_session_id: ::prost::alloc::string::String,
426 #[prost(string, tag = "2")]
427 pub note: ::prost::alloc::string::String,
428}
429#[derive(Clone, PartialEq, ::prost::Message)]
430pub struct SessionPongEvent {
431 #[prost(string, tag = "1")]
432 pub message: ::prost::alloc::string::String,
433}
434#[derive(Clone, PartialEq, ::prost::Message)]
435pub struct SurfaceSessionClosedEvent {
436 #[prost(string, tag = "1")]
437 pub reason: ::prost::alloc::string::String,
438}
439#[derive(Clone, PartialEq, ::prost::Message)]
440pub struct SurfaceSessionErrorEvent {
441 #[prost(string, tag = "1")]
442 pub message: ::prost::alloc::string::String,
443}
444#[derive(Clone, PartialEq, ::prost::Message)]
445pub struct ContextSessionCommand {
446 #[prost(string, tag = "1")]
447 pub surface_session_id: ::prost::alloc::string::String,
448 #[prost(string, tag = "2")]
449 pub context_session_id: ::prost::alloc::string::String,
450 #[prost(
451 oneof = "context_session_command::Command",
452 tags = "3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26"
453 )]
454 pub command: ::core::option::Option<context_session_command::Command>,
455}
456pub mod context_session_command {
458 #[derive(Clone, PartialEq, ::prost::Oneof)]
459 pub enum Command {
460 #[prost(message, tag = "3")]
461 Ping(super::ContextSessionPingCommand),
462 #[prost(message, tag = "4")]
463 Close(super::CloseContextSessionCommand),
464 #[prost(message, tag = "5")]
465 Navigate(super::NavigatePageCommand),
466 #[prost(message, tag = "6")]
467 ClickElement(super::ClickElementCommand),
468 #[prost(message, tag = "7")]
469 CountElements(super::CountElementsCommand),
470 #[prost(message, tag = "8")]
471 HighlightElements(super::HighlightElementsCommand),
472 #[prost(message, tag = "9")]
473 FocusElement(super::FocusElementCommand),
474 #[prost(message, tag = "10")]
475 FillElement(super::FillElementCommand),
476 #[prost(message, tag = "11")]
477 HoverElement(super::HoverElementCommand),
478 #[prost(message, tag = "12")]
479 PressKey(super::PressKeyCommand),
480 #[prost(message, tag = "13")]
481 GetTextContent(super::GetTextContentCommand),
482 #[prost(message, tag = "14")]
483 GetInnerText(super::GetInnerTextCommand),
484 #[prost(message, tag = "15")]
485 WaitForSelector(super::WaitForSelectorCommand),
486 #[prost(message, tag = "16")]
487 Screenshot(super::ScreenshotCommand),
488 #[prost(message, tag = "17")]
489 AccessibilitySnapshot(super::AccessibilitySnapshotCommand),
490 #[prost(message, tag = "18")]
491 RegisterHook(super::RegisterHookCommand),
492 #[prost(message, tag = "19")]
493 WaitForHook(super::WaitForHookCommand),
494 #[prost(message, tag = "20")]
495 SetFileChooserFiles(super::SetFileChooserFilesCommand),
496 #[prost(message, tag = "21")]
497 SaveDownload(super::SaveDownloadCommand),
498 #[prost(message, tag = "22")]
499 UploadFileChunk(super::UploadFileChunkCommand),
500 #[prost(message, tag = "23")]
501 ReadFileChunk(super::ReadFileChunkCommand),
502 #[prost(message, tag = "24")]
503 SetMobileFileChooserFiles(super::SetMobileFileChooserFilesCommand),
504 #[prost(message, tag = "25")]
505 SaveMobileDownload(super::SaveMobileDownloadCommand),
506 #[prost(message, tag = "26")]
507 ResolveFrame(super::ResolveFrameCommand),
508 }
509}
510#[derive(Clone, PartialEq, ::prost::Message)]
511pub struct ContextSessionPingCommand {
512 #[prost(string, tag = "1")]
513 pub message: ::prost::alloc::string::String,
514}
515#[derive(Clone, Copy, PartialEq, ::prost::Message)]
516pub struct CloseContextSessionCommand {}
517#[derive(Clone, PartialEq, ::prost::Message)]
518pub struct ContextSessionEvent {
519 #[prost(string, tag = "1")]
520 pub context_session_id: ::prost::alloc::string::String,
521 #[prost(
522 oneof = "context_session_event::Event",
523 tags = "2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28"
524 )]
525 pub event: ::core::option::Option<context_session_event::Event>,
526}
527pub mod context_session_event {
529 #[derive(Clone, PartialEq, ::prost::Oneof)]
530 pub enum Event {
531 #[prost(message, tag = "2")]
532 Attached(super::ContextSessionAttachedEvent),
533 #[prost(message, tag = "3")]
534 Pong(super::ContextSessionPongEvent),
535 #[prost(message, tag = "4")]
536 Closed(super::ContextSessionClosedEvent),
537 #[prost(message, tag = "5")]
538 Error(super::ContextSessionErrorEvent),
539 #[prost(message, tag = "6")]
540 Navigated(super::PageNavigatedEvent),
541 #[prost(message, tag = "7")]
542 ChromiumBidiInjection(super::ChromiumBidiInjectionEvent),
543 #[prost(message, tag = "8")]
544 ElementClicked(super::ElementClickedEvent),
545 #[prost(message, tag = "9")]
546 ElementCounted(super::ElementCountedEvent),
547 #[prost(message, tag = "10")]
548 ElementsHighlighted(super::ElementsHighlightedEvent),
549 #[prost(message, tag = "11")]
550 ElementFocused(super::ElementFocusedEvent),
551 #[prost(message, tag = "12")]
552 ElementFilled(super::ElementFilledEvent),
553 #[prost(message, tag = "13")]
554 ElementHovered(super::ElementHoveredEvent),
555 #[prost(message, tag = "14")]
556 KeyPressed(super::KeyPressedEvent),
557 #[prost(message, tag = "15")]
558 TextContentResolved(super::TextContentResolvedEvent),
559 #[prost(message, tag = "16")]
560 InnerTextResolved(super::InnerTextResolvedEvent),
561 #[prost(message, tag = "17")]
562 SelectorWaitSatisfied(super::SelectorWaitSatisfiedEvent),
563 #[prost(message, tag = "18")]
564 ScreenshotCaptured(super::ScreenshotCapturedEvent),
565 #[prost(message, tag = "19")]
566 AccessibilitySnapshotCaptured(super::AccessibilitySnapshotCapturedEvent),
567 #[prost(message, tag = "20")]
568 HookRegistered(super::HookRegisteredEvent),
569 #[prost(message, tag = "21")]
570 HookCompleted(super::HookCompletedEvent),
571 #[prost(message, tag = "22")]
572 FileChooserFilesSet(super::FileChooserFilesSetEvent),
573 #[prost(message, tag = "23")]
574 DownloadSaved(super::DownloadSavedEvent),
575 #[prost(message, tag = "24")]
576 FileUploaded(super::FileUploadedEvent),
577 #[prost(message, tag = "25")]
578 FileChunk(super::FileChunkEvent),
579 #[prost(message, tag = "26")]
580 MobileFileChooserFilesSet(super::MobileFileChooserFilesSetEvent),
581 #[prost(message, tag = "27")]
582 MobileDownloadSaved(super::MobileDownloadSavedEvent),
583 #[prost(message, tag = "28")]
584 FrameResolved(super::FrameResolvedEvent),
585 }
586}
587#[derive(Clone, PartialEq, ::prost::Message)]
588pub struct ContextSessionAttachedEvent {
589 #[prost(string, tag = "1")]
590 pub note: ::prost::alloc::string::String,
591}
592#[derive(Clone, PartialEq, ::prost::Message)]
593pub struct ContextSessionPongEvent {
594 #[prost(string, tag = "1")]
595 pub message: ::prost::alloc::string::String,
596}
597#[derive(Clone, PartialEq, ::prost::Message)]
598pub struct ContextSessionClosedEvent {
599 #[prost(string, tag = "1")]
600 pub reason: ::prost::alloc::string::String,
601}
602#[derive(Clone, PartialEq, ::prost::Message)]
603pub struct ContextSessionErrorEvent {
604 #[prost(string, tag = "1")]
605 pub message: ::prost::alloc::string::String,
606}
607#[derive(Clone, Copy, PartialEq, ::prost::Message)]
608pub struct RegisterHookCommand {
609 #[prost(oneof = "register_hook_command::Hook", tags = "1, 2, 3, 4, 5")]
610 pub hook: ::core::option::Option<register_hook_command::Hook>,
611}
612pub mod register_hook_command {
614 #[derive(Clone, Copy, PartialEq, ::prost::Oneof)]
615 pub enum Hook {
616 #[prost(message, tag = "1")]
617 NewPage(super::RegisterNewPageHook),
618 #[prost(message, tag = "2")]
619 FileChooser(super::RegisterFileChooserHook),
620 #[prost(message, tag = "3")]
621 Download(super::RegisterDownloadHook),
622 #[prost(message, tag = "4")]
623 MobileFileChooser(super::RegisterMobileFileChooserHook),
624 #[prost(message, tag = "5")]
625 MobileDownload(super::RegisterMobileDownloadHook),
626 }
627}
628#[derive(Clone, PartialEq, ::prost::Message)]
629pub struct WaitForHookCommand {
630 #[prost(string, tag = "1")]
631 pub hook_id: ::prost::alloc::string::String,
632 #[prost(message, optional, tag = "2")]
633 pub retry_options: ::core::option::Option<CommandRetryOptions>,
634}
635#[derive(Clone, PartialEq, ::prost::Message)]
636pub struct HookRegisteredEvent {
637 #[prost(string, tag = "1")]
638 pub hook_id: ::prost::alloc::string::String,
639}
640#[derive(Clone, PartialEq, ::prost::Message)]
641pub struct HookCompletedEvent {
642 #[prost(string, tag = "1")]
643 pub hook_id: ::prost::alloc::string::String,
644 #[prost(oneof = "hook_completed_event::Result", tags = "2, 3, 4, 5, 6")]
645 pub result: ::core::option::Option<hook_completed_event::Result>,
646}
647pub mod hook_completed_event {
649 #[derive(Clone, PartialEq, ::prost::Oneof)]
650 pub enum Result {
651 #[prost(message, tag = "2")]
652 NewPage(super::NewPageHookResult),
653 #[prost(message, tag = "3")]
654 FileChooser(super::FileChooserHookResult),
655 #[prost(message, tag = "4")]
656 Download(super::DownloadHookResult),
657 #[prost(message, tag = "5")]
658 MobileFileChooser(super::MobileFileChooserHookResult),
659 #[prost(message, tag = "6")]
660 MobileDownload(super::MobileDownloadHookResult),
661 }
662}
663#[derive(Clone, PartialEq, ::prost::Message)]
664pub struct UploadFileChunkCommand {
665 #[prost(string, tag = "1")]
666 pub transfer_id: ::prost::alloc::string::String,
667 #[prost(string, tag = "2")]
668 pub name: ::prost::alloc::string::String,
669 #[prost(uint64, tag = "3")]
670 pub offset: u64,
671 #[prost(bytes = "vec", tag = "4")]
672 pub data: ::prost::alloc::vec::Vec<u8>,
673 #[prost(bool, tag = "5")]
674 pub last: bool,
675}
676#[derive(Clone, PartialEq, ::prost::Message)]
677pub struct FileUploadedEvent {
678 #[prost(string, tag = "1")]
679 pub transfer_id: ::prost::alloc::string::String,
680 #[prost(string, tag = "2")]
681 pub file_id: ::prost::alloc::string::String,
682 #[prost(string, tag = "3")]
683 pub name: ::prost::alloc::string::String,
684 #[prost(uint64, tag = "4")]
685 pub size: u64,
686}
687#[derive(Clone, PartialEq, ::prost::Message)]
688pub struct ReadFileChunkCommand {
689 #[prost(string, tag = "1")]
690 pub file_id: ::prost::alloc::string::String,
691 #[prost(uint64, tag = "2")]
692 pub offset: u64,
693 #[prost(uint32, tag = "3")]
694 pub max_bytes: u32,
695}
696#[derive(Clone, PartialEq, ::prost::Message)]
697pub struct FileChunkEvent {
698 #[prost(string, tag = "1")]
699 pub file_id: ::prost::alloc::string::String,
700 #[prost(uint64, tag = "2")]
701 pub offset: u64,
702 #[prost(bytes = "vec", tag = "3")]
703 pub data: ::prost::alloc::vec::Vec<u8>,
704 #[prost(bool, tag = "4")]
705 pub last: bool,
706}
707#[derive(Clone, PartialEq, ::prost::Message)]
708pub struct NavigatePageCommand {
709 #[prost(string, tag = "1")]
710 pub url: ::prost::alloc::string::String,
711 #[prost(message, optional, tag = "2")]
712 pub retry_options: ::core::option::Option<CommandRetryOptions>,
713}
714#[derive(Clone, PartialEq, ::prost::Message)]
715pub struct ClickElementCommand {
716 #[prost(string, tag = "1")]
717 pub css_selector: ::prost::alloc::string::String,
718 #[prost(message, optional, tag = "2")]
719 pub retry_options: ::core::option::Option<CommandRetryOptions>,
720}
721#[derive(Clone, PartialEq, ::prost::Message)]
722pub struct CountElementsCommand {
723 #[prost(string, tag = "1")]
724 pub css_selector: ::prost::alloc::string::String,
725 #[prost(message, optional, tag = "2")]
726 pub retry_options: ::core::option::Option<CommandRetryOptions>,
727}
728#[derive(Clone, PartialEq, ::prost::Message)]
729pub struct HighlightElementsCommand {
730 #[prost(string, tag = "1")]
731 pub css_selector: ::prost::alloc::string::String,
732 #[prost(uint32, optional, tag = "2")]
733 pub duration_ms: ::core::option::Option<u32>,
734 #[prost(message, optional, tag = "3")]
735 pub retry_options: ::core::option::Option<CommandRetryOptions>,
736}
737#[derive(Clone, PartialEq, ::prost::Message)]
738pub struct FocusElementCommand {
739 #[prost(string, tag = "1")]
740 pub css_selector: ::prost::alloc::string::String,
741 #[prost(message, optional, tag = "2")]
742 pub retry_options: ::core::option::Option<CommandRetryOptions>,
743}
744#[derive(Clone, PartialEq, ::prost::Message)]
745pub struct FillElementCommand {
746 #[prost(string, tag = "1")]
747 pub css_selector: ::prost::alloc::string::String,
748 #[prost(string, tag = "2")]
749 pub value: ::prost::alloc::string::String,
750 #[prost(message, optional, tag = "3")]
751 pub retry_options: ::core::option::Option<CommandRetryOptions>,
752}
753#[derive(Clone, PartialEq, ::prost::Message)]
754pub struct HoverElementCommand {
755 #[prost(string, tag = "1")]
756 pub css_selector: ::prost::alloc::string::String,
757 #[prost(message, optional, tag = "2")]
758 pub retry_options: ::core::option::Option<CommandRetryOptions>,
759}
760#[derive(Clone, PartialEq, ::prost::Message)]
761pub struct PressKeyCommand {
762 #[prost(string, tag = "1")]
763 pub css_selector: ::prost::alloc::string::String,
764 #[prost(string, tag = "2")]
765 pub key: ::prost::alloc::string::String,
766 #[prost(string, optional, tag = "3")]
767 pub text: ::core::option::Option<::prost::alloc::string::String>,
768 #[prost(message, optional, tag = "4")]
769 pub retry_options: ::core::option::Option<CommandRetryOptions>,
770}
771#[derive(Clone, PartialEq, ::prost::Message)]
772pub struct GetTextContentCommand {
773 #[prost(string, tag = "1")]
774 pub css_selector: ::prost::alloc::string::String,
775 #[prost(message, optional, tag = "2")]
776 pub retry_options: ::core::option::Option<CommandRetryOptions>,
777}
778#[derive(Clone, PartialEq, ::prost::Message)]
779pub struct GetInnerTextCommand {
780 #[prost(string, tag = "1")]
781 pub css_selector: ::prost::alloc::string::String,
782 #[prost(message, optional, tag = "2")]
783 pub retry_options: ::core::option::Option<CommandRetryOptions>,
784}
785#[derive(Clone, PartialEq, ::prost::Message)]
786pub struct WaitForSelectorCommand {
787 #[prost(string, tag = "1")]
788 pub css_selector: ::prost::alloc::string::String,
789 #[prost(bool, optional, tag = "2")]
790 pub visible: ::core::option::Option<bool>,
791 #[prost(message, optional, tag = "3")]
792 pub retry_options: ::core::option::Option<CommandRetryOptions>,
793}
794#[derive(Clone, Copy, PartialEq, ::prost::Message)]
795pub struct ScreenshotCommand {
796 #[prost(message, optional, tag = "1")]
797 pub retry_options: ::core::option::Option<CommandRetryOptions>,
798 #[prost(bool, optional, tag = "2")]
799 pub full_page: ::core::option::Option<bool>,
800}
801#[derive(Clone, PartialEq, ::prost::Message)]
802pub struct PageNavigatedEvent {
803 #[prost(string, tag = "1")]
804 pub url: ::prost::alloc::string::String,
805 #[prost(string, tag = "2")]
806 pub note: ::prost::alloc::string::String,
807}
808#[derive(Clone, PartialEq, ::prost::Message)]
809pub struct ChromiumBidiInjectionEvent {
810 #[prost(string, tag = "1")]
811 pub note: ::prost::alloc::string::String,
812 #[prost(string, tag = "2")]
813 pub bidi_session_id: ::prost::alloc::string::String,
814 #[prost(string, tag = "3")]
815 pub mapper_target_id: ::prost::alloc::string::String,
816 #[prost(string, tag = "4")]
817 pub mapper_session_id: ::prost::alloc::string::String,
818 #[prost(string, tag = "5")]
819 pub package_version: ::prost::alloc::string::String,
820}
821#[derive(Clone, PartialEq, ::prost::Message)]
822pub struct ElementClickedEvent {
823 #[prost(string, tag = "1")]
824 pub css_selector: ::prost::alloc::string::String,
825 #[prost(string, tag = "2")]
826 pub note: ::prost::alloc::string::String,
827 #[prost(string, tag = "3")]
828 pub bidi_session_id: ::prost::alloc::string::String,
829}
830#[derive(Clone, PartialEq, ::prost::Message)]
831pub struct ElementCountedEvent {
832 #[prost(string, tag = "1")]
833 pub css_selector: ::prost::alloc::string::String,
834 #[prost(uint32, tag = "2")]
835 pub count: u32,
836 #[prost(string, tag = "3")]
837 pub note: ::prost::alloc::string::String,
838}
839#[derive(Clone, PartialEq, ::prost::Message)]
840pub struct ElementsHighlightedEvent {
841 #[prost(string, tag = "1")]
842 pub css_selector: ::prost::alloc::string::String,
843 #[prost(uint32, tag = "2")]
844 pub count: u32,
845 #[prost(string, tag = "3")]
846 pub note: ::prost::alloc::string::String,
847}
848#[derive(Clone, PartialEq, ::prost::Message)]
849pub struct ElementFocusedEvent {
850 #[prost(string, tag = "1")]
851 pub css_selector: ::prost::alloc::string::String,
852 #[prost(string, tag = "2")]
853 pub note: ::prost::alloc::string::String,
854}
855#[derive(Clone, PartialEq, ::prost::Message)]
856pub struct ElementFilledEvent {
857 #[prost(string, tag = "1")]
858 pub css_selector: ::prost::alloc::string::String,
859 #[prost(string, tag = "2")]
860 pub value: ::prost::alloc::string::String,
861 #[prost(string, tag = "3")]
862 pub note: ::prost::alloc::string::String,
863}
864#[derive(Clone, PartialEq, ::prost::Message)]
865pub struct ElementHoveredEvent {
866 #[prost(string, tag = "1")]
867 pub css_selector: ::prost::alloc::string::String,
868 #[prost(string, tag = "2")]
869 pub note: ::prost::alloc::string::String,
870}
871#[derive(Clone, PartialEq, ::prost::Message)]
872pub struct KeyPressedEvent {
873 #[prost(string, tag = "1")]
874 pub css_selector: ::prost::alloc::string::String,
875 #[prost(string, tag = "2")]
876 pub key: ::prost::alloc::string::String,
877 #[prost(string, tag = "3")]
878 pub note: ::prost::alloc::string::String,
879}
880#[derive(Clone, PartialEq, ::prost::Message)]
881pub struct TextContentResolvedEvent {
882 #[prost(string, tag = "1")]
883 pub css_selector: ::prost::alloc::string::String,
884 #[prost(string, tag = "2")]
885 pub text: ::prost::alloc::string::String,
886 #[prost(string, tag = "3")]
887 pub note: ::prost::alloc::string::String,
888}
889#[derive(Clone, PartialEq, ::prost::Message)]
890pub struct InnerTextResolvedEvent {
891 #[prost(string, tag = "1")]
892 pub css_selector: ::prost::alloc::string::String,
893 #[prost(string, tag = "2")]
894 pub text: ::prost::alloc::string::String,
895 #[prost(string, tag = "3")]
896 pub note: ::prost::alloc::string::String,
897}
898#[derive(Clone, PartialEq, ::prost::Message)]
899pub struct SelectorWaitSatisfiedEvent {
900 #[prost(string, tag = "1")]
901 pub css_selector: ::prost::alloc::string::String,
902 #[prost(bool, tag = "2")]
903 pub visible: bool,
904 #[prost(string, tag = "3")]
905 pub note: ::prost::alloc::string::String,
906}
907#[derive(Clone, PartialEq, ::prost::Message)]
908pub struct ScreenshotCapturedEvent {
909 #[prost(bytes = "vec", tag = "1")]
910 pub png_data: ::prost::alloc::vec::Vec<u8>,
911 #[prost(string, tag = "2")]
912 pub note: ::prost::alloc::string::String,
913}
914#[derive(Clone, PartialEq, ::prost::Message)]
916pub struct AccessibilitySnapshotCommand {
917 #[prost(string, tag = "3")]
920 pub mode: ::prost::alloc::string::String,
921 #[prost(string, tag = "1")]
922 pub format: ::prost::alloc::string::String,
923 #[prost(message, optional, tag = "2")]
924 pub retry_options: ::core::option::Option<CommandRetryOptions>,
925}
926#[derive(Clone, PartialEq, ::prost::Message)]
928pub struct AccessibilitySnapshotCapturedEvent {
929 #[prost(string, tag = "1")]
930 pub snapshot: ::prost::alloc::string::String,
931 #[prost(string, tag = "2")]
932 pub format: ::prost::alloc::string::String,
933}
934pub mod engine_service_client {
936 #![allow(
937 unused_variables,
938 dead_code,
939 missing_docs,
940 clippy::wildcard_imports,
941 clippy::let_unit_value,
942 )]
943 use tonic::codegen::*;
944 use tonic::codegen::http::Uri;
945 #[derive(Debug, Clone)]
946 pub struct EngineServiceClient<T> {
947 inner: tonic::client::Grpc<T>,
948 }
949 impl EngineServiceClient<tonic::transport::Channel> {
950 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
952 where
953 D: TryInto<tonic::transport::Endpoint>,
954 D::Error: Into<StdError>,
955 {
956 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
957 Ok(Self::new(conn))
958 }
959 }
960 impl<T> EngineServiceClient<T>
961 where
962 T: tonic::client::GrpcService<tonic::body::BoxBody>,
963 T::Error: Into<StdError>,
964 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
965 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
966 {
967 pub fn new(inner: T) -> Self {
968 let inner = tonic::client::Grpc::new(inner);
969 Self { inner }
970 }
971 pub fn with_origin(inner: T, origin: Uri) -> Self {
972 let inner = tonic::client::Grpc::with_origin(inner, origin);
973 Self { inner }
974 }
975 pub fn with_interceptor<F>(
976 inner: T,
977 interceptor: F,
978 ) -> EngineServiceClient<InterceptedService<T, F>>
979 where
980 F: tonic::service::Interceptor,
981 T::ResponseBody: Default,
982 T: tonic::codegen::Service<
983 http::Request<tonic::body::BoxBody>,
984 Response = http::Response<
985 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
986 >,
987 >,
988 <T as tonic::codegen::Service<
989 http::Request<tonic::body::BoxBody>,
990 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
991 {
992 EngineServiceClient::new(InterceptedService::new(inner, interceptor))
993 }
994 #[must_use]
999 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1000 self.inner = self.inner.send_compressed(encoding);
1001 self
1002 }
1003 #[must_use]
1005 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1006 self.inner = self.inner.accept_compressed(encoding);
1007 self
1008 }
1009 #[must_use]
1013 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1014 self.inner = self.inner.max_decoding_message_size(limit);
1015 self
1016 }
1017 #[must_use]
1021 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1022 self.inner = self.inner.max_encoding_message_size(limit);
1023 self
1024 }
1025 pub async fn ping(
1026 &mut self,
1027 request: impl tonic::IntoRequest<super::PingRequest>,
1028 ) -> std::result::Result<tonic::Response<super::PingResponse>, tonic::Status> {
1029 self.inner
1030 .ready()
1031 .await
1032 .map_err(|e| {
1033 tonic::Status::unknown(
1034 format!("Service was not ready: {}", e.into()),
1035 )
1036 })?;
1037 let codec = tonic::codec::ProstCodec::default();
1038 let path = http::uri::PathAndQuery::from_static(
1039 "/allwright.engine.v1.EngineService/Ping",
1040 );
1041 let mut req = request.into_request();
1042 req.extensions_mut()
1043 .insert(GrpcMethod::new("allwright.engine.v1.EngineService", "Ping"));
1044 self.inner.unary(req, path, codec).await
1045 }
1046 pub async fn surface_session(
1047 &mut self,
1048 request: impl tonic::IntoStreamingRequest<
1049 Message = super::SurfaceSessionCommand,
1050 >,
1051 ) -> std::result::Result<
1052 tonic::Response<tonic::codec::Streaming<super::SurfaceSessionEvent>>,
1053 tonic::Status,
1054 > {
1055 self.inner
1056 .ready()
1057 .await
1058 .map_err(|e| {
1059 tonic::Status::unknown(
1060 format!("Service was not ready: {}", e.into()),
1061 )
1062 })?;
1063 let codec = tonic::codec::ProstCodec::default();
1064 let path = http::uri::PathAndQuery::from_static(
1065 "/allwright.engine.v1.EngineService/SurfaceSession",
1066 );
1067 let mut req = request.into_streaming_request();
1068 req.extensions_mut()
1069 .insert(
1070 GrpcMethod::new(
1071 "allwright.engine.v1.EngineService",
1072 "SurfaceSession",
1073 ),
1074 );
1075 self.inner.streaming(req, path, codec).await
1076 }
1077 pub async fn context_session(
1078 &mut self,
1079 request: impl tonic::IntoStreamingRequest<
1080 Message = super::ContextSessionCommand,
1081 >,
1082 ) -> std::result::Result<
1083 tonic::Response<tonic::codec::Streaming<super::ContextSessionEvent>>,
1084 tonic::Status,
1085 > {
1086 self.inner
1087 .ready()
1088 .await
1089 .map_err(|e| {
1090 tonic::Status::unknown(
1091 format!("Service was not ready: {}", e.into()),
1092 )
1093 })?;
1094 let codec = tonic::codec::ProstCodec::default();
1095 let path = http::uri::PathAndQuery::from_static(
1096 "/allwright.engine.v1.EngineService/ContextSession",
1097 );
1098 let mut req = request.into_streaming_request();
1099 req.extensions_mut()
1100 .insert(
1101 GrpcMethod::new(
1102 "allwright.engine.v1.EngineService",
1103 "ContextSession",
1104 ),
1105 );
1106 self.inner.streaming(req, path, codec).await
1107 }
1108 }
1109}
1110pub mod engine_service_server {
1112 #![allow(
1113 unused_variables,
1114 dead_code,
1115 missing_docs,
1116 clippy::wildcard_imports,
1117 clippy::let_unit_value,
1118 )]
1119 use tonic::codegen::*;
1120 #[async_trait]
1122 pub trait EngineService: std::marker::Send + std::marker::Sync + 'static {
1123 async fn ping(
1124 &self,
1125 request: tonic::Request<super::PingRequest>,
1126 ) -> std::result::Result<tonic::Response<super::PingResponse>, tonic::Status>;
1127 type SurfaceSessionStream: tonic::codegen::tokio_stream::Stream<
1129 Item = std::result::Result<super::SurfaceSessionEvent, tonic::Status>,
1130 >
1131 + std::marker::Send
1132 + 'static;
1133 async fn surface_session(
1134 &self,
1135 request: tonic::Request<tonic::Streaming<super::SurfaceSessionCommand>>,
1136 ) -> std::result::Result<
1137 tonic::Response<Self::SurfaceSessionStream>,
1138 tonic::Status,
1139 >;
1140 type ContextSessionStream: tonic::codegen::tokio_stream::Stream<
1142 Item = std::result::Result<super::ContextSessionEvent, tonic::Status>,
1143 >
1144 + std::marker::Send
1145 + 'static;
1146 async fn context_session(
1147 &self,
1148 request: tonic::Request<tonic::Streaming<super::ContextSessionCommand>>,
1149 ) -> std::result::Result<
1150 tonic::Response<Self::ContextSessionStream>,
1151 tonic::Status,
1152 >;
1153 }
1154 #[derive(Debug)]
1155 pub struct EngineServiceServer<T> {
1156 inner: Arc<T>,
1157 accept_compression_encodings: EnabledCompressionEncodings,
1158 send_compression_encodings: EnabledCompressionEncodings,
1159 max_decoding_message_size: Option<usize>,
1160 max_encoding_message_size: Option<usize>,
1161 }
1162 impl<T> EngineServiceServer<T> {
1163 pub fn new(inner: T) -> Self {
1164 Self::from_arc(Arc::new(inner))
1165 }
1166 pub fn from_arc(inner: Arc<T>) -> Self {
1167 Self {
1168 inner,
1169 accept_compression_encodings: Default::default(),
1170 send_compression_encodings: Default::default(),
1171 max_decoding_message_size: None,
1172 max_encoding_message_size: None,
1173 }
1174 }
1175 pub fn with_interceptor<F>(
1176 inner: T,
1177 interceptor: F,
1178 ) -> InterceptedService<Self, F>
1179 where
1180 F: tonic::service::Interceptor,
1181 {
1182 InterceptedService::new(Self::new(inner), interceptor)
1183 }
1184 #[must_use]
1186 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
1187 self.accept_compression_encodings.enable(encoding);
1188 self
1189 }
1190 #[must_use]
1192 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
1193 self.send_compression_encodings.enable(encoding);
1194 self
1195 }
1196 #[must_use]
1200 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
1201 self.max_decoding_message_size = Some(limit);
1202 self
1203 }
1204 #[must_use]
1208 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
1209 self.max_encoding_message_size = Some(limit);
1210 self
1211 }
1212 }
1213 impl<T, B> tonic::codegen::Service<http::Request<B>> for EngineServiceServer<T>
1214 where
1215 T: EngineService,
1216 B: Body + std::marker::Send + 'static,
1217 B::Error: Into<StdError> + std::marker::Send + 'static,
1218 {
1219 type Response = http::Response<tonic::body::BoxBody>;
1220 type Error = std::convert::Infallible;
1221 type Future = BoxFuture<Self::Response, Self::Error>;
1222 fn poll_ready(
1223 &mut self,
1224 _cx: &mut Context<'_>,
1225 ) -> Poll<std::result::Result<(), Self::Error>> {
1226 Poll::Ready(Ok(()))
1227 }
1228 fn call(&mut self, req: http::Request<B>) -> Self::Future {
1229 match req.uri().path() {
1230 "/allwright.engine.v1.EngineService/Ping" => {
1231 #[allow(non_camel_case_types)]
1232 struct PingSvc<T: EngineService>(pub Arc<T>);
1233 impl<
1234 T: EngineService,
1235 > tonic::server::UnaryService<super::PingRequest> for PingSvc<T> {
1236 type Response = super::PingResponse;
1237 type Future = BoxFuture<
1238 tonic::Response<Self::Response>,
1239 tonic::Status,
1240 >;
1241 fn call(
1242 &mut self,
1243 request: tonic::Request<super::PingRequest>,
1244 ) -> Self::Future {
1245 let inner = Arc::clone(&self.0);
1246 let fut = async move {
1247 <T as EngineService>::ping(&inner, request).await
1248 };
1249 Box::pin(fut)
1250 }
1251 }
1252 let accept_compression_encodings = self.accept_compression_encodings;
1253 let send_compression_encodings = self.send_compression_encodings;
1254 let max_decoding_message_size = self.max_decoding_message_size;
1255 let max_encoding_message_size = self.max_encoding_message_size;
1256 let inner = self.inner.clone();
1257 let fut = async move {
1258 let method = PingSvc(inner);
1259 let codec = tonic::codec::ProstCodec::default();
1260 let mut grpc = tonic::server::Grpc::new(codec)
1261 .apply_compression_config(
1262 accept_compression_encodings,
1263 send_compression_encodings,
1264 )
1265 .apply_max_message_size_config(
1266 max_decoding_message_size,
1267 max_encoding_message_size,
1268 );
1269 let res = grpc.unary(method, req).await;
1270 Ok(res)
1271 };
1272 Box::pin(fut)
1273 }
1274 "/allwright.engine.v1.EngineService/SurfaceSession" => {
1275 #[allow(non_camel_case_types)]
1276 struct SurfaceSessionSvc<T: EngineService>(pub Arc<T>);
1277 impl<
1278 T: EngineService,
1279 > tonic::server::StreamingService<super::SurfaceSessionCommand>
1280 for SurfaceSessionSvc<T> {
1281 type Response = super::SurfaceSessionEvent;
1282 type ResponseStream = T::SurfaceSessionStream;
1283 type Future = BoxFuture<
1284 tonic::Response<Self::ResponseStream>,
1285 tonic::Status,
1286 >;
1287 fn call(
1288 &mut self,
1289 request: tonic::Request<
1290 tonic::Streaming<super::SurfaceSessionCommand>,
1291 >,
1292 ) -> Self::Future {
1293 let inner = Arc::clone(&self.0);
1294 let fut = async move {
1295 <T as EngineService>::surface_session(&inner, request).await
1296 };
1297 Box::pin(fut)
1298 }
1299 }
1300 let accept_compression_encodings = self.accept_compression_encodings;
1301 let send_compression_encodings = self.send_compression_encodings;
1302 let max_decoding_message_size = self.max_decoding_message_size;
1303 let max_encoding_message_size = self.max_encoding_message_size;
1304 let inner = self.inner.clone();
1305 let fut = async move {
1306 let method = SurfaceSessionSvc(inner);
1307 let codec = tonic::codec::ProstCodec::default();
1308 let mut grpc = tonic::server::Grpc::new(codec)
1309 .apply_compression_config(
1310 accept_compression_encodings,
1311 send_compression_encodings,
1312 )
1313 .apply_max_message_size_config(
1314 max_decoding_message_size,
1315 max_encoding_message_size,
1316 );
1317 let res = grpc.streaming(method, req).await;
1318 Ok(res)
1319 };
1320 Box::pin(fut)
1321 }
1322 "/allwright.engine.v1.EngineService/ContextSession" => {
1323 #[allow(non_camel_case_types)]
1324 struct ContextSessionSvc<T: EngineService>(pub Arc<T>);
1325 impl<
1326 T: EngineService,
1327 > tonic::server::StreamingService<super::ContextSessionCommand>
1328 for ContextSessionSvc<T> {
1329 type Response = super::ContextSessionEvent;
1330 type ResponseStream = T::ContextSessionStream;
1331 type Future = BoxFuture<
1332 tonic::Response<Self::ResponseStream>,
1333 tonic::Status,
1334 >;
1335 fn call(
1336 &mut self,
1337 request: tonic::Request<
1338 tonic::Streaming<super::ContextSessionCommand>,
1339 >,
1340 ) -> Self::Future {
1341 let inner = Arc::clone(&self.0);
1342 let fut = async move {
1343 <T as EngineService>::context_session(&inner, request).await
1344 };
1345 Box::pin(fut)
1346 }
1347 }
1348 let accept_compression_encodings = self.accept_compression_encodings;
1349 let send_compression_encodings = self.send_compression_encodings;
1350 let max_decoding_message_size = self.max_decoding_message_size;
1351 let max_encoding_message_size = self.max_encoding_message_size;
1352 let inner = self.inner.clone();
1353 let fut = async move {
1354 let method = ContextSessionSvc(inner);
1355 let codec = tonic::codec::ProstCodec::default();
1356 let mut grpc = tonic::server::Grpc::new(codec)
1357 .apply_compression_config(
1358 accept_compression_encodings,
1359 send_compression_encodings,
1360 )
1361 .apply_max_message_size_config(
1362 max_decoding_message_size,
1363 max_encoding_message_size,
1364 );
1365 let res = grpc.streaming(method, req).await;
1366 Ok(res)
1367 };
1368 Box::pin(fut)
1369 }
1370 _ => {
1371 Box::pin(async move {
1372 let mut response = http::Response::new(empty_body());
1373 let headers = response.headers_mut();
1374 headers
1375 .insert(
1376 tonic::Status::GRPC_STATUS,
1377 (tonic::Code::Unimplemented as i32).into(),
1378 );
1379 headers
1380 .insert(
1381 http::header::CONTENT_TYPE,
1382 tonic::metadata::GRPC_CONTENT_TYPE,
1383 );
1384 Ok(response)
1385 })
1386 }
1387 }
1388 }
1389 }
1390 impl<T> Clone for EngineServiceServer<T> {
1391 fn clone(&self) -> Self {
1392 let inner = self.inner.clone();
1393 Self {
1394 inner,
1395 accept_compression_encodings: self.accept_compression_encodings,
1396 send_compression_encodings: self.send_compression_encodings,
1397 max_decoding_message_size: self.max_decoding_message_size,
1398 max_encoding_message_size: self.max_encoding_message_size,
1399 }
1400 }
1401 }
1402 pub const SERVICE_NAME: &str = "allwright.engine.v1.EngineService";
1404 impl<T> tonic::server::NamedService for EngineServiceServer<T> {
1405 const NAME: &'static str = SERVICE_NAME;
1406 }
1407}