Record Class ImageSearchApiResponse
java.lang.Object
java.lang.Record
net.ygbstudio.jbrave.api.response.ImageSearchApiResponse
- Record Components:
type- The type of the response. This will always be "image_results".query- The original query submitted by the user.results- A list of image results provided by the API. Each result contains information about the image, such as its URL, width, height, and more.extra- Additional information about the response, such as the total number of results and the search engine used.
- All Implemented Interfaces:
ApiResponse
public record ImageSearchApiResponse(String type, ImageQuery query, List<ImageResult> results, Extra extra)
extends Record
implements ApiResponse
Represents the response from the Brave Search API for image searches. This class contains the
original query, a list of image results, and extra information.
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
ConstructorsConstructorDescriptionImageSearchApiResponse(String type, ImageQuery query, List<ImageResult> results, Extra extra) Creates an instance of aImageSearchApiResponserecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.extra()Returns the value of theextrarecord component.static ImageSearchApiResponsestatic ImageSearchApiResponsestatic ImageSearchApiResponsestatic ImageSearchApiResponsefrom(@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
-
ImageSearchApiResponse
public ImageSearchApiResponse(String type, ImageQuery query, List<ImageResult> results, Extra extra) Creates an instance of aImageSearchApiResponserecord class.
-
-
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
-
extra
Returns the value of theextrarecord component.- Returns:
- the value of the
extrarecord component
-