Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all elements of IssueOptions be Options #42

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env_logger="0.3"

[build-dependencies]
serde_codegen = "0.7"
syntex = "0.35"
syntex = "0.37"

[dependencies]
log = "0.3"
Expand Down
14 changes: 8 additions & 6 deletions src/rep.rs.in
Original file line number Diff line number Diff line change
Expand Up @@ -1156,34 +1156,36 @@ impl IssueListOptionsBuilder {

#[derive(Debug, Serialize)]
pub struct IssueOptions {
pub title: String,
#[serde(skip_serializing_if="Option::is_none")]
pub title: Option<String>,
#[serde(skip_serializing_if="Option::is_none")]
pub body: Option<String>,
#[serde(skip_serializing_if="Option::is_none")]
pub assignee: Option<String>,
#[serde(skip_serializing_if="Option::is_none")]
pub milestone: Option<u64>,
pub labels: Vec<String>,
#[serde(skip_serializing_if="Option::is_none")]
pub labels: Option<Vec<String>>,
}

impl IssueOptions {
pub fn new<T, B, A, L>(title: T,
pub fn new<T, B, A, L>(title: Option<T>,
body: Option<B>,
assignee: Option<A>,
milestone: Option<u64>,
labels: Vec<L>)
labels: Option<Vec<L>>)
-> IssueOptions
where T: Into<String>,
B: Into<String>,
A: Into<String>,
L: Into<String>
{
IssueOptions {
title: title.into(),
title: title.map(|t| t.into()),
body: body.map(|b| b.into()),
assignee: assignee.map(|a| a.into()),
milestone: milestone,
labels: labels.into_iter().map(|l| l.into()).collect::<Vec<String>>(),
labels: labels.map(|lb| lb.into_iter().map(|l| l.into()).collect::<Vec<String>>()),
}
}
}
Expand Down