Skip to main content

nominal_api_proto/proto/
nominal.attachments.v2.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct Attachment {
4    #[prost(string, tag = "1")]
5    pub rid: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub title: ::prost::alloc::string::String,
8    #[prost(string, tag = "3")]
9    pub s3_path: ::prost::alloc::string::String,
10    #[prost(string, tag = "4")]
11    pub file_type: ::prost::alloc::string::String,
12    #[prost(string, tag = "5")]
13    pub description: ::prost::alloc::string::String,
14    #[prost(string, tag = "6")]
15    pub created_by: ::prost::alloc::string::String,
16    #[prost(map = "string, string", tag = "7")]
17    pub properties: ::std::collections::HashMap<
18        ::prost::alloc::string::String,
19        ::prost::alloc::string::String,
20    >,
21    #[prost(string, repeated, tag = "8")]
22    pub labels: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
23    #[prost(message, optional, tag = "9")]
24    pub created_at: ::core::option::Option<
25        super::super::super::google::protobuf::Timestamp,
26    >,
27    #[prost(bool, tag = "10")]
28    pub is_archived: bool,
29}
30#[derive(Clone, PartialEq, ::prost::Message)]
31pub struct CreateAttachmentRequest {
32    #[prost(message, optional, tag = "1")]
33    pub attachment: ::core::option::Option<Attachment>,
34    #[prost(string, optional, tag = "2")]
35    pub workspace_rid: ::core::option::Option<::prost::alloc::string::String>,
36}
37#[derive(Clone, PartialEq, ::prost::Message)]
38pub struct CreateAttachmentResponse {
39    #[prost(message, optional, tag = "1")]
40    pub attachment: ::core::option::Option<Attachment>,
41}
42#[derive(Clone, PartialEq, ::prost::Message)]
43pub struct GetAttachmentRequest {
44    #[prost(string, tag = "1")]
45    pub attachment_rid: ::prost::alloc::string::String,
46}
47#[derive(Clone, PartialEq, ::prost::Message)]
48pub struct GetAttachmentResponse {
49    #[prost(message, optional, tag = "1")]
50    pub attachment: ::core::option::Option<Attachment>,
51}
52#[derive(Clone, PartialEq, ::prost::Message)]
53pub struct BatchGetAttachmentsRequest {
54    #[prost(string, repeated, tag = "1")]
55    pub attachment_rids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
56}
57#[derive(Clone, PartialEq, ::prost::Message)]
58pub struct BatchGetAttachmentsResponse {
59    #[prost(message, repeated, tag = "1")]
60    pub attachments: ::prost::alloc::vec::Vec<Attachment>,
61}
62#[derive(Clone, PartialEq, ::prost::Message)]
63pub struct UpdateAttachmentRequest {
64    #[prost(message, optional, tag = "1")]
65    pub attachment: ::core::option::Option<Attachment>,
66    #[prost(message, optional, tag = "2")]
67    pub update_mask: ::core::option::Option<
68        super::super::super::google::protobuf::FieldMask,
69    >,
70}
71#[derive(Clone, PartialEq, ::prost::Message)]
72pub struct UpdateAttachmentResponse {
73    #[prost(message, optional, tag = "1")]
74    pub attachment: ::core::option::Option<Attachment>,
75}
76#[derive(Clone, PartialEq, ::prost::Message)]
77pub struct GetAttachmentUriRequest {
78    #[prost(string, tag = "1")]
79    pub attachment_rid: ::prost::alloc::string::String,
80}
81#[derive(Clone, PartialEq, ::prost::Message)]
82pub struct GetAttachmentUriResponse {
83    #[prost(string, tag = "1")]
84    pub uri: ::prost::alloc::string::String,
85}
86#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
87#[repr(i32)]
88pub enum AttachmentError {
89    Unspecified = 0,
90    AttachmentNotFound = 1,
91    AttachmentsNotFound = 2,
92    InvalidS3Path = 3,
93    S3FileNotFound = 4,
94    InvalidRequest = 5,
95}
96impl AttachmentError {
97    /// String value of the enum field names used in the ProtoBuf definition.
98    ///
99    /// The values are not transformed in any way and thus are considered stable
100    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
101    pub fn as_str_name(&self) -> &'static str {
102        match self {
103            Self::Unspecified => "ATTACHMENT_ERROR_UNSPECIFIED",
104            Self::AttachmentNotFound => "ATTACHMENT_ERROR_ATTACHMENT_NOT_FOUND",
105            Self::AttachmentsNotFound => "ATTACHMENT_ERROR_ATTACHMENTS_NOT_FOUND",
106            Self::InvalidS3Path => "ATTACHMENT_ERROR_INVALID_S3_PATH",
107            Self::S3FileNotFound => "ATTACHMENT_ERROR_S3_FILE_NOT_FOUND",
108            Self::InvalidRequest => "ATTACHMENT_ERROR_INVALID_REQUEST",
109        }
110    }
111    /// Creates an enum from field names used in the ProtoBuf definition.
112    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
113        match value {
114            "ATTACHMENT_ERROR_UNSPECIFIED" => Some(Self::Unspecified),
115            "ATTACHMENT_ERROR_ATTACHMENT_NOT_FOUND" => Some(Self::AttachmentNotFound),
116            "ATTACHMENT_ERROR_ATTACHMENTS_NOT_FOUND" => Some(Self::AttachmentsNotFound),
117            "ATTACHMENT_ERROR_INVALID_S3_PATH" => Some(Self::InvalidS3Path),
118            "ATTACHMENT_ERROR_S3_FILE_NOT_FOUND" => Some(Self::S3FileNotFound),
119            "ATTACHMENT_ERROR_INVALID_REQUEST" => Some(Self::InvalidRequest),
120            _ => None,
121        }
122    }
123}
124/// Generated client implementations.
125pub mod attachment_service_client {
126    #![allow(
127        unused_variables,
128        dead_code,
129        missing_docs,
130        clippy::wildcard_imports,
131        clippy::let_unit_value,
132    )]
133    use tonic::codegen::*;
134    use tonic::codegen::http::Uri;
135    #[derive(Debug, Clone)]
136    pub struct AttachmentServiceClient<T> {
137        inner: tonic::client::Grpc<T>,
138    }
139    impl AttachmentServiceClient<tonic::transport::Channel> {
140        /// Attempt to create a new client by connecting to a given endpoint.
141        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
142        where
143            D: TryInto<tonic::transport::Endpoint>,
144            D::Error: Into<StdError>,
145        {
146            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
147            Ok(Self::new(conn))
148        }
149    }
150    impl<T> AttachmentServiceClient<T>
151    where
152        T: tonic::client::GrpcService<tonic::body::Body>,
153        T::Error: Into<StdError>,
154        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
155        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
156    {
157        pub fn new(inner: T) -> Self {
158            let inner = tonic::client::Grpc::new(inner);
159            Self { inner }
160        }
161        pub fn with_origin(inner: T, origin: Uri) -> Self {
162            let inner = tonic::client::Grpc::with_origin(inner, origin);
163            Self { inner }
164        }
165        pub fn with_interceptor<F>(
166            inner: T,
167            interceptor: F,
168        ) -> AttachmentServiceClient<InterceptedService<T, F>>
169        where
170            F: tonic::service::Interceptor,
171            T::ResponseBody: Default,
172            T: tonic::codegen::Service<
173                http::Request<tonic::body::Body>,
174                Response = http::Response<
175                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
176                >,
177            >,
178            <T as tonic::codegen::Service<
179                http::Request<tonic::body::Body>,
180            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
181        {
182            AttachmentServiceClient::new(InterceptedService::new(inner, interceptor))
183        }
184        /// Compress requests with the given encoding.
185        ///
186        /// This requires the server to support it otherwise it might respond with an
187        /// error.
188        #[must_use]
189        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
190            self.inner = self.inner.send_compressed(encoding);
191            self
192        }
193        /// Enable decompressing responses.
194        #[must_use]
195        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
196            self.inner = self.inner.accept_compressed(encoding);
197            self
198        }
199        /// Limits the maximum size of a decoded message.
200        ///
201        /// Default: `4MB`
202        #[must_use]
203        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
204            self.inner = self.inner.max_decoding_message_size(limit);
205            self
206        }
207        /// Limits the maximum size of an encoded message.
208        ///
209        /// Default: `usize::MAX`
210        #[must_use]
211        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
212            self.inner = self.inner.max_encoding_message_size(limit);
213            self
214        }
215        pub async fn create_attachment(
216            &mut self,
217            request: impl tonic::IntoRequest<super::CreateAttachmentRequest>,
218        ) -> std::result::Result<
219            tonic::Response<super::CreateAttachmentResponse>,
220            tonic::Status,
221        > {
222            self.inner
223                .ready()
224                .await
225                .map_err(|e| {
226                    tonic::Status::unknown(
227                        format!("Service was not ready: {}", e.into()),
228                    )
229                })?;
230            let codec = tonic::codec::ProstCodec::default();
231            let path = http::uri::PathAndQuery::from_static(
232                "/nominal.attachments.v2.AttachmentService/CreateAttachment",
233            );
234            let mut req = request.into_request();
235            req.extensions_mut()
236                .insert(
237                    GrpcMethod::new(
238                        "nominal.attachments.v2.AttachmentService",
239                        "CreateAttachment",
240                    ),
241                );
242            self.inner.unary(req, path, codec).await
243        }
244        pub async fn get_attachment(
245            &mut self,
246            request: impl tonic::IntoRequest<super::GetAttachmentRequest>,
247        ) -> std::result::Result<
248            tonic::Response<super::GetAttachmentResponse>,
249            tonic::Status,
250        > {
251            self.inner
252                .ready()
253                .await
254                .map_err(|e| {
255                    tonic::Status::unknown(
256                        format!("Service was not ready: {}", e.into()),
257                    )
258                })?;
259            let codec = tonic::codec::ProstCodec::default();
260            let path = http::uri::PathAndQuery::from_static(
261                "/nominal.attachments.v2.AttachmentService/GetAttachment",
262            );
263            let mut req = request.into_request();
264            req.extensions_mut()
265                .insert(
266                    GrpcMethod::new(
267                        "nominal.attachments.v2.AttachmentService",
268                        "GetAttachment",
269                    ),
270                );
271            self.inner.unary(req, path, codec).await
272        }
273        pub async fn batch_get_attachments(
274            &mut self,
275            request: impl tonic::IntoRequest<super::BatchGetAttachmentsRequest>,
276        ) -> std::result::Result<
277            tonic::Response<super::BatchGetAttachmentsResponse>,
278            tonic::Status,
279        > {
280            self.inner
281                .ready()
282                .await
283                .map_err(|e| {
284                    tonic::Status::unknown(
285                        format!("Service was not ready: {}", e.into()),
286                    )
287                })?;
288            let codec = tonic::codec::ProstCodec::default();
289            let path = http::uri::PathAndQuery::from_static(
290                "/nominal.attachments.v2.AttachmentService/BatchGetAttachments",
291            );
292            let mut req = request.into_request();
293            req.extensions_mut()
294                .insert(
295                    GrpcMethod::new(
296                        "nominal.attachments.v2.AttachmentService",
297                        "BatchGetAttachments",
298                    ),
299                );
300            self.inner.unary(req, path, codec).await
301        }
302        pub async fn update_attachment(
303            &mut self,
304            request: impl tonic::IntoRequest<super::UpdateAttachmentRequest>,
305        ) -> std::result::Result<
306            tonic::Response<super::UpdateAttachmentResponse>,
307            tonic::Status,
308        > {
309            self.inner
310                .ready()
311                .await
312                .map_err(|e| {
313                    tonic::Status::unknown(
314                        format!("Service was not ready: {}", e.into()),
315                    )
316                })?;
317            let codec = tonic::codec::ProstCodec::default();
318            let path = http::uri::PathAndQuery::from_static(
319                "/nominal.attachments.v2.AttachmentService/UpdateAttachment",
320            );
321            let mut req = request.into_request();
322            req.extensions_mut()
323                .insert(
324                    GrpcMethod::new(
325                        "nominal.attachments.v2.AttachmentService",
326                        "UpdateAttachment",
327                    ),
328                );
329            self.inner.unary(req, path, codec).await
330        }
331        pub async fn get_attachment_uri(
332            &mut self,
333            request: impl tonic::IntoRequest<super::GetAttachmentUriRequest>,
334        ) -> std::result::Result<
335            tonic::Response<super::GetAttachmentUriResponse>,
336            tonic::Status,
337        > {
338            self.inner
339                .ready()
340                .await
341                .map_err(|e| {
342                    tonic::Status::unknown(
343                        format!("Service was not ready: {}", e.into()),
344                    )
345                })?;
346            let codec = tonic::codec::ProstCodec::default();
347            let path = http::uri::PathAndQuery::from_static(
348                "/nominal.attachments.v2.AttachmentService/GetAttachmentUri",
349            );
350            let mut req = request.into_request();
351            req.extensions_mut()
352                .insert(
353                    GrpcMethod::new(
354                        "nominal.attachments.v2.AttachmentService",
355                        "GetAttachmentUri",
356                    ),
357                );
358            self.inner.unary(req, path, codec).await
359        }
360    }
361}