public static Gist getGist(final GitHubEvent event) {
        if (event == null || event.payload() == null) {
            return null;
        }

        GitHubEventType type = event.type();
        if (GitHubEventType.GistEvent.equals(type)) {
            return ((GistPayload) event.payload()).gist();
        } else {
            return null;
        }
    }
Get gist from event

@param event
@return gist or null if event doesn't apply
app/src/main/java/com/github/pockethub/android/core/gist/GistEventMatcher.java