@@ -16,38 +16,177 @@ import (
1616
1717// Repository contains information about a GitHub repo
1818type Repository struct {
19- ID string
20- Name string
21- Description string
22- URL string
23- CloneURL string
24- CreatedAt time.Time
25- Owner RepositoryOwner
26-
27- IsPrivate bool
28- HasIssuesEnabled bool
29- HasWikiEnabled bool
30- ViewerPermission string
31- DefaultBranchRef BranchRef
32-
33- Parent * Repository
34-
35- MergeCommitAllowed bool
36- RebaseMergeAllowed bool
37- SquashMergeAllowed bool
19+ ID string
20+ Name string
21+ NameWithOwner string
22+ Owner RepositoryOwner
23+ Parent * Repository
24+ TemplateRepository * Repository
25+ Description string
26+ HomepageURL string
27+ OpenGraphImageURL string
28+ UsesCustomOpenGraphImage bool
29+ URL string
30+ SSHURL string
31+ MirrorURL string
32+ SecurityPolicyURL string
33+
34+ CreatedAt time.Time
35+ PushedAt * time.Time
36+ UpdatedAt time.Time
37+
38+ IsBlankIssuesEnabled bool
39+ IsSecurityPolicyEnabled bool
40+ HasIssuesEnabled bool
41+ HasProjectsEnabled bool
42+ HasWikiEnabled bool
43+ MergeCommitAllowed bool
44+ SquashMergeAllowed bool
45+ RebaseMergeAllowed bool
46+
47+ ForkCount int
48+ StargazerCount int
49+ Watchers struct {
50+ TotalCount int `json:"totalCount"`
51+ }
52+ Issues struct {
53+ TotalCount int `json:"totalCount"`
54+ }
55+ PullRequests struct {
56+ TotalCount int `json:"totalCount"`
57+ }
58+
59+ CodeOfConduct * CodeOfConduct
60+ ContactLinks []ContactLink
61+ DefaultBranchRef BranchRef
62+ DeleteBranchOnMerge bool
63+ DiskUsage int
64+ FundingLinks []FundingLink
65+ IsArchived bool
66+ IsEmpty bool
67+ IsFork bool
68+ IsInOrganization bool
69+ IsMirror bool
70+ IsPrivate bool
71+ IsTemplate bool
72+ IsUserConfigurationRepository bool
73+ LicenseInfo * RepositoryLicense
74+ ViewerCanAdminister bool
75+ ViewerDefaultCommitEmail string
76+ ViewerDefaultMergeMethod string
77+ ViewerHasStarred bool
78+ ViewerPermission string
79+ ViewerPossibleCommitEmails []string
80+ ViewerSubscription string
81+
82+ RepositoryTopics struct {
83+ Nodes []struct {
84+ Topic RepositoryTopic
85+ }
86+ }
87+ PrimaryLanguage * CodingLanguage
88+ Languages struct {
89+ Edges []struct {
90+ Size int `json:"size"`
91+ Node CodingLanguage `json:"node"`
92+ }
93+ }
94+ IssueTemplates []IssueTemplate
95+ PullRequestTemplates []PullRequestTemplate
96+ Labels struct {
97+ Nodes []IssueLabel
98+ }
99+ Milestones struct {
100+ Nodes []Milestone
101+ }
102+ LatestRelease * RepositoryRelease
103+
104+ AssignableUsers struct {
105+ Nodes []GitHubUser
106+ }
107+ MentionableUsers struct {
108+ Nodes []GitHubUser
109+ }
110+ Projects struct {
111+ Nodes []RepoProject
112+ }
38113
39114 // pseudo-field that keeps track of host name of this repo
40115 hostname string
41116}
42117
43118// RepositoryOwner is the owner of a GitHub repository
44119type RepositoryOwner struct {
45- Login string
120+ ID string `json:"id"`
121+ Login string `json:"login"`
122+ }
123+
124+ type GitHubUser struct {
125+ ID string `json:"id"`
126+ Login string `json:"login"`
127+ Name string `json:"name"`
46128}
47129
48130// BranchRef is the branch name in a GitHub repository
49131type BranchRef struct {
50- Name string
132+ Name string `json:"name"`
133+ }
134+
135+ type CodeOfConduct struct {
136+ Key string `json:"key"`
137+ Name string `json:"name"`
138+ URL string `json:"url"`
139+ }
140+
141+ type RepositoryLicense struct {
142+ Key string `json:"key"`
143+ Name string `json:"name"`
144+ Nickname string `json:"nickname"`
145+ }
146+
147+ type ContactLink struct {
148+ About string `json:"about"`
149+ Name string `json:"name"`
150+ URL string `json:"url"`
151+ }
152+
153+ type FundingLink struct {
154+ Platform string `json:"platform"`
155+ URL string `json:"url"`
156+ }
157+
158+ type CodingLanguage struct {
159+ Name string `json:"name"`
160+ }
161+
162+ type IssueTemplate struct {
163+ Name string `json:"name"`
164+ Title string `json:"title"`
165+ Body string `json:"body"`
166+ About string `json:"about"`
167+ }
168+
169+ type PullRequestTemplate struct {
170+ Filename string `json:"filename"`
171+ Body string `json:"body"`
172+ }
173+
174+ type RepositoryTopic struct {
175+ Name string `json:"name"`
176+ }
177+
178+ type RepositoryRelease struct {
179+ Name string `json:"name"`
180+ TagName string `json:"tagName"`
181+ URL string `json:"url"`
182+ PublishedAt time.Time `json:"publishedAt"`
183+ }
184+
185+ type IssueLabel struct {
186+ ID string `json:"id"`
187+ Name string `json:"name"`
188+ Description string `json:"description"`
189+ Color string `json:"color"`
51190}
52191
53192// RepoOwner is the login name of the owner
@@ -65,11 +204,6 @@ func (r Repository) RepoHost() string {
65204 return r .hostname
66205}
67206
68- // IsFork is true when this repository has a parent repository
69- func (r Repository ) IsFork () bool {
70- return r .Parent != nil
71- }
72-
73207// ViewerCanPush is true when the requesting user has push access
74208func (r Repository ) ViewerCanPush () bool {
75209 switch r .ViewerPermission {
@@ -305,7 +439,6 @@ type repositoryV3 struct {
305439 NodeID string
306440 Name string
307441 CreatedAt time.Time `json:"created_at"`
308- CloneURL string `json:"clone_url"`
309442 Owner struct {
310443 Login string
311444 }
@@ -324,7 +457,6 @@ func ForkRepo(client *Client, repo ghrepo.Interface) (*Repository, error) {
324457 return & Repository {
325458 ID : result .NodeID ,
326459 Name : result .Name ,
327- CloneURL : result .CloneURL ,
328460 CreatedAt : result .CreatedAt ,
329461 Owner : RepositoryOwner {
330462 Login : result .Owner .Login ,
@@ -707,9 +839,10 @@ func RepoResolveMetadataIDs(client *Client, repo ghrepo.Interface, input RepoRes
707839}
708840
709841type RepoProject struct {
710- ID string
711- Name string
712- ResourcePath string
842+ ID string `json:"id"`
843+ Name string `json:"name"`
844+ Number int `json:"number"`
845+ ResourcePath string `json:"resourcePath"`
713846}
714847
715848// RepoProjects fetches all open projects for a repository
0 commit comments