nominal-api-proto 0.1440.0

Protobuf/gRPC API bindings for the Nominal platform
Documentation
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueueSourceRequest {
    #[prost(string, tag = "1")]
    pub source_rid: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub workspace_rid: ::prost::alloc::string::String,
    #[prost(string, optional, tag = "3")]
    pub drive_rid: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct QueueSourceResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct QueuedSource {
    #[prost(string, tag = "1")]
    pub source_rid: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ListQueuedSourcesRequest {
    #[prost(int32, optional, tag = "1")]
    pub limit: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListQueuedSourcesResponse {
    #[prost(message, repeated, tag = "1")]
    pub queued_sources: ::prost::alloc::vec::Vec<QueuedSource>,
    #[prost(bool, tag = "2")]
    pub truncated: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListChunksRequest {
    #[prost(string, tag = "1")]
    pub source_rid: ::prost::alloc::string::String,
    #[prost(int32, optional, tag = "2")]
    pub limit: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListChunksResponse {
    #[prost(message, repeated, tag = "1")]
    pub chunks: ::prost::alloc::vec::Vec<super::super::knowledge::v1::KnowledgeChunk>,
    #[prost(bool, tag = "2")]
    pub truncated: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDriveIndexExecutionRequest {
    #[prost(string, tag = "1")]
    pub drive_index_job_id: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDriveIndexExecutionResponse {
    #[prost(bool, tag = "1")]
    pub found: bool,
    #[prost(message, optional, tag = "2")]
    pub execution: ::core::option::Option<KnowledgeIndexExecution>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KnowledgeIndexExecution {
    #[prost(string, tag = "1")]
    pub drive_index_job_id: ::prost::alloc::string::String,
    #[prost(enumeration = "KnowledgeIndexExecutionState", tag = "2")]
    pub state: i32,
    #[prost(int64, tag = "3")]
    pub completed_source_count: i64,
    #[prost(int64, tag = "4")]
    pub successful_chunk_count: i64,
    #[prost(message, repeated, tag = "5")]
    pub sources: ::prost::alloc::vec::Vec<KnowledgeSourceExecution>,
    #[prost(enumeration = "KnowledgeIndexFailureCategory", repeated, tag = "6")]
    pub safe_failure_categories: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct KnowledgeSourceExecution {
    #[prost(string, tag = "1")]
    pub source_rid: ::prost::alloc::string::String,
    #[prost(enumeration = "KnowledgeSourceExecutionState", tag = "2")]
    pub state: i32,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum KnowledgeIndexExecutionState {
    Unspecified = 0,
    Running = 1,
    Succeeded = 2,
    SucceededWithFailures = 3,
}
impl KnowledgeIndexExecutionState {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "KNOWLEDGE_INDEX_EXECUTION_STATE_UNSPECIFIED",
            Self::Running => "KNOWLEDGE_INDEX_EXECUTION_STATE_RUNNING",
            Self::Succeeded => "KNOWLEDGE_INDEX_EXECUTION_STATE_SUCCEEDED",
            Self::SucceededWithFailures => {
                "KNOWLEDGE_INDEX_EXECUTION_STATE_SUCCEEDED_WITH_FAILURES"
            }
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "KNOWLEDGE_INDEX_EXECUTION_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "KNOWLEDGE_INDEX_EXECUTION_STATE_RUNNING" => Some(Self::Running),
            "KNOWLEDGE_INDEX_EXECUTION_STATE_SUCCEEDED" => Some(Self::Succeeded),
            "KNOWLEDGE_INDEX_EXECUTION_STATE_SUCCEEDED_WITH_FAILURES" => {
                Some(Self::SucceededWithFailures)
            }
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum KnowledgeSourceExecutionState {
    Unspecified = 0,
    Succeeded = 1,
    PermanentlyFailed = 2,
}
impl KnowledgeSourceExecutionState {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "KNOWLEDGE_SOURCE_EXECUTION_STATE_UNSPECIFIED",
            Self::Succeeded => "KNOWLEDGE_SOURCE_EXECUTION_STATE_SUCCEEDED",
            Self::PermanentlyFailed => {
                "KNOWLEDGE_SOURCE_EXECUTION_STATE_PERMANENTLY_FAILED"
            }
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "KNOWLEDGE_SOURCE_EXECUTION_STATE_UNSPECIFIED" => Some(Self::Unspecified),
            "KNOWLEDGE_SOURCE_EXECUTION_STATE_SUCCEEDED" => Some(Self::Succeeded),
            "KNOWLEDGE_SOURCE_EXECUTION_STATE_PERMANENTLY_FAILED" => {
                Some(Self::PermanentlyFailed)
            }
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum KnowledgeIndexFailureCategory {
    Unspecified = 0,
    UnsupportedSource = 1,
    RetryExhausted = 2,
}
impl KnowledgeIndexFailureCategory {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "KNOWLEDGE_INDEX_FAILURE_CATEGORY_UNSPECIFIED",
            Self::UnsupportedSource => {
                "KNOWLEDGE_INDEX_FAILURE_CATEGORY_UNSUPPORTED_SOURCE"
            }
            Self::RetryExhausted => "KNOWLEDGE_INDEX_FAILURE_CATEGORY_RETRY_EXHAUSTED",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "KNOWLEDGE_INDEX_FAILURE_CATEGORY_UNSPECIFIED" => Some(Self::Unspecified),
            "KNOWLEDGE_INDEX_FAILURE_CATEGORY_UNSUPPORTED_SOURCE" => {
                Some(Self::UnsupportedSource)
            }
            "KNOWLEDGE_INDEX_FAILURE_CATEGORY_RETRY_EXHAUSTED" => {
                Some(Self::RetryExhausted)
            }
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod internal_knowledge_index_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    #[derive(Debug, Clone)]
    pub struct InternalKnowledgeIndexServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl InternalKnowledgeIndexServiceClient<tonic::transport::Channel> {
        /// Attempt to create a new client by connecting to a given endpoint.
        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
        where
            D: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> InternalKnowledgeIndexServiceClient<T>
    where
        T: tonic::client::GrpcService<tonic::body::Body>,
        T::Error: Into<StdError>,
        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
    {
        pub fn new(inner: T) -> Self {
            let inner = tonic::client::Grpc::new(inner);
            Self { inner }
        }
        pub fn with_origin(inner: T, origin: Uri) -> Self {
            let inner = tonic::client::Grpc::with_origin(inner, origin);
            Self { inner }
        }
        pub fn with_interceptor<F>(
            inner: T,
            interceptor: F,
        ) -> InternalKnowledgeIndexServiceClient<InterceptedService<T, F>>
        where
            F: tonic::service::Interceptor,
            T::ResponseBody: Default,
            T: tonic::codegen::Service<
                http::Request<tonic::body::Body>,
                Response = http::Response<
                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
                >,
            >,
            <T as tonic::codegen::Service<
                http::Request<tonic::body::Body>,
            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
        {
            InternalKnowledgeIndexServiceClient::new(
                InterceptedService::new(inner, interceptor),
            )
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        pub async fn queue_source(
            &mut self,
            request: impl tonic::IntoRequest<super::QueueSourceRequest>,
        ) -> std::result::Result<
            tonic::Response<super::QueueSourceResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.internalknowledge.v1.InternalKnowledgeIndexService/QueueSource",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.internalknowledge.v1.InternalKnowledgeIndexService",
                        "QueueSource",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn list_queued_sources(
            &mut self,
            request: impl tonic::IntoRequest<super::ListQueuedSourcesRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListQueuedSourcesResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.internalknowledge.v1.InternalKnowledgeIndexService/ListQueuedSources",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.internalknowledge.v1.InternalKnowledgeIndexService",
                        "ListQueuedSources",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn list_chunks(
            &mut self,
            request: impl tonic::IntoRequest<super::ListChunksRequest>,
        ) -> std::result::Result<
            tonic::Response<super::ListChunksResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.internalknowledge.v1.InternalKnowledgeIndexService/ListChunks",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.internalknowledge.v1.InternalKnowledgeIndexService",
                        "ListChunks",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn get_drive_index_execution(
            &mut self,
            request: impl tonic::IntoRequest<super::GetDriveIndexExecutionRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetDriveIndexExecutionResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.internalknowledge.v1.InternalKnowledgeIndexService/GetDriveIndexExecution",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.internalknowledge.v1.InternalKnowledgeIndexService",
                        "GetDriveIndexExecution",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}