Package org.botblock.javabotblockapi

## Class BotBlockAPI.Builder

- java.lang.Object
- - org.botblock.javabotblockapi.BotBlockAPI.Builder

- Enclosing class:
    BotBlockAPI

      public static class BotBlockAPI.Builder
      extends Object

  Builder class to create an instance of `BotBlockAPI`

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Builder()` | Empty constructor to get the class.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `BotBlockAPI.Builder` | `addAuthToken​(String site, String token)` | Adds the provided Site name and token to the Map.
    `BotBlockAPI.Builder` | `addAuthToken​(Site site, String token)` | Adds the provided `Site name` and token to the Map.
    `BotBlockAPI` | `build()` | Builds the instance of `BotBlockAPI`.
    `BotBlockAPI.Builder` | `setAuthTokens​(Map<String,​String> tokens)` | Sets the provided Map as the new Map.
    `BotBlockAPI.Builder` | `setUpdateDelay​(Integer updateDelay)` | Sets the update delay (in minutes) for the auto-posting.

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

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

- - ### Constructor Detail

    - #### Builder

          public Builder()

      Empty constructor to get the class.

  - ### Method Detail

    - #### addAuthToken

          public BotBlockAPI.Builder addAuthToken​(@Nonnull
                                                  Site site,
                                                  @Nonnull
                                                  String token)

      Adds the provided `Site name` and token to the Map.
      Entries with the same key will be overwritten.
      Parameters:
        `site` - The `Site` to get the name from.
        `token` - The API token from the corresponding bot list. May not be null or empty.
        You may receive the API token from the bot list.
      Returns:
        The Builder after the site and token were set. Useful for chaining.
      Throws:
        `NullPointerException` - When the provided token is empty (`""`).
      Since:
        2.1.0

    - #### addAuthToken

          public BotBlockAPI.Builder addAuthToken​(@Nonnull
                                                  String site,
                                                  @Nonnull
                                                  String token)

      Adds the provided Site name and token to the Map.
      Entries with the same key will be overwritten.
      Parameters:
        `site` - The name of the site. May not be null or empty.
        A list of supported sites can be found here.
        `token` - The API token from the corresponding bot list. May not be null or empty.
        You may receive the API token from the bot list.
      Returns:
        The Builder after the site and token were set. Useful for chaining.
      Throws:
        `NullPointerException` - When either the site or token are empty (`""`).

    - #### setAuthTokens

          public BotBlockAPI.Builder setAuthTokens​(@Nonnull
                                                   Map<String,​String> tokens)

      Sets the provided Map as the new Map.
      This will overwrite every previously set entry!
      Parameters:
        `tokens` - The Map that should be used. May not be null.
      Returns:
        The Builder after the Map was set. Useful for chaining.
      Throws:
        `NullPointerException` - When the provided Map is empty.

    - #### setUpdateDelay

          public BotBlockAPI.Builder setUpdateDelay​(@Nonnull
                                                    Integer updateDelay)

      Sets the update delay (in minutes) for the auto-posting.
      You don't need to set this when not using the auto-post option. Default is 30.
      Parameters:
        `updateDelay` - The update interval in minutes that should be used. This can't be less than 2.
      Returns:
        The Builder after the updateInterval was set. Useful for chaining.
      Throws:
        `IllegalStateException` - When the updateInterval is less than 2.

    - #### build

          public BotBlockAPI build()

      Builds the instance of `BotBlockAPI`.
      Returns:
        The built, usable `BotBlockAPI`.
      Throws:
        `NullPointerException` - When the Tokens Map is empty.