Class ClickUp4jBuilder

java.lang.Object
pw.chew.clickup4j.api.ClickUp4jBuilder

public class ClickUp4jBuilder extends Object
Used to create new ClickUp4j instances.

A single builder can be reused multiple times. Each call to build() creates a new ClickUp4j instance using the same information.

  • Field Details

    • httpClientBuilder

      protected okhttp3.OkHttpClient.Builder httpClientBuilder
    • httpClient

      protected okhttp3.OkHttpClient httpClient
    • token

      protected String token
    • useWebhookServer

      protected boolean useWebhookServer
    • webhookEndpoint

      protected String webhookEndpoint
    • webhookPort

      protected int webhookPort
  • Constructor Details

    • ClickUp4jBuilder

      public ClickUp4jBuilder(@Nullable @Nullable String token)
      Create a builder using the specified token
      Parameters:
      token - The token to use
  • Method Details

    • create

      @NotNull public static @NotNull ClickUp4jBuilder create(@Nullable @Nullable String token)
      Creates a builder with the predefined token.
      Parameters:
      token - The bot token to use
      Returns:
      The builder instance
      See Also:
    • setToken

      @NotNull public @NotNull ClickUp4jBuilder setToken(@Nullable @Nullable String token)
      Sets the token that will be used by the ClickUp4j instance to log in when build() is called.
      1. Go to your Apps
      2. Locate "API Token" at the top.
      3. Either generate it, or use the current value.
      Parameters:
      token - The token of the account that you would like to use when accessing the API
      Returns:
      This builder instance. Useful for chaining.
    • setHttpClientBuilder

      @NotNull public @NotNull ClickUp4jBuilder setHttpClientBuilder(@Nullable okhttp3.OkHttpClient.Builder builder)
      Sets the Builder that will be used by the requester.
      This can be used to set things such as connection timeout and proxy.
      Parameters:
      builder - The new Builder to use
      Returns:
      This builder instance. Useful for chaining.
    • setHttpClient

      @NotNull public @NotNull ClickUp4jBuilder setHttpClient(@Nullable @Nullable okhttp3.OkHttpClient client)
      Sets the OkHttpClient that will be used by the requester.
      This can be used to set things such as connection timeout and proxy.
      Parameters:
      client - The new OkHttpClient to use
      Returns:
      This builder instance. Useful for chaining.
    • useWebhookServer

      public ClickUp4jBuilder useWebhookServer(boolean useWebhookServer)
      Sets whether the ClickUp4j instance will use the webhook server. This is required to listen to and handle webhook events.
      If you enable this, you must set an endpoint with setWebhookEndpoint(String).
      Parameters:
      useWebhookServer - Whether to use the webhook server
      Returns:
      This builder instance. Useful for chaining.
    • setWebhookEndpoint

      public ClickUp4jBuilder setWebhookEndpoint(String webhookEndpoint)
      Sets the webhook endpoint that the ClickUp4j instance will use.
      This should be equal to something like http://my.server.ip:4545/.
      The port can be specified with setWebhookPort(int).
      Parameters:
      webhookEndpoint - The webhook endpoint to use
      Returns:
      This builder instance. Useful for chaining.
    • setWebhookPort

      public ClickUp4jBuilder setWebhookPort(int webhookPort)
      Sets the webhook port that the ClickUp4j instance will use.
      By default, this is 4545.
      Parameters:
      webhookPort - The webhook port to use
      Returns:
      This builder instance. Useful for chaining.
    • useWebhookServer

      public ClickUp4jBuilder useWebhookServer(boolean useWebhookServer, String webhookEndpoint, int webhookPort)
      Have your cake and eat it too! This is the method that completely builds and uses the webhook server.
      Be sure to start the webhook server with ClickUp4j.startWebhookServer(String).
      Parameters:
      useWebhookServer - Whether to use the webhook server
      webhookEndpoint - The webhook endpoint to use
      webhookPort - The webhook port to use
      Returns:
      This builder instance. Useful for chaining.
    • build

      @NotNull public @NotNull ClickUp4j build()
      Builds a new ClickUp4j instance and uses the provided token.
      Returns:
      A ClickUp4j instance.