Skip to content

Commit fe0949f

Browse files
committed
Fixed PersonalAccessTokenPermissions to reflect the actual API
1 parent 722192c commit fe0949f

File tree

4 files changed

+41
-19
lines changed

4 files changed

+41
-19
lines changed

github/event_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -837,9 +837,9 @@ type PersonalAccessTokenRequest struct {
837837
// PersonalAccessTokenPermissions represents the original or newly requested
838838
// scope of permissions for a fine-grained personal access token within a PersonalAccessTokenRequest.
839839
type PersonalAccessTokenPermissions struct {
840-
Org *Organization `json:"organization,omitempty"`
841-
Repo *Repository `json:"repository,omitempty"`
842-
Other json.RawMessage `json:"other,omitempty"`
840+
Org map[string]string `json:"organization,omitempty"`
841+
Repo map[string]string `json:"repository,omitempty"`
842+
Other map[string]string `json:"other,omitempty"`
843843
}
844844

845845
// PingEvent is triggered when a Webhook is added to GitHub.

github/event_types_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7098,10 +7098,8 @@ func TestPersonalAccessTokenRequestEvent_Marshal(t *testing.T) {
70987098
ID: Int64(1),
70997099
Owner: &User{Login: String("l")},
71007100
PermissionsAdded: &PersonalAccessTokenPermissions{
7101-
Org: &Organization{Name: String("n")},
7102-
Repo: &Repository{
7103-
Name: String("n"),
7104-
},
7101+
Org: map[string]string{"organization_events": "read"},
7102+
Repo: map[string]string{"security_events": "write"},
71057103
},
71067104
CreatedAt: &Timestamp{referenceTime},
71077105
TokenExpired: Bool(false),
@@ -7133,10 +7131,10 @@ func TestPersonalAccessTokenRequestEvent_Marshal(t *testing.T) {
71337131
},
71347132
"permissions_added": {
71357133
"organization": {
7136-
"name": "n"
7134+
"organization_events": "read"
71377135
},
71387136
"repository": {
7139-
"name": "n"
7137+
"security_events": "write"
71407138
}
71417139
},
71427140
"created_at": ` + referenceTimeStr + `,

github/github-accessors.go

Lines changed: 16 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

github/github-accessors_test.go

Lines changed: 18 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)