Record Class SuggestSearchApiResponse
java.lang.Object
java.lang.Record
net.ygbstudio.jbrave.api.response.SuggestSearchApiResponse
- Record Components:
type- The type of the response.query- The original query submitted by the user.results- A list of suggestion results provided by the API.
- All Implemented Interfaces:
ApiResponse
public record SuggestSearchApiResponse(String type, OriginalQuery query, List<SuggestResult> results)
extends Record
implements ApiResponse
Represents the response from the Brave Search API for suggestions. This class contains the string
query and a list of suggestion results.
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
ConstructorsConstructorDescriptionSuggestSearchApiResponse(String type, OriginalQuery query, List<SuggestResult> results) Creates an instance of aSuggestSearchApiResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.static SuggestSearchApiResponsestatic SuggestSearchApiResponsestatic SuggestSearchApiResponsestatic SuggestSearchApiResponsefrom(@NotNull HttpResponse<String> dataResponse) final inthashCode()Returns a hash code value for this object.query()Returns the value of thequeryrecord component.results()Returns the value of theresultsrecord 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.voidWrites the response object to a file on the filesystem.
-
Constructor Details
-
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
-
query
Returns the value of thequeryrecord component.- Returns:
- the value of the
queryrecord component
-
results
Returns the value of theresultsrecord component.- Returns:
- the value of the
resultsrecord component
-