Package pw.chew.clickup4j.api
Class ClickUp4jBuilder
java.lang.Object
pw.chew.clickup4j.api.ClickUp4jBuilder
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionClickUp4jBuilder(@Nullable String token) Create a builder using the specified token -
Method Summary
Modifier and TypeMethodDescription@NotNull ClickUp4jbuild()Builds a newClickUp4jinstance and uses the provided token.static @NotNull ClickUp4jBuilderCreates a builder with the predefined token.@NotNull ClickUp4jBuildersetHttpClient(@Nullable okhttp3.OkHttpClient client) Sets theOkHttpClientthat will be used by the requester.@NotNull ClickUp4jBuildersetHttpClientBuilder(okhttp3.OkHttpClient.Builder builder) Sets theBuilderthat will be used by the requester.@NotNull ClickUp4jBuildersetWebhookEndpoint(String webhookEndpoint) Sets the webhook endpoint that theClickUp4jinstance will use.setWebhookPort(int webhookPort) Sets the webhook port that theClickUp4jinstance will use.useWebhookServer(boolean useWebhookServer) Sets whether theClickUp4jinstance 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 theClickUp4jinstance 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 theBuilderthat will be used by the requester.
This can be used to set things such as connection timeout and proxy.- Parameters:
builder- The newBuilderto use- Returns:
- This builder instance. Useful for chaining.
-
setHttpClient
@NotNull public @NotNull ClickUp4jBuilder setHttpClient(@Nullable @Nullable okhttp3.OkHttpClient client) Sets theOkHttpClientthat will be used by the requester.
This can be used to set things such as connection timeout and proxy.- Parameters:
client- The newOkHttpClientto use- Returns:
- This builder instance. Useful for chaining.
-
useWebhookServer
Sets whether theClickUp4jinstance 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 theClickUp4jinstance 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 newClickUp4jinstance and uses the provided token.- Returns:
- A
ClickUp4jinstance.
-