Skip to main content

nominal_api_proto/proto/
nominal.webhooktemplates.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct ValidateTemplateRequest {
4    #[prost(string, tag = "1")]
5    pub template: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub sample_context_json: ::prost::alloc::string::String,
8}
9#[derive(Clone, PartialEq, ::prost::Message)]
10pub struct ValidationError {
11    #[prost(string, tag = "1")]
12    pub message: ::prost::alloc::string::String,
13}
14#[derive(Clone, PartialEq, ::prost::Message)]
15pub struct ValidateTemplateResponse {
16    #[prost(bool, tag = "1")]
17    pub valid: bool,
18    #[prost(string, optional, tag = "2")]
19    pub evaluated_payload: ::core::option::Option<::prost::alloc::string::String>,
20    #[prost(message, repeated, tag = "3")]
21    pub errors: ::prost::alloc::vec::Vec<ValidationError>,
22}
23#[derive(Clone, PartialEq, ::prost::Message)]
24pub struct TestWebhookRequest {
25    #[prost(string, tag = "1")]
26    pub integration_rid: ::prost::alloc::string::String,
27    #[prost(string, tag = "2")]
28    pub template: ::prost::alloc::string::String,
29    #[prost(string, tag = "3")]
30    pub sample_context_json: ::prost::alloc::string::String,
31    #[prost(string, optional, tag = "4")]
32    pub event_type: ::core::option::Option<::prost::alloc::string::String>,
33}
34#[derive(Clone, PartialEq, ::prost::Message)]
35pub struct TestWebhookResponse {
36    #[prost(bool, tag = "1")]
37    pub success: bool,
38    #[prost(int32, tag = "2")]
39    pub status_code: i32,
40    #[prost(string, optional, tag = "3")]
41    pub response_body: ::core::option::Option<::prost::alloc::string::String>,
42    #[prost(string, optional, tag = "4")]
43    pub error_message: ::core::option::Option<::prost::alloc::string::String>,
44    #[prost(string, optional, tag = "5")]
45    pub evaluated_payload: ::core::option::Option<::prost::alloc::string::String>,
46    #[prost(int64, tag = "6")]
47    pub latency_millis: i64,
48}
49#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
50#[repr(i32)]
51pub enum WebhookTemplateError {
52    InvalidRequest = 0,
53}
54impl WebhookTemplateError {
55    /// String value of the enum field names used in the ProtoBuf definition.
56    ///
57    /// The values are not transformed in any way and thus are considered stable
58    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
59    pub fn as_str_name(&self) -> &'static str {
60        match self {
61            Self::InvalidRequest => "WEBHOOK_TEMPLATE_ERROR_INVALID_REQUEST",
62        }
63    }
64    /// Creates an enum from field names used in the ProtoBuf definition.
65    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
66        match value {
67            "WEBHOOK_TEMPLATE_ERROR_INVALID_REQUEST" => Some(Self::InvalidRequest),
68            _ => None,
69        }
70    }
71}
72/// Generated client implementations.
73pub mod webhook_templates_service_client {
74    #![allow(
75        unused_variables,
76        dead_code,
77        missing_docs,
78        clippy::wildcard_imports,
79        clippy::let_unit_value,
80    )]
81    use tonic::codegen::*;
82    use tonic::codegen::http::Uri;
83    #[derive(Debug, Clone)]
84    pub struct WebhookTemplatesServiceClient<T> {
85        inner: tonic::client::Grpc<T>,
86    }
87    impl WebhookTemplatesServiceClient<tonic::transport::Channel> {
88        /// Attempt to create a new client by connecting to a given endpoint.
89        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
90        where
91            D: TryInto<tonic::transport::Endpoint>,
92            D::Error: Into<StdError>,
93        {
94            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
95            Ok(Self::new(conn))
96        }
97    }
98    impl<T> WebhookTemplatesServiceClient<T>
99    where
100        T: tonic::client::GrpcService<tonic::body::Body>,
101        T::Error: Into<StdError>,
102        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
103        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
104    {
105        pub fn new(inner: T) -> Self {
106            let inner = tonic::client::Grpc::new(inner);
107            Self { inner }
108        }
109        pub fn with_origin(inner: T, origin: Uri) -> Self {
110            let inner = tonic::client::Grpc::with_origin(inner, origin);
111            Self { inner }
112        }
113        pub fn with_interceptor<F>(
114            inner: T,
115            interceptor: F,
116        ) -> WebhookTemplatesServiceClient<InterceptedService<T, F>>
117        where
118            F: tonic::service::Interceptor,
119            T::ResponseBody: Default,
120            T: tonic::codegen::Service<
121                http::Request<tonic::body::Body>,
122                Response = http::Response<
123                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
124                >,
125            >,
126            <T as tonic::codegen::Service<
127                http::Request<tonic::body::Body>,
128            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
129        {
130            WebhookTemplatesServiceClient::new(
131                InterceptedService::new(inner, interceptor),
132            )
133        }
134        /// Compress requests with the given encoding.
135        ///
136        /// This requires the server to support it otherwise it might respond with an
137        /// error.
138        #[must_use]
139        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
140            self.inner = self.inner.send_compressed(encoding);
141            self
142        }
143        /// Enable decompressing responses.
144        #[must_use]
145        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
146            self.inner = self.inner.accept_compressed(encoding);
147            self
148        }
149        /// Limits the maximum size of a decoded message.
150        ///
151        /// Default: `4MB`
152        #[must_use]
153        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
154            self.inner = self.inner.max_decoding_message_size(limit);
155            self
156        }
157        /// Limits the maximum size of an encoded message.
158        ///
159        /// Default: `usize::MAX`
160        #[must_use]
161        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
162            self.inner = self.inner.max_encoding_message_size(limit);
163            self
164        }
165        pub async fn validate_template(
166            &mut self,
167            request: impl tonic::IntoRequest<super::ValidateTemplateRequest>,
168        ) -> std::result::Result<
169            tonic::Response<super::ValidateTemplateResponse>,
170            tonic::Status,
171        > {
172            self.inner
173                .ready()
174                .await
175                .map_err(|e| {
176                    tonic::Status::unknown(
177                        format!("Service was not ready: {}", e.into()),
178                    )
179                })?;
180            let codec = tonic::codec::ProstCodec::default();
181            let path = http::uri::PathAndQuery::from_static(
182                "/nominal.webhooktemplates.v1.WebhookTemplatesService/ValidateTemplate",
183            );
184            let mut req = request.into_request();
185            req.extensions_mut()
186                .insert(
187                    GrpcMethod::new(
188                        "nominal.webhooktemplates.v1.WebhookTemplatesService",
189                        "ValidateTemplate",
190                    ),
191                );
192            self.inner.unary(req, path, codec).await
193        }
194        pub async fn test_webhook(
195            &mut self,
196            request: impl tonic::IntoRequest<super::TestWebhookRequest>,
197        ) -> std::result::Result<
198            tonic::Response<super::TestWebhookResponse>,
199            tonic::Status,
200        > {
201            self.inner
202                .ready()
203                .await
204                .map_err(|e| {
205                    tonic::Status::unknown(
206                        format!("Service was not ready: {}", e.into()),
207                    )
208                })?;
209            let codec = tonic::codec::ProstCodec::default();
210            let path = http::uri::PathAndQuery::from_static(
211                "/nominal.webhooktemplates.v1.WebhookTemplatesService/TestWebhook",
212            );
213            let mut req = request.into_request();
214            req.extensions_mut()
215                .insert(
216                    GrpcMethod::new(
217                        "nominal.webhooktemplates.v1.WebhookTemplatesService",
218                        "TestWebhook",
219                    ),
220                );
221            self.inner.unary(req, path, codec).await
222        }
223    }
224}