Class BraveWebSearchRequest
java.lang.Object
net.ygbstudio.jbrave.core.builders.AbstractBraveRequestBuilder<BraveWebSearchRequest>
net.ygbstudio.jbrave.core.builders.BraveWebSearchRequest
- All Implemented Interfaces:
BraveWebRequest,VerticalHeaderBuilder<BraveWebRequest>,WebHeaderBuilder<BraveWebRequest>
public final class BraveWebSearchRequest
extends AbstractBraveRequestBuilder<BraveWebSearchRequest>
implements BraveWebRequest
Builds a Brave web search request.
It configures the request URI and the request headers (user agent, cache control, API version,
subscription token, and the geolocation headers) and builds the underlying HttpRequest.
Clients typically configure web search requests through BraveWebQuery's
withHeaders consumer, which receives this builder as a WebHeaderBuilder typed with
BraveWebRequest.
Instances are created with builder() and can be reused after calling AbstractBraveRequestBuilder.clear().
-
Field Summary
Fields inherited from class net.ygbstudio.jbrave.core.builders.AbstractBraveRequestBuilder
headers, headersAttached, internalRequestBuilder, requestURI -
Method Summary
Modifier and TypeMethodDescriptionstatic BraveWebSearchRequestbuilder()Creates a new instance ofBraveWebSearchRequest.queryAddress(URI uri) Sets the URI for the request.withApiVersion(String apiVersion) Adds an API version header to the request.withCacheControl(String cacheControl) Adds a cache control header to the request.Adds a city header to the request.withCountry(String country) Adds a country header to the request.withLatitude(double latitude) Adds a latitude header to the request.withLongitude(double longitude) Adds a longitude header to the request.withPostalCode(String postalCode) Adds a postal code header to the request.Adds a state header to the request.withStateName(String stateName) Adds a state name header to the request.withTimezone(@NotNull ZoneId timezone) Adds a timezone header to the request.Adds a brave subscription token header to the request.withUserAgent(String userAgent) Adds a user agent header to the request.Methods inherited from class net.ygbstudio.jbrave.core.builders.AbstractBraveRequestBuilder
addHeader, attachHeaders, build, clear, clearRetainURI, queryURI, self, subscriptionMissing
-
Method Details
-
builder
Creates a new instance ofBraveWebSearchRequest.- Returns:
- a new instance of
BraveWebSearchRequest
-
queryAddress
Sets the URI for the request.- Parameters:
uri- the request URI- Returns:
- the current instance of
BraveWebSearchRequest
-
withLatitude
Adds a latitude header to the request.- Specified by:
withLatitudein interfaceWebHeaderBuilder<BraveWebRequest>- Parameters:
latitude- the latitude value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withLongitude
Adds a longitude header to the request.- Specified by:
withLongitudein interfaceWebHeaderBuilder<BraveWebRequest>- Parameters:
longitude- the longitude value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withTimezone
Adds a timezone header to the request.- Specified by:
withTimezonein interfaceWebHeaderBuilder<BraveWebRequest>- Parameters:
timezone- the timezone value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withCountry
Adds a country header to the request.- Specified by:
withCountryin interfaceWebHeaderBuilder<BraveWebRequest>- Parameters:
country- the country value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withCity
Adds a city header to the request.- Specified by:
withCityin interfaceWebHeaderBuilder<BraveWebRequest>- Parameters:
city- the city value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withState
Adds a state header to the request.- Specified by:
withStatein interfaceWebHeaderBuilder<BraveWebRequest>- Parameters:
state- the state value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withStateName
Adds a state name header to the request.- Specified by:
withStateNamein interfaceWebHeaderBuilder<BraveWebRequest>- Parameters:
stateName- the state name value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withPostalCode
Adds a postal code header to the request.- Specified by:
withPostalCodein interfaceWebHeaderBuilder<BraveWebRequest>- Parameters:
postalCode- the postal code value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withUserAgent
Adds a user agent header to the request.- Specified by:
withUserAgentin interfaceVerticalHeaderBuilder<BraveWebRequest>- Parameters:
userAgent- the user agent value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withCacheControl
Adds a cache control header to the request.- Specified by:
withCacheControlin interfaceVerticalHeaderBuilder<BraveWebRequest>- Parameters:
cacheControl- the cache control value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withApiVersion
Adds an API version header to the request.- Specified by:
withApiVersionin interfaceVerticalHeaderBuilder<BraveWebRequest>- Parameters:
apiVersion- the API version value to set- Returns:
- the current instance of
BraveWebSearchRequest
-
withToken
Adds a brave subscription token header to the request.- Parameters:
subscriptionToken- the subscription token to set- Returns:
- the current instance of
BraveWebSearchRequest
-