Skip to content

Instantly share code, notes, and snippets.

@mantono
Created December 3, 2019 14:21
Show Gist options
  • Save mantono/64c56aaba0c6235a4820f64e18d5bb1c to your computer and use it in GitHub Desktop.
Save mantono/64c56aaba0c6235a4820f64e18d5bb1c to your computer and use it in GitHub Desktop.
{
"__typename": "Issue",
"number": 4,
"databaseId": 461065166,
"title": "Send ETAG and Cache-Control headers",
"body": "",
"url": "https://github.com/owner/my-repo/issues/4",
"state": "OPEN",
"updatedAt": "2019-07-01T09:50:21Z",
"createdAt": "2019-06-26T16:18:41Z",
"labels": {
"nodes": []
},
"repository": {
"nameWithOwner": "owner/my-repo"
},
"comments": {
"totalCount": 0
},
"reactions": {
"totalCount": 0
}
}
use serde::Deserialize;
#[derive(Debug, Deserialize)]
pub struct Issue {
pub url: String,
#[serde(alias = "databaseId")]
pub id: u64,
pub number: u32,
pub title: String,
#[serde(alias = "bodyText")]
pub body: Option<String>,
#[serde(alias = "updatedAt")]
pub updated_at: String,
pub state: ghrs::State,
pub comments: u32,
pub assignees: Vec<Assignee>,
pub labels: Vec<Label>,
pub repository: String, // How can I read 'repository -> nameWithOwner' directly?
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment