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 LaunchBrowserCommand {
20 #[prost(enumeration = "BrowserKind", tag = "1")]
21 pub browser_kind: i32,
22 #[prost(string, optional, tag = "2")]
23 pub browser_binary: ::core::option::Option<::prost::alloc::string::String>,
24 #[prost(message, optional, tag = "3")]
25 pub retry_options: ::core::option::Option<CommandRetryOptions>,
26}
27#[derive(Clone, PartialEq, ::prost::Message)]
28pub struct BrowserLaunchedEvent {
29 #[prost(enumeration = "BrowserKind", tag = "1")]
30 pub browser_kind: i32,
31 #[prost(string, tag = "2")]
32 pub browser: ::prost::alloc::string::String,
33 #[prost(string, tag = "3")]
34 pub note: ::prost::alloc::string::String,
35 #[prost(string, tag = "4")]
36 pub user_data_dir: ::prost::alloc::string::String,
37 #[prost(string, tag = "5")]
38 pub initial_tab_session_id: ::prost::alloc::string::String,
39}
40#[derive(Clone, PartialEq, ::prost::Message)]
41pub struct LaunchChromeCommand {
42 #[prost(string, optional, tag = "1")]
43 pub chrome_binary: ::core::option::Option<::prost::alloc::string::String>,
44 #[prost(message, optional, tag = "2")]
45 pub retry_options: ::core::option::Option<CommandRetryOptions>,
46}
47#[derive(Clone, PartialEq, ::prost::Message)]
48pub struct ChromeLaunchedEvent {
49 #[prost(string, tag = "1")]
50 pub browser: ::prost::alloc::string::String,
51 #[prost(string, tag = "2")]
52 pub note: ::prost::alloc::string::String,
53 #[prost(string, tag = "3")]
54 pub cdp_websocket_url: ::prost::alloc::string::String,
55 #[prost(string, tag = "4")]
56 pub user_data_dir: ::prost::alloc::string::String,
57 #[prost(string, tag = "5")]
58 pub initial_tab_session_id: ::prost::alloc::string::String,
59}
60#[derive(Clone, PartialEq, ::prost::Message)]
61pub struct NavigateTabCommand {
62 #[prost(string, tag = "1")]
63 pub url: ::prost::alloc::string::String,
64 #[prost(message, optional, tag = "2")]
65 pub retry_options: ::core::option::Option<CommandRetryOptions>,
66}
67#[derive(Clone, PartialEq, ::prost::Message)]
68pub struct ClickElementCommand {
69 #[prost(string, tag = "1")]
70 pub css_selector: ::prost::alloc::string::String,
71 #[prost(message, optional, tag = "2")]
72 pub retry_options: ::core::option::Option<CommandRetryOptions>,
73}
74#[derive(Clone, PartialEq, ::prost::Message)]
75pub struct CountElementsCommand {
76 #[prost(string, tag = "1")]
77 pub css_selector: ::prost::alloc::string::String,
78 #[prost(message, optional, tag = "2")]
79 pub retry_options: ::core::option::Option<CommandRetryOptions>,
80}
81#[derive(Clone, PartialEq, ::prost::Message)]
82pub struct HighlightElementsCommand {
83 #[prost(string, tag = "1")]
84 pub css_selector: ::prost::alloc::string::String,
85 #[prost(uint32, optional, tag = "2")]
86 pub duration_ms: ::core::option::Option<u32>,
87 #[prost(message, optional, tag = "3")]
88 pub retry_options: ::core::option::Option<CommandRetryOptions>,
89}
90#[derive(Clone, PartialEq, ::prost::Message)]
91pub struct FocusElementCommand {
92 #[prost(string, tag = "1")]
93 pub css_selector: ::prost::alloc::string::String,
94 #[prost(message, optional, tag = "2")]
95 pub retry_options: ::core::option::Option<CommandRetryOptions>,
96}
97#[derive(Clone, PartialEq, ::prost::Message)]
98pub struct FillElementCommand {
99 #[prost(string, tag = "1")]
100 pub css_selector: ::prost::alloc::string::String,
101 #[prost(string, tag = "2")]
102 pub value: ::prost::alloc::string::String,
103 #[prost(message, optional, tag = "3")]
104 pub retry_options: ::core::option::Option<CommandRetryOptions>,
105}
106#[derive(Clone, PartialEq, ::prost::Message)]
107pub struct HoverElementCommand {
108 #[prost(string, tag = "1")]
109 pub css_selector: ::prost::alloc::string::String,
110 #[prost(message, optional, tag = "2")]
111 pub retry_options: ::core::option::Option<CommandRetryOptions>,
112}
113#[derive(Clone, PartialEq, ::prost::Message)]
114pub struct PressKeyCommand {
115 #[prost(string, tag = "1")]
116 pub css_selector: ::prost::alloc::string::String,
117 #[prost(string, tag = "2")]
118 pub key: ::prost::alloc::string::String,
119 #[prost(string, optional, tag = "3")]
120 pub text: ::core::option::Option<::prost::alloc::string::String>,
121 #[prost(message, optional, tag = "4")]
122 pub retry_options: ::core::option::Option<CommandRetryOptions>,
123}
124#[derive(Clone, PartialEq, ::prost::Message)]
125pub struct GetTextContentCommand {
126 #[prost(string, tag = "1")]
127 pub css_selector: ::prost::alloc::string::String,
128 #[prost(message, optional, tag = "2")]
129 pub retry_options: ::core::option::Option<CommandRetryOptions>,
130}
131#[derive(Clone, PartialEq, ::prost::Message)]
132pub struct GetInnerTextCommand {
133 #[prost(string, tag = "1")]
134 pub css_selector: ::prost::alloc::string::String,
135 #[prost(message, optional, tag = "2")]
136 pub retry_options: ::core::option::Option<CommandRetryOptions>,
137}
138#[derive(Clone, PartialEq, ::prost::Message)]
139pub struct WaitForSelectorCommand {
140 #[prost(string, tag = "1")]
141 pub css_selector: ::prost::alloc::string::String,
142 #[prost(bool, optional, tag = "2")]
143 pub visible: ::core::option::Option<bool>,
144 #[prost(message, optional, tag = "3")]
145 pub retry_options: ::core::option::Option<CommandRetryOptions>,
146}
147#[derive(Clone, PartialEq, ::prost::Message)]
148pub struct TabNavigatedEvent {
149 #[prost(string, tag = "1")]
150 pub url: ::prost::alloc::string::String,
151 #[prost(string, tag = "2")]
152 pub note: ::prost::alloc::string::String,
153}
154#[derive(Clone, PartialEq, ::prost::Message)]
155pub struct ChromiumBidiInjectionEvent {
156 #[prost(string, tag = "1")]
157 pub note: ::prost::alloc::string::String,
158 #[prost(string, tag = "2")]
159 pub bidi_session_id: ::prost::alloc::string::String,
160 #[prost(string, tag = "3")]
161 pub mapper_target_id: ::prost::alloc::string::String,
162 #[prost(string, tag = "4")]
163 pub mapper_session_id: ::prost::alloc::string::String,
164 #[prost(string, tag = "5")]
165 pub package_version: ::prost::alloc::string::String,
166}
167#[derive(Clone, PartialEq, ::prost::Message)]
168pub struct ElementClickedEvent {
169 #[prost(string, tag = "1")]
170 pub css_selector: ::prost::alloc::string::String,
171 #[prost(string, tag = "2")]
172 pub note: ::prost::alloc::string::String,
173 #[prost(string, tag = "3")]
174 pub bidi_session_id: ::prost::alloc::string::String,
175}
176#[derive(Clone, PartialEq, ::prost::Message)]
177pub struct ElementCountedEvent {
178 #[prost(string, tag = "1")]
179 pub css_selector: ::prost::alloc::string::String,
180 #[prost(uint32, tag = "2")]
181 pub count: u32,
182 #[prost(string, tag = "3")]
183 pub note: ::prost::alloc::string::String,
184}
185#[derive(Clone, PartialEq, ::prost::Message)]
186pub struct ElementsHighlightedEvent {
187 #[prost(string, tag = "1")]
188 pub css_selector: ::prost::alloc::string::String,
189 #[prost(uint32, tag = "2")]
190 pub count: u32,
191 #[prost(string, tag = "3")]
192 pub note: ::prost::alloc::string::String,
193}
194#[derive(Clone, PartialEq, ::prost::Message)]
195pub struct ElementFocusedEvent {
196 #[prost(string, tag = "1")]
197 pub css_selector: ::prost::alloc::string::String,
198 #[prost(string, tag = "2")]
199 pub note: ::prost::alloc::string::String,
200}
201#[derive(Clone, PartialEq, ::prost::Message)]
202pub struct ElementFilledEvent {
203 #[prost(string, tag = "1")]
204 pub css_selector: ::prost::alloc::string::String,
205 #[prost(string, tag = "2")]
206 pub value: ::prost::alloc::string::String,
207 #[prost(string, tag = "3")]
208 pub note: ::prost::alloc::string::String,
209}
210#[derive(Clone, PartialEq, ::prost::Message)]
211pub struct ElementHoveredEvent {
212 #[prost(string, tag = "1")]
213 pub css_selector: ::prost::alloc::string::String,
214 #[prost(string, tag = "2")]
215 pub note: ::prost::alloc::string::String,
216}
217#[derive(Clone, PartialEq, ::prost::Message)]
218pub struct KeyPressedEvent {
219 #[prost(string, tag = "1")]
220 pub css_selector: ::prost::alloc::string::String,
221 #[prost(string, tag = "2")]
222 pub key: ::prost::alloc::string::String,
223 #[prost(string, tag = "3")]
224 pub note: ::prost::alloc::string::String,
225}
226#[derive(Clone, PartialEq, ::prost::Message)]
227pub struct TextContentResolvedEvent {
228 #[prost(string, tag = "1")]
229 pub css_selector: ::prost::alloc::string::String,
230 #[prost(string, tag = "2")]
231 pub text: ::prost::alloc::string::String,
232 #[prost(string, tag = "3")]
233 pub note: ::prost::alloc::string::String,
234}
235#[derive(Clone, PartialEq, ::prost::Message)]
236pub struct InnerTextResolvedEvent {
237 #[prost(string, tag = "1")]
238 pub css_selector: ::prost::alloc::string::String,
239 #[prost(string, tag = "2")]
240 pub text: ::prost::alloc::string::String,
241 #[prost(string, tag = "3")]
242 pub note: ::prost::alloc::string::String,
243}
244#[derive(Clone, PartialEq, ::prost::Message)]
245pub struct SelectorWaitSatisfiedEvent {
246 #[prost(string, tag = "1")]
247 pub css_selector: ::prost::alloc::string::String,
248 #[prost(bool, tag = "2")]
249 pub visible: bool,
250 #[prost(string, tag = "3")]
251 pub note: ::prost::alloc::string::String,
252}
253#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
254#[repr(i32)]
255pub enum BrowserKind {
256 Unspecified = 0,
257 Chromium = 1,
258 Firefox = 2,
259}
260impl BrowserKind {
261 pub fn as_str_name(&self) -> &'static str {
266 match self {
267 Self::Unspecified => "BROWSER_KIND_UNSPECIFIED",
268 Self::Chromium => "BROWSER_KIND_CHROMIUM",
269 Self::Firefox => "BROWSER_KIND_FIREFOX",
270 }
271 }
272 pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
274 match value {
275 "BROWSER_KIND_UNSPECIFIED" => Some(Self::Unspecified),
276 "BROWSER_KIND_CHROMIUM" => Some(Self::Chromium),
277 "BROWSER_KIND_FIREFOX" => Some(Self::Firefox),
278 _ => None,
279 }
280 }
281}
282#[derive(Clone, PartialEq, ::prost::Message)]
283pub struct BrowserSessionCommand {
284 #[prost(oneof = "browser_session_command::Command", tags = "1, 2, 3, 4, 5")]
285 pub command: ::core::option::Option<browser_session_command::Command>,
286}
287pub mod browser_session_command {
289 #[derive(Clone, PartialEq, ::prost::Oneof)]
290 pub enum Command {
291 #[prost(message, tag = "1")]
292 LaunchChrome(super::LaunchChromeCommand),
293 #[prost(message, tag = "2")]
294 OpenTab(super::OpenTabCommand),
295 #[prost(message, tag = "3")]
296 Ping(super::SessionPingCommand),
297 #[prost(message, tag = "4")]
298 Close(super::CloseBrowserSessionCommand),
299 #[prost(message, tag = "5")]
300 LaunchBrowser(super::LaunchBrowserCommand),
301 }
302}
303#[derive(Clone, Copy, PartialEq, ::prost::Message)]
304pub struct OpenTabCommand {
305 #[prost(message, optional, tag = "1")]
306 pub retry_options: ::core::option::Option<CommandRetryOptions>,
307}
308#[derive(Clone, PartialEq, ::prost::Message)]
309pub struct SessionPingCommand {
310 #[prost(string, tag = "1")]
311 pub message: ::prost::alloc::string::String,
312}
313#[derive(Clone, Copy, PartialEq, ::prost::Message)]
314pub struct CloseBrowserSessionCommand {}
315#[derive(Clone, PartialEq, ::prost::Message)]
316pub struct BrowserSessionEvent {
317 #[prost(string, tag = "1")]
318 pub session_id: ::prost::alloc::string::String,
319 #[prost(oneof = "browser_session_event::Event", tags = "2, 3, 4, 5, 6, 7")]
320 pub event: ::core::option::Option<browser_session_event::Event>,
321}
322pub mod browser_session_event {
324 #[derive(Clone, PartialEq, ::prost::Oneof)]
325 pub enum Event {
326 #[prost(message, tag = "2")]
327 ChromeLaunched(super::ChromeLaunchedEvent),
328 #[prost(message, tag = "3")]
329 TabOpened(super::TabOpenedEvent),
330 #[prost(message, tag = "4")]
331 Pong(super::SessionPongEvent),
332 #[prost(message, tag = "5")]
333 Closed(super::BrowserSessionClosedEvent),
334 #[prost(message, tag = "6")]
335 Error(super::BrowserSessionErrorEvent),
336 #[prost(message, tag = "7")]
337 BrowserLaunched(super::BrowserLaunchedEvent),
338 }
339}
340#[derive(Clone, PartialEq, ::prost::Message)]
341pub struct TabOpenedEvent {
342 #[prost(string, tag = "1")]
343 pub tab_session_id: ::prost::alloc::string::String,
344 #[prost(string, tag = "2")]
345 pub note: ::prost::alloc::string::String,
346}
347#[derive(Clone, PartialEq, ::prost::Message)]
348pub struct SessionPongEvent {
349 #[prost(string, tag = "1")]
350 pub message: ::prost::alloc::string::String,
351}
352#[derive(Clone, PartialEq, ::prost::Message)]
353pub struct BrowserSessionClosedEvent {
354 #[prost(string, tag = "1")]
355 pub reason: ::prost::alloc::string::String,
356}
357#[derive(Clone, PartialEq, ::prost::Message)]
358pub struct BrowserSessionErrorEvent {
359 #[prost(string, tag = "1")]
360 pub message: ::prost::alloc::string::String,
361}
362#[derive(Clone, PartialEq, ::prost::Message)]
363pub struct TabSessionCommand {
364 #[prost(string, tag = "1")]
365 pub browser_session_id: ::prost::alloc::string::String,
366 #[prost(string, tag = "2")]
367 pub tab_session_id: ::prost::alloc::string::String,
368 #[prost(
369 oneof = "tab_session_command::Command",
370 tags = "3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15"
371 )]
372 pub command: ::core::option::Option<tab_session_command::Command>,
373}
374pub mod tab_session_command {
376 #[derive(Clone, PartialEq, ::prost::Oneof)]
377 pub enum Command {
378 #[prost(message, tag = "3")]
379 Ping(super::TabSessionPingCommand),
380 #[prost(message, tag = "4")]
381 Close(super::CloseTabSessionCommand),
382 #[prost(message, tag = "5")]
383 Navigate(super::NavigateTabCommand),
384 #[prost(message, tag = "6")]
385 ClickElement(super::ClickElementCommand),
386 #[prost(message, tag = "7")]
387 CountElements(super::CountElementsCommand),
388 #[prost(message, tag = "8")]
389 HighlightElements(super::HighlightElementsCommand),
390 #[prost(message, tag = "9")]
391 FocusElement(super::FocusElementCommand),
392 #[prost(message, tag = "10")]
393 FillElement(super::FillElementCommand),
394 #[prost(message, tag = "11")]
395 HoverElement(super::HoverElementCommand),
396 #[prost(message, tag = "12")]
397 PressKey(super::PressKeyCommand),
398 #[prost(message, tag = "13")]
399 GetTextContent(super::GetTextContentCommand),
400 #[prost(message, tag = "14")]
401 GetInnerText(super::GetInnerTextCommand),
402 #[prost(message, tag = "15")]
403 WaitForSelector(super::WaitForSelectorCommand),
404 }
405}
406#[derive(Clone, PartialEq, ::prost::Message)]
407pub struct TabSessionPingCommand {
408 #[prost(string, tag = "1")]
409 pub message: ::prost::alloc::string::String,
410}
411#[derive(Clone, Copy, PartialEq, ::prost::Message)]
412pub struct CloseTabSessionCommand {}
413#[derive(Clone, PartialEq, ::prost::Message)]
414pub struct TabSessionEvent {
415 #[prost(string, tag = "1")]
416 pub tab_session_id: ::prost::alloc::string::String,
417 #[prost(
418 oneof = "tab_session_event::Event",
419 tags = "2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17"
420 )]
421 pub event: ::core::option::Option<tab_session_event::Event>,
422}
423pub mod tab_session_event {
425 #[derive(Clone, PartialEq, ::prost::Oneof)]
426 pub enum Event {
427 #[prost(message, tag = "2")]
428 Attached(super::TabSessionAttachedEvent),
429 #[prost(message, tag = "3")]
430 Pong(super::TabSessionPongEvent),
431 #[prost(message, tag = "4")]
432 Closed(super::TabSessionClosedEvent),
433 #[prost(message, tag = "5")]
434 Error(super::TabSessionErrorEvent),
435 #[prost(message, tag = "6")]
436 Navigated(super::TabNavigatedEvent),
437 #[prost(message, tag = "7")]
438 ChromiumBidiInjection(super::ChromiumBidiInjectionEvent),
439 #[prost(message, tag = "8")]
440 ElementClicked(super::ElementClickedEvent),
441 #[prost(message, tag = "9")]
442 ElementCounted(super::ElementCountedEvent),
443 #[prost(message, tag = "10")]
444 ElementsHighlighted(super::ElementsHighlightedEvent),
445 #[prost(message, tag = "11")]
446 ElementFocused(super::ElementFocusedEvent),
447 #[prost(message, tag = "12")]
448 ElementFilled(super::ElementFilledEvent),
449 #[prost(message, tag = "13")]
450 ElementHovered(super::ElementHoveredEvent),
451 #[prost(message, tag = "14")]
452 KeyPressed(super::KeyPressedEvent),
453 #[prost(message, tag = "15")]
454 TextContentResolved(super::TextContentResolvedEvent),
455 #[prost(message, tag = "16")]
456 InnerTextResolved(super::InnerTextResolvedEvent),
457 #[prost(message, tag = "17")]
458 SelectorWaitSatisfied(super::SelectorWaitSatisfiedEvent),
459 }
460}
461#[derive(Clone, PartialEq, ::prost::Message)]
462pub struct TabSessionAttachedEvent {
463 #[prost(string, tag = "1")]
464 pub note: ::prost::alloc::string::String,
465}
466#[derive(Clone, PartialEq, ::prost::Message)]
467pub struct TabSessionPongEvent {
468 #[prost(string, tag = "1")]
469 pub message: ::prost::alloc::string::String,
470}
471#[derive(Clone, PartialEq, ::prost::Message)]
472pub struct TabSessionClosedEvent {
473 #[prost(string, tag = "1")]
474 pub reason: ::prost::alloc::string::String,
475}
476#[derive(Clone, PartialEq, ::prost::Message)]
477pub struct TabSessionErrorEvent {
478 #[prost(string, tag = "1")]
479 pub message: ::prost::alloc::string::String,
480}
481pub mod engine_service_client {
483 #![allow(
484 unused_variables,
485 dead_code,
486 missing_docs,
487 clippy::wildcard_imports,
488 clippy::let_unit_value,
489 )]
490 use tonic::codegen::*;
491 use tonic::codegen::http::Uri;
492 #[derive(Debug, Clone)]
493 pub struct EngineServiceClient<T> {
494 inner: tonic::client::Grpc<T>,
495 }
496 impl EngineServiceClient<tonic::transport::Channel> {
497 pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
499 where
500 D: TryInto<tonic::transport::Endpoint>,
501 D::Error: Into<StdError>,
502 {
503 let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
504 Ok(Self::new(conn))
505 }
506 }
507 impl<T> EngineServiceClient<T>
508 where
509 T: tonic::client::GrpcService<tonic::body::BoxBody>,
510 T::Error: Into<StdError>,
511 T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
512 <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
513 {
514 pub fn new(inner: T) -> Self {
515 let inner = tonic::client::Grpc::new(inner);
516 Self { inner }
517 }
518 pub fn with_origin(inner: T, origin: Uri) -> Self {
519 let inner = tonic::client::Grpc::with_origin(inner, origin);
520 Self { inner }
521 }
522 pub fn with_interceptor<F>(
523 inner: T,
524 interceptor: F,
525 ) -> EngineServiceClient<InterceptedService<T, F>>
526 where
527 F: tonic::service::Interceptor,
528 T::ResponseBody: Default,
529 T: tonic::codegen::Service<
530 http::Request<tonic::body::BoxBody>,
531 Response = http::Response<
532 <T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
533 >,
534 >,
535 <T as tonic::codegen::Service<
536 http::Request<tonic::body::BoxBody>,
537 >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
538 {
539 EngineServiceClient::new(InterceptedService::new(inner, interceptor))
540 }
541 #[must_use]
546 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
547 self.inner = self.inner.send_compressed(encoding);
548 self
549 }
550 #[must_use]
552 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
553 self.inner = self.inner.accept_compressed(encoding);
554 self
555 }
556 #[must_use]
560 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
561 self.inner = self.inner.max_decoding_message_size(limit);
562 self
563 }
564 #[must_use]
568 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
569 self.inner = self.inner.max_encoding_message_size(limit);
570 self
571 }
572 pub async fn ping(
573 &mut self,
574 request: impl tonic::IntoRequest<super::PingRequest>,
575 ) -> std::result::Result<tonic::Response<super::PingResponse>, tonic::Status> {
576 self.inner
577 .ready()
578 .await
579 .map_err(|e| {
580 tonic::Status::unknown(
581 format!("Service was not ready: {}", e.into()),
582 )
583 })?;
584 let codec = tonic::codec::ProstCodec::default();
585 let path = http::uri::PathAndQuery::from_static(
586 "/allwright.engine.v1.EngineService/Ping",
587 );
588 let mut req = request.into_request();
589 req.extensions_mut()
590 .insert(GrpcMethod::new("allwright.engine.v1.EngineService", "Ping"));
591 self.inner.unary(req, path, codec).await
592 }
593 pub async fn browser_session(
594 &mut self,
595 request: impl tonic::IntoStreamingRequest<
596 Message = super::BrowserSessionCommand,
597 >,
598 ) -> std::result::Result<
599 tonic::Response<tonic::codec::Streaming<super::BrowserSessionEvent>>,
600 tonic::Status,
601 > {
602 self.inner
603 .ready()
604 .await
605 .map_err(|e| {
606 tonic::Status::unknown(
607 format!("Service was not ready: {}", e.into()),
608 )
609 })?;
610 let codec = tonic::codec::ProstCodec::default();
611 let path = http::uri::PathAndQuery::from_static(
612 "/allwright.engine.v1.EngineService/BrowserSession",
613 );
614 let mut req = request.into_streaming_request();
615 req.extensions_mut()
616 .insert(
617 GrpcMethod::new(
618 "allwright.engine.v1.EngineService",
619 "BrowserSession",
620 ),
621 );
622 self.inner.streaming(req, path, codec).await
623 }
624 pub async fn tab_session(
625 &mut self,
626 request: impl tonic::IntoStreamingRequest<Message = super::TabSessionCommand>,
627 ) -> std::result::Result<
628 tonic::Response<tonic::codec::Streaming<super::TabSessionEvent>>,
629 tonic::Status,
630 > {
631 self.inner
632 .ready()
633 .await
634 .map_err(|e| {
635 tonic::Status::unknown(
636 format!("Service was not ready: {}", e.into()),
637 )
638 })?;
639 let codec = tonic::codec::ProstCodec::default();
640 let path = http::uri::PathAndQuery::from_static(
641 "/allwright.engine.v1.EngineService/TabSession",
642 );
643 let mut req = request.into_streaming_request();
644 req.extensions_mut()
645 .insert(
646 GrpcMethod::new("allwright.engine.v1.EngineService", "TabSession"),
647 );
648 self.inner.streaming(req, path, codec).await
649 }
650 }
651}
652pub mod engine_service_server {
654 #![allow(
655 unused_variables,
656 dead_code,
657 missing_docs,
658 clippy::wildcard_imports,
659 clippy::let_unit_value,
660 )]
661 use tonic::codegen::*;
662 #[async_trait]
664 pub trait EngineService: std::marker::Send + std::marker::Sync + 'static {
665 async fn ping(
666 &self,
667 request: tonic::Request<super::PingRequest>,
668 ) -> std::result::Result<tonic::Response<super::PingResponse>, tonic::Status>;
669 type BrowserSessionStream: tonic::codegen::tokio_stream::Stream<
671 Item = std::result::Result<super::BrowserSessionEvent, tonic::Status>,
672 >
673 + std::marker::Send
674 + 'static;
675 async fn browser_session(
676 &self,
677 request: tonic::Request<tonic::Streaming<super::BrowserSessionCommand>>,
678 ) -> std::result::Result<
679 tonic::Response<Self::BrowserSessionStream>,
680 tonic::Status,
681 >;
682 type TabSessionStream: tonic::codegen::tokio_stream::Stream<
684 Item = std::result::Result<super::TabSessionEvent, tonic::Status>,
685 >
686 + std::marker::Send
687 + 'static;
688 async fn tab_session(
689 &self,
690 request: tonic::Request<tonic::Streaming<super::TabSessionCommand>>,
691 ) -> std::result::Result<tonic::Response<Self::TabSessionStream>, tonic::Status>;
692 }
693 #[derive(Debug)]
694 pub struct EngineServiceServer<T> {
695 inner: Arc<T>,
696 accept_compression_encodings: EnabledCompressionEncodings,
697 send_compression_encodings: EnabledCompressionEncodings,
698 max_decoding_message_size: Option<usize>,
699 max_encoding_message_size: Option<usize>,
700 }
701 impl<T> EngineServiceServer<T> {
702 pub fn new(inner: T) -> Self {
703 Self::from_arc(Arc::new(inner))
704 }
705 pub fn from_arc(inner: Arc<T>) -> Self {
706 Self {
707 inner,
708 accept_compression_encodings: Default::default(),
709 send_compression_encodings: Default::default(),
710 max_decoding_message_size: None,
711 max_encoding_message_size: None,
712 }
713 }
714 pub fn with_interceptor<F>(
715 inner: T,
716 interceptor: F,
717 ) -> InterceptedService<Self, F>
718 where
719 F: tonic::service::Interceptor,
720 {
721 InterceptedService::new(Self::new(inner), interceptor)
722 }
723 #[must_use]
725 pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
726 self.accept_compression_encodings.enable(encoding);
727 self
728 }
729 #[must_use]
731 pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
732 self.send_compression_encodings.enable(encoding);
733 self
734 }
735 #[must_use]
739 pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
740 self.max_decoding_message_size = Some(limit);
741 self
742 }
743 #[must_use]
747 pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
748 self.max_encoding_message_size = Some(limit);
749 self
750 }
751 }
752 impl<T, B> tonic::codegen::Service<http::Request<B>> for EngineServiceServer<T>
753 where
754 T: EngineService,
755 B: Body + std::marker::Send + 'static,
756 B::Error: Into<StdError> + std::marker::Send + 'static,
757 {
758 type Response = http::Response<tonic::body::BoxBody>;
759 type Error = std::convert::Infallible;
760 type Future = BoxFuture<Self::Response, Self::Error>;
761 fn poll_ready(
762 &mut self,
763 _cx: &mut Context<'_>,
764 ) -> Poll<std::result::Result<(), Self::Error>> {
765 Poll::Ready(Ok(()))
766 }
767 fn call(&mut self, req: http::Request<B>) -> Self::Future {
768 match req.uri().path() {
769 "/allwright.engine.v1.EngineService/Ping" => {
770 #[allow(non_camel_case_types)]
771 struct PingSvc<T: EngineService>(pub Arc<T>);
772 impl<
773 T: EngineService,
774 > tonic::server::UnaryService<super::PingRequest> for PingSvc<T> {
775 type Response = super::PingResponse;
776 type Future = BoxFuture<
777 tonic::Response<Self::Response>,
778 tonic::Status,
779 >;
780 fn call(
781 &mut self,
782 request: tonic::Request<super::PingRequest>,
783 ) -> Self::Future {
784 let inner = Arc::clone(&self.0);
785 let fut = async move {
786 <T as EngineService>::ping(&inner, request).await
787 };
788 Box::pin(fut)
789 }
790 }
791 let accept_compression_encodings = self.accept_compression_encodings;
792 let send_compression_encodings = self.send_compression_encodings;
793 let max_decoding_message_size = self.max_decoding_message_size;
794 let max_encoding_message_size = self.max_encoding_message_size;
795 let inner = self.inner.clone();
796 let fut = async move {
797 let method = PingSvc(inner);
798 let codec = tonic::codec::ProstCodec::default();
799 let mut grpc = tonic::server::Grpc::new(codec)
800 .apply_compression_config(
801 accept_compression_encodings,
802 send_compression_encodings,
803 )
804 .apply_max_message_size_config(
805 max_decoding_message_size,
806 max_encoding_message_size,
807 );
808 let res = grpc.unary(method, req).await;
809 Ok(res)
810 };
811 Box::pin(fut)
812 }
813 "/allwright.engine.v1.EngineService/BrowserSession" => {
814 #[allow(non_camel_case_types)]
815 struct BrowserSessionSvc<T: EngineService>(pub Arc<T>);
816 impl<
817 T: EngineService,
818 > tonic::server::StreamingService<super::BrowserSessionCommand>
819 for BrowserSessionSvc<T> {
820 type Response = super::BrowserSessionEvent;
821 type ResponseStream = T::BrowserSessionStream;
822 type Future = BoxFuture<
823 tonic::Response<Self::ResponseStream>,
824 tonic::Status,
825 >;
826 fn call(
827 &mut self,
828 request: tonic::Request<
829 tonic::Streaming<super::BrowserSessionCommand>,
830 >,
831 ) -> Self::Future {
832 let inner = Arc::clone(&self.0);
833 let fut = async move {
834 <T as EngineService>::browser_session(&inner, request).await
835 };
836 Box::pin(fut)
837 }
838 }
839 let accept_compression_encodings = self.accept_compression_encodings;
840 let send_compression_encodings = self.send_compression_encodings;
841 let max_decoding_message_size = self.max_decoding_message_size;
842 let max_encoding_message_size = self.max_encoding_message_size;
843 let inner = self.inner.clone();
844 let fut = async move {
845 let method = BrowserSessionSvc(inner);
846 let codec = tonic::codec::ProstCodec::default();
847 let mut grpc = tonic::server::Grpc::new(codec)
848 .apply_compression_config(
849 accept_compression_encodings,
850 send_compression_encodings,
851 )
852 .apply_max_message_size_config(
853 max_decoding_message_size,
854 max_encoding_message_size,
855 );
856 let res = grpc.streaming(method, req).await;
857 Ok(res)
858 };
859 Box::pin(fut)
860 }
861 "/allwright.engine.v1.EngineService/TabSession" => {
862 #[allow(non_camel_case_types)]
863 struct TabSessionSvc<T: EngineService>(pub Arc<T>);
864 impl<
865 T: EngineService,
866 > tonic::server::StreamingService<super::TabSessionCommand>
867 for TabSessionSvc<T> {
868 type Response = super::TabSessionEvent;
869 type ResponseStream = T::TabSessionStream;
870 type Future = BoxFuture<
871 tonic::Response<Self::ResponseStream>,
872 tonic::Status,
873 >;
874 fn call(
875 &mut self,
876 request: tonic::Request<
877 tonic::Streaming<super::TabSessionCommand>,
878 >,
879 ) -> Self::Future {
880 let inner = Arc::clone(&self.0);
881 let fut = async move {
882 <T as EngineService>::tab_session(&inner, request).await
883 };
884 Box::pin(fut)
885 }
886 }
887 let accept_compression_encodings = self.accept_compression_encodings;
888 let send_compression_encodings = self.send_compression_encodings;
889 let max_decoding_message_size = self.max_decoding_message_size;
890 let max_encoding_message_size = self.max_encoding_message_size;
891 let inner = self.inner.clone();
892 let fut = async move {
893 let method = TabSessionSvc(inner);
894 let codec = tonic::codec::ProstCodec::default();
895 let mut grpc = tonic::server::Grpc::new(codec)
896 .apply_compression_config(
897 accept_compression_encodings,
898 send_compression_encodings,
899 )
900 .apply_max_message_size_config(
901 max_decoding_message_size,
902 max_encoding_message_size,
903 );
904 let res = grpc.streaming(method, req).await;
905 Ok(res)
906 };
907 Box::pin(fut)
908 }
909 _ => {
910 Box::pin(async move {
911 let mut response = http::Response::new(empty_body());
912 let headers = response.headers_mut();
913 headers
914 .insert(
915 tonic::Status::GRPC_STATUS,
916 (tonic::Code::Unimplemented as i32).into(),
917 );
918 headers
919 .insert(
920 http::header::CONTENT_TYPE,
921 tonic::metadata::GRPC_CONTENT_TYPE,
922 );
923 Ok(response)
924 })
925 }
926 }
927 }
928 }
929 impl<T> Clone for EngineServiceServer<T> {
930 fn clone(&self) -> Self {
931 let inner = self.inner.clone();
932 Self {
933 inner,
934 accept_compression_encodings: self.accept_compression_encodings,
935 send_compression_encodings: self.send_compression_encodings,
936 max_decoding_message_size: self.max_decoding_message_size,
937 max_encoding_message_size: self.max_encoding_message_size,
938 }
939 }
940 }
941 pub const SERVICE_NAME: &str = "allwright.engine.v1.EngineService";
943 impl<T> tonic::server::NamedService for EngineServiceServer<T> {
944 const NAME: &'static str = SERVICE_NAME;
945 }
946}