Interface SearchVertical

All Superinterfaces:
BraveAPIConstant
All Known Implementing Classes:
BraveResource

public non-sealed interface SearchVertical extends BraveAPIConstant
An interface representing a search vertical.

This interface extends BraveAPIConstant and is implemented by enums that represent search verticals.

Each search vertical has a BraveAPIConstant.value() method that is used to get the parameter value for the API requests. All verticals are followed by the SEARCH_PATH string, and it is included here for convenience and readability as it is used in the implementation of the
BraveAPIConstant.urlParam() method by default.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The URL path segment appended after the vertical value ("search").

    Fields inherited from interface net.ygbstudio.jbrave.core.domain.BraveAPIConstant

    SEARCH_API_BASE
  • Method Summary

    Static Methods
    Modifier and Type
    Method
    Description
    static @NotNull String
    urlVertical(@NotNull SearchVertical vertical)
    Creates a URL query string for the given search vertical.

    Methods inherited from interface net.ygbstudio.jbrave.core.domain.BraveAPIConstant

    urlParam, value
  • Field Details

    • SEARCH_PATH

      static final String SEARCH_PATH
      The URL path segment appended after the vertical value ("search").
      See Also:
  • Method Details

    • urlVertical

      @Contract(pure=true) @NotNull static @NotNull String urlVertical(@NotNull @NotNull SearchVertical vertical)
      Creates a URL query string for the given search vertical.

      This method takes a search vertical and returns a URL query string that can be used to construct a request to the Brave API. The URL query string is constructed by concatenating the value of the search vertical with the SEARCH_PATH string and appending "?q=".

      Parameters:
      vertical - the search vertical to use for constructing the URL query string
      Returns:
      the URL query string for the given search vertical