Skip to main content

nominal_api_proto/proto/
nominal.uploads.v1.rs

1// This file is @generated by prost-build.
2#[derive(Clone, PartialEq, ::prost::Message)]
3pub struct MultipartUpload {
4    #[prost(string, tag = "1")]
5    pub upload_id: ::prost::alloc::string::String,
6    #[prost(string, tag = "2")]
7    pub object_key: ::prost::alloc::string::String,
8    #[prost(string, tag = "3")]
9    pub file_name: ::prost::alloc::string::String,
10    #[prost(string, tag = "4")]
11    pub content_type: ::prost::alloc::string::String,
12    #[prost(string, optional, tag = "5")]
13    pub workspace_rid: ::core::option::Option<::prost::alloc::string::String>,
14    #[prost(string, optional, tag = "6")]
15    pub target_resource_rid: ::core::option::Option<::prost::alloc::string::String>,
16    #[prost(enumeration = "UploadDestination", tag = "7")]
17    pub destination: i32,
18}
19#[derive(Clone, PartialEq, ::prost::Message)]
20pub struct UploadPart {
21    #[prost(int32, tag = "1")]
22    pub part_number: i32,
23    #[prost(string, tag = "2")]
24    pub etag: ::prost::alloc::string::String,
25    #[prost(int64, tag = "3")]
26    pub size_bytes: i64,
27}
28#[derive(Clone, PartialEq, ::prost::Message)]
29pub struct UploadPartUrl {
30    #[prost(string, tag = "1")]
31    pub url: ::prost::alloc::string::String,
32    #[prost(int64, tag = "2")]
33    pub expires_in_seconds: i64,
34}
35#[derive(Clone, PartialEq, ::prost::Message)]
36pub struct DownloadUrl {
37    #[prost(string, tag = "1")]
38    pub source_path: ::prost::alloc::string::String,
39    #[prost(string, tag = "2")]
40    pub url: ::prost::alloc::string::String,
41    #[prost(message, optional, tag = "3")]
42    pub expire_time: ::core::option::Option<
43        super::super::super::google::protobuf::Timestamp,
44    >,
45}
46#[derive(Clone, PartialEq, ::prost::Message)]
47pub struct CreateMultipartUploadRequest {
48    #[prost(message, optional, tag = "1")]
49    pub multipart_upload: ::core::option::Option<MultipartUpload>,
50}
51#[derive(Clone, PartialEq, ::prost::Message)]
52pub struct CreateMultipartUploadResponse {
53    #[prost(message, optional, tag = "1")]
54    pub multipart_upload: ::core::option::Option<MultipartUpload>,
55}
56#[derive(Clone, PartialEq, ::prost::Message)]
57pub struct ListUploadPartsRequest {
58    #[prost(string, tag = "1")]
59    pub upload_id: ::prost::alloc::string::String,
60    #[prost(int32, tag = "2")]
61    pub page_size: i32,
62    #[prost(string, tag = "3")]
63    pub page_token: ::prost::alloc::string::String,
64}
65#[derive(Clone, PartialEq, ::prost::Message)]
66pub struct ListUploadPartsResponse {
67    #[prost(message, repeated, tag = "1")]
68    pub parts: ::prost::alloc::vec::Vec<UploadPart>,
69    #[prost(string, tag = "2")]
70    pub next_page_token: ::prost::alloc::string::String,
71}
72#[derive(Clone, PartialEq, ::prost::Message)]
73pub struct CreateUploadPartUrlRequest {
74    #[prost(string, tag = "1")]
75    pub upload_id: ::prost::alloc::string::String,
76    #[prost(int32, tag = "2")]
77    pub part_number: i32,
78}
79#[derive(Clone, PartialEq, ::prost::Message)]
80pub struct CreateUploadPartUrlResponse {
81    #[prost(message, optional, tag = "1")]
82    pub upload_part_url: ::core::option::Option<UploadPartUrl>,
83}
84#[derive(Clone, PartialEq, ::prost::Message)]
85pub struct CompleteMultipartUploadRequest {
86    #[prost(string, tag = "1")]
87    pub upload_id: ::prost::alloc::string::String,
88    #[prost(message, repeated, tag = "2")]
89    pub parts: ::prost::alloc::vec::Vec<UploadPart>,
90}
91#[derive(Clone, PartialEq, ::prost::Message)]
92pub struct CompleteMultipartUploadResponse {
93    #[prost(string, tag = "1")]
94    pub object_path: ::prost::alloc::string::String,
95}
96#[derive(Clone, PartialEq, ::prost::Message)]
97pub struct DeleteMultipartUploadRequest {
98    #[prost(string, tag = "1")]
99    pub upload_id: ::prost::alloc::string::String,
100}
101#[derive(Clone, Copy, PartialEq, ::prost::Message)]
102pub struct DeleteMultipartUploadResponse {}
103#[derive(Clone, PartialEq, ::prost::Message)]
104pub struct CreateDownloadUrlRequest {
105    #[prost(message, optional, tag = "1")]
106    pub download_url: ::core::option::Option<DownloadUrl>,
107}
108#[derive(Clone, PartialEq, ::prost::Message)]
109pub struct CreateDownloadUrlResponse {
110    #[prost(message, optional, tag = "1")]
111    pub download_url: ::core::option::Option<DownloadUrl>,
112}
113#[derive(Clone, PartialEq, ::prost::Message)]
114pub struct UploadFileMetadata {
115    #[prost(string, tag = "1")]
116    pub file_name: ::prost::alloc::string::String,
117    #[prost(int64, optional, tag = "2")]
118    pub size_bytes: ::core::option::Option<i64>,
119    #[prost(string, optional, tag = "3")]
120    pub workspace_rid: ::core::option::Option<::prost::alloc::string::String>,
121}
122#[derive(Clone, PartialEq, ::prost::Message)]
123pub struct UploadedFile {
124    #[prost(string, tag = "1")]
125    pub object_path: ::prost::alloc::string::String,
126}
127#[derive(Clone, PartialEq, ::prost::Message)]
128pub struct UploadFileRequest {
129    #[prost(oneof = "upload_file_request::Content", tags = "1, 2")]
130    pub content: ::core::option::Option<upload_file_request::Content>,
131}
132/// Nested message and enum types in `UploadFileRequest`.
133pub mod upload_file_request {
134    #[derive(Clone, PartialEq, ::prost::Oneof)]
135    pub enum Content {
136        #[prost(message, tag = "1")]
137        Metadata(super::UploadFileMetadata),
138        #[prost(bytes, tag = "2")]
139        Data(::prost::alloc::vec::Vec<u8>),
140    }
141}
142#[derive(Clone, PartialEq, ::prost::Message)]
143pub struct UploadFileResponse {
144    #[prost(message, optional, tag = "1")]
145    pub file: ::core::option::Option<UploadedFile>,
146}
147#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
148#[repr(i32)]
149pub enum UploadError {
150    Unspecified = 0,
151    InvalidPageToken = 1,
152    InvalidUploadId = 2,
153    InvalidUploadStream = 3,
154    UploadSizeMismatch = 4,
155    UploadStreamIdle = 5,
156    TooManyActiveUploads = 6,
157}
158impl UploadError {
159    /// String value of the enum field names used in the ProtoBuf definition.
160    ///
161    /// The values are not transformed in any way and thus are considered stable
162    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
163    pub fn as_str_name(&self) -> &'static str {
164        match self {
165            Self::Unspecified => "UPLOAD_ERROR_UNSPECIFIED",
166            Self::InvalidPageToken => "UPLOAD_ERROR_INVALID_PAGE_TOKEN",
167            Self::InvalidUploadId => "UPLOAD_ERROR_INVALID_UPLOAD_ID",
168            Self::InvalidUploadStream => "UPLOAD_ERROR_INVALID_UPLOAD_STREAM",
169            Self::UploadSizeMismatch => "UPLOAD_ERROR_UPLOAD_SIZE_MISMATCH",
170            Self::UploadStreamIdle => "UPLOAD_ERROR_UPLOAD_STREAM_IDLE",
171            Self::TooManyActiveUploads => "UPLOAD_ERROR_TOO_MANY_ACTIVE_UPLOADS",
172        }
173    }
174    /// Creates an enum from field names used in the ProtoBuf definition.
175    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
176        match value {
177            "UPLOAD_ERROR_UNSPECIFIED" => Some(Self::Unspecified),
178            "UPLOAD_ERROR_INVALID_PAGE_TOKEN" => Some(Self::InvalidPageToken),
179            "UPLOAD_ERROR_INVALID_UPLOAD_ID" => Some(Self::InvalidUploadId),
180            "UPLOAD_ERROR_INVALID_UPLOAD_STREAM" => Some(Self::InvalidUploadStream),
181            "UPLOAD_ERROR_UPLOAD_SIZE_MISMATCH" => Some(Self::UploadSizeMismatch),
182            "UPLOAD_ERROR_UPLOAD_STREAM_IDLE" => Some(Self::UploadStreamIdle),
183            "UPLOAD_ERROR_TOO_MANY_ACTIVE_UPLOADS" => Some(Self::TooManyActiveUploads),
184            _ => None,
185        }
186    }
187}
188#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
189#[repr(i32)]
190pub enum UploadDestination {
191    Unspecified = 0,
192    StandaloneObject = 1,
193    FileStore = 2,
194}
195impl UploadDestination {
196    /// String value of the enum field names used in the ProtoBuf definition.
197    ///
198    /// The values are not transformed in any way and thus are considered stable
199    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
200    pub fn as_str_name(&self) -> &'static str {
201        match self {
202            Self::Unspecified => "UPLOAD_DESTINATION_UNSPECIFIED",
203            Self::StandaloneObject => "UPLOAD_DESTINATION_STANDALONE_OBJECT",
204            Self::FileStore => "UPLOAD_DESTINATION_FILE_STORE",
205        }
206    }
207    /// Creates an enum from field names used in the ProtoBuf definition.
208    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
209        match value {
210            "UPLOAD_DESTINATION_UNSPECIFIED" => Some(Self::Unspecified),
211            "UPLOAD_DESTINATION_STANDALONE_OBJECT" => Some(Self::StandaloneObject),
212            "UPLOAD_DESTINATION_FILE_STORE" => Some(Self::FileStore),
213            _ => None,
214        }
215    }
216}
217/// Generated client implementations.
218pub mod upload_service_client {
219    #![allow(
220        unused_variables,
221        dead_code,
222        missing_docs,
223        clippy::wildcard_imports,
224        clippy::let_unit_value,
225    )]
226    use tonic::codegen::*;
227    use tonic::codegen::http::Uri;
228    #[derive(Debug, Clone)]
229    pub struct UploadServiceClient<T> {
230        inner: tonic::client::Grpc<T>,
231    }
232    impl UploadServiceClient<tonic::transport::Channel> {
233        /// Attempt to create a new client by connecting to a given endpoint.
234        pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
235        where
236            D: TryInto<tonic::transport::Endpoint>,
237            D::Error: Into<StdError>,
238        {
239            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
240            Ok(Self::new(conn))
241        }
242    }
243    impl<T> UploadServiceClient<T>
244    where
245        T: tonic::client::GrpcService<tonic::body::Body>,
246        T::Error: Into<StdError>,
247        T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
248        <T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
249    {
250        pub fn new(inner: T) -> Self {
251            let inner = tonic::client::Grpc::new(inner);
252            Self { inner }
253        }
254        pub fn with_origin(inner: T, origin: Uri) -> Self {
255            let inner = tonic::client::Grpc::with_origin(inner, origin);
256            Self { inner }
257        }
258        pub fn with_interceptor<F>(
259            inner: T,
260            interceptor: F,
261        ) -> UploadServiceClient<InterceptedService<T, F>>
262        where
263            F: tonic::service::Interceptor,
264            T::ResponseBody: Default,
265            T: tonic::codegen::Service<
266                http::Request<tonic::body::Body>,
267                Response = http::Response<
268                    <T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
269                >,
270            >,
271            <T as tonic::codegen::Service<
272                http::Request<tonic::body::Body>,
273            >>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
274        {
275            UploadServiceClient::new(InterceptedService::new(inner, interceptor))
276        }
277        /// Compress requests with the given encoding.
278        ///
279        /// This requires the server to support it otherwise it might respond with an
280        /// error.
281        #[must_use]
282        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
283            self.inner = self.inner.send_compressed(encoding);
284            self
285        }
286        /// Enable decompressing responses.
287        #[must_use]
288        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
289            self.inner = self.inner.accept_compressed(encoding);
290            self
291        }
292        /// Limits the maximum size of a decoded message.
293        ///
294        /// Default: `4MB`
295        #[must_use]
296        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
297            self.inner = self.inner.max_decoding_message_size(limit);
298            self
299        }
300        /// Limits the maximum size of an encoded message.
301        ///
302        /// Default: `usize::MAX`
303        #[must_use]
304        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
305            self.inner = self.inner.max_encoding_message_size(limit);
306            self
307        }
308        pub async fn upload_file(
309            &mut self,
310            request: impl tonic::IntoStreamingRequest<Message = super::UploadFileRequest>,
311        ) -> std::result::Result<
312            tonic::Response<super::UploadFileResponse>,
313            tonic::Status,
314        > {
315            self.inner
316                .ready()
317                .await
318                .map_err(|e| {
319                    tonic::Status::unknown(
320                        format!("Service was not ready: {}", e.into()),
321                    )
322                })?;
323            let codec = tonic::codec::ProstCodec::default();
324            let path = http::uri::PathAndQuery::from_static(
325                "/nominal.uploads.v1.UploadService/UploadFile",
326            );
327            let mut req = request.into_streaming_request();
328            req.extensions_mut()
329                .insert(
330                    GrpcMethod::new("nominal.uploads.v1.UploadService", "UploadFile"),
331                );
332            self.inner.client_streaming(req, path, codec).await
333        }
334        pub async fn create_multipart_upload(
335            &mut self,
336            request: impl tonic::IntoRequest<super::CreateMultipartUploadRequest>,
337        ) -> std::result::Result<
338            tonic::Response<super::CreateMultipartUploadResponse>,
339            tonic::Status,
340        > {
341            self.inner
342                .ready()
343                .await
344                .map_err(|e| {
345                    tonic::Status::unknown(
346                        format!("Service was not ready: {}", e.into()),
347                    )
348                })?;
349            let codec = tonic::codec::ProstCodec::default();
350            let path = http::uri::PathAndQuery::from_static(
351                "/nominal.uploads.v1.UploadService/CreateMultipartUpload",
352            );
353            let mut req = request.into_request();
354            req.extensions_mut()
355                .insert(
356                    GrpcMethod::new(
357                        "nominal.uploads.v1.UploadService",
358                        "CreateMultipartUpload",
359                    ),
360                );
361            self.inner.unary(req, path, codec).await
362        }
363        pub async fn list_upload_parts(
364            &mut self,
365            request: impl tonic::IntoRequest<super::ListUploadPartsRequest>,
366        ) -> std::result::Result<
367            tonic::Response<super::ListUploadPartsResponse>,
368            tonic::Status,
369        > {
370            self.inner
371                .ready()
372                .await
373                .map_err(|e| {
374                    tonic::Status::unknown(
375                        format!("Service was not ready: {}", e.into()),
376                    )
377                })?;
378            let codec = tonic::codec::ProstCodec::default();
379            let path = http::uri::PathAndQuery::from_static(
380                "/nominal.uploads.v1.UploadService/ListUploadParts",
381            );
382            let mut req = request.into_request();
383            req.extensions_mut()
384                .insert(
385                    GrpcMethod::new(
386                        "nominal.uploads.v1.UploadService",
387                        "ListUploadParts",
388                    ),
389                );
390            self.inner.unary(req, path, codec).await
391        }
392        pub async fn create_upload_part_url(
393            &mut self,
394            request: impl tonic::IntoRequest<super::CreateUploadPartUrlRequest>,
395        ) -> std::result::Result<
396            tonic::Response<super::CreateUploadPartUrlResponse>,
397            tonic::Status,
398        > {
399            self.inner
400                .ready()
401                .await
402                .map_err(|e| {
403                    tonic::Status::unknown(
404                        format!("Service was not ready: {}", e.into()),
405                    )
406                })?;
407            let codec = tonic::codec::ProstCodec::default();
408            let path = http::uri::PathAndQuery::from_static(
409                "/nominal.uploads.v1.UploadService/CreateUploadPartUrl",
410            );
411            let mut req = request.into_request();
412            req.extensions_mut()
413                .insert(
414                    GrpcMethod::new(
415                        "nominal.uploads.v1.UploadService",
416                        "CreateUploadPartUrl",
417                    ),
418                );
419            self.inner.unary(req, path, codec).await
420        }
421        pub async fn complete_multipart_upload(
422            &mut self,
423            request: impl tonic::IntoRequest<super::CompleteMultipartUploadRequest>,
424        ) -> std::result::Result<
425            tonic::Response<super::CompleteMultipartUploadResponse>,
426            tonic::Status,
427        > {
428            self.inner
429                .ready()
430                .await
431                .map_err(|e| {
432                    tonic::Status::unknown(
433                        format!("Service was not ready: {}", e.into()),
434                    )
435                })?;
436            let codec = tonic::codec::ProstCodec::default();
437            let path = http::uri::PathAndQuery::from_static(
438                "/nominal.uploads.v1.UploadService/CompleteMultipartUpload",
439            );
440            let mut req = request.into_request();
441            req.extensions_mut()
442                .insert(
443                    GrpcMethod::new(
444                        "nominal.uploads.v1.UploadService",
445                        "CompleteMultipartUpload",
446                    ),
447                );
448            self.inner.unary(req, path, codec).await
449        }
450        pub async fn delete_multipart_upload(
451            &mut self,
452            request: impl tonic::IntoRequest<super::DeleteMultipartUploadRequest>,
453        ) -> std::result::Result<
454            tonic::Response<super::DeleteMultipartUploadResponse>,
455            tonic::Status,
456        > {
457            self.inner
458                .ready()
459                .await
460                .map_err(|e| {
461                    tonic::Status::unknown(
462                        format!("Service was not ready: {}", e.into()),
463                    )
464                })?;
465            let codec = tonic::codec::ProstCodec::default();
466            let path = http::uri::PathAndQuery::from_static(
467                "/nominal.uploads.v1.UploadService/DeleteMultipartUpload",
468            );
469            let mut req = request.into_request();
470            req.extensions_mut()
471                .insert(
472                    GrpcMethod::new(
473                        "nominal.uploads.v1.UploadService",
474                        "DeleteMultipartUpload",
475                    ),
476                );
477            self.inner.unary(req, path, codec).await
478        }
479        pub async fn create_download_url(
480            &mut self,
481            request: impl tonic::IntoRequest<super::CreateDownloadUrlRequest>,
482        ) -> std::result::Result<
483            tonic::Response<super::CreateDownloadUrlResponse>,
484            tonic::Status,
485        > {
486            self.inner
487                .ready()
488                .await
489                .map_err(|e| {
490                    tonic::Status::unknown(
491                        format!("Service was not ready: {}", e.into()),
492                    )
493                })?;
494            let codec = tonic::codec::ProstCodec::default();
495            let path = http::uri::PathAndQuery::from_static(
496                "/nominal.uploads.v1.UploadService/CreateDownloadUrl",
497            );
498            let mut req = request.into_request();
499            req.extensions_mut()
500                .insert(
501                    GrpcMethod::new(
502                        "nominal.uploads.v1.UploadService",
503                        "CreateDownloadUrl",
504                    ),
505                );
506            self.inner.unary(req, path, codec).await
507        }
508    }
509}