Skip to main content

utapi_rs/models/
list_files.rs

1use serde::Deserialize;
2
3use crate::models::UploadthingFileStatus;
4
5/// A representation of an uploaded file within the system.
6///
7/// This struct is used to deserialize information about files that have been
8/// uploaded, including their key, unique identifier, and current status.
9#[derive(Debug, Deserialize)]
10pub struct UploadthingFile {
11    /// A unique key associated with the file, typically used for retrieval.
12    pub key: String,
13    /// A unique identifier for the file, often a UUID.
14    pub id: String,
15    /// The current status of the file, indicating whether it's pending, completed, etc.
16    pub status: UploadthingFileStatus,
17    /// The name of the file.
18    pub name: String,
19}
20
21/// A response structure containing a list of `UploadthingFile` objects.
22///
23/// This is typically used to send a collection of uploaded file information
24/// back to a client, encapsulating the data in a single struct for convenience.
25#[derive(Debug, Deserialize)]
26pub struct UploadthingFileResponse {
27    /// A vector of `UploadthingFile` objects representing each file's data.
28    pub files: Vec<UploadthingFile>,
29}