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 CompileUdfRequest {
    #[prost(string, optional, tag = "1")]
    pub workspace_rid: ::core::option::Option<::prost::alloc::string::String>,
    #[prost(message, repeated, tag = "2")]
    pub inputs: ::prost::alloc::vec::Vec<UdfParameter>,
    #[prost(enumeration = "UdfOutputType", tag = "3")]
    pub output: i32,
    #[prost(enumeration = "UdfOutputShape", tag = "4")]
    pub output_shape: i32,
    #[prost(message, optional, tag = "5")]
    pub source: ::core::option::Option<UdfSource>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompileUdfResponse {
    #[prost(string, tag = "1")]
    pub compile_key: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UdfParameter {
    #[prost(enumeration = "UdfDataType", tag = "1")]
    pub r#type: i32,
    #[prost(enumeration = "UdfCardinality", tag = "2")]
    pub cardinality: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UdfSource {
    #[prost(oneof = "udf_source::UdfSource", tags = "1")]
    pub udf_source: ::core::option::Option<udf_source::UdfSource>,
}
/// Nested message and enum types in `UdfSource`.
pub mod udf_source {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum UdfSource {
        #[prost(message, tag = "1")]
        Rust(super::RustUdfSource),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RustUdfSource {
    #[prost(string, tag = "1")]
    pub source_code: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UdfDataType {
    Unspecified = 0,
    F64 = 1,
    I64 = 2,
    String = 3,
}
impl UdfDataType {
    /// 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 => "UDF_DATA_TYPE_UNSPECIFIED",
            Self::F64 => "UDF_DATA_TYPE_F64",
            Self::I64 => "UDF_DATA_TYPE_I64",
            Self::String => "UDF_DATA_TYPE_STRING",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "UDF_DATA_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "UDF_DATA_TYPE_F64" => Some(Self::F64),
            "UDF_DATA_TYPE_I64" => Some(Self::I64),
            "UDF_DATA_TYPE_STRING" => Some(Self::String),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UdfCardinality {
    Unspecified = 0,
    Value = 1,
    Vector = 2,
}
impl UdfCardinality {
    /// 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 => "UDF_CARDINALITY_UNSPECIFIED",
            Self::Value => "UDF_CARDINALITY_VALUE",
            Self::Vector => "UDF_CARDINALITY_VECTOR",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "UDF_CARDINALITY_UNSPECIFIED" => Some(Self::Unspecified),
            "UDF_CARDINALITY_VALUE" => Some(Self::Value),
            "UDF_CARDINALITY_VECTOR" => Some(Self::Vector),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UdfOutputType {
    Unspecified = 0,
    Numeric = 1,
    Enum = 2,
}
impl UdfOutputType {
    /// 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 => "UDF_OUTPUT_TYPE_UNSPECIFIED",
            Self::Numeric => "UDF_OUTPUT_TYPE_NUMERIC",
            Self::Enum => "UDF_OUTPUT_TYPE_ENUM",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "UDF_OUTPUT_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "UDF_OUTPUT_TYPE_NUMERIC" => Some(Self::Numeric),
            "UDF_OUTPUT_TYPE_ENUM" => Some(Self::Enum),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum UdfOutputShape {
    Unspecified = 0,
    Scalar = 1,
    TimestampedValue = 2,
    TimestampedValues = 3,
}
impl UdfOutputShape {
    /// 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 => "UDF_OUTPUT_SHAPE_UNSPECIFIED",
            Self::Scalar => "UDF_OUTPUT_SHAPE_SCALAR",
            Self::TimestampedValue => "UDF_OUTPUT_SHAPE_TIMESTAMPED_VALUE",
            Self::TimestampedValues => "UDF_OUTPUT_SHAPE_TIMESTAMPED_VALUES",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "UDF_OUTPUT_SHAPE_UNSPECIFIED" => Some(Self::Unspecified),
            "UDF_OUTPUT_SHAPE_SCALAR" => Some(Self::Scalar),
            "UDF_OUTPUT_SHAPE_TIMESTAMPED_VALUE" => Some(Self::TimestampedValue),
            "UDF_OUTPUT_SHAPE_TIMESTAMPED_VALUES" => Some(Self::TimestampedValues),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod udf_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 UdfServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl UdfServiceClient<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> UdfServiceClient<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,
        ) -> UdfServiceClient<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,
        {
            UdfServiceClient::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 compile_udf(
            &mut self,
            request: impl tonic::IntoRequest<super::CompileUdfRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CompileUdfResponse>,
            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.modules.v1.UdfService/CompileUdf",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(GrpcMethod::new("nominal.modules.v1.UdfService", "CompileUdf"));
            self.inner.unary(req, path, codec).await
        }
    }
}