diff --git a/Cargo.lock b/Cargo.lock index 9b21a63..2c23273 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -794,6 +794,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" dependencies = [ "deranged", + "itoa", "powerfmt", "serde", "time-core", diff --git a/Cargo.toml b/Cargo.toml index 14f45dd..d64f32a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,4 +12,4 @@ thiserror = "1.0.43" tokio = { version = "1.29.1", features = ["net"] } url = { version = "2.4.0", features = ["serde"] } serde = { version = "1.0.168", features = ["derive"] } -time = { version = "0.3.22", features = ["parsing", "serde"] } +time = { version = "0.3.22", features = ["parsing", "serde", "formatting"] } diff --git a/src/issue.rs b/src/issue.rs new file mode 100644 index 0000000..bfd5355 --- /dev/null +++ b/src/issue.rs @@ -0,0 +1,128 @@ +use super::*; + +impl Forgejo { + pub async fn get_repo_issues(&mut self, owner: &str, repo: &str, query: IssueQuery) -> Result, ForgejoError> { + self.get(&query.to_string(owner, repo)).await + } +} + +#[derive(serde::Deserialize, Debug, PartialEq)] +pub struct Issue { + pub assets: Vec, + pub assignee: User, + pub assignees: Vec, + pub body: String, + #[serde(with = "time::serde::rfc3339")] + pub closed_at: time::OffsetDateTime, + pub comments: u64, + #[serde(with = "time::serde::rfc3339")] + pub created_at: time::OffsetDateTime, + #[serde(with = "time::serde::rfc3339")] + pub due_date: time::OffsetDateTime, + pub html_url: Url, + pub id: u64, + pub is_locked: bool, + pub labels: Vec