Package org.botblock.javabotblockapi.requests

## Class PostAction

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

-     public class PostAction
      extends Object

  Class used to perform POST requests towards the `/api/count` endpoint.

  You can `post automatically` or `post manually`.

  Since:
    3.0.0

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `PostAction()` | Empty constructor to create the PostAction instance.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `disableAutoPost()` | Shuts down the scheduler, to stop the automatic posting.
    `void` | `enableAutoPost​(@NotNull Long botId, int guilds, @NotNull BotBlockAPI botBlockAPI)` | Starts posting of the guild count each n minutes.
    `void` | `enableAutoPost​(@NotNull String botId, int guilds, @NotNull BotBlockAPI botBlockAPI)` | Starts posting of the guild count each n minutes.
    `void` | `enableAutoPost​(@NotNull JDA jda, @NotNull BotBlockAPI botBlockAPI)` | Starts posting of the guild count each n minutes.
    `void` | `enableAutoPost​(@NotNull ShardManager shardManager, @NotNull BotBlockAPI botBlockAPI)` | Starts posting of the guild count each n minutes.
    `void` | `postGuilds​(@NotNull Long botId, @NotNull Integer guilds, @NotNull BotBlockAPI botBlockAPI)` | Posts the guild count with the provided bot id.
    `void` | `postGuilds​(@NotNull String botId, @NotNull Integer guilds, @NotNull BotBlockAPI botBlockAPI)` | Posts the guild count with the provided bot id.
    `void` | `postGuilds​(@NotNull JDA jda, @NotNull BotBlockAPI botBlockAPI)` | Posts the guild count provided through the `JDA instance`.
    `void` | `postGuilds​(@NotNull ShardManager shardManager, @NotNull BotBlockAPI botBlockAPI)` | Posts the guild count from the provided `ShardManager instance`.

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

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

- - ### Constructor Detail

    - #### PostAction

          public PostAction()

      Empty constructor to create the PostAction instance.

  - ### Method Detail

    - #### disableAutoPost

          public void disableAutoPost()

      Shuts down the scheduler, to stop the automatic posting.

    - #### enableAutoPost

          public void enableAutoPost​(@NotNull
                                     @NotNull JDA jda,
                                     @NotNull
                                     @NotNull BotBlockAPI botBlockAPI)

      Starts posting of the guild count each n minutes.
      The delay in which this happens is set using ``BotBlockAPI.Builder#setUpdateInterval(Integer)``

      The scheduler will stop (cancel) the task, when an Exception appears!

      Parameters:
        `jda` - The `JDA instance` to use.
        `botBlockAPI` - The `BotBlockAPI instance` to use.

    - #### enableAutoPost

          public void enableAutoPost​(@NotNull
                                     @NotNull Long botId,
                                     int guilds,
                                     @NotNull
                                     @NotNull BotBlockAPI botBlockAPI)

      Starts posting of the guild count each n minutes.
      The delay in which this happens is set using ``BotBlockAPI.Builder.setUpdateDelay(Integer)` BotBlockAPI.Builder#setUpdateInterval(Integer)}`

      The scheduler will stop (cancel) the task, when an Exception appears!

      Parameters:
        `botId` - The ID of the bot as Long.
        `guilds` - The guild count.
        `botBlockAPI` - The `BotBlockAPI instance` to use.

    - #### enableAutoPost

          public void enableAutoPost​(@NotNull
                                     @NotNull ShardManager shardManager,
                                     @NotNull
                                     @NotNull BotBlockAPI botBlockAPI)

      Starts posting of the guild count each n minutes.
      The delay in which this happens is set using ``BotBlockAPI.Builder.setUpdateDelay(Integer)` BotBlockAPI.Builder#setUpdateInterval(Integer)}`

      The scheduler will stop (cancel) the task, when an Exception appears!

      Parameters:
        `shardManager` - The `ShardManager instance` to use.
        `botBlockAPI` - The `BotBlockAPI instance` to use.

    - #### enableAutoPost

          public void enableAutoPost​(@NotNull
                                     @NotNull String botId,
                                     int guilds,
                                     @NotNull
                                     @NotNull BotBlockAPI botBlockAPI)

      Starts posting of the guild count each n minutes.
      The delay in which this happens is set using ``BotBlockAPI.Builder.setUpdateDelay(Integer)` BotBlockAPI.Builder#setUpdateInterval(Integer)}`

      The scheduler will stop (cancel) the task, when an Exception appears!

      Parameters:
        `botId` - The ID of the bot as String.
        `guilds` - The guild count.
        `botBlockAPI` - The `BotBlockAPI instance` to use.

    - #### postGuilds

          public void postGuilds​(@NotNull
                                 @NotNull JDA jda,
                                 @NotNull
                                 @NotNull BotBlockAPI botBlockAPI)
                          throws IOException,
                                 RatelimitedException

      Posts the guild count provided through the `JDA instance`.
      It's recommended to use `postGuilds(ShardManager, BotBlockAPI)` if you're using a sharded bot.

      When the amount of shards a bot has is bigger than one will `shard_id` and `shard_count` be added.

      Parameters:
        `jda` - The `JDA instance`.
        `botBlockAPI` - The `BotBlockAPI instance`.
      Throws:
        `IOException` - When the post request couldn't be performed.
        `RatelimitedException` - When we exceed the rate-limit of the BotBlock API.

    - #### postGuilds

          public void postGuilds​(@NotNull
                                 @NotNull Long botId,
                                 @NotNull
                                 @NotNull Integer guilds,
                                 @NotNull
                                 @NotNull BotBlockAPI botBlockAPI)
                          throws IOException,
                                 RatelimitedException

      Posts the guild count with the provided bot id.
      Parameters:
        `botId` - The ID of the bot.
        `guilds` - The guild count.
        `botBlockAPI` - The `BotBlockAPI instance`.
      Throws:
        `IOException` - When the post request couldn't be performed.
        `RatelimitedException` - When we exceed the rate-limit of the BotBlock API.

    - #### postGuilds

          public void postGuilds​(@NotNull
                                 @NotNull ShardManager shardManager,
                                 @NotNull
                                 @NotNull BotBlockAPI botBlockAPI)
                          throws IOException,
                                 RatelimitedException

      Posts the guild count from the provided `ShardManager instance`.
      The guild count of each shard will be added as an JSONArray.
      Parameters:
        `shardManager` - The `ShardManager instance`.
        `botBlockAPI` - The `BotBlockAPI instance`.
      Throws:
        `IOException` - When the post request couldn't be performed.
        `RatelimitedException` - When we exceed the rate-limit of the BotBlock API.

    - #### postGuilds

          public void postGuilds​(@NotNull
                                 @NotNull String botId,
                                 @NotNull
                                 @NotNull Integer guilds,
                                 @NotNull
                                 @NotNull BotBlockAPI botBlockAPI)
                          throws IOException,
                                 RatelimitedException

      Posts the guild count with the provided bot id.
      Parameters:
        `botId` - The ID of the bot.
        `guilds` - The guild count.
        `botBlockAPI` - The `BotBlockAPI instance`.
      Throws:
        `IOException` - When the post request couldn't be performed.
        `RatelimitedException` - When we exceed the rate-limit of the BotBlock API.