Class GitHubSecurityAdvisoryClient

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Cleanup allocated resources.
      int getLastStatusCode()
      Returns the last HTTP Status Code received.
      java.time.ZonedDateTime getLastUpdated()
      Returns the latest updated date.
      int getTotalAvailable()
      The number of available entries; only available after the first call to `next()`.
      boolean hasNext()
      Returns true if there are more records available; otherwise false.
      java.util.Collection<SecurityAdvisory> next()
      Returns the next list of security advisories.
      void setClassifications​(java.lang.String classifications)
      The classification of the advisory ("GENERAL", "MALWARE")
      void setPublishedSinceFilter​(java.time.ZonedDateTime utcPublishedSinceFilter)
      Filter the Security Advisories by those published since the give date time.
      void setUpdatedSinceFilter​(java.time.ZonedDateTime utcUpdatedSinceFilter)
      Filter the Security Advisories by those updated since the give date time.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining, remove
    • Field Detail

      • GITHUB_GRAPHQL_ENDPOINT

        public static final java.lang.String GITHUB_GRAPHQL_ENDPOINT
        See Also:
        Constant Field Values
    • Constructor Detail

      • GitHubSecurityAdvisoryClient

        public GitHubSecurityAdvisoryClient​(java.lang.String githubToken)
        Constructs a new client.
        Parameters:
        githubToken - the GitHub API Token.
      • GitHubSecurityAdvisoryClient

        public GitHubSecurityAdvisoryClient​(java.lang.String githubToken,
                                            java.lang.String endpoint)
        Constructs a new client.
        Parameters:
        endpoint - the GraphQL endpoint of GitHub or GHE.
        githubToken - the GitHub API Token.
      • GitHubSecurityAdvisoryClient

        public GitHubSecurityAdvisoryClient​(java.lang.String githubToken,
                                            java.lang.String endpoint,
                                            HttpAsyncClientSupplier httpClientSupplier)
        Constructs a new client.
        Parameters:
        githubToken - the GitHub API Token.
        endpoint - the GraphQL endpoint of GitHub or GHE.
        httpClientSupplier - supplier for custom HTTP clients; if null a default client will be used
      • GitHubSecurityAdvisoryClient

        public GitHubSecurityAdvisoryClient​(java.lang.String githubToken,
                                            java.lang.String endpoint,
                                            HttpAsyncClientSupplier httpClientSupplier,
                                            java.lang.String userAgent)
        Constructs a new client.
        Parameters:
        githubToken - the GitHub API Token.
        endpoint - the GraphQL endpoint of GitHub or GHE.
        httpClientSupplier - supplier for custom HTTP clients; if null a default client will be used
        userAgent - the user agent to append to the default open-vulnerability-client's user-agent string
    • Method Detail

      • setClassifications

        public void setClassifications​(java.lang.String classifications)
        The classification of the advisory ("GENERAL", "MALWARE")
        Parameters:
        classifications - the classification of the advisory.
      • setUpdatedSinceFilter

        public void setUpdatedSinceFilter​(java.time.ZonedDateTime utcUpdatedSinceFilter)
        Filter the Security Advisories by those updated since the give date time.
        Parameters:
        utcUpdatedSinceFilter - the date to filter on.
      • setPublishedSinceFilter

        public void setPublishedSinceFilter​(java.time.ZonedDateTime utcPublishedSinceFilter)
        Filter the Security Advisories by those published since the give date time.
        Parameters:
        utcPublishedSinceFilter - the date to filter on.
      • close

        public void close()
                   throws java.lang.Exception
        Cleanup allocated resources.
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface PagedDataSource<SecurityAdvisory>
        Throws:
        java.lang.Exception - thrown if there is a problem.
      • getTotalAvailable

        public int getTotalAvailable()
        The number of available entries; only available after the first call to `next()`.
        Specified by:
        getTotalAvailable in interface PagedDataSource<SecurityAdvisory>
        Returns:
        the number of available entries
      • hasNext

        public boolean hasNext()
        Returns true if there are more records available; otherwise false.
        Specified by:
        hasNext in interface java.util.Iterator<java.util.Collection<SecurityAdvisory>>
        Specified by:
        hasNext in interface PagedDataSource<SecurityAdvisory>
        Returns:
        true if there are more records available; otherwise false.
      • next

        public java.util.Collection<SecurityAdvisory> next()
        Returns the next list of security advisories. Note that even if `hasNext()` returns true it is possible that `next()` will return null. This will generally only occur on the very first call.
        Specified by:
        next in interface java.util.Iterator<java.util.Collection<SecurityAdvisory>>
        Specified by:
        next in interface PagedDataSource<SecurityAdvisory>
        Returns:
        a list of security advisories.