1
2
3
4
5
6 package github
7
8 import (
9 "context"
10 )
11
12
13
14 type AdminStats struct {
15 Issues *IssueStats `json:"issues,omitempty"`
16 Hooks *HookStats `json:"hooks,omitempty"`
17 Milestones *MilestoneStats `json:"milestones,omitempty"`
18 Orgs *OrgStats `json:"orgs,omitempty"`
19 Comments *CommentStats `json:"comments,omitempty"`
20 Pages *PageStats `json:"pages,omitempty"`
21 Users *UserStats `json:"users,omitempty"`
22 Gists *GistStats `json:"gists,omitempty"`
23 Pulls *PullStats `json:"pulls,omitempty"`
24 Repos *RepoStats `json:"repos,omitempty"`
25 }
26
27 func (s AdminStats) String() string {
28 return Stringify(s)
29 }
30
31
32 type IssueStats struct {
33 TotalIssues *int `json:"total_issues,omitempty"`
34 OpenIssues *int `json:"open_issues,omitempty"`
35 ClosedIssues *int `json:"closed_issues,omitempty"`
36 }
37
38 func (s IssueStats) String() string {
39 return Stringify(s)
40 }
41
42
43 type HookStats struct {
44 TotalHooks *int `json:"total_hooks,omitempty"`
45 ActiveHooks *int `json:"active_hooks,omitempty"`
46 InactiveHooks *int `json:"inactive_hooks,omitempty"`
47 }
48
49 func (s HookStats) String() string {
50 return Stringify(s)
51 }
52
53
54 type MilestoneStats struct {
55 TotalMilestones *int `json:"total_milestones,omitempty"`
56 OpenMilestones *int `json:"open_milestones,omitempty"`
57 ClosedMilestones *int `json:"closed_milestones,omitempty"`
58 }
59
60 func (s MilestoneStats) String() string {
61 return Stringify(s)
62 }
63
64
65
66 type OrgStats struct {
67 TotalOrgs *int `json:"total_orgs,omitempty"`
68 DisabledOrgs *int `json:"disabled_orgs,omitempty"`
69 TotalTeams *int `json:"total_teams,omitempty"`
70 TotalTeamMembers *int `json:"total_team_members,omitempty"`
71 }
72
73 func (s OrgStats) String() string {
74 return Stringify(s)
75 }
76
77
78
79 type CommentStats struct {
80 TotalCommitComments *int `json:"total_commit_comments,omitempty"`
81 TotalGistComments *int `json:"total_gist_comments,omitempty"`
82 TotalIssueComments *int `json:"total_issue_comments,omitempty"`
83 TotalPullRequestComments *int `json:"total_pull_request_comments,omitempty"`
84 }
85
86 func (s CommentStats) String() string {
87 return Stringify(s)
88 }
89
90
91 type PageStats struct {
92 TotalPages *int `json:"total_pages,omitempty"`
93 }
94
95 func (s PageStats) String() string {
96 return Stringify(s)
97 }
98
99
100 type UserStats struct {
101 TotalUsers *int `json:"total_users,omitempty"`
102 AdminUsers *int `json:"admin_users,omitempty"`
103 SuspendedUsers *int `json:"suspended_users,omitempty"`
104 }
105
106 func (s UserStats) String() string {
107 return Stringify(s)
108 }
109
110
111 type GistStats struct {
112 TotalGists *int `json:"total_gists,omitempty"`
113 PrivateGists *int `json:"private_gists,omitempty"`
114 PublicGists *int `json:"public_gists,omitempty"`
115 }
116
117 func (s GistStats) String() string {
118 return Stringify(s)
119 }
120
121
122
123 type PullStats struct {
124 TotalPulls *int `json:"total_pulls,omitempty"`
125 MergedPulls *int `json:"merged_pulls,omitempty"`
126 MergablePulls *int `json:"mergeable_pulls,omitempty"`
127 UnmergablePulls *int `json:"unmergeable_pulls,omitempty"`
128 }
129
130 func (s PullStats) String() string {
131 return Stringify(s)
132 }
133
134
135
136 type RepoStats struct {
137 TotalRepos *int `json:"total_repos,omitempty"`
138 RootRepos *int `json:"root_repos,omitempty"`
139 ForkRepos *int `json:"fork_repos,omitempty"`
140 OrgRepos *int `json:"org_repos,omitempty"`
141 TotalPushes *int `json:"total_pushes,omitempty"`
142 TotalWikis *int `json:"total_wikis,omitempty"`
143 }
144
145 func (s RepoStats) String() string {
146 return Stringify(s)
147 }
148
149
150
151
152
153
154
155
156 func (s *AdminService) GetAdminStats(ctx context.Context) (*AdminStats, *Response, error) {
157 u := "enterprise/stats/all"
158 req, err := s.client.NewRequest("GET", u, nil)
159 if err != nil {
160 return nil, nil, err
161 }
162
163 m := new(AdminStats)
164 resp, err := s.client.Do(ctx, req, m)
165 if err != nil {
166 return nil, resp, err
167 }
168
169 return m, resp, nil
170 }
171
View as plain text