Skip to main content

allwright/
allwright.engine.v1.rs

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