Class GHEventsSubscriber

    • Constructor Detail

      • GHEventsSubscriber

        public GHEventsSubscriber()
    • Method Detail

      • isApplicable

        @Deprecated
        protected boolean isApplicable​(@Nullable
                                       Job<?,​?> project)
        Deprecated.
        override isApplicable(Item) instead.
        Should return true only if this subscriber interested in events() set for this project Don't call it directly, use isApplicableFor(hudson.model.Job<?, ?>) static function
        Parameters:
        project - to check
        Returns:
        true to provide events to register and subscribe for this project
      • isApplicable

        protected abstract boolean isApplicable​(@Nullable
                                                Item item)
        Should return true only if this subscriber interested in events() set for this project Don't call it directly, use isApplicableFor(hudson.model.Job<?, ?>) static function
        Parameters:
        item - to check
        Returns:
        true to provide events to register and subscribe for this item
        Since:
        1.25.0
      • events

        protected abstract Set<org.kohsuke.github.GHEvent> events()
        Should be not null. Should return only events which this extension can parse in onEvent(GHEvent, String) Don't call it directly, use extractEvents() or isInterestedIn(GHEvent) static functions
        Returns:
        immutable set of events this subscriber wants to register and then subscribe to.
      • onEvent

        @Deprecated
        protected void onEvent​(org.kohsuke.github.GHEvent event,
                               String payload)
        Deprecated.
        override onEvent(GHSubscriberEvent) instead.
        This method called when root action receives webhook from GH and this extension is interested in such events (provided by events() method). By default do nothing and can be overridden to implement any parse logic Don't call it directly, use processEvent(GHSubscriberEvent) static function
        Parameters:
        event - gh-event (as of PUSH, ISSUE...). One of returned by events() method. Never null.
        payload - payload of gh-event. Never blank. Can be parsed with help of GitHub#parseEventPayload
      • onEvent

        protected void onEvent​(GHSubscriberEvent event)
        This method called when root action receives webhook from GH and this extension is interested in such events (provided by events() method). By default do nothing and can be overridden to implement any parse logic Don't call it directly, use processEvent(GHSubscriberEvent) static function
        Parameters:
        event - the event.
        Since:
        1.26.0
      • extractEvents

        public static com.google.common.base.Function<GHEventsSubscriber,​Set<org.kohsuke.github.GHEvent>> extractEvents()
        Converts each subscriber to set of GHEvents
        Returns:
        converter to use in iterable manipulations
      • isApplicableFor

        public static com.google.common.base.Predicate<GHEventsSubscriber> isApplicableFor​(Item item)
        Helps to filter only GHEventsSubscribers that can return TRUE on given item
        Parameters:
        item - to check every GHEventsSubscriber for being applicable
        Returns:
        predicate to use in iterable filtering
        Since:
        1.25.0
        See Also:
        isApplicable(hudson.model.Job<?, ?>)
      • isInterestedIn

        public static com.google.common.base.Predicate<GHEventsSubscriber> isInterestedIn​(org.kohsuke.github.GHEvent event)
        Predicate which returns true on apply if current subscriber is interested in event
        Parameters:
        event - should be one of events() set to return true on apply
        Returns:
        predicate to match against GHEventsSubscriber