Skip to content

# GetListAction

The GetListAction allows to perform GET requests towards the `/api/lists` and `/api/lists/:id` endpoint of the BotBlock API.

Note

All requests are getting cached for 2 minutes to prevent possible rate limits.
If you want to disable this, use `GetListAction(true)`.
We do not recommend doing this without any caching or rate limit-system in place!

## Index

- Disable caching
- Methods
  - `getApiField(String, Site|String, ApiField)`
  - `getBotWidget(String, Site|String)`
  - `getDescription(String, Site|String)`
  - `getDiscordInvite(String, Site|String)`
  - `getFeatures(String, Site|String)`
  - `getFilteredLists(String)`
  - `getIcon(String, Site|String)`
  - `getId(String, Site|String)`
  - `getLanguage(String, Site|String)`
  - `getList(String, Site|String)`
  - `getLists(String)`
  - `getName(String, Site|String)`
  - `getOwners(String, Site|String)`
  - `getTimeAdded(String, Site|String)`
  - `getUrl(String, Site|String)`
  - `isDefunct(String, Site|String)`
  - `isDiscordOnly(String, Site|String)`

## Disable caching

If you want to disable caching, will you need to add a boolean to the `GetListAction` constructor like this:

    // "true" disables the internal caching.
    GetListAction getListAction = new GetListAction(true);

## Methods

### `getApiField(String, Site|String, ApiField)`

Returns: Possibly-null String

Gets one of the JSON fields that are prefixed with `api_`.
The returned String can either be text (i.e. name of JSON field for POST requests), a URL (i.e. to documentation) or null.

### `getBotWidget(String, Site|String)`

Returns: Possibly-null String

Gets the link for displaying a bot widget (image with various information of the bot from the bot list). This may return null if no widget link was set.

### `getDescription(String, Site|String)`

Returns: Possibly-null String

Gets the description (tag line) of the bot list. This may return null if no description is set.

### `getDiscordInvite(String, Site|String)`

Returns: Possibly-null String

Gets the Discord invite of the bot list. This may return null if no invite was set.

### `getFeatures(String, Site|String)`

Returns: Possibly-empty JSONArray

Gets a JSONArray containing all the positive and negative features. This may return an empty JSONArray if no features are set.
An entry of the JSONArray may look like this:

    {
        "name": "Displayed name of feature",
        "id": -1,
        "display": -1,
        "type": 0,
        "description": null,
        "value": 1
    }

### `getFilteredList(String)`

Returns: JSONObject

Gets the lists, but with only the API fields present.

### `getIcon(String, Site|String)`

Returns: Possibly-null String

Gets the URL to the Bot list-icon. This may return null if no icon was set.

### `getId(String, Site|String)`

Returns: String

Gets the id of a bot list. This is not a numerical id (id from Discord) but what is used by BotBlock for things like the POST API.

### `getLanguage(String, Site|String)`

Returns: String

Gets the primary language of the bot list.

### `getList(String, Site|String)`

Returns: JSONObject

Gets the full info of a bot list.

### `getLists(String)`

Returns: JSONObject

Gets all available bot lists, including those that are defunct

### `getName(String, Site|String)`

Returns: String

Gets the displayed name of the bot list.

### `getOwners(String, Site|String)`

Returns: Possibly-null String

Gets the owners of a bot list. The returned String is in the format `<name>#<discrim> (<id>), <name>#<discrim> (<id>), ...`
This may return null if no owners are set.

### `getTimeAdded(String, Site|String)`

Returns: Integer

Gets the date and time (UNIX timestamp) of when the bot list was added to BotBlock.

### `getUrl(String, Site|String)`

Returns: String

Gets the URL of the bot list.

### `isDefunct(String, Site|String)`

Returns: Boolean

Returns `true` when the bot list is defunct and `false` otherwise.
A defunct site is not usable by the API of BotBlock, but can still be found on the website and accessed through the `/api/lists/:id` endpoint.

### `isDiscordOnly(String, Site|String)`

Returns: Boolean

Returns `true` when the bot list is only for Discord bots and `false` otherwise.