Skip to content

Commit 2bd38f9

Browse files
Refactor to avoid deserialization failure
1 parent 4a305d8 commit 2bd38f9

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/github/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl Client {
120120
}
121121

122122
pub fn fetch_pull_request(&self, pr_info: &PullRequestUrls) -> DashResult<PullRequestFromJson> {
123-
if let Some(url) = pr_info.get("url") {
123+
if let Some(url) = &pr_info.url {
124124
Ok(self.get(url, None)?.json()?)
125125
} else {
126126
throw!(DashError::Misc(None))

src/github/models.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// Copyright 2016 Adam Perry. Dual-licensed MIT and Apache 2.0 (see LICENSE files for details).
22

3-
use std::collections::BTreeMap;
43
use std::i32;
54

65
use chrono::{DateTime, Utc};
@@ -50,7 +49,10 @@ pub struct LabelFromJson {
5049
name: String,
5150
}
5251

53-
pub type PullRequestUrls = BTreeMap<String, String>;
52+
#[derive(Debug, Deserialize)]
53+
pub struct PullRequestUrls {
54+
pub url: Option<String>,
55+
}
5456

5557
#[derive(Debug, Deserialize)]
5658
pub struct IssueFromJson {

0 commit comments

Comments
 (0)