adk_anthropic/types/
file_object.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
5pub struct FileObject {
6 pub id: String,
8 pub filename: String,
10 pub created_at: i64,
12 pub size: u64,
14 pub purpose: String,
16}
17
18#[cfg(test)]
19mod tests {
20 use super::*;
21 use serde_json::json;
22
23 #[test]
24 fn roundtrip() {
25 let obj = FileObject {
26 id: "file-abc123".to_string(),
27 filename: "document.pdf".to_string(),
28 created_at: 1700000000,
29 size: 1024,
30 purpose: "assistants".to_string(),
31 };
32 let json = serde_json::to_value(&obj).unwrap();
33 assert_eq!(
34 json,
35 json!({
36 "id": "file-abc123",
37 "filename": "document.pdf",
38 "created_at": 1700000000,
39 "size": 1024,
40 "purpose": "assistants"
41 })
42 );
43 let deserialized: FileObject = serde_json::from_value(json).unwrap();
44 assert_eq!(obj, deserialized);
45 }
46}