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

GHEventInfo getPayload #238

Closed
ghost opened this issue Dec 3, 2015 · 2 comments
Closed

GHEventInfo getPayload #238

ghost opened this issue Dec 3, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Dec 3, 2015

The problem in the getPayload method when used in Scala e.g. is when we want to pattern match against a type.

As by definition, getPayload returns a derivate of a GHEventPayload abstract class. This derivates can either be of type Push, IssueComment or PullRequest.

While in order to get the payload of an event we must provide the type of the derivate class such as Push, meaning that we cannot pattern match for the PushEvent type in order to extract the payload of the event.

For example:

override def onNext(e : GHEventInfo) = e.getType match {
      case GHEvent.PUSH => PushEvent.handle(e)
      case _ => // All cases not supported yet
}

pattern matches against a type, in our case it can be an event of type Push. Once it is matched against this type, we cannot refer to getPayload because we do not know the type of it, hence we are unable to pattern match against it.

@kohsuke
Copy link
Collaborator

kohsuke commented Dec 10, 2015

It's not clear what's being asked here. Can you clarify?

@kohsuke
Copy link
Collaborator

kohsuke commented Mar 1, 2016

No information provided by the submitter

@kohsuke kohsuke closed this as completed Mar 1, 2016
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

No branches or pull requests

1 participant