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 ConstantsEnum ConstantDescriptionApi-Versionrequest header; check the API changelog for the current value.Cache-Controlrequest header; sendno-cacheto prevent caching.Generic name of the client's city.Two-letter country code (ISO 3166-1 alpha-2).Client latitude in degrees, in the range[-90.0, +90.0].Client longitude in degrees, in the range[-180.0, +180.0].Client's postal code.First-level administrative subdivision (ISO 3166-2); up to three characters.Human-readable name of the first-level administrative subdivision.Subscription token identifying the calling client.IANA timezone of the client's device (for example"America/Costa_Rica").User-Agentrequest header.X-RateLimit-Limitresponse header reporting the plan's request limit.X-RateLimit-Policyresponse header describing the rate-limit policy.X-RateLimit-Remainingresponse header reporting the remaining request quota.X-RateLimit-Resetresponse header reporting the time until the quota resets. -
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
Subscription token identifying the calling client. -
LATITUDE
Client latitude in degrees, in the range[-90.0, +90.0]. -
LONGITUDE
Client longitude in degrees, in the range[-180.0, +180.0]. -
TIMEZONE
IANA timezone of the client's device (for example"America/Costa_Rica"). -
CITY
Generic name of the client's city. -
STATE
First-level administrative subdivision (ISO 3166-2); up to three characters. -
STATE_NAME
Human-readable name of the first-level administrative subdivision. -
COUNTRY
Two-letter country code (ISO 3166-1 alpha-2). -
POSTAL_CODE
Client's postal code. -
USER_AGENT
User-Agentrequest header. -
CACHE_CONTROL
Cache-Controlrequest header; sendno-cacheto prevent caching. -
API_VERSION
Api-Versionrequest header; check the API changelog for the current value. -
X_RATE_LIMIT
X-RateLimit-Limitresponse header reporting the plan's request limit. -
X_RATE_LIMIT_POLICY
X-RateLimit-Policyresponse header describing the rate-limit policy. -
X_RATE_LIMIT_REMAINING
X-RateLimit-Remainingresponse header reporting the remaining request quota. -
X_RATE_LIMIT_RESET
X-RateLimit-Resetresponse header reporting the time until the quota resets.
-
-
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
-