Skip to main content

nominal_api_proto/proto/
nominal.knowledge.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct CreateDriveIndexJobRequest {
4    #[prost(string, tag = "1")]
5    pub drive_rid: ::prost::alloc::string::String,
6}
7#[derive(Clone, PartialEq, ::prost::Message)]
8pub struct CreateDriveIndexJobResponse {
9    #[prost(message, optional, tag = "1")]
10    pub drive_index_job: ::core::option::Option<DriveIndexJob>,
11}
12#[derive(Clone, PartialEq, ::prost::Message)]
13pub struct GetDriveIndexJobRequest {
14    #[prost(string, tag = "1")]
15    pub drive_index_job_rid: ::prost::alloc::string::String,
16}
17#[derive(Clone, PartialEq, ::prost::Message)]
18pub struct GetDriveIndexJobResponse {
19    #[prost(message, optional, tag = "1")]
20    pub drive_index_job: ::core::option::Option<DriveIndexJob>,
21}
22#[derive(Clone, PartialEq, ::prost::Message)]
23pub struct DriveIndexJob {
24    #[prost(string, tag = "1")]
25    pub drive_index_job_rid: ::prost::alloc::string::String,
26    #[prost(string, tag = "2")]
27    pub drive_rid: ::prost::alloc::string::String,
28    #[prost(enumeration = "DriveIndexJobState", tag = "3")]
29    pub state: i32,
30    #[prost(uint64, tag = "4")]
31    pub completed_source_count: u64,
32    #[prost(uint64, tag = "5")]
33    pub successful_chunk_count: u64,
34    #[prost(message, repeated, tag = "6")]
35    pub sources: ::prost::alloc::vec::Vec<DriveIndexSourceExecution>,
36    #[prost(bool, tag = "7")]
37    pub sources_truncated: bool,
38}
39#[derive(Clone, PartialEq, ::prost::Message)]
40pub struct DriveIndexSourceExecution {
41    #[prost(string, tag = "1")]
42    pub source_rid: ::prost::alloc::string::String,
43    #[prost(enumeration = "DriveIndexSourceExecutionState", tag = "2")]
44    pub state: i32,
45}
46#[derive(Clone, PartialEq, ::prost::Message)]
47pub struct KnowledgeChunk {
48    #[prost(string, tag = "1")]
49    pub sample_rid: ::prost::alloc::string::String,
50    #[prost(string, tag = "2")]
51    pub source_rid: ::prost::alloc::string::String,
52    #[prost(string, tag = "3")]
53    pub source_locator: ::prost::alloc::string::String,
54    #[prost(string, tag = "4")]
55    pub partition_key: ::prost::alloc::string::String,
56}
57#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct QueryRequest {
59    #[prost(string, tag = "1")]
60    pub query: ::prost::alloc::string::String,
61    #[prost(string, tag = "4")]
62    pub drive_rid: ::prost::alloc::string::String,
63    #[prost(int32, optional, tag = "2")]
64    pub page_size: ::core::option::Option<i32>,
65    #[prost(string, tag = "3")]
66    pub page_token: ::prost::alloc::string::String,
67}
68#[derive(Clone, PartialEq, ::prost::Message)]
69pub struct QueryResponse {
70    #[prost(message, repeated, tag = "1")]
71    pub chunks: ::prost::alloc::vec::Vec<KnowledgeChunk>,
72    #[prost(string, tag = "2")]
73    pub next_page_token: ::prost::alloc::string::String,
74}
75#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
76#[repr(i32)]
77pub enum DriveIndexJobState {
78    Unspecified = 0,
79    Queued = 1,
80    Running = 2,
81    Succeeded = 3,
82    SucceededWithFailures = 4,
83}
84impl DriveIndexJobState {
85    /// String value of the enum field names used in the ProtoBuf definition.
86    ///
87    /// The values are not transformed in any way and thus are considered stable
88    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
89    pub fn as_str_name(&self) -> &'static str {
90        match self {
91            Self::Unspecified => "DRIVE_INDEX_JOB_STATE_UNSPECIFIED",
92            Self::Queued => "DRIVE_INDEX_JOB_STATE_QUEUED",
93            Self::Running => "DRIVE_INDEX_JOB_STATE_RUNNING",
94            Self::Succeeded => "DRIVE_INDEX_JOB_STATE_SUCCEEDED",
95            Self::SucceededWithFailures => {
96                "DRIVE_INDEX_JOB_STATE_SUCCEEDED_WITH_FAILURES"
97            }
98        }
99    }
100    /// Creates an enum from field names used in the ProtoBuf definition.
101    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
102        match value {
103            "DRIVE_INDEX_JOB_STATE_UNSPECIFIED" => Some(Self::Unspecified),
104            "DRIVE_INDEX_JOB_STATE_QUEUED" => Some(Self::Queued),
105            "DRIVE_INDEX_JOB_STATE_RUNNING" => Some(Self::Running),
106            "DRIVE_INDEX_JOB_STATE_SUCCEEDED" => Some(Self::Succeeded),
107            "DRIVE_INDEX_JOB_STATE_SUCCEEDED_WITH_FAILURES" => {
108                Some(Self::SucceededWithFailures)
109            }
110            _ => None,
111        }
112    }
113}
114#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
115#[repr(i32)]
116pub enum DriveIndexSourceExecutionState {
117    Unspecified = 0,
118    Succeeded = 1,
119    PermanentlyFailed = 2,
120}
121impl DriveIndexSourceExecutionState {
122    /// String value of the enum field names used in the ProtoBuf definition.
123    ///
124    /// The values are not transformed in any way and thus are considered stable
125    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
126    pub fn as_str_name(&self) -> &'static str {
127        match self {
128            Self::Unspecified => "DRIVE_INDEX_SOURCE_EXECUTION_STATE_UNSPECIFIED",
129            Self::Succeeded => "DRIVE_INDEX_SOURCE_EXECUTION_STATE_SUCCEEDED",
130            Self::PermanentlyFailed => {
131                "DRIVE_INDEX_SOURCE_EXECUTION_STATE_PERMANENTLY_FAILED"
132            }
133        }
134    }
135    /// Creates an enum from field names used in the ProtoBuf definition.
136    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
137        match value {
138            "DRIVE_INDEX_SOURCE_EXECUTION_STATE_UNSPECIFIED" => Some(Self::Unspecified),
139            "DRIVE_INDEX_SOURCE_EXECUTION_STATE_SUCCEEDED" => Some(Self::Succeeded),
140            "DRIVE_INDEX_SOURCE_EXECUTION_STATE_PERMANENTLY_FAILED" => {
141                Some(Self::PermanentlyFailed)
142            }
143            _ => None,
144        }
145    }
146}
147/// Generated client implementations.
148pub mod knowledge_service_client {
149    #![allow(
150        unused_variables,
151        dead_code,
152        missing_docs,
153        clippy::wildcard_imports,
154        clippy::let_unit_value,
155    )]
156    use tonic::codegen::*;
157    use tonic::codegen::http::Uri;
158    #[derive(Debug, Clone)]
159    pub struct KnowledgeServiceClient<T> {
160        inner: tonic::client::Grpc<T>,
161    }
162    impl KnowledgeServiceClient<tonic::transport::Channel> {
163        /// Attempt to create a new client by connecting to a given endpoint.
164        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
165        where
166            D: TryInto<tonic::transport::Endpoint>,
167            D::Error: Into<StdError>,
168        {
169            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
170            Ok(Self::new(conn))
171        }
172    }
173    impl<T> KnowledgeServiceClient<T>
174    where
175        T: tonic::client::GrpcService<tonic::body::Body>,
176        T::Error: Into<StdError>,
177        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
178        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
179    {
180        pub fn new(inner: T) -> Self {
181            let inner = tonic::client::Grpc::new(inner);
182            Self { inner }
183        }
184        pub fn with_origin(inner: T, origin: Uri) -> Self {
185            let inner = tonic::client::Grpc::with_origin(inner, origin);
186            Self { inner }
187        }
188        pub fn with_interceptor<F>(
189            inner: T,
190            interceptor: F,
191        ) -> KnowledgeServiceClient<InterceptedService<T, F>>
192        where
193            F: tonic::service::Interceptor,
194            T::ResponseBody: Default,
195            T: tonic::codegen::Service<
196                http::Request<tonic::body::Body>,
197                Response = http::Response<
198                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
199                >,
200            >,
201            <T as tonic::codegen::Service<
202                http::Request<tonic::body::Body>,
203            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
204        {
205            KnowledgeServiceClient::new(InterceptedService::new(inner, interceptor))
206        }
207        /// Compress requests with the given encoding.
208        ///
209        /// This requires the server to support it otherwise it might respond with an
210        /// error.
211        #[must_use]
212        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
213            self.inner = self.inner.send_compressed(encoding);
214            self
215        }
216        /// Enable decompressing responses.
217        #[must_use]
218        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
219            self.inner = self.inner.accept_compressed(encoding);
220            self
221        }
222        /// Limits the maximum size of a decoded message.
223        ///
224        /// Default: `4MB`
225        #[must_use]
226        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
227            self.inner = self.inner.max_decoding_message_size(limit);
228            self
229        }
230        /// Limits the maximum size of an encoded message.
231        ///
232        /// Default: `usize::MAX`
233        #[must_use]
234        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
235            self.inner = self.inner.max_encoding_message_size(limit);
236            self
237        }
238        pub async fn create_drive_index_job(
239            &mut self,
240            request: impl tonic::IntoRequest<super::CreateDriveIndexJobRequest>,
241        ) -> std::result::Result<
242            tonic::Response<super::CreateDriveIndexJobResponse>,
243            tonic::Status,
244        > {
245            self.inner
246                .ready()
247                .await
248                .map_err(|e| {
249                    tonic::Status::unknown(
250                        format!("Service was not ready: {}", e.into()),
251                    )
252                })?;
253            let codec = tonic::codec::ProstCodec::default();
254            let path = http::uri::PathAndQuery::from_static(
255                "/nominal.knowledge.v1.KnowledgeService/CreateDriveIndexJob",
256            );
257            let mut req = request.into_request();
258            req.extensions_mut()
259                .insert(
260                    GrpcMethod::new(
261                        "nominal.knowledge.v1.KnowledgeService",
262                        "CreateDriveIndexJob",
263                    ),
264                );
265            self.inner.unary(req, path, codec).await
266        }
267        pub async fn get_drive_index_job(
268            &mut self,
269            request: impl tonic::IntoRequest<super::GetDriveIndexJobRequest>,
270        ) -> std::result::Result<
271            tonic::Response<super::GetDriveIndexJobResponse>,
272            tonic::Status,
273        > {
274            self.inner
275                .ready()
276                .await
277                .map_err(|e| {
278                    tonic::Status::unknown(
279                        format!("Service was not ready: {}", e.into()),
280                    )
281                })?;
282            let codec = tonic::codec::ProstCodec::default();
283            let path = http::uri::PathAndQuery::from_static(
284                "/nominal.knowledge.v1.KnowledgeService/GetDriveIndexJob",
285            );
286            let mut req = request.into_request();
287            req.extensions_mut()
288                .insert(
289                    GrpcMethod::new(
290                        "nominal.knowledge.v1.KnowledgeService",
291                        "GetDriveIndexJob",
292                    ),
293                );
294            self.inner.unary(req, path, codec).await
295        }
296        pub async fn query(
297            &mut self,
298            request: impl tonic::IntoRequest<super::QueryRequest>,
299        ) -> std::result::Result<tonic::Response<super::QueryResponse>, tonic::Status> {
300            self.inner
301                .ready()
302                .await
303                .map_err(|e| {
304                    tonic::Status::unknown(
305                        format!("Service was not ready: {}", e.into()),
306                    )
307                })?;
308            let codec = tonic::codec::ProstCodec::default();
309            let path = http::uri::PathAndQuery::from_static(
310                "/nominal.knowledge.v1.KnowledgeService/Query",
311            );
312            let mut req = request.into_request();
313            req.extensions_mut()
314                .insert(
315                    GrpcMethod::new("nominal.knowledge.v1.KnowledgeService", "Query"),
316                );
317            self.inner.unary(req, path, codec).await
318        }
319    }
320}