Record Class WebSearchApiResponse
java.lang.Object
java.lang.Record
net.ygbstudio.jbrave.api.response.WebSearchApiResponse
- Record Components:
type- The type of the response.discussions- Forum and discussion results related to the search query.faq- Frequently asked questions and their answers.infobox- Structured information box with key details.locations- Location-based results and points of interest.mixed- Mixed collection of different result types.news- News article results.query- Information about the search query.videos- Video search results.web- Standard web search results.summarizer- AI-generated summary of search results.rich- Additional rich callback information.
- All Implemented Interfaces:
ApiResponse
public record WebSearchApiResponse(String type, Discussions discussions, FAQ faq, GraphInfobox infobox, Locations locations, MixedResponse mixed, News news, WebQuery query, Videos videos, Search web, Summarizer summarizer, RichCallbackInfo rich)
extends Record
implements ApiResponse
Represents the top-level response from the Brave Search API. This class contains all the
different types of search results that can be returned by the API, organized by result type.
This response record contains methods to deserialise and serialise instances.
Factory methods are available for String, File, Reader, and HttpResponse inputs. You can also write the contents of a response object to the filesystem;
write(File) can be useful for that purpose.
-
Constructor Summary
ConstructorsConstructorDescriptionWebSearchApiResponse(String type, Discussions discussions, FAQ faq, GraphInfobox infobox, Locations locations, MixedResponse mixed, News news, WebQuery query, Videos videos, Search web, Summarizer summarizer, RichCallbackInfo rich) Creates an instance of aWebSearchApiResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thediscussionsrecord component.final booleanIndicates whether some other object is "equal to" this one.faq()Returns the value of thefaqrecord component.static WebSearchApiResponsestatic WebSearchApiResponsestatic WebSearchApiResponsestatic WebSearchApiResponsefrom(@NotNull HttpResponse<String> dataResponse) final inthashCode()Returns a hash code value for this object.infobox()Returns the value of theinfoboxrecord component.Returns the value of thelocationsrecord component.mixed()Returns the value of themixedrecord component.news()Returns the value of thenewsrecord component.query()Returns the value of thequeryrecord component.rich()Returns the value of therichrecord component.Returns the value of thesummarizerrecord component.toJson()Serializes the response object to a JSON string.final StringtoString()Returns a string representation of this record class.type()Returns the value of thetyperecord component.videos()Returns the value of thevideosrecord component.web()Returns the value of thewebrecord component.voidWrites the response object to a file on the filesystem.
-
Constructor Details
-
WebSearchApiResponse
public WebSearchApiResponse(String type, Discussions discussions, FAQ faq, GraphInfobox infobox, Locations locations, MixedResponse mixed, News news, WebQuery query, Videos videos, Search web, Summarizer summarizer, RichCallbackInfo rich) Creates an instance of aWebSearchApiResponserecord class.- Parameters:
type- the value for thetyperecord componentdiscussions- the value for thediscussionsrecord componentfaq- the value for thefaqrecord componentinfobox- the value for theinfoboxrecord componentlocations- the value for thelocationsrecord componentmixed- the value for themixedrecord componentnews- the value for thenewsrecord componentquery- the value for thequeryrecord componentvideos- the value for thevideosrecord componentweb- the value for thewebrecord componentsummarizer- the value for thesummarizerrecord componentrich- the value for therichrecord component
-
-
Method Details
-
from
-
from
-
from
-
from
-
write
Description copied from interface:ApiResponseWrites the response object to a file on the filesystem.- Specified by:
writein interfaceApiResponse- Parameters:
target- the file to write the response object to.
-
toJson
Description copied from interface:ApiResponseSerializes the response object to a JSON string.- Specified by:
toJsonin interfaceApiResponse- Returns:
- a JSON string representation of the response object.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
type
Returns the value of thetyperecord component.- Returns:
- the value of the
typerecord component
-
discussions
Returns the value of thediscussionsrecord component.- Returns:
- the value of the
discussionsrecord component
-
faq
Returns the value of thefaqrecord component.- Returns:
- the value of the
faqrecord component
-
infobox
Returns the value of theinfoboxrecord component.- Returns:
- the value of the
infoboxrecord component
-
locations
Returns the value of thelocationsrecord component.- Returns:
- the value of the
locationsrecord component
-
mixed
Returns the value of themixedrecord component.- Returns:
- the value of the
mixedrecord component
-
news
Returns the value of thenewsrecord component.- Returns:
- the value of the
newsrecord component
-
query
Returns the value of thequeryrecord component.- Returns:
- the value of the
queryrecord component
-
videos
Returns the value of thevideosrecord component.- Returns:
- the value of the
videosrecord component
-
web
Returns the value of thewebrecord component.- Returns:
- the value of the
webrecord component
-
summarizer
Returns the value of thesummarizerrecord component.- Returns:
- the value of the
summarizerrecord component
-
rich
Returns the value of therichrecord component.- Returns:
- the value of the
richrecord component
-