support POST /repos/{owner}/{repo}/issues
This commit is contained in:
parent
c4b014294b
commit
8e45141822
17
src/issue.rs
17
src/issue.rs
|
@ -4,6 +4,10 @@ impl Forgejo {
|
||||||
pub async fn get_repo_issues(&mut self, owner: &str, repo: &str, query: IssueQuery) -> Result<Vec<Issue>, ForgejoError> {
|
pub async fn get_repo_issues(&mut self, owner: &str, repo: &str, query: IssueQuery) -> Result<Vec<Issue>, ForgejoError> {
|
||||||
self.get(&query.to_string(owner, repo)).await
|
self.get(&query.to_string(owner, repo)).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub async fn create_issue(&mut self, owner: &str, repo: &str, opts: CreateIssueOption) -> Result<Issue, ForgejoError> {
|
||||||
|
self.post(&format!("/repos/{owner}/{repo}/issues"), &opts).await
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(serde::Deserialize, Debug, PartialEq)]
|
#[derive(serde::Deserialize, Debug, PartialEq)]
|
||||||
|
@ -126,3 +130,16 @@ impl IssueQueryType {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(serde::Serialize, Debug, PartialEq, Default)]
|
||||||
|
pub struct CreateIssueOption {
|
||||||
|
pub assignees: Vec<String>,
|
||||||
|
pub body: Option<String>,
|
||||||
|
pub closed: Option<bool>,
|
||||||
|
#[serde(with = "time::serde::rfc3339::option")]
|
||||||
|
pub due_date: Option<time::OffsetDateTime>,
|
||||||
|
pub labels: Vec<u64>,
|
||||||
|
pub milestone: Option<u64>,
|
||||||
|
pub _ref: Option<String>,
|
||||||
|
pub title: String,
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue