From fcae4973635d2560c5ea819a37d1870a9a4dca1f Mon Sep 17 00:00:00 2001 From: wanghaosq Date: Thu, 2 Dec 2021 11:03:37 +0800 Subject: [PATCH] add some new files --- api/swagger.yaml | 4 - gitee/hook_branchhook_accessors.go | 41 +++++++ gitee/hook_commithook_accessors.go | 17 +++ gitee/hook_enterprisehook_accessors.go | 17 +++ gitee/hook_issueevent_accessors.go | 137 +++++++++++++++++++++++ gitee/hook_issuehook_accessors.go | 25 +++++ gitee/hook_labelhokk_accessors.go | 17 +++ gitee/hook_milestonehook_accessors.go | 17 +++ gitee/hook_noteevent_accessors.go | 137 +++++++++++++++++++++++ gitee/hook_notehook_accessors.go | 9 ++ gitee/hook_projecthook_accessors.go | 16 +++ gitee/hook_pullrequestevent_accessors.go | 6 - gitee/hook_pullrequesthook_accessors.go | 1 + gitee/hook_pushevent_accessors.go | 137 +++++++++++++++++++++++ gitee/hook_userhook_accessors.go | 9 ++ 15 files changed, 580 insertions(+), 10 deletions(-) create mode 100644 gitee/hook_branchhook_accessors.go create mode 100644 gitee/hook_commithook_accessors.go create mode 100644 gitee/hook_enterprisehook_accessors.go create mode 100644 gitee/hook_issueevent_accessors.go create mode 100644 gitee/hook_issuehook_accessors.go create mode 100644 gitee/hook_labelhokk_accessors.go create mode 100644 gitee/hook_milestonehook_accessors.go create mode 100644 gitee/hook_noteevent_accessors.go create mode 100644 gitee/hook_notehook_accessors.go create mode 100644 gitee/hook_pushevent_accessors.go create mode 100644 gitee/hook_userhook_accessors.go diff --git a/api/swagger.yaml b/api/swagger.yaml index 7a53189..dbb16ac 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -14483,10 +14483,6 @@ definitions: $ref: "#/definitions/UserBasic" milestone: $ref: "#/definitions/Milestone" - stale_labels: - type: "array" - items: - $ref: "#/definitions/StaleLabels" labels: type: "array" items: diff --git a/gitee/hook_branchhook_accessors.go b/gitee/hook_branchhook_accessors.go new file mode 100644 index 0000000..694de3e --- /dev/null +++ b/gitee/hook_branchhook_accessors.go @@ -0,0 +1,41 @@ +package gitee + +func (b *BranchHook) GetLabel() string { + if b == nil { + return "" + } + + return b.Label +} + +func (b *BranchHook) GetRef() string { + if b == nil { + return "" + } + + return b.Ref +} + +func (b *BranchHook) GetSha() string { + if b == nil { + return "" + } + + return b.Sha +} + +func (b *BranchHook) GetUser() *UserHook { + if b == nil { + return nil + } + + return b.User +} + +func (b *BranchHook) GetRepo() *ProjectHook { + if b == nil { + return nil + } + + return b.Repo +} \ No newline at end of file diff --git a/gitee/hook_commithook_accessors.go b/gitee/hook_commithook_accessors.go new file mode 100644 index 0000000..69f3dc1 --- /dev/null +++ b/gitee/hook_commithook_accessors.go @@ -0,0 +1,17 @@ +package gitee + +func (c *CommitHook) GetAuthor() *UserHook { + if c == nil { + return nil + } + + return c.Author +} + +func (c *CommitHook) GetCommitter() *UserHook { + if c == nil { + return nil + } + + return c.Committer +} \ No newline at end of file diff --git a/gitee/hook_enterprisehook_accessors.go b/gitee/hook_enterprisehook_accessors.go new file mode 100644 index 0000000..02ab8f4 --- /dev/null +++ b/gitee/hook_enterprisehook_accessors.go @@ -0,0 +1,17 @@ +package gitee + +func (eh *EnterpriseHook) GetName() string { + if eh == nil { + return "" + } + + return eh.Name +} + +func (eh *EnterpriseHook) GetUrl() string { + if eh == nil { + return "" + } + + return eh.Url +} \ No newline at end of file diff --git a/gitee/hook_issueevent_accessors.go b/gitee/hook_issueevent_accessors.go new file mode 100644 index 0000000..3a658ac --- /dev/null +++ b/gitee/hook_issueevent_accessors.go @@ -0,0 +1,137 @@ +package gitee + +func (ie *IssueEvent) GetAction() string { + if ie == nil || ie.Action == nil { + return "" + } + + return *ie.Action +} + +func (ie *IssueEvent) GetIssue() *IssueHook { + if ie == nil { + return nil + } + + return ie.Issue +} + +func (ie *IssueEvent) GetRepository() *ProjectHook { + if ie == nil { + return nil + } + + return ie.Repository +} + +func (ie *IssueEvent) GetProject() *ProjectHook { + if ie == nil { + return nil + } + + return ie.Project +} + +func (ie *IssueEvent) GetSender() *UserHook { + if ie == nil { + return nil + } + + return ie.Sender +} + +func (ie *IssueEvent) GetTargetUser() *UserHook { + if ie == nil { + return nil + } + + return ie.TargetUser +} + +func (ie *IssueEvent) GetUser() *UserHook { + if ie == nil { + return nil + } + + return ie.User +} + +func (ie *IssueEvent) GetAssignee() *UserHook { + if ie == nil { + return nil + } + + return ie.Assignee +} + +func (ie *IssueEvent) GetUpdatedBy() *UserHook { + if ie == nil { + return nil + } + + return ie.UpdatedBy +} + +func (ie *IssueEvent) GetTitle() string { + if ie == nil || ie.Title == nil { + return "" + } + + return *ie.Title +} + +func (ie *IssueEvent) GetDescription() string { + if ie == nil || ie.Description == nil { + return "" + } + + return *ie.Description +} + +func (ie *IssueEvent) GetState() string { + if ie == nil || ie.State == nil { + return "" + } + + return *ie.State +} + +func (ie *IssueEvent) GetMilestone() string { + if ie == nil || ie.Milestone == nil { + return "" + } + + return *ie.Milestone +} + +func (ie *IssueEvent) GetURL() string { + if ie == nil || ie.URL == nil { + return "" + } + + return *ie.URL +} + +func (ie *IssueEvent) GetEnterprise() *EnterpriseHook { + if ie == nil { + return nil + } + + return ie.Enterprise +} + +func (ie *IssueEvent) GetHookName() string { + if ie == nil || ie.HookName == nil { + return "" + } + + return *ie.HookName +} + +func (ie *IssueEvent) GetPassword() string { + if ie == nil || ie.Password == nil { + return "" + } + + return *ie.Password +} diff --git a/gitee/hook_issuehook_accessors.go b/gitee/hook_issuehook_accessors.go new file mode 100644 index 0000000..c11c6b4 --- /dev/null +++ b/gitee/hook_issuehook_accessors.go @@ -0,0 +1,25 @@ +package gitee + +func (ih *IssueHook) GetUser() *UserHook { + if ih == nil { + return nil + } + + return ih.User +} + +func (ih *IssueHook) GetNumber() string { + if ih == nil { + return "" + } + + return ih.Number +} + +func (ih *IssueHook) GetState() string { + if ih == nil { + return "" + } + + return ih.State +} diff --git a/gitee/hook_labelhokk_accessors.go b/gitee/hook_labelhokk_accessors.go new file mode 100644 index 0000000..e4b375e --- /dev/null +++ b/gitee/hook_labelhokk_accessors.go @@ -0,0 +1,17 @@ +package gitee + +func (l *LabelHook) GetName() string { + if l == nil { + return "" + } + + return l.Name +} + +func (l *LabelHook) GetColor() string { + if l == nil { + return "" + } + + return l.Color +} diff --git a/gitee/hook_milestonehook_accessors.go b/gitee/hook_milestonehook_accessors.go new file mode 100644 index 0000000..d9e2e25 --- /dev/null +++ b/gitee/hook_milestonehook_accessors.go @@ -0,0 +1,17 @@ +package gitee + +func (m *MilestoneHook) GetTitle() string { + if m == nil { + return "" + } + + return m.Title +} + +func (m *MilestoneHook) GetState() string { + if m == nil { + return "" + } + + return m.State +} diff --git a/gitee/hook_noteevent_accessors.go b/gitee/hook_noteevent_accessors.go new file mode 100644 index 0000000..b1b1cd3 --- /dev/null +++ b/gitee/hook_noteevent_accessors.go @@ -0,0 +1,137 @@ +package gitee + +func (ne *NoteEvent) GetAction() string { + if ne == nil || ne.Action == nil { + return "" + } + + return *ne.Action +} + +func (ne *NoteEvent) GetComment() *NoteHook { + if ne == nil { + return nil + } + + return ne.Comment +} + +func (ne *NoteEvent) GetRepository() *ProjectHook { + if ne == nil { + return nil + } + + return ne.Repository +} + +func (ne *NoteEvent) GetProject() *ProjectHook { + if ne == nil { + return nil + } + + return ne.Project +} + +func (ne *NoteEvent) GetAuthor() *UserHook { + if ne == nil { + return nil + } + + return ne.Author +} + +func (ne *NoteEvent) GetSender() *UserHook { + if ne == nil { + return nil + } + + return ne.Sender +} + +func (ne *NoteEvent) GetURL() string { + if ne == nil || ne.URL == nil { + return "" + } + + return *ne.URL +} + +func (ne *NoteEvent) GetNote() string { + if ne == nil || ne.Note == nil { + return "" + } + + return *ne.Note +} + +func (ne *NoteEvent) GetNoteableType() string { + if ne == nil || ne.NoteableType == nil { + return "" + } + + return *ne.NoteableType +} + +func (ne *NoteEvent) GetTitle() string { + if ne == nil || ne.Title == nil { + return "" + } + + return *ne.Title +} + +func (ne *NoteEvent) GetPerIID() string { + if ne == nil || ne.PerIID == nil { + return "" + } + + return *ne.PerIID +} + +func (ne *NoteEvent) GetShortCommitID() string { + if ne == nil || ne.ShortCommitID == nil { + return "" + } + + return *ne.ShortCommitID +} + +func (ne *NoteEvent) GetEnterprise() *EnterpriseHook { + if ne == nil { + return nil + } + + return ne.Enterprise +} + +func (ne *NoteEvent) GetPullRequest() *PullRequestHook { + if ne == nil { + return nil + } + + return ne.PullRequest +} + +func (ne *NoteEvent) GetIssue() *IssueHook { + if ne == nil { + return nil + } + + return ne.Issue +} + +func (ne *NoteEvent) GetHookName() string { + if ne == nil || ne.HookName == nil { + return "" + } + + return *ne.HookName +} + +func (ne *NoteEvent) GetPassword() string { + if ne == nil || ne.Password == nil { + return "" + } + + return *ne.Password +} diff --git a/gitee/hook_notehook_accessors.go b/gitee/hook_notehook_accessors.go new file mode 100644 index 0000000..39c156d --- /dev/null +++ b/gitee/hook_notehook_accessors.go @@ -0,0 +1,9 @@ +package gitee + +func (nh *NoteHook) GetBody() string { + if nh == nil { + return "" + } + + return nh.Body +} diff --git a/gitee/hook_projecthook_accessors.go b/gitee/hook_projecthook_accessors.go index 90dd83e..3195014 100644 --- a/gitee/hook_projecthook_accessors.go +++ b/gitee/hook_projecthook_accessors.go @@ -14,4 +14,20 @@ func (pj *ProjectHook) GetPath() string { } return pj.Path +} + +func (pj *ProjectHook) GetOwner() *UserHook { + if pj == nil { + return nil + } + + return pj.Owner +} + +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 0db9452..7d1ddfe 100644 --- a/gitee/hook_pullrequestevent_accessors.go +++ b/gitee/hook_pullrequestevent_accessors.go @@ -154,9 +154,3 @@ func (p *PullRequestEvent) GetPassword() string{ } return *p.Password } - -func (p *PullRequestEvent) GetOwnerAndRepo() (string, string) { - r := p.GetRepository() - - return r.GetNameSpace(), r.GetPath() -} diff --git a/gitee/hook_pullrequesthook_accessors.go b/gitee/hook_pullrequesthook_accessors.go index 73d543a..62dd5cf 100644 --- a/gitee/hook_pullrequesthook_accessors.go +++ b/gitee/hook_pullrequesthook_accessors.go @@ -39,6 +39,7 @@ func (ph *PullRequestHook) GetBase() *BranchHook { return ph.Base } + func (ph *PullRequestHook) GetUpdatedBy() *UserHook { if ph == nil { return nil diff --git a/gitee/hook_pushevent_accessors.go b/gitee/hook_pushevent_accessors.go new file mode 100644 index 0000000..3b28c67 --- /dev/null +++ b/gitee/hook_pushevent_accessors.go @@ -0,0 +1,137 @@ +package gitee + +func (pe *PushEvent) GetAction() string { + if pe == nil || pe.Ref == nil { + return "" + } + + return *pe.Ref +} + +func (pe *PushEvent) GetBefore() string { + if pe == nil || pe.Before == nil { + return "" + } + + return *pe.Before +} + +func (pe *PushEvent) GetAfter() string { + if pe == nil || pe.After == nil { + return "" + } + + return *pe.After +} + +func (pe *PushEvent) GetCommitsMoreThanTen() bool { + if pe == nil || pe.CommitsMoreThanTen == nil { + return false + } + + return *pe.CommitsMoreThanTen +} + +func (pe *PushEvent) GetCreated() bool { + if pe == nil || pe.Created == nil { + return false + } + + return *pe.Created +} + +func (pe *PushEvent) GetDeleted() bool { + if pe == nil || pe.Deleted == nil { + return false + } + + return *pe.Deleted +} + +func (pe *PushEvent) GetCompare() string { + if pe == nil || pe.Compare == nil { + return "" + } + + return *pe.Compare +} + +func (pe *PushEvent) GetHeadCommit() *CommitHook { + if pe == nil { + return nil + } + + return pe.HeadCommit +} + +func (pe *PushEvent) GetRepository() *ProjectHook { + if pe == nil { + return nil + } + + return pe.Repository +} + +func (pe *PushEvent) GetProject() *ProjectHook { + if pe == nil { + return nil + } + + return pe.Project +} + +func (pe *PushEvent) GetUserName() string { + if pe == nil || pe.UserName == nil { + return "" + } + + return *pe.UserName +} + +func (pe *PushEvent) GetUser() *UserHook { + if pe == nil { + return nil + } + + return pe.User +} + +func (pe *PushEvent) GetPusher() *UserHook { + if pe == nil { + return nil + } + + return pe.Pusher +} + +func (pe *PushEvent) GetSender() *UserHook { + if pe == nil { + return nil + } + + return pe.Sender +} + +func (pe *PushEvent) GetEnterprise() *EnterpriseHook { + if pe == nil { + return nil + } + + return pe.Enterprise +} + +func (pe *PushEvent) GetHookName() string { + if pe == nil || pe.HookName == nil { + return "" + } + + return *pe.HookName +} + +func (pe *PushEvent) GetPassword() string { + if pe == nil || pe.Password == nil { + return "" + } + + return *pe.Password +} diff --git a/gitee/hook_userhook_accessors.go b/gitee/hook_userhook_accessors.go new file mode 100644 index 0000000..48a8378 --- /dev/null +++ b/gitee/hook_userhook_accessors.go @@ -0,0 +1,9 @@ +package gitee + +func (u *UserHook) GetLogin() string { + if u == nil { + return "" + } + + return u.Login +} \ No newline at end of file -- Gitee