Commit e598ec88 authored by Ben Boeckel's avatar Ben Boeckel Committed by Kitware Robot
Browse files

Merge topic 'mr-with-statuses'

5d74b2ba Use enum_serialize! for as_str method and derives more traits.
c8361223 Use additional parameter instead of three methods.

 Add {opened, merged ,closed}_merge_requests

Acked-by: Kitware Robot's avatarKitware Robot <>
Reviewed-by: Ben Boeckel's avatarBen Boeckel <>
Merge-request: !51
parents 100bc63c 5d74b2ba
......@@ -11,7 +11,8 @@ use self::ease::Error as EaseError;
use self::ease::{Request, Response, Url};
extern crate serde;
use self::serde::Deserialize;
use self::serde::{Deserialize, Deserializer, Serialize, Serializer};
use self::serde::de::Error as SerdeError;
extern crate serde_json;
......@@ -57,6 +58,23 @@ pub struct CommitStatusInfo<'a> {
pub description: Option<&'a str>,
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
/// Optional information for merge requests.
pub enum MergeRequestStateFilter {
/// Get the opened/reopened merge requests.
/// Get the closes merge requests.
/// Get the merged merge requests.
enum_serialize!(MergeRequestStateFilter -> "state",
Opened => "opened",
Closed => "closed",
Merged => "merged",
impl Gitlab {
/// Create a new Gitlab API representation.
......@@ -358,6 +376,15 @@ impl Gitlab {
self._get_paged(&format!("projects/{}/merge_requests", project))
/// Get the merge requests with a given state.
pub fn merge_requests_with_state(&self, project: ProjectId, state: MergeRequestStateFilter) -> GitlabResult<Vec<MergeRequest>> {
let mut req = try!(self._mkrequest(&format!("projects/{}/merge_requests", project)));
req.param("state", state.as_str());
/// Get merge requests.
pub fn merge_request(&self, project: ProjectId, merge_request: MergeRequestId)
-> GitlabResult<MergeRequest> {
......@@ -20,10 +20,10 @@ extern crate log;
extern crate quick_error;
mod error;
mod gitlab;
mod macros;
mod gitlab;
pub mod systemhooks;
pub mod types;
pub mod webhooks;
......@@ -31,6 +31,7 @@ pub mod hooks;
pub use error::Error;
pub use gitlab::CommitStatusInfo;
pub use gitlab::MergeRequestStateFilter;
pub use gitlab::Gitlab;
pub use gitlab::GitlabResult;
pub use types::*;
Supports Markdown
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