Skip to content
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

Feature/GitHub webhooks instances #8

Merged
merged 5 commits into from
Jan 24, 2018
Merged

Feature/GitHub webhooks instances #8

merged 5 commits into from
Jan 24, 2018

Conversation

TomMD
Copy link
Contributor

@TomMD TomMD commented Jan 23, 2018

As mentioned in PR #7 we might want to incorporate github-webhooks (package) and instances for HasRepository. That's this PR.

I did the cheap thing and made one instances of the HasRepository class on a polymorphic newtype wrapper and re-used github-webhooks' EventHasRepo class. The advantage here is lower maintenance - we didn't need to write and maintain N instances. The downside is the user needs to unwrap the Events (but the JSON decoding should be handled). It would be nice to just re-use EventHasRepo and not have our own class but that would assume all users stick with the github-webhooks types which seems overly-restrictive.

Thomas M. DuBuisson added 4 commits January 23, 2018 10:14
Some uses of webhooks require dynamic keys, such as adding new keys for
new users or repositories.  This change allows dynamic keys to look at
the result (ex: repository or username) before returning a key for use
in verification.  N.B. the API changes since we now have:

Another type variable on GitHubKey'.
GitHubKey now wraps a function that takes an extra argument.
Helper functions of `dynamicKey` and `repositoryKey` exist.
Helper class of `HasRepository` exists with bare-bones instances.
@tsani
Copy link
Owner

tsani commented Jan 24, 2018

This PR looks good to me. Just get it to pass travis and I'll merge it.

@TomMD
Copy link
Contributor Author

TomMD commented Jan 24, 2018

It appears I finally re-learned stack fields. Let me know if you'd like any other changes.

@tsani tsani merged commit 0d29c05 into tsani:master Jan 24, 2018
@tsani
Copy link
Owner

tsani commented Jan 24, 2018

Thanks!
I've opened an issue on github-webhooks to see when it will be uploaded to Stackage. This way we can avoid using extra-deps. I'll take care of adjusting stack.yaml when the time comes.

@TomMD TomMD deleted the feature/github-webhooks-instances branch January 25, 2018 00:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants