Package pw.chew.clickup4j.api
Class ClickUp4jBuilder
java.lang.Object
pw.chew.clickup4j.api.ClickUp4jBuilder
-
Field Summary
-
Constructor Summary
ConstructorDescriptionClickUp4jBuilder
(@Nullable String token) Create a builder using the specified token -
Method Summary
Modifier and TypeMethodDescription@NotNull ClickUp4j
build()
Builds a newClickUp4j
instance and uses the provided token.static @NotNull ClickUp4jBuilder
Creates a builder with the predefined token.@NotNull ClickUp4jBuilder
setHttpClient
(@Nullable okhttp3.OkHttpClient client) Sets theOkHttpClient
that will be used by the requester.@NotNull ClickUp4jBuilder
setHttpClientBuilder
(okhttp3.OkHttpClient.Builder builder) Sets theBuilder
that will be used by the requester.@NotNull ClickUp4jBuilder
setWebhookEndpoint
(String webhookEndpoint) Sets the webhook endpoint that theClickUp4j
instance will use.setWebhookPort
(int webhookPort) Sets the webhook port that theClickUp4j
instance will use.useWebhookServer
(boolean useWebhookServer) Sets whether theClickUp4j
instance will use the webhook server.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.
-
Field Details
-
httpClientBuilder
protected okhttp3.OkHttpClient.Builder httpClientBuilder -
httpClient
protected okhttp3.OkHttpClient httpClient -
token
-
useWebhookServer
protected boolean useWebhookServer -
webhookEndpoint
-
webhookPort
protected int webhookPort
-
-
Constructor Details
-
ClickUp4jBuilder
Create a builder using the specified token- Parameters:
token
- The token to use
-
-
Method Details
-
create
Creates a builder with the predefined token.- Parameters:
token
- The bot token to use- Returns:
- The builder instance
- See Also:
-
setToken
Sets the token that will be used by theClickUp4j
instance to log in whenbuild()
is called.- Go to your Apps
- Locate "API Token" at the top.
- 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 theBuilder
that will be used by the requester.
This can be used to set things such as connection timeout and proxy.- Parameters:
builder
- The newBuilder
to use- Returns:
- This builder instance. Useful for chaining.
-
setHttpClient
@NotNull public @NotNull ClickUp4jBuilder setHttpClient(@Nullable @Nullable okhttp3.OkHttpClient client) Sets theOkHttpClient
that will be used by the requester.
This can be used to set things such as connection timeout and proxy.- Parameters:
client
- The newOkHttpClient
to use- Returns:
- This builder instance. Useful for chaining.
-
useWebhookServer
Sets whether theClickUp4j
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 withsetWebhookEndpoint(String)
.- Parameters:
useWebhookServer
- Whether to use the webhook server- Returns:
- This builder instance. Useful for chaining.
-
setWebhookEndpoint
Sets the webhook endpoint that theClickUp4j
instance will use.
This should be equal to something likehttp://my.server.ip:4545/
.
The port can be specified withsetWebhookPort(int)
.- Parameters:
webhookEndpoint
- The webhook endpoint to use- Returns:
- This builder instance. Useful for chaining.
-
setWebhookPort
- 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 withClickUp4j.startWebhookServer(String)
.- Parameters:
useWebhookServer
- Whether to use the webhook serverwebhookEndpoint
- The webhook endpoint to usewebhookPort
- The webhook port to use- Returns:
- This builder instance. Useful for chaining.
-
build
Builds a newClickUp4j
instance and uses the provided token.- Returns:
- A
ClickUp4j
instance.
-