#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Comment {
#[prost(string, tag = "1")]
pub rid: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub parent: ::core::option::Option<CommentParent>,
#[prost(string, tag = "3")]
pub author_rid: ::prost::alloc::string::String,
#[prost(message, optional, tag = "4")]
pub created_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(message, optional, tag = "5")]
pub edited_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(message, optional, tag = "6")]
pub deleted_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(string, tag = "7")]
pub content: ::prost::alloc::string::String,
#[prost(string, optional, tag = "8")]
pub pinned_by: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, optional, tag = "9")]
pub pinned_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(message, repeated, tag = "10")]
pub reactions: ::prost::alloc::vec::Vec<Reaction>,
#[prost(string, repeated, tag = "11")]
pub attachments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommentParent {
#[prost(oneof = "comment_parent::CommentParent", tags = "1, 2")]
pub comment_parent: ::core::option::Option<comment_parent::CommentParent>,
}
pub mod comment_parent {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum CommentParent {
#[prost(message, tag = "1")]
Resource(super::CommentParentResource),
#[prost(message, tag = "2")]
Comment(super::CommentParentComment),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommentParentComment {
#[prost(string, tag = "1")]
pub comment_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommentParentResource {
#[prost(enumeration = "ResourceType", tag = "1")]
pub resource_type: i32,
#[prost(string, tag = "2")]
pub resource_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Conversation {
#[prost(string, tag = "1")]
pub resource_rid: ::prost::alloc::string::String,
#[prost(enumeration = "ResourceType", tag = "2")]
pub resource_type: i32,
#[prost(message, repeated, tag = "3")]
pub comments: ::prost::alloc::vec::Vec<ConversationNode>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ConversationNode {
#[prost(message, optional, tag = "1")]
pub comment: ::core::option::Option<Comment>,
#[prost(message, repeated, tag = "2")]
pub replies: ::prost::alloc::vec::Vec<ConversationNode>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateCommentRequest {
#[prost(message, optional, tag = "1")]
pub parent: ::core::option::Option<CommentParent>,
#[prost(string, tag = "2")]
pub content: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub attachments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EditCommentRequest {
#[prost(string, tag = "1")]
pub content: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "2")]
pub attachments: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Reaction {
#[prost(string, tag = "1")]
pub rid: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub user_rid: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub created_at: ::core::option::Option<
super::super::super::google::protobuf::Timestamp,
>,
#[prost(enumeration = "ReactionType", tag = "4")]
pub r#type: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationRequest {
#[prost(enumeration = "ResourceType", tag = "1")]
pub resource_type: i32,
#[prost(string, tag = "2")]
pub resource_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationResponse {
#[prost(message, optional, tag = "1")]
pub conversation: ::core::option::Option<Conversation>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetConversationCountRequest {
#[prost(enumeration = "ResourceType", tag = "1")]
pub resource_type: i32,
#[prost(string, tag = "2")]
pub resource_rid: ::prost::alloc::string::String,
#[prost(bool, optional, tag = "3")]
pub include_deleted: ::core::option::Option<bool>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetConversationCountResponse {
#[prost(int32, tag = "1")]
pub count: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCommentRequest {
#[prost(string, tag = "1")]
pub comment_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCommentResponse {
#[prost(message, optional, tag = "1")]
pub comment: ::core::option::Option<Comment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateCommentResponse {
#[prost(message, optional, tag = "1")]
pub comment: ::core::option::Option<Comment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EditCommentRequestWrapper {
#[prost(string, tag = "1")]
pub comment_rid: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub request: ::core::option::Option<EditCommentRequest>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct EditCommentResponse {
#[prost(message, optional, tag = "1")]
pub comment: ::core::option::Option<Comment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteCommentRequest {
#[prost(string, tag = "1")]
pub comment_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteCommentResponse {
#[prost(message, optional, tag = "1")]
pub comment: ::core::option::Option<Comment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PinCommentRequest {
#[prost(string, tag = "1")]
pub comment_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct PinCommentResponse {
#[prost(message, optional, tag = "1")]
pub comment: ::core::option::Option<Comment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnpinCommentRequest {
#[prost(string, tag = "1")]
pub comment_rid: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UnpinCommentResponse {
#[prost(message, optional, tag = "1")]
pub comment: ::core::option::Option<Comment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddReactionRequest {
#[prost(string, tag = "1")]
pub comment_rid: ::prost::alloc::string::String,
#[prost(enumeration = "ReactionType", tag = "2")]
pub r#type: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AddReactionResponse {
#[prost(message, optional, tag = "1")]
pub comment: ::core::option::Option<Comment>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveReactionRequest {
#[prost(string, tag = "1")]
pub comment_rid: ::prost::alloc::string::String,
#[prost(enumeration = "ReactionType", tag = "2")]
pub r#type: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveReactionResponse {
#[prost(message, optional, tag = "1")]
pub comment: ::core::option::Option<Comment>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ReactionType {
Unspecified = 0,
Like = 1,
Dislike = 2,
Heart = 3,
Hooray = 4,
Rocket = 5,
Eyes = 6,
}
impl ReactionType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "REACTION_TYPE_UNSPECIFIED",
Self::Like => "LIKE",
Self::Dislike => "DISLIKE",
Self::Heart => "HEART",
Self::Hooray => "HOORAY",
Self::Rocket => "ROCKET",
Self::Eyes => "EYES",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"REACTION_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"LIKE" => Some(Self::Like),
"DISLIKE" => Some(Self::Dislike),
"HEART" => Some(Self::Heart),
"HOORAY" => Some(Self::Hooray),
"ROCKET" => Some(Self::Rocket),
"EYES" => Some(Self::Eyes),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum ResourceType {
Unspecified = 0,
Run = 1,
Event = 2,
}
impl ResourceType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Unspecified => "RESOURCE_TYPE_UNSPECIFIED",
Self::Run => "RUN",
Self::Event => "EVENT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"RESOURCE_TYPE_UNSPECIFIED" => Some(Self::Unspecified),
"RUN" => Some(Self::Run),
"EVENT" => Some(Self::Event),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CommentsError {
CommentNotFound = 0,
ContentTooLong = 1,
EmptyCommentContent = 2,
InvalidAttachment = 3,
MaxNestingDepthExceeded = 4,
Unauthorized = 5,
}
impl CommentsError {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::CommentNotFound => "COMMENTS_ERROR_COMMENT_NOT_FOUND",
Self::ContentTooLong => "COMMENTS_ERROR_CONTENT_TOO_LONG",
Self::EmptyCommentContent => "COMMENTS_ERROR_EMPTY_COMMENT_CONTENT",
Self::InvalidAttachment => "COMMENTS_ERROR_INVALID_ATTACHMENT",
Self::MaxNestingDepthExceeded => "COMMENTS_ERROR_MAX_NESTING_DEPTH_EXCEEDED",
Self::Unauthorized => "COMMENTS_ERROR_UNAUTHORIZED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"COMMENTS_ERROR_COMMENT_NOT_FOUND" => Some(Self::CommentNotFound),
"COMMENTS_ERROR_CONTENT_TOO_LONG" => Some(Self::ContentTooLong),
"COMMENTS_ERROR_EMPTY_COMMENT_CONTENT" => Some(Self::EmptyCommentContent),
"COMMENTS_ERROR_INVALID_ATTACHMENT" => Some(Self::InvalidAttachment),
"COMMENTS_ERROR_MAX_NESTING_DEPTH_EXCEEDED" => {
Some(Self::MaxNestingDepthExceeded)
}
"COMMENTS_ERROR_UNAUTHORIZED" => Some(Self::Unauthorized),
_ => None,
}
}
}
pub mod comments_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 CommentsServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl CommentsServiceClient<tonic::transport::Channel> {
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> CommentsServiceClient<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,
) -> CommentsServiceClient<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,
{
CommentsServiceClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[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_conversation(
&mut self,
request: impl tonic::IntoRequest<super::GetConversationRequest>,
) -> std::result::Result<
tonic::Response<super::GetConversationResponse>,
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.comments.v1.CommentsService/GetConversation",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.comments.v1.CommentsService",
"GetConversation",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_conversation_count(
&mut self,
request: impl tonic::IntoRequest<super::GetConversationCountRequest>,
) -> std::result::Result<
tonic::Response<super::GetConversationCountResponse>,
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.comments.v1.CommentsService/GetConversationCount",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.comments.v1.CommentsService",
"GetConversationCount",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_comment(
&mut self,
request: impl tonic::IntoRequest<super::GetCommentRequest>,
) -> std::result::Result<
tonic::Response<super::GetCommentResponse>,
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.comments.v1.CommentsService/GetComment",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("nominal.comments.v1.CommentsService", "GetComment"),
);
self.inner.unary(req, path, codec).await
}
pub async fn create_comment(
&mut self,
request: impl tonic::IntoRequest<super::CreateCommentRequest>,
) -> std::result::Result<
tonic::Response<super::CreateCommentResponse>,
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.comments.v1.CommentsService/CreateComment",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.comments.v1.CommentsService",
"CreateComment",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn edit_comment(
&mut self,
request: impl tonic::IntoRequest<super::EditCommentRequestWrapper>,
) -> std::result::Result<
tonic::Response<super::EditCommentResponse>,
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.comments.v1.CommentsService/EditComment",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("nominal.comments.v1.CommentsService", "EditComment"),
);
self.inner.unary(req, path, codec).await
}
pub async fn delete_comment(
&mut self,
request: impl tonic::IntoRequest<super::DeleteCommentRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteCommentResponse>,
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.comments.v1.CommentsService/DeleteComment",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.comments.v1.CommentsService",
"DeleteComment",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn pin_comment(
&mut self,
request: impl tonic::IntoRequest<super::PinCommentRequest>,
) -> std::result::Result<
tonic::Response<super::PinCommentResponse>,
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.comments.v1.CommentsService/PinComment",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("nominal.comments.v1.CommentsService", "PinComment"),
);
self.inner.unary(req, path, codec).await
}
pub async fn unpin_comment(
&mut self,
request: impl tonic::IntoRequest<super::UnpinCommentRequest>,
) -> std::result::Result<
tonic::Response<super::UnpinCommentResponse>,
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.comments.v1.CommentsService/UnpinComment",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.comments.v1.CommentsService",
"UnpinComment",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn add_reaction(
&mut self,
request: impl tonic::IntoRequest<super::AddReactionRequest>,
) -> std::result::Result<
tonic::Response<super::AddReactionResponse>,
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.comments.v1.CommentsService/AddReaction",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new("nominal.comments.v1.CommentsService", "AddReaction"),
);
self.inner.unary(req, path, codec).await
}
pub async fn remove_reaction(
&mut self,
request: impl tonic::IntoRequest<super::RemoveReactionRequest>,
) -> std::result::Result<
tonic::Response<super::RemoveReactionResponse>,
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.comments.v1.CommentsService/RemoveReaction",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"nominal.comments.v1.CommentsService",
"RemoveReaction",
),
);
self.inner.unary(req, path, codec).await
}
}
}