Class ImmutablePushEvent

  • All Implemented Interfaces:
    PushEvent

    @ParametersAreNonnullByDefault
    @Generated("org.immutables.processor.ProxyProcessor")
    @Immutable
    @CheckReturnValue
    public final class ImmutablePushEvent
    extends Object
    implements PushEvent
    Immutable implementation of PushEvent.

    Use the builder to create immutable instances: ImmutablePushEvent.builder().

    • Method Detail

      • sender

        @Nullable
        public User sender()
        The User that triggered/sent the event.
        Specified by:
        sender in interface PushEvent
      • ref

        @Nullable
        public String ref()
        The full Git ref that was pushed. Example: "refs/heads/master".
        Specified by:
        ref in interface PushEvent
      • before

        @Nullable
        public String before()
        The SHA of the most recent commit on ref before the push.
        Specified by:
        before in interface PushEvent
      • after

        @Nullable
        public String after()
        SHA of the repository state after the push.
        Specified by:
        after in interface PushEvent
      • created

        @Nullable
        public Boolean created()
        True if given reference was created
        Specified by:
        created in interface PushEvent
      • deleted

        @Nullable
        public Boolean deleted()
        True if given reference was deleted
        Specified by:
        deleted in interface PushEvent
      • forced

        @Nullable
        public Boolean forced()
        True if given reference was force pushed
        Specified by:
        forced in interface PushEvent
      • compare

        @Nullable
        public String compare()
        Compare API URL This is a string because of malformed URIs sent from github. They send unencoded '^' in the uri path.
        Specified by:
        compare in interface PushEvent
      • commits

        @Nullable
        public List<PushCommit> commits()
        An array of commit objects describing the pushed commits. (The array includes a maximum of 20 commits. If necessary, you can use the Commits API to fetch additional commits. This limit is applied to timeline events only and isn't applied to webhook deliveries.)
        Specified by:
        commits in interface PushEvent
      • headCommit

        @Nullable
        public Optional<PushCommit> headCommit()
        The push commit object of the most recent commit on ref after the push.
        Specified by:
        headCommit in interface PushEvent
      • withRepository

        public final ImmutablePushEvent withRepository​(@Nullable
                                                       PushRepository value)
        Copy the current immutable object by setting a value for the repository attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for repository (can be null)
        Returns:
        A modified copy of the this object
      • withSender

        public final ImmutablePushEvent withSender​(@Nullable
                                                   User value)
        Copy the current immutable object by setting a value for the sender attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for sender (can be null)
        Returns:
        A modified copy of the this object
      • withRef

        public final ImmutablePushEvent withRef​(@Nullable
                                                String value)
        Copy the current immutable object by setting a value for the ref attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for ref (can be null)
        Returns:
        A modified copy of the this object
      • withBefore

        public final ImmutablePushEvent withBefore​(@Nullable
                                                   String value)
        Copy the current immutable object by setting a value for the before attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for before (can be null)
        Returns:
        A modified copy of the this object
      • withAfter

        public final ImmutablePushEvent withAfter​(@Nullable
                                                  String value)
        Copy the current immutable object by setting a value for the after attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for after (can be null)
        Returns:
        A modified copy of the this object
      • withCreated

        public final ImmutablePushEvent withCreated​(@Nullable
                                                    Boolean value)
        Copy the current immutable object by setting a value for the created attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for created (can be null)
        Returns:
        A modified copy of the this object
      • withDeleted

        public final ImmutablePushEvent withDeleted​(@Nullable
                                                    Boolean value)
        Copy the current immutable object by setting a value for the deleted attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for deleted (can be null)
        Returns:
        A modified copy of the this object
      • withForced

        public final ImmutablePushEvent withForced​(@Nullable
                                                   Boolean value)
        Copy the current immutable object by setting a value for the forced attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for forced (can be null)
        Returns:
        A modified copy of the this object
      • withBaseRef

        public final ImmutablePushEvent withBaseRef​(String value)
        Copy the current immutable object by setting a present value for the optional baseRef attribute.
        Parameters:
        value - The value for baseRef
        Returns:
        A modified copy of this object
      • withBaseRef

        public final ImmutablePushEvent withBaseRef​(Optional<String> optional)
        Copy the current immutable object by setting an optional value for the baseRef attribute. An equality check is used on inner nullable value to prevent copying of the same value by returning this.
        Parameters:
        optional - A value for baseRef
        Returns:
        A modified copy of this object
      • withCompare

        public final ImmutablePushEvent withCompare​(@Nullable
                                                    String value)
        Copy the current immutable object by setting a value for the compare attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for compare (can be null)
        Returns:
        A modified copy of the this object
      • withCommits

        public final ImmutablePushEvent withCommits​(@Nullable
                                                    PushCommit... elements)
        Copy the current immutable object with elements that replace the content of commits.
        Parameters:
        elements - The elements to set
        Returns:
        A modified copy of this object
      • withCommits

        public final ImmutablePushEvent withCommits​(@Nullable
                                                    Iterable<? extends PushCommit> elements)
        Copy the current immutable object with elements that replace the content of commits. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        elements - An iterable of commits elements to set
        Returns:
        A modified copy of this object
      • withHeadCommit

        public final ImmutablePushEvent withHeadCommit​(@Nullable
                                                       Optional<PushCommit> value)
        Copy the current immutable object by setting a value for the headCommit attribute. An equals check used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for headCommit (can be null)
        Returns:
        A modified copy of the this object
      • withPusher

        public final ImmutablePushEvent withPusher​(@Nullable
                                                   Author value)
        Copy the current immutable object by setting a value for the pusher attribute. A shallow reference equality check is used to prevent copying of the same value by returning this.
        Parameters:
        value - A new value for pusher (can be null)
        Returns:
        A modified copy of the this object
      • equals

        public boolean equals​(@Nullable
                              Object another)
        This instance is equal to all instances of ImmutablePushEvent that have equal attribute values.
        Overrides:
        equals in class Object
        Returns:
        true if this is equal to another instance
      • hashCode

        public int hashCode()
        Computes a hash code from attributes: repository, sender, ref, before, after, created, deleted, forced, baseRef, compare, commits, headCommit, pusher.
        Overrides:
        hashCode in class Object
        Returns:
        hashCode value
      • toString

        public String toString()
        Prints the immutable value PushEvent with attribute values.
        Overrides:
        toString in class Object
        Returns:
        A string representation of the value
      • copyOf

        public static ImmutablePushEvent copyOf​(PushEvent instance)
        Creates an immutable copy of a PushEvent value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
        Parameters:
        instance - The instance to copy
        Returns:
        A copied immutable PushEvent instance
      • builder

        public static ImmutablePushEvent.Builder builder()
        Creates a builder for ImmutablePushEvent.
         ImmutablePushEvent.builder()
            .repository(com.spotify.github.v3.repos.PushRepository | null) // nullable repository
            .sender(com.spotify.github.v3.User | null) // nullable sender
            .ref(String | null) // nullable ref
            .before(String | null) // nullable before
            .after(String | null) // nullable after
            .created(Boolean | null) // nullable created
            .deleted(Boolean | null) // nullable deleted
            .forced(Boolean | null) // nullable forced
            .baseRef(String) // optional baseRef
            .compare(String | null) // nullable compare
            .commits(List&lt;com.spotify.github.v3.repos.PushCommit&gt; | null) // nullable commits
            .headCommit(Optional&lt;com.spotify.github.v3.repos.PushCommit&gt; | null) // nullable headCommit
            .pusher(com.spotify.github.v3.git.Author | null) // nullable pusher
            .build();
         
        Returns:
        A new ImmutablePushEvent builder