nominal-api-proto 0.1301.0

Protobuf/gRPC API bindings for the Nominal platform
Documentation
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FavoriteResource {
    #[prost(oneof = "favorite_resource::FavoriteResource", tags = "1, 2, 3, 4, 5, 6, 7")]
    pub favorite_resource: ::core::option::Option<favorite_resource::FavoriteResource>,
}
/// Nested message and enum types in `FavoriteResource`.
pub mod favorite_resource {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum FavoriteResource {
        #[prost(string, tag = "1")]
        Asset(::prost::alloc::string::String),
        #[prost(string, tag = "2")]
        Run(::prost::alloc::string::String),
        #[prost(string, tag = "3")]
        Notebook(::prost::alloc::string::String),
        #[prost(string, tag = "4")]
        NotebookTemplate(::prost::alloc::string::String),
        #[prost(string, tag = "5")]
        Checklist(::prost::alloc::string::String),
        #[prost(string, tag = "6")]
        SavedView(::prost::alloc::string::String),
        #[prost(string, tag = "7")]
        Procedure(::prost::alloc::string::String),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FavoritesListResponse {
    #[prost(message, repeated, tag = "1")]
    pub favorites: ::prost::alloc::vec::Vec<FavoriteResource>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetFavoritesListRequest {
    #[prost(message, repeated, tag = "1")]
    pub resources: ::prost::alloc::vec::Vec<FavoriteResource>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetFavoritesListRequest {
    #[prost(string, tag = "1")]
    pub workspace_rid: ::prost::alloc::string::String,
    #[prost(enumeration = "ResourceType", repeated, tag = "2")]
    pub resource_types: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SetFavoritesListRequestWrapper {
    #[prost(string, tag = "1")]
    pub workspace_rid: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub request: ::core::option::Option<SetFavoritesListRequest>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ResourceType {
    Unspecified = 0,
    Asset = 1,
    Run = 2,
    Notebook = 3,
    NotebookTemplate = 4,
    Checklist = 5,
    SavedView = 6,
    Procedure = 7,
}
impl ResourceType {
    /// 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 => "RESOURCE_TYPE_UNSPECIFIED",
            Self::Asset => "ASSET",
            Self::Run => "RUN",
            Self::Notebook => "NOTEBOOK",
            Self::NotebookTemplate => "NOTEBOOK_TEMPLATE",
            Self::Checklist => "CHECKLIST",
            Self::SavedView => "SAVED_VIEW",
            Self::Procedure => "PROCEDURE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "RESOURCE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
            "ASSET" => Some(Self::Asset),
            "RUN" => Some(Self::Run),
            "NOTEBOOK" => Some(Self::Notebook),
            "NOTEBOOK_TEMPLATE" => Some(Self::NotebookTemplate),
            "CHECKLIST" => Some(Self::Checklist),
            "SAVED_VIEW" => Some(Self::SavedView),
            "PROCEDURE" => Some(Self::Procedure),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum FavoritesError {
    DuplicateResourcesError = 0,
    ResourcesNotFoundError = 1,
    InvalidFavorite = 2,
}
impl FavoritesError {
    /// 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::DuplicateResourcesError => "FAVORITES_ERROR_DUPLICATE_RESOURCES_ERROR",
            Self::ResourcesNotFoundError => "FAVORITES_ERROR_RESOURCES_NOT_FOUND_ERROR",
            Self::InvalidFavorite => "FAVORITES_ERROR_INVALID_FAVORITE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "FAVORITES_ERROR_DUPLICATE_RESOURCES_ERROR" => {
                Some(Self::DuplicateResourcesError)
            }
            "FAVORITES_ERROR_RESOURCES_NOT_FOUND_ERROR" => {
                Some(Self::ResourcesNotFoundError)
            }
            "FAVORITES_ERROR_INVALID_FAVORITE" => Some(Self::InvalidFavorite),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod favorites_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 FavoritesServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl FavoritesServiceClient<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> FavoritesServiceClient<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,
        ) -> FavoritesServiceClient<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,
        {
            FavoritesServiceClient::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 get_favorites_list(
            &mut self,
            request: impl tonic::IntoRequest<super::GetFavoritesListRequest>,
        ) -> std::result::Result<
            tonic::Response<super::FavoritesListResponse>,
            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.favorites.v1.FavoritesService/GetFavoritesList",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.favorites.v1.FavoritesService",
                        "GetFavoritesList",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        pub async fn set_favorites_list(
            &mut self,
            request: impl tonic::IntoRequest<super::SetFavoritesListRequestWrapper>,
        ) -> std::result::Result<
            tonic::Response<super::FavoritesListResponse>,
            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.favorites.v1.FavoritesService/SetFavoritesList",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.favorites.v1.FavoritesService",
                        "SetFavoritesList",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}