Skip to content

Commit

Permalink
Add DicussionCommentEvent Webhook (google#2678)
Browse files Browse the repository at this point in the history
Fixes: google#2497.
  • Loading branch information
apurwaj2 authored and exageraldo committed Mar 13, 2023
1 parent 178f004 commit 192f9d3
Show file tree
Hide file tree
Showing 8 changed files with 791 additions and 0 deletions.
2 changes: 2 additions & 0 deletions github/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ func (e *Event) ParsePayload() (payload interface{}, err error) {
payload = &DeploymentStatusEvent{}
case "DiscussionEvent":
payload = &DiscussionEvent{}
case "DiscussionCommentEvent":
payload = &DiscussionCommentEvent{}
case "ForkEvent":
payload = &ForkEvent{}
case "GitHubAppAuthorizationEvent":
Expand Down
33 changes: 33 additions & 0 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,39 @@ type DeploymentStatusEvent struct {
Installation *Installation `json:"installation,omitempty"`
}

// DiscussionCommentEvent represents a webhook event for a comment on discussion.
// The Webhook event name is "discussion_comment".
//
// GitHub API docs: https://docs.github.com/webhooks-and-events/webhooks/webhook-events-and-payloads#discussion_comment
type DiscussionCommentEvent struct {
// Action is the action that was performed on the comment.
// Possible values are: "created", "edited", "deleted". ** check what all can be added
Action *string `json:"action,omitempty"`
Discussion *Discussion `json:"discussion,omitempty"`
Comment *CommentDiscussion `json:"comment,omitempty"`
Repo *Repository `json:"repository,omitempty"`
Org *Organization `json:"organization,omitempty"`
Sender *User `json:"sender,omitempty"`
Installation *Installation `json:"installation,omitempty"`
}

// CommentDiscussion represents a comment in a GitHub DiscussionCommentEvent.
type CommentDiscussion struct {
AuthorAssociation *string `json:"author_association,omitempty"`
Body *string `json:"body,omitempty"`
ChildCommentCount *int `json:"child_comment_count,omitempty"`
CreatedAt *Timestamp `json:"created_at,omitempty"`
DiscussionID *int64 `json:"discussion_id,omitempty"`
HTMLURL *string `json:"html_url,omitempty"`
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
ParentID *int64 `json:"parent_id,omitempty"`
Reactions *Reactions `json:"reactions,omitempty"`
RepositoryURL *string `json:"repository_url,omitempty"`
UpdatedAt *Timestamp `json:"updated_at,omitempty"`
User *User `json:"user,omitempty"`
}

// DiscussionEvent represents a webhook event for a discussion.
// The Webhook event name is "discussion".
//
Expand Down

0 comments on commit 192f9d3

Please sign in to comment.