Class GetListAction

    • Constructor Detail

      • GetListAction

        public GetListAction​(@Nonnull
                             String id)
        Constructor to get an instance of GetListAction.

        Using this constructor will set the following default values:

        • Cache: Enabled
        • User-Agent: "JavaBotBlockAPI-0000/API_VERSION (Unknown; +https://jbba.dev) DBots/{id}"
        Parameters:
        id - The id of the bot. This is required for the internal User-Agent.
        Throws:
        NullPointerException - When the provided id is empty.
      • GetListAction

        public GetListAction​(boolean disableCache,
                             @Nonnull
                             String id)
        Constructor to get an instance of GetListAction.
        This constructor allows you to disable the internal caching, by providing true as the first argument.

        Using this constructor will set the following default values:

        • User-Agent: "JavaBotBlockAPI-0000/API_VERSION (Unknown; +https://jbba.dev) DBots/{id}"

        Following Exceptions can be thrown from the CheckUtil:

        Parameters:
        disableCache - If the cache should be disabled.
        true means the cache is disabled.
        id - The id of the bot. This is required for the internal User-Agent.
      • GetListAction

        public GetListAction​(boolean disableCache,
                             @Nonnull
                             String userAgent,
                             @Nonnull
                             String id)
        Constructor to get the instance of GetListAction.
        This constructor allows you to disable the internal caching, by providing true as the first argument and also set a own User-Agent for the requests by providing any String as the second argument.

        Note that you can provide {id} inside the userAgent to get it replaced with the provided id.

        Following Exceptions can be thrown from the CheckUtil:

        Parameters:
        disableCache - If the cache should be disabled.
        true means the cache is disabled.
        userAgent - The Name that should be used as User-Agent.
        id - The id of the bot. This is required for the internal User-Agent.
    • Method Detail

      • getApiField

        @Nullable
        public String getApiField​(@Nonnull
                                  String id,
                                  @Nonnull
                                  Site site,
                                  @Nonnull
                                  GetListAction.ApiField field)
        Gets the name of the specified field. The returned String can either be a URL or a field name.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        field - The API field to get the value from.
        Returns:
        Possibly-null String containing either a URL or API field name.
      • getApiField

        @Nullable
        public String getApiField​(@Nonnull
                                  String id,
                                  @Nonnull
                                  String site,
                                  @Nonnull
                                  GetListAction.ApiField field)
        Gets the name of the specified field. The returned String can either be a URL or a field name.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        field - The API field to get the value from.
        Returns:
        Possibly-null String containing either a URL or API field name.
      • getBotWidgetUrl

        @Nullable
        public String getBotWidgetUrl​(@Nonnull
                                      String id,
                                      @Nonnull
                                      Site site)
        Gets the URL used to display a widget (custom image) of the bot.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the URL used to display a widget.
      • getBotWidgetUrl

        @Nullable
        public String getBotWidgetUrl​(@Nonnull
                                      String id,
                                      @Nonnull
                                      String site)
        Gets the URL used to display a widget (custom image) of the bot.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the URL used to display a widget.
      • getDescription

        @Nullable
        public String getDescription​(@Nonnull
                                     String id,
                                     @Nonnull
                                     Site site)
        Gets the description of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the description/tag line of the bot list.
      • getDescription

        @Nullable
        public String getDescription​(@Nonnull
                                     String id,
                                     @Nonnull
                                     String site)
        Gets the description of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the description/tag line of the bot list.
      • getDiscordInvite

        @Nullable
        public String getDiscordInvite​(@Nonnull
                                       String id,
                                       @Nonnull
                                       Site site)
        Gets the invite to the Discord of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the invite to the Discord of the bot list.
      • getDiscordInvite

        @Nullable
        public String getDiscordInvite​(@Nonnull
                                       String id,
                                       @Nonnull
                                       String site)
        Gets the invite to the Discord of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the invite to the Discord of the bot list.
      • getFeatures

        public JSONArray getFeatures​(@Nonnull
                                     String id,
                                     @Nonnull
                                     Site site)
        Gets the features of the bot list.
        The listed features can be both positive and negative.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-empty JSONArray containing the features of the bot list.
      • getFeatures

        public JSONArray getFeatures​(@Nonnull
                                     String id,
                                     @Nonnull
                                     String site)
        Gets the features of the bot list.
        The listed features can be both positive and negative.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-empty JSONArray containing the features of the bot list.
      • getFilteredLists

        public JSONObject getFilteredLists​(@Nonnull
                                           String id)
        Returns the filtered JSON of bot lists.
        The filtered version only contains the API fields of the bot lists.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        Returns:
        JSONObject containing the filtered information of the bot lists.
      • getIcon

        @Nullable
        public String getIcon​(@Nonnull
                              String id,
                              @Nonnull
                              Site site)
        Gets the URL displaying the current Icon of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the Icon-URL of the bot list.
      • getIcon

        @Nullable
        public String getIcon​(@Nonnull
                              String id,
                              @Nonnull
                              String site)
        Gets the URL displaying the current Icon of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the Icon-URL of the bot list.
      • getId

        public String getId​(@Nonnull
                            String id,
                            @Nonnull
                            Site site)
        Gets the id of the bot list.
        The id is used for the /api/count endpoint.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        String containing the id of the bot list.
      • getId

        public String getId​(@Nonnull
                            String id,
                            @Nonnull
                            String site)
        Gets the id of the bot list.
        The id is used for the /api/count endpoint.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        String containing the id of the bot list.
      • getLanguage

        public String getLanguage​(@Nonnull
                                  String id,
                                  @Nonnull
                                  Site site)
        Gets the primary language of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        String containing the primarily used language of the bot list.
      • getLanguage

        public String getLanguage​(@Nonnull
                                  String id,
                                  @Nonnull
                                  String site)
        Gets the primary language of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        String containing the primarily used language of the bot list.
      • getList

        public JSONObject getList​(@Nonnull
                                  String id,
                                  @Nonnull
                                  Site site)
        Gets the information of a specific bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        JSONObject containing information about the specified bot list.
      • getList

        public JSONObject getList​(@Nonnull
                                  String id,
                                  @Nonnull
                                  String site)
        Gets the information of a specific bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        JSONObject containing information about the specified bot list.
      • getLists

        public JSONObject getLists​(@Nonnull
                                   String id)
        Gets the information about all the currently listed bot lists.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        Returns:
        JSONObject containing information about all the different bot lists.
      • getName

        public String getName​(@Nonnull
                              String id,
                              @Nonnull
                              Site site)
        Gets the name of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        String containing the name of the bot list.
      • getName

        public String getName​(@Nonnull
                              String id,
                              @Nonnull
                              String site)
        Gets the name of the bot list.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        String containing the name of the bot list.
      • getOwners

        @Nullable
        public String getOwners​(@Nonnull
                                String id,
                                @Nonnull
                                Site site)
        Gets the owners of a bot list.
        The pattern in which the owners are listed is <name#discrim> (<id>), <name#discrim> (<id>), ...

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the owners of the bot list.
      • getOwners

        @Nullable
        public String getOwners​(@Nonnull
                                String id,
                                @Nonnull
                                String site)
        Gets the owners of a bot list.
        The pattern in which the owners are listed is <name#discrim> (<id>), <name#discrim> (<id>), ...

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Possibly-null String containing the owners of the bot list,
      • getTimeAdded

        public Integer getTimeAdded​(@Nonnull
                                    String id,
                                    @Nonnull
                                    Site site)
        Gets the UNIX timestamp of when the bot list was added to BotBlock as Integer.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Integer displaying the UNIX time at which the bot list was added to BotBlock.
      • getTimeAdded

        public Integer getTimeAdded​(@Nonnull
                                    String id,
                                    @Nonnull
                                    String site)
        Gets the UNIX timestamp of when the bot list was added to BotBlock as Integer.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        Integer displaying the UNIX time at which the bot list was added to BotBlock.
      • getUrl

        public String getUrl​(@Nonnull
                             String id,
                             @Nonnull
                             Site site)
        Gets the URL for the bot list's website.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        String containing the URL to the bot list website.
      • getUrl

        public String getUrl​(@Nonnull
                             String id,
                             @Nonnull
                             String site)
        Gets the URL for the bot list's website.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        String containing the URL to the bot list website.
      • isDefunct

        public boolean isDefunct​(@Nonnull
                                 String id,
                                 @Nonnull
                                 Site site)
        Returns if the bot list is defunct.
        A defunct bot list is not displayed on the main site and is also excluded from the POST api.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        true if the bot list is defunct, false otherwise.
      • isDefunct

        public boolean isDefunct​(@Nonnull
                                 String id,
                                 @Nonnull
                                 String site)
        Returns if the bot list is defunct.
        A defunct bot list is not displayed on the main site and is also excluded from the POST api.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        true if the bot list is defunct, false otherwise.
      • isDiscordOnly

        public boolean isDiscordOnly​(@Nonnull
                                     String id,
                                     @Nonnull
                                     Site site)
        Returns if the bot list is only for Discord bots.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        true if the list is only for Discord bots, false otherwise.
      • isDiscordOnly

        public boolean isDiscordOnly​(@Nonnull
                                     String id,
                                     @Nonnull
                                     String site)
        Returns if the bot list is only for Discord bots.

        Following Exceptions can be thrown from the CheckUtil:

        Following Exceptions can be thrown from the HTTP request:

        Parameters:
        id - The id used for the cache.
        site - The site to get information from.
        Returns:
        true if the list is only for Discord bots, false otherwise.