public class Client extends AbstractClient
Client client = new Client( "API TOKEN" );
client.getChannel( "whatsapp" ).sendMessage(
"WhatsApp-business-id", "receiver-phone-number", new TextContent( "Text to be sent!" )
);
DEFAULT_CONNECTION_POOL_TIMEOUT, DEFAULT_CONNECTION_TIMEOUT, DEFAULT_INACTIVITY_TIME_BEFORE_STALE_CHECK, DEFAULT_MAX_CONNECTION_RETRIES, DEFAULT_MAX_CONNECTIONS, DEFAULT_SOCKET_TIMEOUT, DEFAULT_URL| Constructor and Description |
|---|
Client(String apiToken)
Initializes the connection pool using default configurations.
|
Client(String apiToken,
Integer maxConnections)
Initializes the connection pool using a mix of the given configurations
and below default configurations.
|
Client(String apiToken,
Integer connectionTimeout,
Integer socketTimeout,
Integer maxConnectionRetries)
Initializes the connection pool using a mix of the given configurations
and below default configurations.
|
Client(String apiToken,
Integer maxConnections,
Integer connectionTimeout,
Integer socketTimeout,
Integer maxConnectionRetries)
Initializes the connection pool using a mix of the given configurations
and below default configurations.
|
Client(String apiToken,
Integer maxConnections,
Integer connectionTimeout,
Integer socketTimeout,
Integer maxConnectionRetries,
Integer connectionPoolTimeout,
Integer inactivityTimeBeforeStaleCheck)
Initializes the connection pool using the given configurations.
|
Client(String apiToken,
String apiUrl)
Initializes the connection pool using default configurations.
|
Client(String apiToken,
String apiUrl,
Integer maxConnections)
Initializes the connection pool using a mix of the given configurations
and below default configurations.
|
Client(String apiToken,
String apiUrl,
Integer connectionTimeout,
Integer socketTimeout,
Integer maxConnectionRetries)
Initializes the connection pool using a mix of the given configurations
and below default configurations.
|
Client(String apiToken,
String apiUrl,
Integer maxConnections,
Integer connectionTimeout,
Integer socketTimeout,
Integer maxConnectionRetries)
Initializes the connection pool using a mix of the given configurations
and below default configurations.
|
Client(String apiToken,
String apiUrl,
Integer maxConnections,
Integer connectionTimeout,
Integer socketTimeout,
Integer maxConnectionRetries,
Integer connectionPoolTimeout,
Integer inactivityTimeBeforeStaleCheck)
Initializes the connection pool using the given configurations.
|
| Modifier and Type | Method and Description |
|---|---|
<SUBSCRIPTION extends Subscription> |
createSubscription(SUBSCRIPTION subscription) |
void |
deleteSubscription(String id) |
Channel |
getChannel(ChannelType channelType) |
Channel |
getChannel(String channelType) |
<SUBSCRIPTION extends Subscription> |
getSubscription(String id) |
List<Subscription> |
listSubscriptions() |
<SUBSCRIPTION extends Subscription> |
updateSubscription(String id,
PartialSubscription partialSubscription) |
<SUBSCRIPTION extends Subscription> |
updateSubscription(SUBSCRIPTION subscription) |
close, getApiUrl, getConnectionPoolTimeout, getConnectionTimeout, getInactivityTimeBeforeStaleCheck, getMaxConnectionRetries, getMaxConnections, getSocketTimeout, toStringpublic Client(String apiToken)
apiToken - An API token generated on Zenvia API console.public Client(String apiToken, Integer maxConnections)
apiToken - An API token generated on Zenvia API console.maxConnections - The maximum number of connections in the pool.
When null, the default 100 will be used instead.public Client(String apiToken, Integer connectionTimeout, Integer socketTimeout, Integer maxConnectionRetries)
apiToken - An API token generated on Zenvia API console.connectionTimeout - The amount of time in milliseconds for a connection attempt to timeout.
When null, the default 25000 will be used instead.socketTimeout - The amount of time in milliseconds for a server reply to timeout.
When null, the default 60000 will be used instead.maxConnectionRetries - The maximum amount of connection retries automatically made by the HTTP client in
case of connection failure.
When null, the default 4 will be used instead.public Client(String apiToken, Integer maxConnections, Integer connectionTimeout, Integer socketTimeout, Integer maxConnectionRetries)
apiToken - An API token generated on Zenvia API console.maxConnections - The maximum number of connections in the pool.
When null, the default 100 will be used instead.connectionTimeout - The amount of time in milliseconds for a connection attempt to timeout.
When null, the default 25000 will be used instead.socketTimeout - The amount of time in milliseconds for a server reply to timeout.
When null, the default 60000 will be used instead.maxConnectionRetries - The maximum amount of connection retries automatically made by the HTTP client in
case of connection failure.
When null, the default 4 will be used instead.public Client(String apiToken, Integer maxConnections, Integer connectionTimeout, Integer socketTimeout, Integer maxConnectionRetries, Integer connectionPoolTimeout, Integer inactivityTimeBeforeStaleCheck)
apiToken - An API token generated on Zenvia API console.maxConnections - The maximum number of connections in the pool.
When null, the default 100 will be used instead.connectionTimeout - The amount of time in milliseconds for a connection attempt to timeout.
When null, the default 25000 will be used instead.socketTimeout - The amount of time in milliseconds for a server reply to timeout.
When null, the default 60000 will be used instead.maxConnectionRetries - The maximum amount of connection retries automatically made by the HTTP client in
case of connection failure.
When null, the default 4 will be used instead.connectionPoolTimeout - The amount of time in milliseconds for a request to timeout when wait for a free connection
from the pool. When zero, it means it will wait indefinitely for a connection.
When null, the default 0 will be used instead.inactivityTimeBeforeStaleCheck - The amount of time in milliseconds of inactivity necessary to trigger a stale check on
idle pool connections.
When null, the default 5000 will be used instead.public Client(String apiToken, String apiUrl)
apiToken - An API token generated on Zenvia API console.apiUrl - The URL for the API service. Normally the value "https://api.zenvia.com" is used, but can be
useful for testing, and in rare cases, for custom integrations.
When null, the default "https://api.zenvia.com" will be used instead.public Client(String apiToken, String apiUrl, Integer maxConnections)
apiToken - An API token generated on Zenvia API console.apiUrl - The URL for the API service. Normally the value "https://api.zenvia.com" is used, but can be
useful for testing, and in rare cases, for custom integrations.
When null, the default "https://api.zenvia.com" will be used instead.maxConnections - The maximum number of connections in the pool.
When null, the default 100 will be used instead.public Client(String apiToken, String apiUrl, Integer connectionTimeout, Integer socketTimeout, Integer maxConnectionRetries)
apiToken - An API token generated on Zenvia API console.apiUrl - The URL for the API service. Normally the value "https://api.zenvia.com" is used, but can be
useful for testing, and in rare cases, for custom integrations.
When null, the default "https://api.zenvia.com" will be used instead.connectionTimeout - The amount of time in milliseconds for a connection attempt to timeout.
When null, the default 25000 will be used instead.socketTimeout - The amount of time in milliseconds for a server reply to timeout.
When null, the default 60000 will be used instead.maxConnectionRetries - The maximum amount of connection retries automatically made by the HTTP client in
case of connection failure.
When null, the default 4 will be used instead.public Client(String apiToken, String apiUrl, Integer maxConnections, Integer connectionTimeout, Integer socketTimeout, Integer maxConnectionRetries)
apiToken - An API token generated on Zenvia API console.apiUrl - The URL for the API service. Normally the value "https://api.zenvia.com" is used, but can be
useful for testing, and in rare cases, for custom integrations.
When null, the default "https://api.zenvia.com" will be used instead.maxConnections - The maximum number of connections in the pool.
When null, the default 100 will be used instead.connectionTimeout - The amount of time in milliseconds for a connection attempt to timeout.
When null, the default 25000 will be used instead.socketTimeout - The amount of time in milliseconds for a server reply to timeout.
When null, the default 60000 will be used instead.maxConnectionRetries - The maximum amount of connection retries automatically made by the HTTP client in
case of connection failure.
When null, the default 4 will be used instead.public Client(String apiToken, String apiUrl, Integer maxConnections, Integer connectionTimeout, Integer socketTimeout, Integer maxConnectionRetries, Integer connectionPoolTimeout, Integer inactivityTimeBeforeStaleCheck)
apiToken - An API token generated on Zenvia API console.apiUrl - The URL for the API service. Normally the value "https://api.zenvia.com" is used, but can be
useful for testing, and in rare cases, for custom integrations.
When null, the default "https://api.zenvia.com" will be used instead.maxConnections - The maximum number of connections in the pool.
When null, the default 100 will be used instead.connectionTimeout - The amount of time in milliseconds for a connection attempt to timeout.
When null, the default 25000 will be used instead.socketTimeout - The amount of time in milliseconds for a server reply to timeout.
When null, the default 60000 will be used instead.maxConnectionRetries - The maximum amount of connection retries automatically made by the HTTP client in
case of connection failure.
When null, the default 4 will be used instead.connectionPoolTimeout - The amount of time in milliseconds for a request to timeout when wait for a free connection
from the pool. When zero, it means it will wait indefinitely for a connection.
When null, the default 0 will be used instead.inactivityTimeBeforeStaleCheck - The amount of time in milliseconds of inactivity necessary to trigger a stale check on
idle pool connections.
When null, the default 5000 will be used instead.public Channel getChannel(String channelType) throws UnsupportedChannelException
getChannel in class AbstractClientUnsupportedChannelExceptionpublic Channel getChannel(ChannelType channelType) throws UnsupportedChannelException
getChannel in class AbstractClientUnsupportedChannelExceptionpublic List<Subscription> listSubscriptions() throws UnsuccessfulRequestException, HttpSocketTimeoutException, HttpConnectionTimeoutException, HttpConnectionFailException, HttpIOException
public <SUBSCRIPTION extends Subscription> SUBSCRIPTION createSubscription(SUBSCRIPTION subscription) throws UnsuccessfulRequestException, HttpSocketTimeoutException, HttpConnectionTimeoutException, HttpConnectionFailException, HttpIOException
public <SUBSCRIPTION extends Subscription> SUBSCRIPTION getSubscription(String id) throws UnsuccessfulRequestException, HttpSocketTimeoutException, HttpConnectionTimeoutException, HttpConnectionFailException, HttpIOException
public <SUBSCRIPTION extends Subscription> SUBSCRIPTION updateSubscription(SUBSCRIPTION subscription) throws UnsuccessfulRequestException, HttpSocketTimeoutException, HttpConnectionTimeoutException, HttpConnectionFailException, HttpIOException
public <SUBSCRIPTION extends Subscription> SUBSCRIPTION updateSubscription(String id, PartialSubscription partialSubscription) throws UnsuccessfulRequestException, HttpSocketTimeoutException, HttpConnectionTimeoutException, HttpConnectionFailException, HttpIOException
public void deleteSubscription(String id) throws UnsuccessfulRequestException, HttpSocketTimeoutException, HttpConnectionTimeoutException, HttpConnectionFailException, HttpIOException
Copyright © 2019 Zenvia. All rights reserved.