Commit 71c00d51 authored by Christophe Labouisse's avatar Christophe Labouisse
Browse files

Group milestone implementation

- Create new `Milestone::new_group` function to build milestone attached
to a group
- Create `Gitlab::create_group_milestone` to create a milestone
attached a group
parent 04918a1a
......@@ -1205,6 +1205,25 @@ impl Gitlab {
) -> GitlabResult<Milestone> {
let path = format!("projects/{}/milestones", project);
self.create_generic_milestone(path, milestone)
}
/// Create a new group milestone
pub fn create_group_milestone(
&self,
group: GroupId,
milestone: Milestone,
) -> GitlabResult<Milestone> {
let path = format!("groups/{}/milestones", group);
self.create_generic_milestone(path, milestone)
}
fn create_generic_milestone(
&self,
path: String,
milestone: Milestone,
) -> GitlabResult<Milestone> {
let mut params: Vec<(&str, String)> = Vec::new();
params.push(("title", milestone.title));
......
......@@ -1204,6 +1204,23 @@ impl Milestone {
start_date: None,
}
}
/// Create a new blank group milestone: it needs at least the GroupId and title
/// GroupId and title are mandatory for new milestone API of Gitlab
pub fn new_group(group_id: GroupId, title: String) -> Milestone {
Milestone {
id: MilestoneId::new(0),
iid: MilestoneInternalId::new(0),
project_id: None,
group_id: Some(group_id),
title,
description: None,
state: MilestoneState::Active,
created_at: Utc::now(),
updated_at: Utc::now(),
due_date: None,
start_date: None,
}
}
/// Complements the milestone with optional paramater: description
pub fn with_description(mut self, description: String) -> Milestone {
self.description = Some(description);
......
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