Skip to content

Commit abcbd1b

Browse files
committed
Add ContentTextAnnotations
1 parent 22c6ba0 commit abcbd1b

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

src/v1/message.rs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ pub struct Content {
101101
#[derive(Debug, Deserialize, Serialize)]
102102
pub struct ContentText {
103103
pub value: String,
104-
pub annotations: Vec<String>,
104+
pub annotations: Vec<ContentTextAnnotations>,
105105
}
106106

107107
#[derive(Debug, Deserialize, Serialize)]
@@ -132,3 +132,38 @@ pub struct ListMessageFile {
132132
pub has_more: bool,
133133
pub headers: Option<HashMap<String, String>>,
134134
}
135+
136+
#[derive(Debug, Deserialize, Serialize)]
137+
#[serde(tag = "type")]
138+
#[serde(rename_all = "snake_case")]
139+
pub enum ContentTextAnnotations {
140+
FileCitation(ContentTextAnnotationsFileCitationObject),
141+
FilePath(ContentTextAnnotationsFilePathObject),
142+
}
143+
144+
#[derive(Debug, Deserialize, Serialize)]
145+
pub struct ContentTextAnnotationsFileCitationObject {
146+
pub text: String,
147+
pub file_citation: FileCitation,
148+
pub start_index: u32,
149+
pub end_index: u32,
150+
}
151+
152+
#[derive(Debug, Deserialize, Serialize)]
153+
pub struct FileCitation {
154+
pub file_id: String,
155+
pub quote: Option<String>,
156+
}
157+
158+
#[derive(Debug, Deserialize, Serialize)]
159+
pub struct ContentTextAnnotationsFilePathObject {
160+
pub text: String,
161+
pub file_path: FilePath,
162+
pub start_index: u32,
163+
pub end_index: u32,
164+
}
165+
166+
#[derive(Debug, Deserialize, Serialize)]
167+
pub struct FilePath {
168+
pub file_id: String,
169+
}

0 commit comments

Comments
 (0)