Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
wanghaosq committed Dec 1, 2021
1 parent e0d9fc0 commit 696bacb
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 10 deletions.
4 changes: 4 additions & 0 deletions api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14483,6 +14483,10 @@ definitions:
$ref: "#/definitions/UserBasic"
milestone:
$ref: "#/definitions/Milestone"
stale_labels:
type: "array"
items:
$ref: "#/definitions/StaleLabels"
labels:
type: "array"
items:
Expand Down
1 change: 1 addition & 0 deletions gitee/hook_event_models.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ type PullRequestHook struct {
PatchUrl string `json:"patch_url,omitempty"`
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
StaleLabels []LabelHook `json:"stale_labels,omitempty"`
Labels []LabelHook `json:"labels,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
UpdatedAt string `json:"updated_at,omitempty"`
Expand Down
17 changes: 17 additions & 0 deletions gitee/hook_projecthook_accessors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package gitee

func (pj *ProjectHook) GetNameSpace() string {
if pj == nil {
return ""
}

return pj.Namespace
}

func (pj *ProjectHook) GetPath() string {
if pj == nil {
return ""
}

return pj.Path
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,28 @@ func (p *PullRequestEvent) GetActionDesc() string{
}

func (p *PullRequestEvent) GetPullRequest() *PullRequestHook {
if p == nil || p.PullRequest == nil {
if p == nil {
return nil
}
return p.PullRequest
}

func (p *PullRequestEvent) GetAuthor() *UserHook {
if p == nil || p.Author == nil {
if p == nil {
return nil
}
return p.Author
}

func (p *PullRequestEvent) GetProject() *ProjectHook {
if p == nil || p.Project == nil {
if p == nil {
return nil
}
return p.Project
}

func (p *PullRequestEvent) GetRepository() *ProjectHook {
if p == nil || p.Repository == nil {
if p == nil {
return nil
}
return p.Repository
Expand Down Expand Up @@ -100,42 +100,42 @@ func (p *PullRequestEvent) GetTargetBranch() string{
}

func (p *PullRequestEvent) GetSourceRepo() *RepoInfo {
if p == nil || p.SourceRepo == nil {
if p == nil {
return nil
}
return p.SourceRepo
}

func (p *PullRequestEvent) GetTargetRepo() *RepoInfo {
if p == nil || p.TargetRepo == nil {
if p == nil {
return nil
}
return p.TargetRepo
}

func (p *PullRequestEvent) GetUpdatedBy() *UserHook {
if p == nil || p.UpdatedBy == nil {
if p == nil {
return nil
}
return p.UpdatedBy
}

func (p *PullRequestEvent) GetSender() *UserHook {
if p == nil || p.Sender == nil {
if p == nil {
return nil
}
return p.Sender
}

func (p *PullRequestEvent) GetTargetUser() *UserHook {
if p == nil || p.TargetUser == nil {
if p == nil {
return nil
}
return p.TargetUser
}

func (p *PullRequestEvent) GetEnterprise() *EnterpriseHook {
if p == nil || p.Enterprise == nil {
if p == nil {
return nil
}
return p.Enterprise
Expand All @@ -154,3 +154,9 @@ func (p *PullRequestEvent) GetPassword() string{
}
return *p.Password
}

func (p *PullRequestEvent) GetOwnerAndRepo() (string, string) {
r := p.GetRepository()

return r.GetNameSpace(), r.GetPath()
}
48 changes: 48 additions & 0 deletions gitee/hook_pullrequesthook_accessors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package gitee

func (ph *PullRequestHook) GetUser() *UserHook {
if ph == nil {
return nil
}

return ph.User
}

func (ph *PullRequestHook) GetAssignee() *UserHook {
if ph == nil {
return nil
}

return ph.Assignee
}

func (ph *PullRequestHook) GetMilestone() *MilestoneHook {
if ph == nil {
return nil
}

return ph.Milestone
}

func (ph *PullRequestHook) GetHead() *BranchHook {
if ph == nil {
return nil
}

return ph.Head
}

func (ph *PullRequestHook) GetBase() *BranchHook {
if ph == nil {
return nil
}

return ph.Base
}
func (ph *PullRequestHook) GetUpdatedBy() *UserHook {
if ph == nil {
return nil
}

return ph.UpdatedBy
}

0 comments on commit 696bacb

Please sign in to comment.