From abcbd1bd47ea277655d8459b286e8636072ee34e Mon Sep 17 00:00:00 2001 From: Dongri Jin Date: Fri, 22 Nov 2024 11:52:37 +0900 Subject: [PATCH] Add ContentTextAnnotations --- src/v1/message.rs | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/v1/message.rs b/src/v1/message.rs index e82644b..094689c 100644 --- a/src/v1/message.rs +++ b/src/v1/message.rs @@ -101,7 +101,7 @@ pub struct Content { #[derive(Debug, Deserialize, Serialize)] pub struct ContentText { pub value: String, - pub annotations: Vec, + pub annotations: Vec, } #[derive(Debug, Deserialize, Serialize)] @@ -132,3 +132,38 @@ pub struct ListMessageFile { pub has_more: bool, pub headers: Option>, } + +#[derive(Debug, Deserialize, Serialize)] +#[serde(tag = "type")] +#[serde(rename_all = "snake_case")] +pub enum ContentTextAnnotations { + FileCitation(ContentTextAnnotationsFileCitationObject), + FilePath(ContentTextAnnotationsFilePathObject), +} + +#[derive(Debug, Deserialize, Serialize)] +pub struct ContentTextAnnotationsFileCitationObject { + pub text: String, + pub file_citation: FileCitation, + pub start_index: u32, + pub end_index: u32, +} + +#[derive(Debug, Deserialize, Serialize)] +pub struct FileCitation { + pub file_id: String, + pub quote: Option, +} + +#[derive(Debug, Deserialize, Serialize)] +pub struct ContentTextAnnotationsFilePathObject { + pub text: String, + pub file_path: FilePath, + pub start_index: u32, + pub end_index: u32, +} + +#[derive(Debug, Deserialize, Serialize)] +pub struct FilePath { + pub file_id: String, +}