gitee.com/openeuler/go-gitee@v0.0.0-20220530104019-3af895bc380c/gitee/hook_event_models.go (about)

     1  package gitee
     2  
     3  import "time"
     4  
     5  // See https://gitee.com/help/articles/4271 for the details of all
     6  // the webhook modles.
     7  
     8  // LabelHook : 标签, issue 和 pull request 的对应标签
     9  type LabelHook struct {
    10  	Id    int32  `json:"id,omitempty"`
    11  	Name  string `json:"name,omitempty"`
    12  	Color string `json:"color,omitempty"`
    13  }
    14  
    15  // EnterpriseHook : 企业信息
    16  type EnterpriseHook struct {
    17  	Name string `json:"name,omitempty"`
    18  	Url  string `json:"url,omitempty"`
    19  }
    20  
    21  // NoteHook : 评论信息
    22  type NoteHook struct {
    23  	Id        int32     `json:"id,omitempty"`
    24  	Body      string    `json:"body,omitempty"`
    25  	User      *UserHook `json:"user,omitempty"`
    26  	CreatedAt string    `json:"created_at,omitempty"`
    27  	UpdatedAt string    `json:"updated_at,omitempty"`
    28  	HtmlUrl   string    `json:"html_url,omitempty"`
    29  	Position  string    `json:"position,omitempty"`
    30  	CommitId  string    `json:"commit_id,omitempty"`
    31  }
    32  
    33  // UserHook : 用户信息
    34  type UserHook struct {
    35  	Id        int32     `json:"id,omitempty"`
    36  	Name      string    `json:"name,omitempty"`
    37  	Email     string    `json:"email,omitempty"`
    38  	Username  string    `json:"username,omitempty"`
    39  	UserName  string    `json:"user_name,omitempty"`
    40  	Url       string    `json:"url,omitempty"`
    41  	Login     string    `json:"login,omitempty"`
    42  	AvatarUrl string    `json:"avatar_url,omitempty"`
    43  	HtmlUrl   string    `json:"html_url,omitempty"`
    44  	Type_     string    `json:"type,omitempty"`
    45  	SiteAdmin bool      `json:"site_admin,omitempty"`
    46  	Time      time.Time `json:"time,omitempty"`
    47  	Remark    string    `json:"remark,omitempty"`
    48  }
    49  
    50  // CommitHook : git commit 中的信息
    51  type CommitHook struct {
    52  	Id        string    `json:"id,omitempty"`
    53  	TreeId    string    `json:"tree_id,omitempty"`
    54  	ParentIds []string  `json:"parent_ids,omitempty"`
    55  	Message   string    `json:"message,omitempty"`
    56  	Timestamp time.Time `json:"timestamp,omitempty"`
    57  	Url       string    `json:"url,omitempty"`
    58  	Author    *UserHook `json:"author,omitempty"`
    59  	Committer *UserHook `json:"committer,omitempty"`
    60  	Distinct  bool      `json:"distinct,omitempty"`
    61  	Added     []string  `json:"added,omitempty"`
    62  	Removed   []string  `json:"removed,omitempty"`
    63  	Modified  []string  `json:"modified,omitempty"`
    64  }
    65  
    66  // MilestoneHook : 里程碑信息
    67  type MilestoneHook struct {
    68  	Id           int32    `json:"id,omitempty"`
    69  	HtmlUrl      string    `json:"html_url,omitempty"`
    70  	Number       int32     `json:"number,omitempty"`
    71  	Title        string    `json:"title,omitempty"`
    72  	Description  string    `json:"description,omitempty"`
    73  	OpenIssues   int32     `json:"open_issues,omitempty"`
    74  	ClosedIssues int32     `json:"closed_issues,omitempty"`
    75  	State        string    `json:"state,omitempty"`
    76  	CreatedAt    time.Time `json:"created_at,omitempty"`
    77  	UpdatedAt    time.Time `json:"updated_at,omitempty"`
    78  	DueOn        string    `json:"due_on,omitempty"`
    79  }
    80  
    81  // IssueHook : issue 信息
    82  type IssueHook struct {
    83  	Id            int32          `json:"id,omitempty"`
    84  	HtmlUrl       string         `json:"html_url,omitempty"`
    85  	Number        string         `json:"number,omitempty"`
    86  	Title         string         `json:"title,omitempty"`
    87  	User          *UserHook      `json:"user,omitempty"`
    88  	Labels        []LabelHook    `json:"labels,omitempty"`
    89  	State         string         `json:"state,omitempty"`
    90  	StateName     string         `json:"state_name,omitempty"`
    91  	TypeName      string         `json:"type_name,omitempty"`
    92  	Assignee      *UserHook      `json:"assignee,omitempty"`
    93  	Collaborators []UserHook     `json:"collaborators,omitempty"`
    94  	Milestone     *MilestoneHook `json:"milestone,omitempty"`
    95  	Comments      int32          `json:"comments,omitempty"`
    96  	CreatedAt     time.Time      `json:"created_at,omitempty"`
    97  	UpdatedAt     time.Time      `json:"updated_at,omitempty"`
    98  	Body          string         `json:"body,omitempty"`
    99  }
   100  
   101  // ProjectHook : project 信息
   102  type ProjectHook struct {
   103  	Id              int32     `json:"id,omitempty"`
   104  	Name            string    `json:"name,omitempty"`
   105  	Path            string    `json:"path,omitempty"`
   106  	FullName        string    `json:"full_name,omitempty"`
   107  	Owner           *UserHook `json:"owner,omitempty"`
   108  	Private         bool      `json:"private,omitempty"`
   109  	HtmlUrl         string    `json:"html_url,omitempty"`
   110  	Url             string    `json:"url,omitempty"`
   111  	Description     string    `json:"description,omitempty"`
   112  	Fork            bool      `json:"fork,omitempty"`
   113  	PushedAt        string    `json:"pushed_at,omitempty"`
   114  	CreatedAt       string    `json:"created_at,omitempty"`
   115  	UpdatedAt       string    `json:"updated_at,omitempty"`
   116  	SshUrl          string    `json:"ssh_url,omitempty"`
   117  	GitUrl          string    `json:"git_url,omitempty"`
   118  	CloneUrl        string    `json:"clone_url,omitempty"`
   119  	SvnUrl          string    `json:"svn_url,omitempty"`
   120  	GitHttpUrl      string    `json:"git_http_url,omitempty"`
   121  	GitSshUrl       string    `json:"git_ssh_url,omitempty"`
   122  	GitSvnUrl       string    `json:"git_svn_url,omitempty"`
   123  	Homepage        string    `json:"homepage,omitempty"`
   124  	StargazersCount int32     `json:"stargazers_count,omitempty"`
   125  	WatchersCount   int32     `json:"watchers_count,omitempty"`
   126  	ForksCount      int32     `json:"forks_count,omitempty"`
   127  	Language        string    `json:"language,omitempty"`
   128  
   129  	HasIssues bool   `json:"has_issues,omitempty"`
   130  	HasWiki   bool   `json:"has_wiki,omitempty"`
   131  	HasPage   bool   `json:"has_pages,omitempty"`
   132  	License   string `json:"license,omitempty"`
   133  
   134  	OpenIssuesCount int32  `json:"open_issues_count,omitempty"`
   135  	DefaultBranch   string `json:"default_branch,omitempty"`
   136  	Namespace       string `json:"namespace,omitempty"`
   137  
   138  	NameWithNamespace string `json:"name_with_namespace,omitempty"`
   139  	PathWithNamespace string `json:"path_with_namespace,omitempty"`
   140  }
   141  
   142  // BranchHook : 分支信息
   143  type BranchHook struct {
   144  	Label string       `json:"label,omitempty"`
   145  	Ref   string       `json:"ref,omitempty"`
   146  	Sha   string       `json:"sha,omitempty"`
   147  	User  *UserHook    `json:"user,omitempty"`
   148  	Repo  *ProjectHook `json:"repo,omitempty"`
   149  }
   150  
   151  // PullRequestHook : PR 信息
   152  type PullRequestHook struct {
   153  	Id                 int32          `json:"id,omitempty"`
   154  	Number             int32          `json:"number,omitempty"`
   155  	State              string         `json:"state,omitempty"`
   156  	HtmlUrl            string         `json:"html_url,omitempty"`
   157  	DiffUrl            string         `json:"diff_url,omitempty"`
   158  	PatchUrl           string         `json:"patch_url,omitempty"`
   159  	Title              string         `json:"title,omitempty"`
   160  	Body               string         `json:"body,omitempty"`
   161  	StaleLabels        []LabelHook    `json:"stale_labels,omitempty"`
   162  	Labels             []LabelHook    `json:"labels,omitempty"`
   163  	CreatedAt          string         `json:"created_at,omitempty"`
   164  	UpdatedAt          string         `json:"updated_at,omitempty"`
   165  	ClosedAt           string         `json:"closed_at,omitempty"`
   166  	MergedAt           string         `json:"merged_at,omitempty"`
   167  	MergeCommitSha     string         `json:"merge_commit_sha,omitempty"`
   168  	MergeReferenceName string         `json:"merge_reference_name,omitempty"`
   169  	User               *UserHook      `json:"user,omitempty"`
   170  	Assignee           *UserHook      `json:"assignee,omitempty"`
   171  	Assignees          []UserHook     `json:"assignees,omitempty"`
   172  	Tester             []UserHook     `json:"tester,omitempty"`
   173  	Testers            []UserHook     `json:"testers,omitempty"`
   174  	NeedTest           bool           `json:"need_test,omitempty"`
   175  	NeedReview         bool           `json:"need_review,omitempty"`
   176  	Milestone          *MilestoneHook `json:"milestone,omitempty"`
   177  	Head               *BranchHook    `json:"head,omitempty"`
   178  	Base               *BranchHook    `json:"base,omitempty"`
   179  	Merged             bool           `json:"merged,omitempty"`
   180  	Mergeable          bool           `json:"mergeable,omitempty"`
   181  	MergeStatus        string         `json:"merge_status,omitempty"`
   182  	UpdatedBy          *UserHook      `json:"updated_by,omitempty"`
   183  	Comments           int32          `json:"comments,omitempty"`
   184  	Commits            int32          `json:"commits,omitempty"`
   185  	Additions          int32          `json:"additions,omitempty"`
   186  	Deletions          int32          `json:"deletions,omitempty"`
   187  	ChangedFiles       int32          `json:"changed_files,omitempty"`
   188  }