-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Add support for listing and getting repository/organization webhook deliveries #1934
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
54e5502
Add support for listing and getting repository webhook deliveries
mumoshu f5889f8
Add test for HookDelivery.ParseRequestPayload
mumoshu f6d688a
Restructure populatePageValues to reduce nesting
mumoshu ff5a47a
Use Timestamp instead of time.Time for delivered_at
mumoshu dffbb1c
Fix HookResponse.Header to Headers for consistency with the underlyin…
mumoshu 5f0e1e4
Use %v instead of %d for formatting int64
mumoshu 431c77c
Add more tests for ParseRequestPayload
mumoshu 23922a8
Enhance cursor pagination test for more coverage
mumoshu 72c3380
Make it clear that cursor and page are mutually exclusive
mumoshu 5b86aff
Add periods to field comments
mumoshu 194eff6
Add comments on HookRequest and HookResponse
mumoshu 1381c0f
Accept suggestions from gmlewis with thanks :)
mumoshu 0a3739c
Add support for listing and getting organization webhook deliveries
mumoshu fc8d20f
Add copyright notice to orgs_hooks_deliveries.go
mumoshu 123bafa
Add blank after if err block for consistency
mumoshu File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Accept suggestions from gmlewis with thanks :)
- Loading branch information
commit 1381c0f3a94a92fb26d5cc36e0c5b818245a2739
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a utility function to ease parsing event payloads, and it is derived from the equivalent function for Events API
go-github/github/event.go
Lines 29 to 31 in 05e95d3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't you reuse https://github.com/google/go-github/blob/master/github/event.go#L29-L132 here?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gmlewis Hey! Interesting idea. How would you like to do that? That snippet in event.go switch on
Typewhose the value can be e.g.CheckRunEvent. On the other hand, this one switches oneventfield where the value is e.g.check_run. They're very similar but different enough to worth a dedicated function.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also note that this is almost fully covered by
TestHookDelivery_ParsePayload, if that helps.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I'm thinking here is to make a helper function that both
ParsePayloadandParseRequestPayloadboth call.The helper method could take an anonymous function to perform the required mapping... one of them would use the
eventTypeMethodmap found in messages.go.Let me know if you don't think this is possible and I'll download your PR and see if I can get it to work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's my proposed replacement for this method: