diff --git a/src/types/api/attachment.rs b/src/types/api/attachment.rs index 3f0b8b1..2736762 100644 --- a/src/types/api/attachment.rs +++ b/src/types/api/attachment.rs @@ -28,3 +28,13 @@ impl Display for Attachment { write!(f, "{}", self.name) } } + +#[cfg(test)] +mod tests { + #[test] + fn deserialize_multiple_attachments() { + let data = include_str!("../../../test_data/example_attachments.json"); + + let _: Vec = serde_json::from_str(data).unwrap(); + } +} diff --git a/src/types/api/issue.rs b/src/types/api/issue.rs index e8ca29e..274e77d 100644 --- a/src/types/api/issue.rs +++ b/src/types/api/issue.rs @@ -33,3 +33,89 @@ // url string // user User{...} // }] + +use std::fmt::Display; + +use chrono::{DateTime, Utc}; +use serde::{Deserialize, Serialize}; +use url::Url; + +use crate::types::api::attachment::Attachment; +use crate::types::api::label::Label; +use crate::types::api::milestone::Milestone; +use crate::types::api::pull_request_meta::PullRequestMeta; +use crate::types::api::repo_meta::RepositoryMeta; +use crate::types::api::user::User; +use crate::types::misc::boolean_enums::is::locked::IsLocked; +use crate::types::misc::boolean_enums::state_type::StateType; + +/// Represents an issue in a repository. +#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +pub struct Issue { + /// List of attachments. + pub assets: Vec, + /// The user assigned to the issue. + pub assignee: Option, + /// List of assignees. + pub assignees: Vec, + /// The body of the issue. + pub body: String, + /// The date and time when the issue was closed (if closed). + pub closed_at: Option>, + /// The number of comments on the issue. + pub comments: usize, + /// The date and time when the issue was created. + pub created_at: DateTime, + /// The due date of the issue. + pub due_date: Option>, + /// The HTML URL of the issue. + pub html_url: Url, + /// The unique identifier of the issue. + pub id: usize, + /// Indicates whether the issue is locked. + pub is_locked: IsLocked, + /// List of labels associated with the issue. + pub labels: Vec