From 6b49cdb7a047d9ce428c8f02738a4c968f3fe272 Mon Sep 17 00:00:00 2001 From: xwzQmxx <1499273991@qq.com> Date: Mon, 13 Dec 2021 15:02:58 +0800 Subject: [PATCH 1/4] add models accessors --- gitee/hook_commithook_accessors.go | 83 +- gitee/hook_event_helper.go | 35 + gitee/hook_issueevent_accessors.go | 26 + gitee/hook_issuehook_accessors.go | 127 +- gitee/hook_labelhokk_accessors.go | 8 + gitee/hook_milestonehook_accessors.go | 74 ++ gitee/hook_noteevent_accessors.go | 54 + gitee/hook_notehook_accessors.go | 48 + gitee/hook_projecthook_accessors.go | 230 +++- gitee/hook_pullrequestevent_accessors.go | 98 +- gitee/hook_pullrequesthook_accessors.go | 208 ++- gitee/hook_pushevent_accessors.go | 18 +- gitee/hook_userhook_accessors.go | 100 +- gitee/models_accessors.go | 1474 ++++++++++++++++++++++ go.mod | 3 +- go.sum | 192 +++ 16 files changed, 2739 insertions(+), 39 deletions(-) create mode 100644 gitee/hook_event_helper.go create mode 100644 gitee/models_accessors.go diff --git a/gitee/hook_commithook_accessors.go b/gitee/hook_commithook_accessors.go index 69f3dc1..c439053 100644 --- a/gitee/hook_commithook_accessors.go +++ b/gitee/hook_commithook_accessors.go @@ -1,5 +1,54 @@ package gitee +import "time" + +func (c *CommitHook) getID() string { + if c == nil { + return "" + } + + return c.Id +} + +func (c *CommitHook) GetTreeId() string { + if c == nil { + return "" + } + + return c.TreeId +} + +func (c *CommitHook) GetParentIds() []string { + if c == nil { + return nil + } + + return c.ParentIds +} + +func (c *CommitHook) GetMessage() string { + if c == nil { + return "" + } + + return c.Message +} + +func (c *CommitHook) GetTimestamp() time.Time { + if c == nil { + return time.Time{} + } + + return c.Timestamp +} + +func (c *CommitHook) GetURL() string { + if c == nil { + return "" + } + + return c.Url +} func (c *CommitHook) GetAuthor() *UserHook { if c == nil { return nil @@ -14,4 +63,36 @@ func (c *CommitHook) GetCommitter() *UserHook { } return c.Committer -} \ No newline at end of file +} + +func (c *CommitHook) GetDistinct() bool { + if c == nil { + return false + } + + return c.Distinct +} + +func (c *CommitHook) GetAdded() []string { + if c == nil { + return nil + } + + return c.Added +} + +func (c *CommitHook) GetRemoved() []string { + if c == nil { + return nil + } + + return c.Removed +} + +func (c *CommitHook) GetModified() []string { + if c == nil { + return nil + } + + return c.Modified +} diff --git a/gitee/hook_event_helper.go b/gitee/hook_event_helper.go new file mode 100644 index 0000000..6cc3c57 --- /dev/null +++ b/gitee/hook_event_helper.go @@ -0,0 +1,35 @@ +package gitee + +import "strings" + +const ( + PRActionOpened = "opened" + PRActionClosed = "closed" + PRActionUpdatedLabel = "update_label" + PRActionChangedTargetBranch = "target_branch_changed" + PRActionChangedSourceBranch = "source_branch_changed" +) + +func GetPullRequestAction(e *PullRequestEvent) string { + switch strings.ToLower(e.GetAction()) { + case "open": + return PRActionOpened + + case "update": + switch strings.ToLower(e.GetActionDesc()) { + case PRActionChangedSourceBranch: // change the pr's commits + return PRActionChangedSourceBranch + + case PRActionChangedTargetBranch: // change the branch to which this pr will be merged + return PRActionChangedTargetBranch + + case PRActionUpdatedLabel: + return PRActionUpdatedLabel + } + + case "close": + return PRActionClosed + } + + return "" +} diff --git a/gitee/hook_issueevent_accessors.go b/gitee/hook_issueevent_accessors.go index 3a658ac..9b69add 100644 --- a/gitee/hook_issueevent_accessors.go +++ b/gitee/hook_issueevent_accessors.go @@ -1,5 +1,7 @@ package gitee +import "k8s.io/apimachinery/pkg/util/sets" + func (ie *IssueEvent) GetAction() string { if ie == nil || ie.Action == nil { return "" @@ -72,6 +74,14 @@ func (ie *IssueEvent) GetUpdatedBy() *UserHook { return ie.UpdatedBy } +func (ie *IssueEvent) GetIID() string { + if ie == nil { + return "" + } + + return ie.IID +} + func (ie *IssueEvent) GetTitle() string { if ie == nil || ie.Title == nil { return "" @@ -135,3 +145,19 @@ func (ie *IssueEvent) GetPassword() string { return *ie.Password } + +func (ie *IssueEvent) GetOrgRepo() (string, string) { + return ie.GetRepository().GetOwnerAndRepo() +} + +func (ie *IssueEvent) GetIssueAuthor() string { + return ie.GetIssue().GetUser().GetLogin() +} + +func (ie *IssueEvent) GetIssueNumber() string { + return ie.GetIssue().GetNumber() +} + +func (ie *IssueEvent) GetIssueLabelSet() sets.String { + return ie.GetIssue().LabelsToSet() +} diff --git a/gitee/hook_issuehook_accessors.go b/gitee/hook_issuehook_accessors.go index c11c6b4..3aae1c8 100644 --- a/gitee/hook_issuehook_accessors.go +++ b/gitee/hook_issuehook_accessors.go @@ -1,11 +1,24 @@ package gitee -func (ih *IssueHook) GetUser() *UserHook { +import ( + "k8s.io/apimachinery/pkg/util/sets" + "time" +) + +func (ih *IssueHook) GetID() int32 { if ih == nil { - return nil + return 0 } - return ih.User + return ih.Id +} + +func (ih *IssueHook) GetHtmlUrl() string { + if ih == nil { + return "" + } + + return ih.HtmlUrl } func (ih *IssueHook) GetNumber() string { @@ -16,6 +29,30 @@ func (ih *IssueHook) GetNumber() string { return ih.Number } +func (ih *IssueHook) GetTitle() string { + if ih == nil { + return "" + } + + return ih.Title +} + +func (ih *IssueHook) GetUser() *UserHook { + if ih == nil { + return nil + } + + return ih.User +} + +func (ih *IssueHook) GetLabels() []LabelHook { + if ih == nil { + return nil + } + + return ih.Labels +} + func (ih *IssueHook) GetState() string { if ih == nil { return "" @@ -23,3 +60,87 @@ func (ih *IssueHook) GetState() string { return ih.State } + +func (ih *IssueHook) GetStateName() string { + if ih == nil { + return "" + } + + return ih.StateName +} + +func (ih *IssueHook) GetTypeName() string { + if ih == nil { + return "" + } + + return ih.TypeName +} + +func (ih *IssueHook) GetAssignee() *UserHook { + if ih == nil { + return nil + } + + return ih.Assignee +} + +func (ih *IssueHook) GetCollaborators() []UserHook { + if ih == nil { + return nil + } + + return ih.Collaborators +} + +func (ih *IssueHook) GetMilestone() *MilestoneHook { + if ih == nil { + return nil + } + + return ih.Milestone +} + +func (ih *IssueHook) GetComments() int32 { + if ih == nil { + return 0 + } + + return ih.Comments +} + +func (ih *IssueHook) GetCreatedAt() time.Time { + if ih == nil { + return time.Time{} + } + + return ih.CreatedAt +} + +func (ih *IssueHook) GetUpdatedAt() time.Time { + if ih == nil { + return time.Time{} + } + + return ih.UpdatedAt +} + +func (ih *IssueHook) GetBody() string { + if ih == nil { + return "" + } + + return ih.Body +} + +func (ih *IssueHook) LabelsToSet() sets.String { + res := sets.NewString() + + for _, v := range ih.GetLabels() { + if v.GetName() != "" { + res.Insert(v.GetName()) + } + } + + return res +} diff --git a/gitee/hook_labelhokk_accessors.go b/gitee/hook_labelhokk_accessors.go index e4b375e..ef76d21 100644 --- a/gitee/hook_labelhokk_accessors.go +++ b/gitee/hook_labelhokk_accessors.go @@ -1,5 +1,13 @@ package gitee +func (l *LabelHook) GetID() int32 { + if l == nil { + return 0 + } + + return l.Id +} + func (l *LabelHook) GetName() string { if l == nil { return "" diff --git a/gitee/hook_milestonehook_accessors.go b/gitee/hook_milestonehook_accessors.go index d9e2e25..0f87b8c 100644 --- a/gitee/hook_milestonehook_accessors.go +++ b/gitee/hook_milestonehook_accessors.go @@ -1,5 +1,31 @@ package gitee +import "time" + +func (m *MilestoneHook) GetID() int32 { + if m == nil { + return 0 + } + + return m.Id +} + +func (m *MilestoneHook) GetHtmlUrl() string { + if m == nil { + return "" + } + + return m.HtmlUrl +} + +func (m *MilestoneHook) GetNumber() int32 { + if m == nil { + return 0 + } + + return m.Number +} + func (m *MilestoneHook) GetTitle() string { if m == nil { return "" @@ -8,6 +34,30 @@ func (m *MilestoneHook) GetTitle() string { return m.Title } +func (m *MilestoneHook) GetDescription() string { + if m == nil { + return "" + } + + return m.Description +} + +func (m *MilestoneHook) GetOpenIssues() int32 { + if m == nil { + return 0 + } + + return m.OpenIssues +} + +func (m *MilestoneHook) GetClosedIssues() int32 { + if m == nil { + return 0 + } + + return m.ClosedIssues +} + func (m *MilestoneHook) GetState() string { if m == nil { return "" @@ -15,3 +65,27 @@ func (m *MilestoneHook) GetState() string { return m.State } + +func (m *MilestoneHook) GetCreatedAt() time.Time { + if m == nil { + return time.Time{} + } + + return m.CreatedAt +} + +func (m *MilestoneHook) GetUpdatedAt() time.Time { + if m == nil { + return time.Time{} + } + + return m.UpdatedAt +} + +func (m *MilestoneHook) GetDueOn() string { + if m == nil { + return "" + } + + return m.DueOn +} diff --git a/gitee/hook_noteevent_accessors.go b/gitee/hook_noteevent_accessors.go index b1b1cd3..a0b08ee 100644 --- a/gitee/hook_noteevent_accessors.go +++ b/gitee/hook_noteevent_accessors.go @@ -1,5 +1,7 @@ package gitee +import "k8s.io/apimachinery/pkg/util/sets" + func (ne *NoteEvent) GetAction() string { if ne == nil || ne.Action == nil { return "" @@ -135,3 +137,55 @@ func (ne *NoteEvent) GetPassword() string { return *ne.Password } + +func (ne *NoteEvent) IsIssue() bool { + return ne.GetNoteableType() == "Issue" +} + +func (ne *NoteEvent) IsIssueClosed() bool { + return ne.GetIssue().GetState() == "closed" +} + +func (ne *NoteEvent) IsIssueOpen() bool { + return ne.GetIssue().GetState() == "open" +} + +func (ne *NoteEvent) GetIssueAuthor() string { + return ne.GetIssue().GetUser().GetLogin() +} + +func (ne *NoteEvent) GetIssueNumber() string { + return ne.GetIssue().GetNumber() +} + +func (ne *NoteEvent) GetIssueLabelSet() sets.String { + return ne.GetIssue().LabelsToSet() +} + +func (ne *NoteEvent) IsPullRequest() bool { + return ne.GetNoteableType() == "PullRequest" +} + +func (ne *NoteEvent) GetPRNumber() int32 { + return ne.GetPullRequest().GetNumber() +} + +func (ne *NoteEvent) GetPRAuthor() string { + return ne.GetPullRequest().GetUser().Login +} + +func (ne *NoteEvent) IsPROpen() bool { + return ne.GetPullRequest().GetState() == "open" +} + +func (ne *NoteEvent) GetPRBaseRef() string { + return ne.GetPullRequest().GetBase().GetRef() +} + +func (ne *NoteEvent) GetPRHeadSha() string { + return ne.GetPullRequest().GetHead().GetSha() +} + +func (ne *NoteEvent) GetPRLabelSets() sets.String { + return ne.GetPullRequest().LabelsToSet() +} diff --git a/gitee/hook_notehook_accessors.go b/gitee/hook_notehook_accessors.go index 39c156d..d53b4d7 100644 --- a/gitee/hook_notehook_accessors.go +++ b/gitee/hook_notehook_accessors.go @@ -7,3 +7,51 @@ func (nh *NoteHook) GetBody() string { return nh.Body } + +func (nh *NoteHook) GetID() int32 { + if nh == nil { + return 0 + } + + return nh.Id +} + +func (nh *NoteHook) GetCreateAt() string { + if nh == nil { + return "" + } + + return nh.CreatedAt +} + +func (nh *NoteHook) GetUpdatedAt() string { + if nh == nil { + return "" + } + + return nh.UpdatedAt +} + +func (nh *NoteHook) GetHtmlUrl() string { + if nh == nil { + return "" + } + + return nh.HtmlUrl +} + +func (nh *NoteHook) GetPosition() string { + if nh == nil { + return "" + } + + return nh.Position +} + +func (nh *NoteHook) GetCommitID() string { + if nh == nil { + return "" + } + + return nh.CommitId +} diff --git a/gitee/hook_projecthook_accessors.go b/gitee/hook_projecthook_accessors.go index 3195014..67a2d5c 100644 --- a/gitee/hook_projecthook_accessors.go +++ b/gitee/hook_projecthook_accessors.go @@ -1,11 +1,19 @@ package gitee -func (pj *ProjectHook) GetNameSpace() string { +func (pj *ProjectHook) GetID() int32 { + if pj == nil { + return 0 + } + + return pj.Id +} + +func (pj *ProjectHook) GetName() string { if pj == nil { return "" } - return pj.Namespace + return pj.Name } func (pj *ProjectHook) GetPath() string { @@ -16,6 +24,14 @@ func (pj *ProjectHook) GetPath() string { return pj.Path } +func (pj *ProjectHook) GetFullName() string { + if pj == nil { + return "" + } + + return pj.FullName +} + func (pj *ProjectHook) GetOwner() *UserHook { if pj == nil { return nil @@ -24,10 +40,218 @@ func (pj *ProjectHook) GetOwner() *UserHook { return pj.Owner } +func (pj *ProjectHook) GetPrivate() bool { + if pj == nil { + return false + } + + return pj.Private +} + +func (pj *ProjectHook) GetHtmlUrl() string { + if pj == nil { + return "" + } + + return pj.HtmlUrl +} + +func (pj *ProjectHook) GetUrl() string { + if pj == nil { + return "" + } + + return pj.Url +} + +func (pj *ProjectHook) GetDescription() string { + if pj == nil { + return "" + } + + return pj.Description +} + +func (pj *ProjectHook) GetFork() bool { + if pj == nil { + return false + } + + return pj.Fork +} + +func (pj *ProjectHook) GetPushedAt() string { + if pj == nil { + return "" + } + + return pj.PushedAt +} + +func (pj *ProjectHook) GetCreatedAt() string { + if pj == nil { + return "" + } + + return pj.CreatedAt +} + +func (pj *ProjectHook) GetUpdatedAt() string { + if pj == nil { + return "" + } + + return pj.UpdatedAt +} + +func (pj *ProjectHook) GetSshUrl() string { + if pj == nil { + return "" + } + + return pj.SshUrl +} + +func (pj *ProjectHook) GetGitUrl() string { + if pj == nil { + return "" + } + + return pj.GitUrl +} + +func (pj *ProjectHook) GetCloneUrl() string { + if pj == nil { + return "" + } + + return pj.CloneUrl +} + +func (pj *ProjectHook) GetSvnUrl() string { + if pj == nil { + return "" + } + + return pj.SvnUrl +} + +func (pj *ProjectHook) GetHomepage() string { + if pj == nil { + return "" + } + + return pj.Homepage +} + +func (pj *ProjectHook) GetStargazersCount() int32 { + if pj == nil { + return 0 + } + + return pj.StargazersCount +} + +func (pj *ProjectHook) GetWatchersCount() int32 { + if pj == nil { + return 0 + } + + return pj.WatchersCount +} + +func (pj *ProjectHook) GetForksCount() int32 { + if pj == nil { + return 0 + } + + return pj.ForksCount +} + +func (pj *ProjectHook) GetLanguage() string { + if pj == nil { + return "" + } + + return pj.Language +} + +func (pj *ProjectHook) GetHasIssues() bool { + if pj == nil { + return false + } + + return pj.HasIssues +} + +func (pj *ProjectHook) GetHasWiki() bool { + if pj == nil { + return false + } + + return pj.HasWiki +} + +func (pj *ProjectHook) GetHasPage() bool { + if pj == nil { + return false + } + + return pj.HasPage +} + +func (pj *ProjectHook) GetLicense() string { + if pj == nil { + return "" + } + + return pj.License +} + +func (pj *ProjectHook) GetOpenIssuesCount() int32 { + if pj == nil { + return 0 + } + + return pj.OpenIssuesCount +} + +func (pj *ProjectHook) GetDefaultBranch() string { + if pj == nil { + return "" + } + + return pj.DefaultBranch +} + +func (pj *ProjectHook) GetNameSpace() string { + if pj == nil { + return "" + } + + return pj.Namespace +} + +func (pj *ProjectHook) GetNameWithNamespace() string { + if pj == nil { + return "" + } + + return pj.NameWithNamespace +} + +func (pj *ProjectHook) GetPathWithNamespace() string { + if pj == nil { + return "" + } + + return pj.PathWithNamespace +} + func (pj *ProjectHook) GetOwnerAndRepo() (string, string) { if pj == nil { return "", "" } return pj.Namespace, pj.Path -} \ No newline at end of file +} diff --git a/gitee/hook_pullrequestevent_accessors.go b/gitee/hook_pullrequestevent_accessors.go index 7d1ddfe..6fef436 100644 --- a/gitee/hook_pullrequestevent_accessors.go +++ b/gitee/hook_pullrequestevent_accessors.go @@ -1,14 +1,15 @@ package gitee +import "k8s.io/apimachinery/pkg/util/sets" -func (p *PullRequestEvent) GetAction() string{ +func (p *PullRequestEvent) GetAction() string { if p == nil || p.Action == nil { return "" } return *p.Action } -func (p *PullRequestEvent) GetActionDesc() string{ +func (p *PullRequestEvent) GetActionDesc() string { if p == nil || p.ActionDesc == nil { return "" } @@ -22,95 +23,111 @@ func (p *PullRequestEvent) GetPullRequest() *PullRequestHook { return p.PullRequest } -func (p *PullRequestEvent) GetAuthor() *UserHook { +func (p *PullRequestEvent) GetNumber() int64 { if p == nil { - return nil + return 0 } - return p.Author -} -func (p *PullRequestEvent) GetProject() *ProjectHook { - if p == nil { - return nil - } - return p.Project + return p.Number } -func (p *PullRequestEvent) GetRepository() *ProjectHook { +func (p *PullRequestEvent) GetIID() int64 { if p == nil { - return nil + return 0 } - return p.Repository + + return p.IID } -func (p *PullRequestEvent) GetTitle() string{ +func (p *PullRequestEvent) GetTitle() string { if p == nil || p.Title == nil { return "" } return *p.Title } -func (p *PullRequestEvent) GetBody() string{ +func (p *PullRequestEvent) GetBody() string { if p == nil || p.Body == nil { return "" } return *p.Body } -func (p *PullRequestEvent) GetState() string{ +func (p *PullRequestEvent) GetState() string { if p == nil || p.State == nil { return "" } return *p.State } -func (p *PullRequestEvent) GetMergeStatus() string{ +func (p *PullRequestEvent) GetMergeStatus() string { if p == nil || p.MergeStatus == nil { return "" } return *p.MergeStatus } -func (p *PullRequestEvent) GetMergeCommitSha() string{ +func (p *PullRequestEvent) GetMergeCommitSha() string { if p == nil || p.MergeCommitSha == nil { return "" } return *p.MergeCommitSha } -func (p *PullRequestEvent) GetURL() string{ +func (p *PullRequestEvent) GetURL() string { if p == nil || p.URL == nil { return "" } return *p.URL } -func (p *PullRequestEvent) GetSourceBranch() string{ +func (p *PullRequestEvent) GetSourceBranch() string { if p == nil || p.SourceBranch == nil { return "" } return *p.SourceBranch } -func (p *PullRequestEvent) GetTargetBranch() string{ +func (p *PullRequestEvent) GetSourceRepo() *RepoInfo { + if p == nil { + return nil + } + return p.SourceRepo +} + +func (p *PullRequestEvent) GetTargetBranch() string { if p == nil || p.TargetBranch == nil { return "" } return *p.TargetBranch } -func (p *PullRequestEvent) GetSourceRepo() *RepoInfo { +func (p *PullRequestEvent) GetTargetRepo() *RepoInfo { if p == nil { return nil } - return p.SourceRepo + return p.TargetRepo } -func (p *PullRequestEvent) GetTargetRepo() *RepoInfo { +func (p *PullRequestEvent) GetProject() *ProjectHook { if p == nil { return nil } - return p.TargetRepo + return p.Project +} + +func (p *PullRequestEvent) GetRepository() *ProjectHook { + if p == nil { + return nil + } + return p.Repository +} + +func (p *PullRequestEvent) GetAuthor() *UserHook { + if p == nil { + return nil + } + return p.Author } func (p *PullRequestEvent) GetUpdatedBy() *UserHook { @@ -141,16 +158,41 @@ func (p *PullRequestEvent) GetEnterprise() *EnterpriseHook { return p.Enterprise } -func (p *PullRequestEvent) GetHookName() string{ +func (p *PullRequestEvent) GetHookName() string { if p == nil || p.HookName == nil { return "" } return *p.HookName } -func (p *PullRequestEvent) GetPassword() string{ +func (p *PullRequestEvent) GetPassword() string { if p == nil || p.Password == nil { return "" } return *p.Password } + +func (p *PullRequestEvent) GetOrgRepo() (string, string) { + return p.GetRepository().GetOwnerAndRepo() +} + +// GetPRAuthor return the PR author's login +func (p *PullRequestEvent) GetPRAuthor() string { + return p.GetPullRequest().GetUser().GetLogin() +} + +func (p *PullRequestEvent) GetPRNumber() int32 { + return p.GetPullRequest().GetNumber() +} + +func (p *PullRequestEvent) GetPRBaseRef() string { + return p.GetPullRequest().GetBase().GetRef() +} + +func (p *PullRequestEvent) GetPRHeadSha() string { + return p.GetPullRequest().GetHead().GetSha() +} + +func (p *PullRequestEvent) GetPRLabelSet() sets.String { + return p.GetPullRequest().LabelsToSet() +} diff --git a/gitee/hook_pullrequesthook_accessors.go b/gitee/hook_pullrequesthook_accessors.go index 8cbf8a2..b1b9b5a 100644 --- a/gitee/hook_pullrequesthook_accessors.go +++ b/gitee/hook_pullrequesthook_accessors.go @@ -1,5 +1,7 @@ package gitee +import "k8s.io/apimachinery/pkg/util/sets" + func (ph *PullRequestHook) GetNumber() int32 { if ph == nil { return 0 @@ -8,6 +10,118 @@ func (ph *PullRequestHook) GetNumber() int32 { return ph.Number } +func (ph *PullRequestHook) GetState() string { + if ph == nil { + return "" + } + + return ph.State +} + +func (ph *PullRequestHook) GetHtmlURL() string { + if ph == nil { + return "" + } + + return ph.HtmlUrl +} + +func (ph *PullRequestHook) GetDiffUrl() string { + if ph == nil { + return "" + } + + return ph.DiffUrl +} + +func (ph *PullRequestHook) GetPatchUrl() string { + if ph == nil { + return "" + } + + return ph.DiffUrl +} + +func (ph *PullRequestHook) GetTitle() string { + if ph == nil { + return "" + } + + return ph.Title +} + +func (ph *PullRequestHook) GetBody() string { + if ph == nil { + return "" + } + + return ph.Body +} + +func (ph *PullRequestHook) GetStaleLabels() []LabelHook { + if ph == nil { + return nil + } + + return ph.StaleLabels +} + +func (ph *PullRequestHook) GetLabels() []LabelHook { + if ph == nil { + return nil + } + + return ph.Labels +} + +func (ph *PullRequestHook) GetCreatedAt() string { + if ph == nil { + return "" + } + + return ph.CreatedAt +} + +func (ph *PullRequestHook) GetUpdatedAt() string { + if ph == nil { + return "" + } + + return ph.UpdatedAt +} + +func (ph *PullRequestHook) GetClosedAt() string { + if ph == nil { + return "" + } + + return ph.ClosedAt +} + +func (ph *PullRequestHook) GetMergedAt() string { + if ph == nil { + return "" + } + + return ph.MergedAt +} + +func (ph *PullRequestHook) GetMergeCommitSha() string { + if ph == nil { + return "" + } + + return ph.MergeCommitSha +} + +func (ph *PullRequestHook) GetMergeReferenceName() string { + if ph == nil { + return "" + } + + return ph.MergeReferenceName +} + func (ph *PullRequestHook) GetNeedTest() bool { if ph == nil { return false @@ -48,6 +162,30 @@ func (ph *PullRequestHook) GetAssignee() *UserHook { return ph.Assignee } +func (ph *PullRequestHook) GetAssignees() []UserHook { + if ph == nil { + return nil + } + + return ph.Assignees +} + +func (ph *PullRequestHook) GetTester() []UserHook { + if ph == nil { + return nil + } + + return ph.Tester +} + +func (ph *PullRequestHook) GetTesters() []UserHook { + if ph == nil { + return nil + } + + return ph.Testers +} + func (ph *PullRequestHook) GetMilestone() *MilestoneHook { if ph == nil { return nil @@ -78,4 +216,72 @@ func (ph *PullRequestHook) GetUpdatedBy() *UserHook { } return ph.UpdatedBy -} \ No newline at end of file +} + +func (ph *PullRequestHook) GetMerged() bool { + if ph == nil { + return false + } + + return ph.Merged +} + +func (ph *PullRequestHook) GetMergeStatus() string { + if ph == nil { + return "" + } + + return ph.MergeStatus +} + +func (ph *PullRequestHook) GetComments() int32 { + if ph != nil { + return 0 + } + + return ph.Comments +} + +func (ph *PullRequestHook) GetCommits() int32 { + if ph != nil { + return 0 + } + + return ph.Commits +} + +func (ph *PullRequestHook) GetAdditions() int32 { + if ph != nil { + return 0 + } + + return ph.Additions +} + +func (ph *PullRequestHook) GetDeletions() int32 { + if ph != nil { + return 0 + } + + return ph.Deletions +} + +func (ph *PullRequestHook) GetChangedFiles() int32 { + if ph != nil { + return 0 + } + + return ph.ChangedFiles +} + +func (ph *PullRequestHook) LabelsToSet() sets.String { + res := sets.NewString() + + for _, v := range ph.GetLabels() { + if v.GetName() != "" { + res.Insert(v.GetName()) + } + } + + return res +} diff --git a/gitee/hook_pushevent_accessors.go b/gitee/hook_pushevent_accessors.go index 3b28c67..11633b0 100644 --- a/gitee/hook_pushevent_accessors.go +++ b/gitee/hook_pushevent_accessors.go @@ -1,6 +1,6 @@ package gitee -func (pe *PushEvent) GetAction() string { +func (pe *PushEvent) GetRef() string { if pe == nil || pe.Ref == nil { return "" } @@ -56,6 +56,14 @@ func (pe *PushEvent) GetCompare() string { return *pe.Compare } +func (pe *PushEvent) getCommits() []CommitHook { + if pe == nil { + return nil + } + + return pe.Commits +} + func (pe *PushEvent) GetHeadCommit() *CommitHook { if pe == nil { return nil @@ -80,6 +88,14 @@ func (pe *PushEvent) GetProject() *ProjectHook { return pe.Project } +func (pe *PushEvent) GetUserID() int64 { + if pe == nil || pe.UserName == nil { + return 0 + } + + return pe.UserID +} + func (pe *PushEvent) GetUserName() string { if pe == nil || pe.UserName == nil { return "" diff --git a/gitee/hook_userhook_accessors.go b/gitee/hook_userhook_accessors.go index 48a8378..c38435a 100644 --- a/gitee/hook_userhook_accessors.go +++ b/gitee/hook_userhook_accessors.go @@ -1,9 +1,107 @@ package gitee +import "time" + +func (u *UserHook) GetID() int32 { + if u == nil { + return 0 + } + + return u.Id +} + +func (u *UserHook) GetName() string { + if u == nil { + return "" + } + + return u.Name +} + +func (u *UserHook) GetEmail() string { + if u == nil { + return "" + } + + return u.Email +} + +func (u *UserHook) GetUsername() string { + if u == nil { + return "" + } + + return u.Username +} + +func (u *UserHook) GetUserName() string { + if u == nil { + return "" + } + + return u.UserName +} + +func (u *UserHook) GetURL() string { + if u == nil { + return "" + } + + return u.Url +} + func (u *UserHook) GetLogin() string { if u == nil { return "" } return u.Login -} \ No newline at end of file +} + +func (u *UserHook) GetAvatarURL() string { + if u == nil { + return "" + } + + return u.AvatarUrl +} + +func (u *UserHook) GetHtmlURL() string { + if u == nil { + return "" + } + + return u.HtmlUrl +} + +func (u *UserHook) GetType() string { + if u == nil { + return "" + } + + return u.Type_ +} + +func (u *UserHook) GetSiteAdmin() bool { + if u == nil { + return false + } + + return u.SiteAdmin +} + +func (u *UserHook) GetTime() time.Time { + if u == nil { + return time.Time{} + } + + return u.Time +} + +func (u *UserHook) GetRemark() string { + if u == nil { + return "" + } + + return u.Remark +} diff --git a/gitee/models_accessors.go b/gitee/models_accessors.go new file mode 100644 index 0000000..4a7b8cb --- /dev/null +++ b/gitee/models_accessors.go @@ -0,0 +1,1474 @@ +package gitee + +import "time" + +func (bi *BasicInfo) GetLabel() string { + if bi == nil { + return "" + } + + return bi.Label +} + +func (bi *BasicInfo) GetRef() string { + if bi == nil { + return "" + } + + return bi.Ref +} + +func (bi *BasicInfo) GetSha() string { + if bi == nil { + return "" + } + + return bi.Sha +} + +func (bi *BasicInfo) GetUser() *UserBasic { + if bi == nil { + return nil + } + + return bi.User +} + +func (bi *BasicInfo) GetProject() *Project { + if bi == nil { + return nil + } + + return bi.Repo +} + +func (b *Branch) GetName() string { + if b == nil { + return "" + } + + return b.Name +} + +func (b *Branch) GetCommit() *BranchCommit { + if b == nil { + return nil + } + + return b.Commit +} + +func (b *Branch) GetProtected() bool { + if b == nil { + return false + } + + return b.Protected +} + +func (b *Branch) GetProtectionUrl() string { + if b == nil { + return "" + } + + return b.ProtectionUrl +} + +func (bc *BranchCommit) GetURL() string { + if bc == nil { + return "" + } + + return bc.Url +} + +func (bc *BranchCommit) GetSha() string { + if bc == nil { + return "" + } + + return bc.Sha +} + +func (c *Commit) GetID() string { + if c == nil { + return "" + } + + return c.Id +} + +func (c *Commit) GetTreeId() string { + if c == nil { + return "" + } + + return c.TreeId +} + +func (c *Commit) GetParentIds() []string { + if c == nil { + return nil + } + + return c.ParentIds +} + +func (c *Commit) GetMessage() string { + if c == nil { + return "" + } + + return c.Message +} + +func (c *Commit) GetTimestamp() time.Time { + if c == nil { + return time.Time{} + } + + return c.Timestamp +} + +func (c *Commit) GetURL() string { + if c == nil { + return "" + } + + return c.Url +} + +func (c *Commit) GetAuthor() *UserBasic { + if c == nil { + return nil + } + + return c.Author +} + +func (c *Commit) GetCommitter() *UserBasic { + if c == nil { + return nil + } + + return c.Committer +} + +func (c *Commit) GetDistinct() bool { + if c == nil { + return false + } + + return c.Distinct +} + +func (c *Commit) GetAdded() []string { + if c == nil { + return nil + } + + return c.Added +} + +func (c *Commit) GetRemoved() []string { + if c == nil { + return nil + } + + return c.Removed +} + +func (c *Commit) GetModified() []string { + if c == nil { + return nil + } + + return c.Modified +} + +func (ct *CommitTree) GetURL() string { + if ct == nil { + return "" + } + + return ct.Url +} + +func (ct *CommitTree) GetSha() string { + if ct == nil { + return "" + } + + return ct.Sha +} + +func (cb *ContentBasic) GetName() string { + if cb == nil { + return "" + } + + return cb.Name +} + +func (cb *ContentBasic) GetPath() string { + if cb == nil { + return "" + } + + return cb.Path +} + +func (cb *ContentBasic) GetSize() string { + if cb == nil { + return "" + } + + return cb.Size +} + +func (cb *ContentBasic) GetSha() string { + if cb == nil { + return "" + } + + return cb.Sha +} + +func (cb *ContentBasic) GetUrl() string { + if cb == nil { + return "" + } + + return cb.Url +} + +func (cb *ContentBasic) GetHtmlUrl() string { + if cb == nil { + return "" + } + + return cb.HtmlUrl +} + +func (cb *ContentBasic) GetDownloadUrl() string { + if cb == nil { + return "" + } + + return cb.DownloadUrl +} + +func (cb *ContentBasic) GetLinks() string { + if cb == nil { + return "" + } + + return cb.Links +} + +func (cb *ContentBasic) GetType_() string { + if cb == nil { + return "" + } + + return cb.Type_ +} + +func (eb *EnterpriseBasic) GetID() int32 { + if eb == nil { + return 0 + } + + return eb.Id +} + +func (eb *EnterpriseBasic) GetPath() string { + if eb == nil { + return "" + } + + return eb.Path +} + +func (eb *EnterpriseBasic) GetName() string { + if eb == nil { + return "" + } + + return eb.Name +} + +func (eb *EnterpriseBasic) GetUrl() string { + if eb == nil { + return "" + } + + return eb.Url +} + +func (eb *EnterpriseBasic) GetAvatarUrl() string { + if eb == nil { + return "" + } + + return eb.AvatarUrl +} + +func (gc *GitCommit) GetUrl() string { + if gc == nil { + return "" + } + + return gc.Url +} + +func (gc *GitCommit) GetAuthor() *GitUser { + if gc == nil { + return nil + } + + return gc.Author +} + +func (gc *GitCommit) GetCommitter() *GitUser { + if gc == nil { + return nil + } + + return gc.Committer +} + +func (gc *GitCommit) GetMessage() string { + if gc == nil { + return "" + } + + return gc.Message +} + +func (gc *GitCommit) GetCommentCount() int32 { + if gc == nil { + return 0 + } + + return gc.CommentCount +} + +func (gu *GitUser) GetName() string { + if gu == nil { + return "" + } + + return gu.Name +} + +func (gu *GitUser) GetEmail() string { + if gu == nil { + return "" + } + + return gu.Email +} + +func (gu *GitUser) GetDate() time.Time { + if gu == nil { + return time.Time{} + } + + return gu.Date +} + +func (g *Group) GetID() int32 { + if g == nil { + return 0 + } + + return g.Id +} + +func (g *Group) GetLogin() string { + if g == nil { + return "" + } + + return g.Login +} + +func (g *Group) GetUrl() string { + if g == nil { + return "" + } + + return g.Url +} + +func (g *Group) GetAvatarUrl() string { + if g == nil { + return "" + } + + return g.AvatarUrl +} + +func (g *Group) GetReposUrl() string { + if g == nil { + return "" + } + + return g.ReposUrl +} + +func (g *Group) GetEventsUrl() string { + if g == nil { + return "" + } + + return g.EventsUrl +} + +func (g *Group) GetMembersUrl() string { + if g == nil { + return "" + } + + return g.MembersUrl +} + +func (g *Group) GetDescription() string { + if g == nil { + return "" + } + + return g.Description +} + +func (m *Milestone) GetURL() string { + if m == nil { + return "" + } + + return m.Url +} + +func (m *Milestone) GetHtmlUrl() string { + if m == nil { + return "" + } + + return m.HtmlUrl +} + +func (m *Milestone) GetState() string { + if m == nil { + return "" + } + + return m.State +} + +func (m *Milestone) GetTitle() string { + if m == nil { + return "" + } + + return m.Title +} + +func (m *Milestone) GetDescription() string { + if m == nil { + return "" + } + + return m.Description +} + +func (m *Milestone) GetDueOn() string { + if m == nil { + return "" + } + + return m.DueOn +} + +func (m *Milestone) GetNumber() int32 { + if m == nil { + return 0 + } + + return m.Number +} + +func (m *Milestone) GetRepositoryId() int32 { + if m == nil { + return 0 + } + + return m.RepositoryId +} + +func (m *Milestone) GetOpenIssues() int32 { + if m == nil { + return 0 + } + + return m.OpenIssues +} + +func (m *Milestone) GetClosedIssues() int32 { + if m == nil { + return 0 + } + + return m.ClosedIssues +} + +func (m *Milestone) GetUpdatedAt() time.Time { + if m == nil { + return time.Time{} + } + + return m.UpdatedAt +} + +func (m *Milestone) GetCreatedAt() time.Time { + if m == nil { + return time.Time{} + } + + return m.CreatedAt +} + +func (n *Namespace) GetID() int32 { + if n == nil { + return 0 + } + + return n.Id +} + +func (n *Namespace) GetType_() string { + if n == nil { + return "" + } + + return n.Type_ +} + +func (n *Namespace) GetName() string { + if n == nil { + return "" + } + + return n.Name +} + +func (n *Namespace) GetPath() string { + if n == nil { + return "" + } + + return n.Path +} + +func (n *Namespace) GetHtmlUrl() string { + if n == nil { + return "" + } + + return n.HtmlUrl +} + +func (n *Namespace) GetParent() *NamespaceMini { + if n == nil { + return nil + } + + return n.Parent +} + +func (nm *NamespaceMini) GetID() int32 { + if nm == nil { + return 0 + } + + return nm.Id +} + +func (nm *NamespaceMini) GetType_() string { + if nm == nil { + return "" + } + + return nm.Type_ +} + +func (nm *NamespaceMini) GetName() string { + if nm == nil { + return "" + } + + return nm.Name +} + +func (nm *NamespaceMini) GetPath() string { + if nm == nil { + return "" + } + + return nm.Path +} + +func (nm *NamespaceMini) GetHtmlUrl() string { + if nm == nil { + return "" + } + + return nm.HtmlUrl +} + +func (pb *ProgramBasic) GetID() string { + if pb == nil { + return "" + } + + return pb.Id +} + +func (pb *ProgramBasic) GetName() string { + if pb == nil { + return "" + } + + return pb.Name +} + +func (pb *ProgramBasic) GetDescription() string { + if pb == nil { + return "" + } + + return pb.Description +} + +func (pb *ProgramBasic) GetAssignee() string { + if pb == nil { + return "" + } + + return pb.Assignee +} + +func (pb *ProgramBasic) GetAuthor() string { + if pb == nil { + return "" + } + + return pb.Author +} + +func (pro *Project) GetID() int32 { + if pro == nil { + return 0 + } + + return pro.Id +} + +func (pro *Project) GetFullName() string { + if pro == nil { + return "" + } + + return pro.FullName +} + +func (pro *Project) GetHumanName() string { + if pro == nil { + return "" + } + + return pro.HumanName +} + +func (pro *Project) GetUrl() string { + if pro == nil { + return "" + } + + return pro.Url +} + +func (pro *Project) GetPath() string { + if pro == nil { + return "" + } + + return pro.Path +} + +func (pro *Project) GetName() string { + if pro == nil { + return "" + } + + return pro.Name +} + +func (pro *Project) GetDescription() string { + if pro == nil { + return "" + } + + return pro.Description +} + +func (pro *Project) GetHtmlUrl() string { + if pro == nil { + return "" + } + + return pro.HtmlUrl +} + +func (pro *Project) GetSshUrl() string { + if pro == nil { + return "" + } + + return pro.SshUrl +} + +func (pro *Project) GetForksUrl() string { + if pro == nil { + return "" + } + + return pro.ForksUrl +} + +func (pro *Project) GetKeysUrl() string { + if pro == nil { + return "" + } + + return pro.KeysUrl +} + +func (pro *Project) GetCollaboratorsUrl() string { + if pro == nil { + return "" + } + + return pro.CollaboratorsUrl +} + +func (pro *Project) GetHooksUrl() string { + if pro == nil { + return "" + } + + return pro.HooksUrl +} + +func (pro *Project) GetTagsUrl() string { + if pro == nil { + return "" + } + + return pro.TagsUrl +} + +func (pro *Project) GetBranchesUrl() string { + if pro == nil { + return "" + } + + return pro.BranchesUrl +} + +func (pro *Project) GetBlobsUrl() string { + if pro == nil { + return "" + } + + return pro.BlobsUrl +} + +func (pro *Project) GetStargazersUrl() string { + if pro == nil { + return "" + } + + return pro.StargazersUrl +} + +func (pro *Project) GetContributorsUrl() string { + if pro == nil { + return "" + } + + return pro.ContributorsUrl +} + +func (pro *Project) GetCommitsUrl() string { + if pro == nil { + return "" + } + + return pro.CommitsUrl +} + +func (pro *Project) GetCommentsUrl() string { + if pro == nil { + return "" + } + + return pro.CommentsUrl +} + +func (pro *Project) GetIssueCommentUrl() string { + if pro == nil { + return "" + } + + return pro.IssueCommentUrl +} + +func (pro *Project) GetIssuesUrl() string { + if pro == nil { + return "" + } + + return pro.IssuesUrl +} + +func (pro *Project) GetPullsUrl() string { + if pro == nil { + return "" + } + + return pro.PullsUrl +} + +func (pro *Project) GetMilestonesUrl() string { + if pro == nil { + return "" + } + + return pro.MilestonesUrl +} + +func (pro *Project) GetNotificationsUrl() string { + if pro == nil { + return "" + } + + return pro.NotificationsUrl +} + +func (pro *Project) GetLabelsUrl() string { + if pro == nil { + return "" + } + + return pro.LabelsUrl +} + +func (pro *Project) GetReleasesUrl() string { + if pro == nil { + return "" + } + + return pro.ReleasesUrl +} + +func (pro *Project) GetHomepage() string { + if pro == nil { + return "" + } + + return pro.Homepage +} + +func (pro *Project) GetLanguage() string { + if pro == nil { + return "" + } + + return pro.Language +} + +func (pro *Project) GetDefaultBranch() string { + if pro == nil { + return "" + } + + return pro.DefaultBranch +} + +func (pro *Project) GetLicense() string { + if pro == nil { + return "" + } + + return pro.License +} + +func (pro *Project) GetPushedAt() string { + if pro == nil { + return "" + } + + return pro.PushedAt +} + +func (pro *Project) GetCreatedAt() string { + if pro == nil { + return "" + } + + return pro.CreatedAt +} + +func (pro *Project) GetUpdatedAt() string { + if pro == nil { + return "" + } + + return pro.UpdatedAt +} + +func (pro *Project) GetPaas() string { + if pro == nil { + return "" + } + + return pro.Paas +} + +func (pro *Project) GetStared() string { + if pro == nil { + return "" + } + + return pro.Stared +} + +func (pro *Project) GetWatched() string { + if pro == nil { + return "" + } + + return pro.Watched +} + +func (pro *Project) GetPermission() string { + if pro == nil { + return "" + } + + return pro.Permission +} + +func (pro *Project) GetRelation() string { + if pro == nil { + return "" + } + + return pro.Relation +} + +func (pro *Project) GetPrivate() bool { + if pro == nil { + return false + } + + return pro.Private +} + +func (pro *Project) GetPublic() bool { + if pro == nil { + return false + } + + return pro.Public +} + +func (pro *Project) GetInternal() bool { + if pro == nil { + return false + } + + return pro.Internal +} + +func (pro *Project) GetFork() bool { + if pro == nil { + return false + } + + return pro.Fork +} + +func (pro *Project) GetRecommend() bool { + if pro == nil { + return false + } + + return pro.Recommend +} + +func (pro *Project) GetHasIssues() bool { + if pro == nil { + return false + } + + return pro.HasIssues +} + +func (pro *Project) GetHasWiki() bool { + if pro == nil { + return false + } + + return pro.HasWiki +} + +func (pro *Project) GetCanComment() bool { + if pro == nil { + return false + } + + return pro.CanComment +} + +func (pro *Project) GetPullRequestsEnabled() bool { + if pro == nil { + return false + } + + return pro.PullRequestsEnabled +} + +func (pro *Project) GetHasPage() bool { + if pro == nil { + return false + } + + return pro.HasPage +} + +func (pro *Project) GetOutsourced() bool { + if pro == nil { + return false + } + + return pro.Outsourced +} + +func (pro *Project) GetNamespace() *Namespace { + if pro == nil { + return nil + } + + return pro.Namespace +} + +func (pro *Project) GetOwner() *UserBasic { + if pro == nil { + return nil + } + + return pro.Owner +} + +func (pro *Project) GetParent() *Project { + if pro == nil { + return nil + } + + return pro.Parent +} + +func (pro *Project) GetMembers() []string { + if pro == nil { + return nil + } + + return pro.Members +} + +func (pro *Project) GetForksCount() int32 { + if pro == nil { + return 0 + } + + return pro.ForksCount +} + +func (pro *Project) GetStargazersCount() int32 { + if pro == nil { + return 0 + } + + return pro.StargazersCount +} + +func (pro *Project) GetWatchersCount() int32 { + if pro == nil { + return 0 + } + + return pro.WatchersCount +} + +func (pro *Project) GetOpenIssuesCount() int32 { + if pro == nil { + return 0 + } + + return pro.OpenIssuesCount +} + +func (pb *ProjectBasic) GetPrivate() bool { + if pb == nil { + return false + } + + return pb.Private +} + +func (pb *ProjectBasic) GetPublic() bool { + if pb == nil { + return false + } + + return pb.Public +} + +func (pb *ProjectBasic) GetInternal() bool { + if pb == nil { + return false + } + + return pb.Internal +} + +func (pb *ProjectBasic) GetID() int32 { + if pb == nil { + return 0 + } + + return pb.Id +} + +func (pb *ProjectBasic) GetFullName() string { + if pb == nil { + return "" + } + + return pb.FullName +} + +func (pb *ProjectBasic) GetHumanName() string { + if pb == nil { + return "" + } + + return pb.HumanName +} + +func (pb *ProjectBasic) GetUrl() string { + if pb == nil { + return "" + } + + return pb.Url +} + +func (pb *ProjectBasic) GetPath() string { + if pb == nil { + return "" + } + + return pb.Path +} + +func (pb *ProjectBasic) GetName() string { + if pb == nil { + return "" + } + + return pb.Name +} + +func (pb *ProjectBasic) GetDescription() string { + if pb == nil { + return "" + } + + return pb.Description +} + +func (pb *ProjectBasic) GetHtmlUrl() string { + if pb == nil { + return "" + } + + return pb.HtmlUrl +} + +func (pb *ProjectBasic) GetSshUrl() string { + if pb == nil { + return "" + } + + return pb.SshUrl +} + +func (pb *ProjectBasic) GetOwner() *UserBasic { + if pb == nil { + return nil + } + + return pb.Owner +} + +func (pmp *ProjectMemberPermissionDetail) GetPull() bool { + if pmp == nil { + return false + } + + return pmp.Pull +} + +func (pmp *ProjectMemberPermissionDetail) GetPush() bool { + if pmp == nil { + return false + } + + return pmp.Push +} + +func (pmp *ProjectMemberPermissionDetail) GetAdmin() bool { + if pmp == nil { + return false + } + + return pmp.Admin +} + +func (pfp *PullRequestFilePath) GetNewFile() bool { + if pfp == nil { + return false + } + + return pfp.NewFile +} + +func (pfp *PullRequestFilePath) GetRenamedFile() bool { + if pfp == nil { + return false + } + + return pfp.RenamedFile +} + +func (pfp *PullRequestFilePath) GetDeletedFile() bool { + if pfp == nil { + return false + } + + return pfp.DeletedFile +} + +func (pfp *PullRequestFilePath) GetTooLarge() bool { + if pfp == nil { + return false + } + + return pfp.TooLarge +} + +func (pfp *PullRequestFilePath) GetDiff() string { + if pfp == nil { + return "" + } + + return pfp.Diff +} + +func (pfp *PullRequestFilePath) GetNewPath() string { + if pfp == nil { + return "" + } + + return pfp.NewPath +} + +func (pfp *PullRequestFilePath) GetOldPath() string { + if pfp == nil { + return "" + } + + return pfp.OldPath +} + +func (pfp *PullRequestFilePath) GetAMode() string { + if pfp == nil { + return "" + } + + return pfp.AMode +} + +func (pfp *PullRequestFilePath) GetBMode() string { + if pfp == nil { + return "" + } + + return pfp.BMode +} + +func (ub *UserBasic) GetID() int32 { + if ub == nil { + return 0 + } + + return ub.Id +} + +func (ub *UserBasic) GetSiteAdmin() bool { + if ub == nil { + return false + } + + return ub.SiteAdmin +} + +func (ub *UserBasic) GetLogin() string { + if ub == nil { + return "" + } + + return ub.Login +} +func (ub *UserBasic) GetFollowingUrl() string { + if ub == nil { + return "" + } + + return ub.FollowingUrl +} + +func (ub *UserBasic) GetGistsUrl() string { + if ub == nil { + return "" + } + + return ub.GistsUrl +} + +func (ub *UserBasic) GetStarredUrl() string { + if ub == nil { + return "" + } + + return ub.StarredUrl +} + +func (ub *UserBasic) GetSubscriptionsUrl() string { + if ub == nil { + return "" + } + + return ub.SubscriptionsUrl +} + +func (ub *UserBasic) GetOrganizationsUrl() string { + if ub == nil { + return "" + } + + return ub.OrganizationsUrl +} + +func (ub *UserBasic) GetReposUrl() string { + if ub == nil { + return "" + } + + return ub.ReposUrl +} + +func (ub *UserBasic) GetEventsUrl() string { + if ub == nil { + return "" + } + + return ub.EventsUrl +} + +func (ub *UserBasic) GetReceivedEventsUrl() string { + if ub == nil { + return "" + } + + return ub.ReceivedEventsUrl +} + +func (ub *UserBasic) GetType_() string { + if ub == nil { + return "" + } + + return ub.Type_ +} + +func (ub *UserBasic) GetEmail() string { + if ub == nil { + return "" + } + + return ub.Email +} + +func (ub *UserBasic) GetAvatarUrl() string { + if ub == nil { + return "" + } + + return ub.AvatarUrl +} + +func (ub *UserBasic) GetUrl() string { + if ub == nil { + return "" + } + + return ub.Url +} + +func (ub *UserBasic) GetHtmlUrl() string { + if ub == nil { + return "" + } + + return ub.HtmlUrl +} + +func (ub *UserBasic) GetFollowersUrl() string { + if ub == nil { + return "" + } + + return ub.FollowersUrl +} + +func (ub *UserBasic) GetName() string { + if ub == nil { + return "" + } + + return ub.Name +} diff --git a/go.mod b/go.mod index 4212ac9..05be3cb 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.12 require ( github.com/antihax/optional v1.0.0 - golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e + golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 + k8s.io/apimachinery v0.22.1 ) diff --git a/go.sum b/go.sum index 50938d2..301834a 100644 --- a/go.sum +++ b/go.sum @@ -1,12 +1,204 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= +github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= +github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/antihax/optional v1.0.0 h1:xK2lYat7ZLaVVcIuj82J8kIro4V6kDe0AUDFboUCwcg= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= +github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= +github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= +github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= +github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= +github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= +github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= +github.com/evanphx/json-patch v4.11.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= +github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= +github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= +github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= +github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= +github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.1.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU= +github.com/googleapis/gnostic v0.5.5/go.mod h1:7+EbHbldMins07ALC74bsA81Ovc97DwqyJO1AENw9kA= +github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= +github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= +github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/onsi/ginkgo v0.0.0-20170829012221-11459a886d9c/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= +github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= +github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= +github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= +github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/spf13/pflag v0.0.0-20170130214245-9ff6c6923cff/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg= golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= +google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= +google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +k8s.io/apimachinery v0.22.1 h1:DTARnyzmdHMz7bFWFDDm22AM4pLWTQECMpRTFu2d2OM= +k8s.io/apimachinery v0.22.1/go.mod h1:O3oNtNadZdeOMxHFVxOreoznohCpy0z6mocxbZr7oJ0= +k8s.io/gengo v0.0.0-20200413195148-3a45101e95ac/go.mod h1:ezvh/TsK7cY6rbqRK0oQQ8IAqLxYwwyPxAX1Pzy0ii0= +k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE= +k8s.io/klog/v2 v2.9.0/go.mod h1:hy9LJ/NvuK+iVyP4Ehqva4HxZG/oXyIS3n3Jmire4Ec= +k8s.io/kube-openapi v0.0.0-20210421082810-95288971da7e/go.mod h1:vHXdDvt9+2spS2Rx9ql3I8tycm3H9FDfdUoIuKCefvw= +sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= +sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= +sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= -- Gitee From beb2b74582acf44e8566b7fa84e35625da499a42 Mon Sep 17 00:00:00 2001 From: xwzQmxx <1499273991@qq.com> Date: Mon, 13 Dec 2021 16:26:02 +0800 Subject: [PATCH 2/4] fix review --- gitee/hook_commithook_accessors.go | 2 +- ...{hook_labelhokk_accessors.go => hook_labelhook_accessors.go} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename gitee/{hook_labelhokk_accessors.go => hook_labelhook_accessors.go} (100%) diff --git a/gitee/hook_commithook_accessors.go b/gitee/hook_commithook_accessors.go index c439053..337f920 100644 --- a/gitee/hook_commithook_accessors.go +++ b/gitee/hook_commithook_accessors.go @@ -2,7 +2,7 @@ package gitee import "time" -func (c *CommitHook) getID() string { +func (c *CommitHook) GetID() string { if c == nil { return "" } diff --git a/gitee/hook_labelhokk_accessors.go b/gitee/hook_labelhook_accessors.go similarity index 100% rename from gitee/hook_labelhokk_accessors.go rename to gitee/hook_labelhook_accessors.go -- Gitee From 512983aab790b78c5fdaa1a674a05a5d4fbe791b Mon Sep 17 00:00:00 2001 From: xwzQmxx <1499273991@qq.com> Date: Tue, 14 Dec 2021 17:01:48 +0800 Subject: [PATCH 3/4] fix review --- gitee/hook_event_models.go | 3 +-- gitee/hook_issuehook_accessors.go | 8 +++++--- gitee/hook_noteevent_accessors.go | 2 +- gitee/hook_projecthook_accessors.go | 24 ++++++++++++++++++++++++ gitee/hook_pullrequestevent_accessors.go | 1 - gitee/hook_pullrequesthook_accessors.go | 10 ++++++---- gitee/hook_pushevent_accessors.go | 2 +- gitee/hook_userhook_accessors.go | 10 +--------- gitee/model_content_basic.go | 2 +- gitee/model_namespace.go | 2 +- gitee/model_namespace_mini.go | 2 +- gitee/model_user_basic.go | 2 +- gitee/models_accessors.go | 16 ++++++++-------- 13 files changed, 51 insertions(+), 33 deletions(-) diff --git a/gitee/hook_event_models.go b/gitee/hook_event_models.go index cbb5a33..c299513 100644 --- a/gitee/hook_event_models.go +++ b/gitee/hook_event_models.go @@ -35,13 +35,12 @@ type UserHook struct { Id int32 `json:"id,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` - Username string `json:"username,omitempty"` UserName string `json:"user_name,omitempty"` Url string `json:"url,omitempty"` Login string `json:"login,omitempty"` AvatarUrl string `json:"avatar_url,omitempty"` HtmlUrl string `json:"html_url,omitempty"` - Type_ string `json:"type,omitempty"` + Type string `json:"type,omitempty"` SiteAdmin bool `json:"site_admin,omitempty"` Time time.Time `json:"time,omitempty"` Remark string `json:"remark,omitempty"` diff --git a/gitee/hook_issuehook_accessors.go b/gitee/hook_issuehook_accessors.go index 3aae1c8..73671a8 100644 --- a/gitee/hook_issuehook_accessors.go +++ b/gitee/hook_issuehook_accessors.go @@ -137,9 +137,11 @@ func (ih *IssueHook) LabelsToSet() sets.String { res := sets.NewString() for _, v := range ih.GetLabels() { - if v.GetName() != "" { - res.Insert(v.GetName()) - } + res.Insert(v.GetName()) + } + + if res.Has("") { + res.Delete("") } return res diff --git a/gitee/hook_noteevent_accessors.go b/gitee/hook_noteevent_accessors.go index a0b08ee..037a8a0 100644 --- a/gitee/hook_noteevent_accessors.go +++ b/gitee/hook_noteevent_accessors.go @@ -171,7 +171,7 @@ func (ne *NoteEvent) GetPRNumber() int32 { } func (ne *NoteEvent) GetPRAuthor() string { - return ne.GetPullRequest().GetUser().Login + return ne.GetPullRequest().GetUser().GetLogin() } func (ne *NoteEvent) IsPROpen() bool { diff --git a/gitee/hook_projecthook_accessors.go b/gitee/hook_projecthook_accessors.go index 67a2d5c..d8d2ad5 100644 --- a/gitee/hook_projecthook_accessors.go +++ b/gitee/hook_projecthook_accessors.go @@ -136,6 +136,30 @@ func (pj *ProjectHook) GetSvnUrl() string { return pj.SvnUrl } +func (pj *ProjectHook) GetGitHttpUrl() string { + if pj == nil { + return "" + } + + return pj.GitHttpUrl +} + +func (pj *ProjectHook) GetGitSshUrl() string { + if pj == nil { + return "" + } + + return pj.GitSshUrl +} + +func (pj *ProjectHook) GetGitSvnUrl() string { + if pj == nil { + return "" + } + + return pj.GitSvnUrl +} + func (pj *ProjectHook) GetHomepage() string { if pj == nil { return "" diff --git a/gitee/hook_pullrequestevent_accessors.go b/gitee/hook_pullrequestevent_accessors.go index 6fef436..bd154de 100644 --- a/gitee/hook_pullrequestevent_accessors.go +++ b/gitee/hook_pullrequestevent_accessors.go @@ -176,7 +176,6 @@ func (p *PullRequestEvent) GetOrgRepo() (string, string) { return p.GetRepository().GetOwnerAndRepo() } -// GetPRAuthor return the PR author's login func (p *PullRequestEvent) GetPRAuthor() string { return p.GetPullRequest().GetUser().GetLogin() } diff --git a/gitee/hook_pullrequesthook_accessors.go b/gitee/hook_pullrequesthook_accessors.go index b1b9b5a..fee6467 100644 --- a/gitee/hook_pullrequesthook_accessors.go +++ b/gitee/hook_pullrequesthook_accessors.go @@ -39,7 +39,7 @@ func (ph *PullRequestHook) GetPatchUrl() string { return "" } - return ph.DiffUrl + return ph.PatchUrl } func (ph *PullRequestHook) GetTitle() string { @@ -278,9 +278,11 @@ func (ph *PullRequestHook) LabelsToSet() sets.String { res := sets.NewString() for _, v := range ph.GetLabels() { - if v.GetName() != "" { - res.Insert(v.GetName()) - } + res.Insert(v.GetName()) + } + + if res.Has("") { + res.Delete("") } return res diff --git a/gitee/hook_pushevent_accessors.go b/gitee/hook_pushevent_accessors.go index 11633b0..4794d2f 100644 --- a/gitee/hook_pushevent_accessors.go +++ b/gitee/hook_pushevent_accessors.go @@ -89,7 +89,7 @@ func (pe *PushEvent) GetProject() *ProjectHook { } func (pe *PushEvent) GetUserID() int64 { - if pe == nil || pe.UserName == nil { + if pe == nil { return 0 } diff --git a/gitee/hook_userhook_accessors.go b/gitee/hook_userhook_accessors.go index c38435a..f4d4e9a 100644 --- a/gitee/hook_userhook_accessors.go +++ b/gitee/hook_userhook_accessors.go @@ -26,14 +26,6 @@ func (u *UserHook) GetEmail() string { return u.Email } -func (u *UserHook) GetUsername() string { - if u == nil { - return "" - } - - return u.Username -} - func (u *UserHook) GetUserName() string { if u == nil { return "" @@ -79,7 +71,7 @@ func (u *UserHook) GetType() string { return "" } - return u.Type_ + return u.Type } func (u *UserHook) GetSiteAdmin() bool { diff --git a/gitee/model_content_basic.go b/gitee/model_content_basic.go index 0c27159..1816565 100644 --- a/gitee/model_content_basic.go +++ b/gitee/model_content_basic.go @@ -14,7 +14,7 @@ type ContentBasic struct { Path string `json:"path,omitempty"` Size string `json:"size,omitempty"` Sha string `json:"sha,omitempty"` - Type_ string `json:"type,omitempty"` + Type string `json:"type,omitempty"` Url string `json:"url,omitempty"` HtmlUrl string `json:"html_url,omitempty"` DownloadUrl string `json:"download_url,omitempty"` diff --git a/gitee/model_namespace.go b/gitee/model_namespace.go index 592ef7c..6c797b9 100644 --- a/gitee/model_namespace.go +++ b/gitee/model_namespace.go @@ -12,7 +12,7 @@ package gitee // 获取授权用户的一个 Namespace type Namespace struct { Id int32 `json:"id,omitempty"` - Type_ string `json:"type,omitempty"` + Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` HtmlUrl string `json:"html_url,omitempty"` diff --git a/gitee/model_namespace_mini.go b/gitee/model_namespace_mini.go index d024352..86ed667 100644 --- a/gitee/model_namespace_mini.go +++ b/gitee/model_namespace_mini.go @@ -11,7 +11,7 @@ package gitee type NamespaceMini struct { Id int32 `json:"id,omitempty"` - Type_ string `json:"type,omitempty"` + Type string `json:"type,omitempty"` Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` HtmlUrl string `json:"html_url,omitempty"` diff --git a/gitee/model_user_basic.go b/gitee/model_user_basic.go index 9f1f55a..723d572 100644 --- a/gitee/model_user_basic.go +++ b/gitee/model_user_basic.go @@ -26,7 +26,7 @@ type UserBasic struct { ReposUrl string `json:"repos_url,omitempty"` EventsUrl string `json:"events_url,omitempty"` ReceivedEventsUrl string `json:"received_events_url,omitempty"` - Type_ string `json:"type,omitempty"` + Type string `json:"type,omitempty"` SiteAdmin bool `json:"site_admin,omitempty"` Email string `json:"email,omitempty"` } diff --git a/gitee/models_accessors.go b/gitee/models_accessors.go index 4a7b8cb..3076ea2 100644 --- a/gitee/models_accessors.go +++ b/gitee/models_accessors.go @@ -266,12 +266,12 @@ func (cb *ContentBasic) GetLinks() string { return cb.Links } -func (cb *ContentBasic) GetType_() string { +func (cb *ContentBasic) GetType() string { if cb == nil { return "" } - return cb.Type_ + return cb.Type } func (eb *EnterpriseBasic) GetID() int32 { @@ -546,12 +546,12 @@ func (n *Namespace) GetID() int32 { return n.Id } -func (n *Namespace) GetType_() string { +func (n *Namespace) GetType() string { if n == nil { return "" } - return n.Type_ + return n.Type } func (n *Namespace) GetName() string { @@ -594,12 +594,12 @@ func (nm *NamespaceMini) GetID() int32 { return nm.Id } -func (nm *NamespaceMini) GetType_() string { +func (nm *NamespaceMini) GetType() string { if nm == nil { return "" } - return nm.Type_ + return nm.Type } func (nm *NamespaceMini) GetName() string { @@ -1417,12 +1417,12 @@ func (ub *UserBasic) GetReceivedEventsUrl() string { return ub.ReceivedEventsUrl } -func (ub *UserBasic) GetType_() string { +func (ub *UserBasic) GetType() string { if ub == nil { return "" } - return ub.Type_ + return ub.Type } func (ub *UserBasic) GetEmail() string { -- Gitee From 183f4d3babcf81e2245316b56fa6136c9fb998c3 Mon Sep 17 00:00:00 2001 From: xwzQmxx <1499273991@qq.com> Date: Wed, 15 Dec 2021 10:15:18 +0800 Subject: [PATCH 4/4] revert type_ --- gitee/hook_event_models.go | 4 ++-- gitee/hook_userhook_accessors.go | 2 +- gitee/model_content_basic.go | 2 +- gitee/model_namespace.go | 2 +- gitee/model_namespace_mini.go | 2 +- gitee/model_user_basic.go | 2 +- gitee/models_accessors.go | 10 +++++----- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/gitee/hook_event_models.go b/gitee/hook_event_models.go index c299513..50ab527 100644 --- a/gitee/hook_event_models.go +++ b/gitee/hook_event_models.go @@ -40,7 +40,7 @@ type UserHook struct { Login string `json:"login,omitempty"` AvatarUrl string `json:"avatar_url,omitempty"` HtmlUrl string `json:"html_url,omitempty"` - Type string `json:"type,omitempty"` + Type_ string `json:"type,omitempty"` SiteAdmin bool `json:"site_admin,omitempty"` Time time.Time `json:"time,omitempty"` Remark string `json:"remark,omitempty"` @@ -64,7 +64,7 @@ type CommitHook struct { // MilestoneHook : 里程碑信息 type MilestoneHook struct { - Id int32 `json:"id,omitempty"` + Id int32 `json:"id,omitempty"` HtmlUrl string `json:"html_url,omitempty"` Number int32 `json:"number,omitempty"` Title string `json:"title,omitempty"` diff --git a/gitee/hook_userhook_accessors.go b/gitee/hook_userhook_accessors.go index f4d4e9a..4f8efd9 100644 --- a/gitee/hook_userhook_accessors.go +++ b/gitee/hook_userhook_accessors.go @@ -71,7 +71,7 @@ func (u *UserHook) GetType() string { return "" } - return u.Type + return u.Type_ } func (u *UserHook) GetSiteAdmin() bool { diff --git a/gitee/model_content_basic.go b/gitee/model_content_basic.go index 1816565..0c27159 100644 --- a/gitee/model_content_basic.go +++ b/gitee/model_content_basic.go @@ -14,7 +14,7 @@ type ContentBasic struct { Path string `json:"path,omitempty"` Size string `json:"size,omitempty"` Sha string `json:"sha,omitempty"` - Type string `json:"type,omitempty"` + Type_ string `json:"type,omitempty"` Url string `json:"url,omitempty"` HtmlUrl string `json:"html_url,omitempty"` DownloadUrl string `json:"download_url,omitempty"` diff --git a/gitee/model_namespace.go b/gitee/model_namespace.go index 6c797b9..592ef7c 100644 --- a/gitee/model_namespace.go +++ b/gitee/model_namespace.go @@ -12,7 +12,7 @@ package gitee // 获取授权用户的一个 Namespace type Namespace struct { Id int32 `json:"id,omitempty"` - Type string `json:"type,omitempty"` + Type_ string `json:"type,omitempty"` Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` HtmlUrl string `json:"html_url,omitempty"` diff --git a/gitee/model_namespace_mini.go b/gitee/model_namespace_mini.go index 86ed667..d024352 100644 --- a/gitee/model_namespace_mini.go +++ b/gitee/model_namespace_mini.go @@ -11,7 +11,7 @@ package gitee type NamespaceMini struct { Id int32 `json:"id,omitempty"` - Type string `json:"type,omitempty"` + Type_ string `json:"type,omitempty"` Name string `json:"name,omitempty"` Path string `json:"path,omitempty"` HtmlUrl string `json:"html_url,omitempty"` diff --git a/gitee/model_user_basic.go b/gitee/model_user_basic.go index 723d572..9f1f55a 100644 --- a/gitee/model_user_basic.go +++ b/gitee/model_user_basic.go @@ -26,7 +26,7 @@ type UserBasic struct { ReposUrl string `json:"repos_url,omitempty"` EventsUrl string `json:"events_url,omitempty"` ReceivedEventsUrl string `json:"received_events_url,omitempty"` - Type string `json:"type,omitempty"` + Type_ string `json:"type,omitempty"` SiteAdmin bool `json:"site_admin,omitempty"` Email string `json:"email,omitempty"` } diff --git a/gitee/models_accessors.go b/gitee/models_accessors.go index 3076ea2..d95835f 100644 --- a/gitee/models_accessors.go +++ b/gitee/models_accessors.go @@ -34,7 +34,7 @@ func (bi *BasicInfo) GetUser() *UserBasic { return bi.User } -func (bi *BasicInfo) GetProject() *Project { +func (bi *BasicInfo) GetRepo() *Project { if bi == nil { return nil } @@ -271,7 +271,7 @@ func (cb *ContentBasic) GetType() string { return "" } - return cb.Type + return cb.Type_ } func (eb *EnterpriseBasic) GetID() int32 { @@ -551,7 +551,7 @@ func (n *Namespace) GetType() string { return "" } - return n.Type + return n.Type_ } func (n *Namespace) GetName() string { @@ -599,7 +599,7 @@ func (nm *NamespaceMini) GetType() string { return "" } - return nm.Type + return nm.Type_ } func (nm *NamespaceMini) GetName() string { @@ -1422,7 +1422,7 @@ func (ub *UserBasic) GetType() string { return "" } - return ub.Type + return ub.Type_ } func (ub *UserBasic) GetEmail() string { -- Gitee