Skip to content

Commit e84c871

Browse files
committed
Merge branch 'rust-1.15'
2 parents a5c0d87 + 3d49d7b commit e84c871

File tree

14 files changed

+523
-607
lines changed

14 files changed

+523
-607
lines changed

Cargo.toml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,17 @@
11
[package]
22
name = "gitlab-api"
3-
version = "0.5.2"
3+
version = "0.6.0"
44
authors = ["Nicolas Bigaouette <nbigaouette@gmail.com>"]
55
description = "Wrapper for GitLab API v3"
66
license = "MIT/Apache-2.0"
77
repository = "https://github.com/nbigaouette/gitlab-api-rs"
88
readme = "README.md"
99
keywords = ["gitlab", "git"]
1010
categories = ["api-bindings"]
11-
build = "build.rs"
1211

1312
[badges]
1413
travis-ci = { repository = "nbigaouette/gitlab-api-rs" }
1514

16-
[features]
17-
default = ["serde_codegen"]
18-
unstable = ["serde_derive"]
19-
20-
[build-dependencies]
21-
serde_codegen = { version = "0.9", optional = true }
22-
2315
[dev-dependencies]
2416
env_logger = "0.4"
2517
clap = "2.20.1"
@@ -30,7 +22,7 @@ error-chain = "0.8"
3022
regex = "0.2.1"
3123
url = "1.4"
3224
serde = "0.9"
33-
serde_derive = { version = "0.9", optional = true }
25+
serde_derive = "0.9"
3426
serde_json = "0.9"
3527
serde_urlencoded = "0.4"
3628

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Rust wrapper to the GitLab API.
1010
[![Codecov](https://img.shields.io/codecov/c/github/nbigaouette/gitlab-api-rs/master.svg?style=flat)](https://codecov.io/github/nbigaouette/gitlab-api-rs?branch=master)
1111

1212

13-
13+
**NOTE**: Requires Rust 1.15 (stable) since this crate is using custom derive for Serde.
1414

1515
## Synopsis
1616

@@ -56,7 +56,7 @@ The (v3) API is quite long, so the parts I need will be implemented first.
5656
5757
```
5858
[dependencies]
59-
gitlab-api = "0.5.2"
59+
gitlab-api = "0.6"
6060
```
6161
6262
This crate uses a builder pattern to add filters to a query. Once the query is built, `list()` will commit it by contacting the GitLab server and performing the request.

build.rs

Lines changed: 0 additions & 39 deletions
This file was deleted.

src/gitlab.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,6 @@ fn remove_gitlab_token_from_url(url: &str) -> String {
390390
mod tests {
391391
use std::fmt;
392392
use gitlab::*;
393-
use errors::*;
394393

395394
fn verify_ok<T>(result: &Result<T>) {
396395
if let &Err(ref e) = result {

src/groups/mod.rs

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,51 @@ pub mod details;
4040
use ::errors::*;
4141

4242

43-
#[cfg(feature = "serde_derive")]
44-
include!("serde_types.in.rs");
43+
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
44+
pub enum ListingOrderBy {
45+
#[serde(rename = "name")]
46+
Name,
47+
#[serde(rename = "path")]
48+
Path,
49+
}
50+
51+
52+
#[derive(Debug, Clone, Serialize, Deserialize)]
53+
pub enum ListingId {
54+
Id(i64),
55+
NamespaceProject(String),
56+
}
57+
58+
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
59+
struct GroupsListerInternal {
60+
/// Skip the group IDs passes
61+
skip_groups: Option<Vec<i64>>,
62+
/// Show all the groups you have access to
63+
all_available: Option<bool>,
64+
/// Return list of authorized groups matching the search criteria
65+
search: Option<String>,
66+
/// Order groups by `name` or `path`. Default is `name`
67+
order_by: Option<ListingOrderBy>,
68+
/// Order groups in `asc` or `desc` order. Default is `asc`
69+
sort: Option<::ListingSort>,
70+
}
71+
72+
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
73+
struct ProjectsListerInternal {
74+
/// Limit by archived status.
75+
archived: Option<bool>,
76+
/// Limit by visibility
77+
visibility: Option<::ListingVisibility>,
78+
/// Return requests ordered by. Default is `ListingOrderBy::CreatedAt`.
79+
order_by: Option<::projects::ListingOrderBy>,
80+
/// Return requests sorted. Default is `::ListingSort::Desc`.
81+
sort: Option<::ListingSort>,
82+
/// Return list of authorized projects according to a search criteria.
83+
search: Option<String>,
84+
/// Return projects ordered by `ci_enabled` flag. Projects with enabled GitLab CI go first.
85+
ci_enabled_first: Option<bool>,
86+
}
4587

46-
#[cfg(feature = "serde_codegen")]
47-
include!(concat!(env!("OUT_DIR"), "/groups/serde_types.rs"));
4888

4989

5090
#[derive(Debug, Clone)]

src/groups/serde_types.in.rs

Lines changed: 0 additions & 44 deletions
This file was deleted.

src/issues/mod.rs

Lines changed: 100 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,6 @@
2121

2222
// use serde_urlencoded;
2323

24-
25-
#[cfg(feature = "serde_derive")]
26-
include!("serde_types.in.rs");
27-
28-
#[cfg(feature = "serde_codegen")]
29-
include!(concat!(env!("OUT_DIR"), "/issues/serde_types.rs"));
30-
3124
use BuildQuery;
3225
use Lister;
3326

@@ -38,6 +31,106 @@ pub mod single;
3831
use ::errors::*;
3932

4033

34+
#[derive(Debug, Copy, Clone, Serialize, Deserialize)]
35+
pub enum State {
36+
#[serde(rename = "opened")]
37+
Opened,
38+
#[serde(rename = "closed")]
39+
Closed,
40+
}
41+
42+
43+
#[derive(Debug, Clone, Copy, Serialize, Deserialize)]
44+
pub enum ListingOrderBy {
45+
#[serde(rename = "created_at")]
46+
CreatedAt,
47+
#[serde(rename = "updated_at")]
48+
UpdatedAt,
49+
}
50+
51+
52+
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
53+
struct IssuesListerInternal {
54+
/// State of issues to return.
55+
state: Option<State>,
56+
/// Labels of issues to return.
57+
labels: Option<Vec<String>>,
58+
/// Return requests ordered by. Default is `ListingOrderBy::CreatedAt`.
59+
order_by: Option<ListingOrderBy>,
60+
/// Return requests sorted. Default is `::ListingSort::Desc`.
61+
sort: Option<::ListingSort>,
62+
}
63+
64+
65+
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
66+
struct GroupIssuesListerInternal {
67+
/// State of issues to return.
68+
state: Option<State>,
69+
/// Labels of issues to return.
70+
labels: Option<Vec<String>>,
71+
/// The milestone title
72+
milestone: Option<String>,
73+
/// Return requests ordered by. Default is `ListingOrderBy::CreatedAt`.
74+
order_by: Option<ListingOrderBy>,
75+
/// Return requests sorted. Default is `::ListingSort::Desc`.
76+
sort: Option<::ListingSort>,
77+
}
78+
79+
80+
#[derive(Default, Debug, Clone, Serialize, Deserialize)]
81+
struct ProjectsIssuesListerInternal {
82+
iid: Option<i64>,
83+
/// State of issues to return.
84+
state: Option<State>,
85+
/// Labels of issues to return.
86+
labels: Option<Vec<String>>,
87+
/// The milestone title
88+
milestone: Option<String>,
89+
/// Return requests ordered by. Default is `ListingOrderBy::CreatedAt`.
90+
order_by: Option<ListingOrderBy>,
91+
/// Return requests sorted. Default is `::ListingSort::Desc`.
92+
sort: Option<::ListingSort>,
93+
}
94+
95+
96+
#[derive(Debug, Serialize, Deserialize)]
97+
pub enum IssueState {
98+
#[serde(rename = "opened")]
99+
Opened,
100+
#[serde(rename = "closed")]
101+
Closed,
102+
#[serde(rename = "reopened")]
103+
Reopened,
104+
}
105+
106+
107+
#[derive(Debug, Serialize, Deserialize)]
108+
pub struct Issue {
109+
pub id: i64,
110+
pub iid: i64,
111+
pub project_id: i64,
112+
pub title: String,
113+
pub description: String,
114+
pub state: IssueState,
115+
pub created_at: String, // FIXME: Use date type?
116+
pub updated_at: String, // FIXME: Use date type?
117+
pub labels: Vec<String>,
118+
pub milestone: Option<::Milestone>,
119+
pub assignee: Option<::User>,
120+
pub author: ::User,
121+
pub subscribed: bool,
122+
pub user_notes_count: i64,
123+
pub upvotes: i64,
124+
pub downvotes: i64,
125+
pub due_date: Option<String>, // FIXME: Use date type?
126+
pub confidential: bool,
127+
pub web_url: Option<String>
128+
}
129+
130+
131+
pub type Issues = Vec<Issue>;
132+
133+
41134
#[derive(Debug, Clone)]
42135
pub struct IssuesLister<'a> {
43136
gl: &'a ::GitLab,

0 commit comments

Comments
 (0)