2026-03-25 13:44:03 -05:00
|
|
|
use bytes::Bytes;
|
|
|
|
|
use chrono::{DateTime, Utc};
|
|
|
|
|
use serde::Deserialize;
|
|
|
|
|
|
|
|
|
|
/// Information about a file attachment.
|
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
|
pub struct FileInfo {
|
2026-03-25 14:11:08 -05:00
|
|
|
#[serde(rename = "type")]
|
|
|
|
|
pub file_type: Option<String>,
|
|
|
|
|
pub content_type: Option<String>,
|
|
|
|
|
pub name: Option<String>,
|
|
|
|
|
pub created_date: Option<DateTime<Utc>>,
|
|
|
|
|
pub modified_date: Option<DateTime<Utc>>,
|
|
|
|
|
pub owner: Option<String>,
|
|
|
|
|
pub notes: Option<String>,
|
|
|
|
|
pub file_href: Option<String>,
|
2026-03-25 13:44:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// The content of a downloaded file.
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub struct FileResponse {
|
2026-03-25 14:11:08 -05:00
|
|
|
pub content_type: Option<String>,
|
|
|
|
|
pub file_name: Option<String>,
|
|
|
|
|
pub data: Bytes,
|
2026-03-25 13:44:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Request to upload a file.
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
|
|
pub struct SaveFileRequest {
|
2026-03-25 14:11:08 -05:00
|
|
|
pub record_id: i32,
|
|
|
|
|
pub field_id: i32,
|
|
|
|
|
pub notes: Option<String>,
|
|
|
|
|
pub modified_date: Option<DateTime<Utc>>,
|
|
|
|
|
pub file_name: String,
|
|
|
|
|
pub file_data: Vec<u8>,
|
|
|
|
|
pub content_type: String,
|
2026-03-25 13:44:03 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// Response from creating a file, containing the new file ID.
|
|
|
|
|
#[derive(Debug, Clone, Deserialize)]
|
|
|
|
|
#[serde(rename_all = "camelCase")]
|
|
|
|
|
pub struct CreatedWithIdResponse {
|
2026-03-25 14:11:08 -05:00
|
|
|
pub id: i32,
|
2026-03-25 13:44:03 -05:00
|
|
|
}
|