Class GitHubSecurityAdvisoryClientBuilder
java.lang.Object
io.github.jeremylong.openvulnerability.client.ghsa.GitHubSecurityAdvisoryClientBuilder
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 Summary
FieldsModifier and TypeFieldDescriptionprivate StringThe GitHub SecurityAdvisory GraphQL API key.private StringThe classification of the advisory ("GENERAL", "MALWARE")private StringThe endpoint for the GitHub GraphQL API.private HttpAsyncClientSupplierprivate static final org.slf4j.LoggerReference to the logger.private ZonedDateTimeThe publishedSince filter.private ZonedDateTimeThe updatedSince filter.private StringThe user agent to append to the default open-vulnerability-client's user-agent string -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivatePrivate constructor for a builder. -
Method Summary
Modifier and TypeMethodDescriptionBegin building the GitHub GraphQL for SecurityAdvisories Object.build()Build the GitHub SecurityAdvisory GraphQL API client.withAdditionalUserAgent(String userAgent) Use an additional identifier as part of the User-Agent when making requests.withApiKey(String apiKey) Use an GitHub SecurityAdvisory GraphQL API key.withClassifications(String classifications) The classification of the advisory ("GENERAL", "MALWARE")withEndpoint(String endpoint) Use an alternative endpoint for the GitHub SecurityAdvisory GraphQL API.withHttpClientSupplier(HttpAsyncClientSupplier httpClientSupplier) Provide a supplier for custom HTTP clients.withPublishedSinceFilter(ZonedDateTime utcStartDate) Filter the results with a range of published since date/time.withUpdatedSinceFilter(ZonedDateTime utcUpdatedSince) Filter for Security Advisories that have been updated since a specific date/time.
-
Field Details
-
LOG
private static final org.slf4j.Logger LOGReference to the logger. -
apiKey
The GitHub SecurityAdvisory GraphQL API key. -
endpoint
The endpoint for the GitHub GraphQL API. -
classifications
The classification of the advisory ("GENERAL", "MALWARE") -
updatedSince
The updatedSince filter. -
publishedSince
The publishedSince filter. -
httpClientSupplier
-
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
Begin building the GitHub GraphQL for SecurityAdvisories Object.- Returns:
- the builder
-
withApiKey
Use an GitHub SecurityAdvisory GraphQL API key.- Parameters:
apiKey- the GitHub API key.- Returns:
- the builder
-
withAdditionalUserAgent
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
Use an alternative endpoint for the GitHub SecurityAdvisory GraphQL API.- Parameters:
endpoint- the endpoint for the GitHub SecurityAdvisory GraphQL API- Returns:
- the builder
-
withClassifications
The classification of the advisory ("GENERAL", "MALWARE")- Parameters:
classifications- the classification of the advisory- Returns:
- the builder
-
withUpdatedSinceFilter
Filter for Security Advisories that have been updated since a specific date/time.- Parameters:
utcUpdatedSince- the UTC date time- Returns:
- the builder
-
withPublishedSinceFilter
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; ifnulla default client will be used- Returns:
- the builder
-
build
Build the GitHub SecurityAdvisory GraphQL API client.- Returns:
- the GitHub SecurityAdvisory GraphQL API client
-