Go-github: Add support for MarketplacePurchaseEvent

Created on 23 Aug 2017  路  15Comments  路  Source: google/go-github

When looking through the webhook events I noticed that we currently do not support the MarketplacePurchaseEvent in messages.go.

It would be nice to add this support and it would be a great project for a new contributor to this repo.

enhancement good first issue

Most helpful comment

Sure thing, thanks!

All 15 comments

@gmlewis Can I take up this issue ?

Sure thing, thanks!

@shurcooL I went through the code arrived at the following conclusions

Files to be modified:

  1. event_types.go

    • Add a new event type struct for MarketplacePurchaseEvent

  2. activity_events.go

    • Add a new case in ParsePayload function for MarketplacePurchaseEvent

  3. messages.go

    • Edit the eventTypeMapping map to include marketplace_purchase

Are my conclusions correct. Can I start working on PR ?

Sorry for the delay in getting back.

You have done a good job finding out what needs to be done!

I see just one thing missing, that is you should also modify messages_test.go and add a test case in TestParseWebHook.

You can/should look over these PRs that have added events in the past, they serve as good examples/references:

  • #630
  • #653
  • #544

Thanks!

@shurcooL Thank you. I will refer mentioned PR's and will sumbit a PR ASAP

@shurcooL Sorry for the delay.I'm having a hard time working with this PR.I've some doubts,please do help me to clear them.
I've been referring other related PR's.When looking through #630 to implement OrgBlockEvent the contributor added a pointer to *Installation in the OrgBlockEvent.But this is not specified in the API payload in github docs.Why is that so ? can u help me out.
Sorry @shurcooL for taking this long to resolve this issue.

No worries about delays, you're welcome to work on this on your own time.

*Installation is a special field. It's an additional part of all events. It's documented at https://developer.github.com/webhooks/#payloads:

In addition to the fields documented for each event, webhook payloads include the user who performed the event (sender) as well as the organization (organization) and/or repository (repository) which the event occurred on, and for an Integration's webhook may include the installation (installation) which an event relates to.

Read my comment here for more context.

@shurcooL when is this event fired? I tested by adding Travis CI from the marketplace and listing the events using the following endpoint https://api.github.com/users/testing-user/events But couldn't find any marketplace purchase event.Should I actually purchase a service to get this event?

when is this event fired?

From https://developer.github.com/v3/activity/events/types/#marketplacepurchaseevent:

Triggered when a user purchases, cancels, or changes their GitHub Marketplace plan.

If there's no easy way to trigger this event, it's completely acceptable to try to make the PR purely based on the GitHub documentation of the event, without testing it. We'd be able to review it based on that.

If it happens to be slightly off, the person who actually receives the event and notices an issue can report it and make any necessary minor adjustments/fixes.

@shurcooL are we not supporting the Github MarketPlace API

Sorry for the delay. It looks like we have no support for the Marketplace preview API at all yet. Since the goal of this library is to implement all GitHub endpoints, it should be added. It doesn't have to be a part of this issue though. I've created issue #720 for tracking it.

@shurcooL as #720 is closed now, I will continue working on this issue. Will send a PR ASAP.

@shurcooL I've tried creating PR's for the Issue but the buid fails. I see that the the tests are passing.What could be the problem ?

You need to look at the Travis CI output to find out what the issue is. If you look at one of the build logs, e.g., https://travis-ci.org/google/go-github/jobs/302917277, it says:

The command "go generate -x ./... && git diff --exit-code; code=$?; git checkout -- .; (exit $code)" exited with 1.

You need to regenerate the package after making your changes. Learn more about that at https://github.com/google/go-github/blob/master/CONTRIBUTING.md#submitting-a-patch. Specifically, the first command of step 5.

Thanks @shurcooL. I thought I did that already. Let me recheck once more.

Was this page helpful?
0 / 5 - 0 ratings