Skip to content

Commit

Permalink
Update struct types to be specific to InstallationTarget
Browse files Browse the repository at this point in the history
  • Loading branch information
RickleAndMortimer committed Jul 10, 2023
1 parent b7da72e commit fbdb75a
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 87 deletions.
34 changes: 17 additions & 17 deletions github/event_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,36 +505,36 @@ type InstallationRepositoriesEvent struct {
Installation *Installation `json:"installation,omitempty"`
}

// Change in login
type Login struct {
// InstallationLoginChange represents a change in login on an installation.
type InstallationLoginChange struct {
From *string `json:"from,omitempty"`
}

// Change in slug
type Slug struct {
// InstallationSlugChange represents a change in slug on an installation.
type InstallationSlugChange struct {
From *string `json:"from,omitempty"`
}

// Changes represents a change in slug or login
type Changes struct {
Login *Login `json:"login,omitempty"`
Slug *Slug `json:"slug,omitempty"`
// InstallationChanges represents a change in slug or login on an installation.
type InstallationChanges struct {
Login *InstallationLoginChange `json:"login,omitempty"`
Slug *InstallationSlugChange `json:"slug,omitempty"`
}

// InstallationTargetEvent is triggered when there is activity on an installation from a user or organization account.
// The Webhook event name is "installation_target".
//
// GitHub API docs: https://docs.github.com/en/webhooks-and-events/webhooks/webhook-events-and-payloads#installation_target
type InstallationTargetEvent struct {
Account *User `json:"account,omitempty"`
Action *string `json:"action,omitempty"`
Changes *Changes `json:"changes,omitempty"`
Enterprise *Enterprise `json:"enterprise,omitempty"`
Installation *Installation `json:"installation,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
TargetType *string `json:"target_type,omitempty"`
Account *User `json:"account,omitempty"`
Action *string `json:"action,omitempty"`
Changes *InstallationChanges `json:"changes,omitempty"`
Enterprise *Enterprise `json:"enterprise,omitempty"`
Installation *Installation `json:"installation,omitempty"`
Organization *Organization `json:"organization,omitempty"`
Repository *Repository `json:"repository,omitempty"`
Sender *User `json:"sender,omitempty"`
TargetType *string `json:"target_type,omitempty"`
}

// IssueCommentEvent is triggered when an issue comment is created on an issue
Expand Down
6 changes: 3 additions & 3 deletions github/event_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1346,11 +1346,11 @@ func TestInstallationTargetEvent_Marshal(t *testing.T) {
AvatarURL: String("l"),
},
Action: String("a"),
Changes: &Changes{
Login: &Login{
Changes: &InstallationChanges{
Login: &InstallationLoginChange{
From: String("p"),
},
Slug: &Slug{
Slug: &InstallationSlugChange{
From: String("j"),
},
},
Expand Down
66 changes: 33 additions & 33 deletions github/github-accessors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 34 additions & 34 deletions github/github-accessors_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit fbdb75a

Please sign in to comment.