Package net.ygbstudio.jbrave.core.model
Enum Class BraveHeaders
- All Implemented Interfaces:
Serializable,Comparable<BraveHeaders>,Constable,SearchHeader
Enumeration of possible Brave Search API headers.
Used as a shorthand for setting custom headers in the API requests.
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionextract(@NotNull HttpHeaders headers) Extracts a list of header values of the specified header from the HTTP headers.<R> Optional<R> extract(@NotNull HttpHeaders headers, Function<String, R> transformer) Extracts the first value of the specified header from the HTTP headers and transforms it using the provided function.value()Returns the value of the header.static BraveHeadersReturns the enum constant of this class with the specified name.static BraveHeaders[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
SUBSCRIPTION_TOKEN
-
LATITUDE
-
LONGITUDE
-
TIMEZONE
-
CITY
-
STATE
-
STATE_NAME
-
COUNTRY
-
POSTAL_CODE
-
USER_AGENT
-
CACHE_CONTROL
-
API_VERSION
-
X_RATE_LIMIT
-
X_RATE_LIMIT_POLICY
-
X_RATE_LIMIT_REMAINING
-
X_RATE_LIMIT_RESET
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
extract
Extracts a list of header values of the specified header from the HTTP headers.- Parameters:
headers- the HTTP headers to extract values from- Returns:
- a list of header values of the specified header
-
extract
public <R> Optional<R> extract(@NotNull @NotNull HttpHeaders headers, Function<String, R> transformer) Extracts the first value of the specified header from the HTTP headers and transforms it using the provided function.- Type Parameters:
R- optional type of the return value- Parameters:
headers- the HTTP headers to extract values fromtransformer- the function used to transform the available header- Returns:
- the transformed first value of the specified header if present, otherwise an empty optional
-
value
Description copied from interface:SearchHeaderReturns the value of the header.- Specified by:
valuein interfaceSearchHeader- Returns:
- the value of the header
-