Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ContentTextAnnotations #128

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 36 additions & 1 deletion src/v1/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ pub struct Content {
#[derive(Debug, Deserialize, Serialize)]
pub struct ContentText {
pub value: String,
pub annotations: Vec<String>,
pub annotations: Vec<ContentTextAnnotations>,
}

#[derive(Debug, Deserialize, Serialize)]
Expand Down Expand Up @@ -132,3 +132,38 @@ pub struct ListMessageFile {
pub has_more: bool,
pub headers: Option<HashMap<String, String>>,
}

#[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<String>,
}

#[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,
}
Loading