github_star_counter/
api.rs

1use crate::request::BasicAuth;
2use serde::{Deserialize, Serialize};
3
4#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
5pub struct Repo {
6    pub stargazers_count: usize,
7    pub name: String,
8    pub owner: RepoOwner,
9}
10
11#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
12pub struct RepoStats {
13    pub total: usize,
14    pub total_by_user_only: Vec<usize>,
15    pub total_by_orgs_only: Vec<usize>,
16}
17
18#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
19pub struct RepoOwner {
20    pub login: String,
21}
22
23#[derive(Debug, Deserialize, Clone)]
24pub struct User {
25    pub login: String,
26    pub public_repos: usize,
27}
28
29pub struct Options {
30    pub no_orgs: bool,
31    pub auth: Option<BasicAuth>,
32    pub page_size: usize,
33    pub repo_limit: usize,
34    pub stargazer_threshold: usize,
35}
36
37impl Default for Options {
38    fn default() -> Self {
39        Self {
40            auth: None,
41            no_orgs: false,
42            page_size: 100,
43            repo_limit: 10,
44            stargazer_threshold: 0,
45        }
46    }
47}
48
49#[derive(Debug)]
50pub struct Response {
51    pub user: User,
52    pub repos: Vec<Repo>,
53}