1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use crate::request::BasicAuth;
use serde::{Deserialize, Serialize};

#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
pub struct Repo {
    pub stargazers_count: usize,
    pub name: String,
    pub owner: RepoOwner,
}

#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
pub struct RepoStats {
    pub total: usize,
    pub total_by_user_only: Vec<usize>,
    pub total_by_orgs_only: Vec<usize>,
}

#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
pub struct RepoOwner {
    pub login: String,
}

#[derive(Debug, Deserialize, Clone)]
pub struct User {
    pub login: String,
    pub public_repos: usize,
}

pub struct Options {
    pub no_orgs: bool,
    pub auth: Option<BasicAuth>,
    pub page_size: usize,
    pub repo_limit: usize,
    pub stargazer_threshold: usize,
}

impl Default for Options {
    fn default() -> Self {
        Self {
            auth: None,
            no_orgs: false,
            page_size: 100,
            repo_limit: 10,
            stargazer_threshold: 0,
        }
    }
}

#[derive(Debug)]
pub struct Response {
    pub user: User,
    pub repos: Vec<Repo>,
}