From 67d7632b900f7221c1a3fb1927cd97b7cb60c71e Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sat, 29 May 2021 18:16:27 +0200 Subject: Move `Repo` to `github` module Makes more sense here rather than in its own module since it models GitHub's repository structure. --- src/github.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src/github.rs') diff --git a/src/github.rs b/src/github.rs index bf42fc8..ccbcf1c 100644 --- a/src/github.rs +++ b/src/github.rs @@ -1,6 +1,5 @@ use reqwest::blocking::ClientBuilder; - -use crate::repo::Repo; +use serde::Deserialize; const USER_AGENT: &'static str = concat!( @@ -10,6 +9,18 @@ const USER_AGENT: &'static str = concat!( ); +#[derive(Debug, Deserialize)] +pub struct Repo { + id: usize, + name: String, + description: Option, + fork: bool, + git_url: String, + default_branch: String, + updated_at: String, // TODO: Maybe parse to date? +} + + pub fn fetch_repos() -> Result, Box> { let mut headers = reqwest::header::HeaderMap::new(); headers.insert("Accept", "application/vnd.github.v3+json".parse().unwrap()); -- cgit v1.2.3