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,
|
||||
pub action: &'a String,
|
||||
pub html_url: &'a String,
|
||||
pub state: &'a String,
|
||||
pub title: &'a String,
|
||||
}
|
||||
|
||||
impl<'a> PullRequestEvent<'a> {
|
||||
@ -25,11 +27,21 @@ impl<'a> PullRequestEvent<'a> {
|
||||
.get("html_url")
|
||||
.map(get_json_string)
|
||||
.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 {
|
||||
original_event,
|
||||
action: payload_action,
|
||||
html_url: payload_pull_request_html_url,
|
||||
state: payload_pull_request_state,
|
||||
title: payload_pull_request_title,
|
||||
})
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user