Parse out the title and state of the pull request.
This commit is contained in:
parent
51bbe22bdf
commit
11ddea7f53
@ -5,6 +5,8 @@ pub struct PullRequestEvent<'a> {
|
|||||||
original_event: &'a serde_json::Value,
|
original_event: &'a serde_json::Value,
|
||||||
pub action: &'a String,
|
pub action: &'a String,
|
||||||
pub html_url: &'a String,
|
pub html_url: &'a String,
|
||||||
|
pub state: &'a String,
|
||||||
|
pub title: &'a String,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> PullRequestEvent<'a> {
|
impl<'a> PullRequestEvent<'a> {
|
||||||
@ -25,11 +27,21 @@ impl<'a> PullRequestEvent<'a> {
|
|||||||
.get("html_url")
|
.get("html_url")
|
||||||
.map(get_json_string)
|
.map(get_json_string)
|
||||||
.expect("Ran into a PullRequestEvent without a payload.pull_request.html_url.");
|
.expect("Ran into a PullRequestEvent without a payload.pull_request.html_url.");
|
||||||
|
let payload_pull_request_state = payload_pull_request
|
||||||
|
.get("state")
|
||||||
|
.map(get_json_string)
|
||||||
|
.expect("Ran into a PullRequestEvent without a payload.pull_request.state.");
|
||||||
|
let payload_pull_request_title = payload_pull_request
|
||||||
|
.get("title")
|
||||||
|
.map(get_json_string)
|
||||||
|
.expect("Ran into a PullRequestEvent without a payload.pull_request.title.");
|
||||||
|
|
||||||
Ok(PullRequestEvent {
|
Ok(PullRequestEvent {
|
||||||
original_event,
|
original_event,
|
||||||
action: payload_action,
|
action: payload_action,
|
||||||
html_url: payload_pull_request_html_url,
|
html_url: payload_pull_request_html_url,
|
||||||
|
state: payload_pull_request_state,
|
||||||
|
title: payload_pull_request_title,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user