Class GitHubSecurityAdvisoryClientBuilder

java.lang.Object
io.github.jeremylong.openvulnerability.client.ghsa.GitHubSecurityAdvisoryClientBuilder

public final class GitHubSecurityAdvisoryClientBuilder extends Object
Used to build an GitHub SecurityAdvisory GraphQL API client. As the GitHubSecurityAdvisoryClient client is autocloseable the builder should be used in a try with resources:
 try (GitHubSecurityAdvisoryClient api = GitHubSecurityAdvisoryClientBuilder.aGitHubSecurityAdvisoryClient()
         .withApiKey(githubToken).build()) {
     while (api.hasNext()) {
         Collection<SecurityAdvisory> items = api.next();
     }
 }
 
  • Field Details

    • LOG

      private static final org.slf4j.Logger LOG
      Reference to the logger.
    • apiKey

      private String apiKey
      The GitHub SecurityAdvisory GraphQL API key.
    • endpoint

      private String endpoint
      The endpoint for the GitHub GraphQL API.
    • classifications

      private String classifications
      The classification of the advisory ("GENERAL", "MALWARE")
    • updatedSince

      private ZonedDateTime updatedSince
      The updatedSince filter.
    • publishedSince

      private ZonedDateTime publishedSince
      The publishedSince filter.
    • httpClientSupplier

      private HttpAsyncClientSupplier httpClientSupplier
    • userAgent

      private String userAgent
      The user agent to append to the default open-vulnerability-client's user-agent string
  • Constructor Details

    • GitHubSecurityAdvisoryClientBuilder

      private GitHubSecurityAdvisoryClientBuilder()
      Private constructor for a builder.
  • Method Details

    • aGitHubSecurityAdvisoryClient

      public static GitHubSecurityAdvisoryClientBuilder aGitHubSecurityAdvisoryClient()
      Begin building the GitHub GraphQL for SecurityAdvisories Object.
      Returns:
      the builder
    • withApiKey

      public GitHubSecurityAdvisoryClientBuilder withApiKey(String apiKey)
      Use an GitHub SecurityAdvisory GraphQL API key.
      Parameters:
      apiKey - the GitHub API key.
      Returns:
      the builder
    • withAdditionalUserAgent

      public GitHubSecurityAdvisoryClientBuilder withAdditionalUserAgent(String userAgent)
      Use an additional identifier as part of the User-Agent when making requests.
      Parameters:
      userAgent - the user agent string to append
      Returns:
      the builder
    • withEndpoint

      public GitHubSecurityAdvisoryClientBuilder withEndpoint(String endpoint)
      Use an alternative endpoint for the GitHub SecurityAdvisory GraphQL API.
      Parameters:
      endpoint - the endpoint for the GitHub SecurityAdvisory GraphQL API
      Returns:
      the builder
    • withClassifications

      public GitHubSecurityAdvisoryClientBuilder withClassifications(String classifications)
      The classification of the advisory ("GENERAL", "MALWARE")
      Parameters:
      classifications - the classification of the advisory
      Returns:
      the builder
    • withUpdatedSinceFilter

      public GitHubSecurityAdvisoryClientBuilder withUpdatedSinceFilter(ZonedDateTime utcUpdatedSince)
      Filter for Security Advisories that have been updated since a specific date/time.
      Parameters:
      utcUpdatedSince - the UTC date time
      Returns:
      the builder
    • withPublishedSinceFilter

      public GitHubSecurityAdvisoryClientBuilder withPublishedSinceFilter(ZonedDateTime utcStartDate)
      Filter the results with a range of published since date/time.
      Parameters:
      utcStartDate - the UTC date time for the range start
      Returns:
      the builder
    • withHttpClientSupplier

      public GitHubSecurityAdvisoryClientBuilder withHttpClientSupplier(HttpAsyncClientSupplier httpClientSupplier)
      Provide a supplier for custom HTTP clients.
      Parameters:
      httpClientSupplier - supplier for custom HTTP clients; if null a default client will be used
      Returns:
      the builder
    • build

      Build the GitHub SecurityAdvisory GraphQL API client.
      Returns:
      the GitHub SecurityAdvisory GraphQL API client