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