Package org.botblock.javabotblockapi.requests

## Class GetListAction

- java.lang.Object
- - org.botblock.javabotblockapi.requests.GetListAction

-     public class GetListAction
      extends Object

  Class used to perform GET actions on the `/api/lists` and `/api/lists/:id` endpoints.

  GET requests are cached for 2 minutes unless disabled through `GetListAction(true)`.

  Since:
    5.0.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class | Description
    --- | --- | ---
    `static class` | `GetListAction.ApiField` | Enum containing the different API fields a bot list may have.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `GetListAction()` | Constructor to get the instance of GetListAction.
    `GetListAction​(boolean disableCache)` | Constructor to get the instance of GetListAction.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `@Nullable String` | `getApiField​(@NotNull String id, @NotNull String site, @NotNull GetListAction.ApiField field)` | Gets the name of the specified field.
    `@Nullable String` | `getApiField​(@NotNull String id, @NotNull Site site, @NotNull GetListAction.ApiField field)` | Gets the name of the specified field.
    `@Nullable String` | `getBotWidgetUrl​(@NotNull String id, @NotNull String site)` | Gets the URL used to display a widget (custom image) of the bot.
    `@Nullable String` | `getBotWidgetUrl​(@NotNull String id, @NotNull Site site)` | Gets the URL used to display a widget (custom image) of the bot.
    `@Nullable String` | `getDescription​(@NotNull String id, @NotNull String site)` | Gets the description of the bot list.
    `@Nullable String` | `getDescription​(@NotNull String id, @NotNull Site site)` | Gets the description of the bot list.
    `@Nullable String` | `getDiscordInvite​(@NotNull String id, @NotNull String site)` | Gets the invite to the Discord of the bot list.
    `@Nullable String` | `getDiscordInvite​(@NotNull String id, @NotNull Site site)` | Gets the invite to the Discord of the bot list.
    `JSONArray` | `getFeatures​(@NotNull String id, @NotNull String site)` | Gets the features of the bot list.
    `JSONArray` | `getFeatures​(@NotNull String id, @NotNull Site site)` | Gets the features of the bot list.
    `JSONObject` | `getFilteredLists​(@NotNull String id)` | Returns the filtered JSON of bot lists.
    `@Nullable String` | `getIcon​(@NotNull String id, @NotNull String site)` | Gets the URL displaying the current Icon of the bot list.
    `@Nullable String` | `getIcon​(@NotNull String id, @NotNull Site site)` | Gets the URL displaying the current Icon of the bot list.
    `String` | `getId​(@NotNull String id, @NotNull String site)` | Gets the id of the bot list.
    `String` | `getId​(@NotNull String id, @NotNull Site site)` | Gets the id of the bot list.
    `String` | `getLanguage​(@NotNull String id, @NotNull String site)` | Gets the primary language of the bot list.
    `String` | `getLanguage​(@NotNull String id, @NotNull Site site)` | Gets the primary language of the bot list.
    `JSONObject` | `getList​(@NotNull String id, @NotNull String site)` | Gets the information of a specific bot list.
    `JSONObject` | `getList​(@NotNull String id, @NotNull Site site)` | Gets the information of a specific bot list.
    `JSONObject` | `getLists​(@NotNull String id)` | Gets the information about all the currently listed bot lists.
    `String` | `getName​(@NotNull String id, @NotNull String site)` | Gets the name of the bot list.
    `String` | `getName​(@NotNull String id, @NotNull Site site)` | Gets the name of the bot list.
    `@Nullable String` | `getOwners​(@NotNull String id, @NotNull String site)` | Gets the owners of a bot list.
    `@Nullable String` | `getOwners​(@NotNull String id, @NotNull Site site)` | Gets the owners of a bot list.
    `Integer` | `getTimeAdded​(@NotNull String id, @NotNull String site)` | Gets the UNIX timestamp of when the bot list was added to BotBlock as Integer.
    `Integer` | `getTimeAdded​(@NotNull String id, @NotNull Site site)` | Gets the UNIX timestamp of when the bot list was added to BotBlock as Integer.
    `String` | `getUrl​(@NotNull String id, @NotNull String site)` | Gets the URL for the bot list's website.
    `String` | `getUrl​(@NotNull String id, @NotNull Site site)` | Gets the URL for the bot list's website.
    `boolean` | `isDefunct​(@NotNull String id, @NotNull String site)` | Returns if the bot list is defunct.
    `boolean` | `isDefunct​(@NotNull String id, @NotNull Site site)` | Returns if the bot list is defunct.
    `boolean` | `isDiscordOnly​(@NotNull String id, @NotNull String site)` | Returns if the bot list is only for Discord bots.
    `boolean` | `isDiscordOnly​(@NotNull String id, @NotNull Site site)` | Returns if the bot list is only for Discord bots.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GetListAction

          public GetListAction()

      Constructor to get the instance of GetListAction.

    - #### GetListAction

          public GetListAction​(boolean disableCache)

      Constructor to get the instance of GetListAction.
      Use this if you want to disable the caching of the GET requests.
      We do not recommend this without own caching/ratelimiting.
      Parameters:
        `disableCache` - Whether or not to disable caching. `true` means caching gets disabled!

  - ### Method Detail

    - #### getApiField

          @Nullable
          public @Nullable String getApiField​(@NotNull
                                              @NotNull String id,
                                              @NotNull
                                              @NotNull Site site,
                                              @NotNull
                                              @NotNull GetListAction.ApiField field)

      Gets the name of the specified field. The returned String can either be a URL or a field name.
      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 @Nullable String getApiField​(@NotNull
                                              @NotNull String id,
                                              @NotNull
                                              @NotNull String site,
                                              @NotNull
                                              @NotNull GetListAction.ApiField field)

      Gets the name of the specified field. The returned String can either be a URL or a field name.
      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 @Nullable String getBotWidgetUrl​(@NotNull
                                                  @NotNull String id,
                                                  @NotNull
                                                  @NotNull Site site)

      Gets the URL used to display a widget (custom image) of the bot.
      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 @Nullable String getBotWidgetUrl​(@NotNull
                                                  @NotNull String id,
                                                  @NotNull
                                                  @NotNull String site)

      Gets the URL used to display a widget (custom image) of the bot.
      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 @Nullable String getDescription​(@NotNull
                                                 @NotNull String id,
                                                 @NotNull
                                                 @NotNull Site site)

      Gets the description of the bot list.
      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 @Nullable String getDescription​(@NotNull
                                                 @NotNull String id,
                                                 @NotNull
                                                 @NotNull String site)

      Gets the description of the bot list.
      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 @Nullable String getDiscordInvite​(@NotNull
                                                   @NotNull String id,
                                                   @NotNull
                                                   @NotNull Site site)

      Gets the invite to the Discord of the bot list.
      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 @Nullable String getDiscordInvite​(@NotNull
                                                   @NotNull String id,
                                                   @NotNull
                                                   @NotNull String site)

      Gets the invite to the Discord of the bot list.
      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​(@NotNull
                                       @NotNull String id,
                                       @NotNull
                                       @NotNull Site site)

      Gets the features of the bot list.
      The listed features can be both positive and negative.
      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​(@NotNull
                                       @NotNull String id,
                                       @NotNull
                                       @NotNull String site)

      Gets the features of the bot list.
      The listed features can be both positive and negative.
      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​(@NotNull
                                             @NotNull String id)

      Returns the filtered JSON of bot lists.
      The filtered version only contains the `API fields` of the bot lists.
      Parameters:
        `id` - The id used for the cache.
      Returns:
        `JSONObject` containing the filtered information of the bot lists.

    - #### getIcon

          @Nullable
          public @Nullable String getIcon​(@NotNull
                                          @NotNull String id,
                                          @NotNull
                                          @NotNull Site site)

      Gets the URL displaying the current Icon of the bot list.
      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 @Nullable String getIcon​(@NotNull
                                          @NotNull String id,
                                          @NotNull
                                          @NotNull String site)

      Gets the URL displaying the current Icon of the bot list.
      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​(@NotNull
                              @NotNull String id,
                              @NotNull
                              @NotNull Site site)

      Gets the id of the bot list.
      The id is used for the `/api/count` endpoint.
      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​(@NotNull
                              @NotNull String id,
                              @NotNull
                              @NotNull String site)

      Gets the id of the bot list.
      The id is used for the `/api/count` endpoint.
      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​(@NotNull
                                    @NotNull String id,
                                    @NotNull
                                    @NotNull Site site)

      Gets the primary language of the bot list.
      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​(@NotNull
                                    @NotNull String id,
                                    @NotNull
                                    @NotNull String site)

      Gets the primary language of the bot list.
      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​(@NotNull
                                    @NotNull String id,
                                    @NotNull
                                    @NotNull Site site)

      Gets the information of a specific bot list.
      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​(@NotNull
                                    @NotNull String id,
                                    @NotNull
                                    @NotNull String site)

      Gets the information of a specific bot list.
      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​(@NotNull
                                     @NotNull String id)

      Gets the information about all the currently listed bot lists.
      Parameters:
        `id` - The id used for the cache.
      Returns:
        `JSONObject` containing information about all the different bot lists.

    - #### getName

          public String getName​(@NotNull
                                @NotNull String id,
                                @NotNull
                                @NotNull Site site)

      Gets the name of the bot list.
      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​(@NotNull
                                @NotNull String id,
                                @NotNull
                                @NotNull String site)

      Gets the name of the bot list.
      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 @Nullable String getOwners​(@NotNull
                                            @NotNull String id,
                                            @NotNull
                                            @NotNull Site site)

      Gets the owners of a bot list.
      The pattern in which the owners are listed is `<name#discrim> (<id>), <name#discrim> (<id>), ...`
      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 @Nullable String getOwners​(@NotNull
                                            @NotNull String id,
                                            @NotNull
                                            @NotNull String site)

      Gets the owners of a bot list.
      The pattern in which the owners are listed is `<name#discrim> (<id>), <name#discrim> (<id>), ...`
      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​(@NotNull
                                      @NotNull String id,
                                      @NotNull
                                      @NotNull Site site)

      Gets the UNIX timestamp of when the bot list was added to BotBlock as Integer.
      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​(@NotNull
                                      @NotNull String id,
                                      @NotNull
                                      @NotNull String site)

      Gets the UNIX timestamp of when the bot list was added to BotBlock as Integer.
      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​(@NotNull
                               @NotNull String id,
                               @NotNull
                               @NotNull Site site)

      Gets the URL for the bot list's website.
      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​(@NotNull
                               @NotNull String id,
                               @NotNull
                               @NotNull String site)

      Gets the URL for the bot list's website.
      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​(@NotNull
                                   @NotNull String id,
                                   @NotNull
                                   @NotNull 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.
      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​(@NotNull
                                   @NotNull String id,
                                   @NotNull
                                   @NotNull 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.
      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​(@NotNull
                                       @NotNull String id,
                                       @NotNull
                                       @NotNull Site site)

      Returns if the bot list is only for Discord bots.
      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​(@NotNull
                                       @NotNull String id,
                                       @NotNull
                                       @NotNull String site)

      Returns if the bot list is only for Discord bots.
      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.