Class WebHookClient.Builder

java.lang.Object
io.github._4drian3d.jdwebhooks.WebHookClient.Builder
Enclosing class:
WebHookClient

public static final class WebHookClient.Builder extends Object
Builder for the creation of a new WebHookClient.
  • Method Details

    • uri

      public WebHookClient.Builder uri(@NotNull @NotNull String uri)
      Sets the client URI
      Parameters:
      uri - the client uri
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the provided URL is invalid
    • credentials

      public WebHookClient.Builder credentials(@NotNull @NotNull String id, @NotNull @NotNull String token)
      Set credentials for sending webhooks
      Parameters:
      id - the webhook id
      token - the webhook token
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the provided id or token are is invalid
    • agent

      public WebHookClient.Builder agent(@NotNull @NotNull String agent)
      Sets the user agent to use
      Parameters:
      agent - the user agent
      Returns:
      this builder
    • build

      public WebHookClient build()
      Creates a new WebHookClient based on the configuration of this builder
      Returns:
      a new WebHookClient
      Throws:
      NullPointerException - in case no credentials/uri or user agent have been configured