Commit 4bbbe235 authored by VC's avatar VC Committed by Brad King

gitlab: add function to get labels with counts

GitLab's query for labels now only returns counts if `with_counts=true`
is added, e.g. `GET /projects/:id/labels?with_counts=true`.
parent 306faaa7
Pipeline #145399 passed with stage
......@@ -727,6 +727,11 @@ impl Gitlab {
self.get_paged(&format!("projects/{}/labels", project))
}
/// Get the labels with open/closed/merge requests count
pub fn labels_with_counts(&self, project: ProjectId) -> Result<Vec<Label>> {
self.get_paged_with_param(&format!("projects/{}/labels", project), vec![("with_counts", "true")])
}
/// Get label by ID.
pub fn label(&self, project: ProjectId, label: LabelId) -> Result<Label> {
self.get(&format!("projects/{}/labels/{}", project, label))
......
......@@ -1308,11 +1308,11 @@ pub struct Label {
/// The description of the label.
pub description: Option<String>,
/// The number of opened issues associated with the label.
pub open_issues_count: u64,
pub open_issues_count: Option<u64>,
/// the number of closed issues associated with the label.
pub closed_issues_count: u64,
pub closed_issues_count: Option<u64>,
/// The number of open merge request associated with the label.
pub open_merge_requests_count: u64,
pub open_merge_requests_count: Option<u64>,
/// Whether or not the account connecting has subscribed to the label.
pub subscribed: bool,
/// The priority of the label.
......@@ -1328,9 +1328,9 @@ impl Label {
name: name,
color: color,
description: None,
open_issues_count: 0,
closed_issues_count: 0,
open_merge_requests_count: 0,
open_issues_count: None,
closed_issues_count: None,
open_merge_requests_count: None,
subscribed: false,
priority: None,
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment