diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/github.rs | 15 | ||||
| -rw-r--r-- | src/lib.rs | 1 | ||||
| -rw-r--r-- | src/repo.rs | 13 | 
3 files changed, 13 insertions, 16 deletions
| 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<String>, +    fork: bool, +    git_url: String, +    default_branch: String, +    updated_at: String,  // TODO: Maybe parse to date? +} + +  pub fn fetch_repos() -> Result<Vec<Repo>, Box<dyn std::error::Error>> {      let mut headers = reqwest::header::HeaderMap::new();      headers.insert("Accept", "application/vnd.github.v3+json".parse().unwrap()); @@ -1,3 +1,2 @@  pub mod git;  pub mod github; -pub mod repo; diff --git a/src/repo.rs b/src/repo.rs index e934be2..e69de29 100644 --- a/src/repo.rs +++ b/src/repo.rs @@ -1,13 +0,0 @@ -use serde::Deserialize; - - -#[derive(Debug, Deserialize)] -pub struct Repo { -    id: usize, -    name: String, -    description: Option<String>, -    fork: bool, -    git_url: String, -    default_branch: String, -    updated_at: String,  // TODO: Maybe parse to date? -} | 
