Package com.slack.api
Class Slack
java.lang.Object
com.slack.api.Slack
- All Implemented Interfaces:
AutoCloseable
public class Slack extends Object implements AutoCloseable
This class is a kind of facade of a variety of Slack API clients offered by this SDK.
Any objects of this class and all the APIs this class provides are thread-safe.
We recommend sharing an instance across your application.
This class internally uses the OkHttpClient and the client has its own daemon thread for realizing its optimal resource management. When your app needs to close all the threads when shutting down etc, call #close() method to terminate those threads.
If your application depends on the Gson library for JSON manipulation as with this SDK and the app uses the latest version for some reasons, just in case, you may need to check the binary-compatibility among their releases. We don't think any issues happened before but in general, some libraries may break bin-compatibility among major/minor releases.
- See Also:
- OkHttpClient, Gson
-
Constructor Summary
Constructors Constructor Description Slack()
-
Method Summary
Modifier and Type Method Description AuditClient
audit()
Creates a Audit Logs API client.AuditClient
audit(String token)
AsyncAuditClient
auditAsync(String token)
RequestStats
auditStats(String enterpriseId)
RequestStats
auditStats(String executorName, String enterpriseId)
void
close()
SlackConfig
getConfig()
SlackHttpClient
getHttpClient()
static Slack
getInstance()
static Slack
getInstance(SlackConfig config)
static Slack
getInstance(SlackConfig config, SlackHttpClient httpClient)
static Slack
getInstance(SlackHttpClient httpClient)
String
issueSocketModeUrl(String appToken)
MethodsClient
methods()
Creates a Methods API client.MethodsClient
methods(String token)
MethodsClient
methods(String token, String teamId)
AsyncMethodsClient
methodsAsync()
AsyncMethodsClient
methodsAsync(String token)
AsyncMethodsClient
methodsAsync(String token, String teamId)
RequestStats
methodsStats(String teamId)
RequestStats
methodsStats(String executorName, String teamId)
RTMClient
rtm(String apiToken)
Creates an RTM API client.RTMClient
rtmConnect(String apiToken)
Creates an RTM API client using `/rtm.connect`.RTMClient
rtmConnect(String apiToken, boolean fullUserInfoRequired)
Creates an RTM API client using `/rtm.connect`.RTMClient
rtmStart(String apiToken)
Creates an RTM API client using `/rtm.start`.RTMClient
rtmStart(String apiToken, boolean fullUserInfoRequired)
Creates an RTM API client using `/rtm.start`.SCIMClient
scim()
Creates a SCIM API client.SCIMClient
scim(String token)
AsyncSCIMClient
scimAsync(String token)
RequestStats
scimStats(String enterpriseId)
RequestStats
scimStats(String executorName, String enterpriseId)
WebhookResponse
send(String url, Payload payload)
Send a data to Incoming Webhook endpoint.WebhookResponse
send(String url, String payload)
Send a raw JSON body to Incoming Webhook endpoint.SocketModeClient
socketMode(String appToken)
SocketModeClient
socketMode(String appToken, SocketModeClient.Backend backend)
StatusClient
status()
LegacyStatusClient
statusLegacy()
Creates a Status API client.
-
Constructor Details
-
Slack
public Slack()
-
-
Method Details
-
getInstance
-
getInstance
-
getInstance
-
getInstance
-
getConfig
-
getHttpClient
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
send
Send a data to Incoming Webhook endpoint.- Throws:
IOException
-
send
Send a raw JSON body to Incoming Webhook endpoint.- Throws:
IOException
-
socketMode
- Throws:
IOException
-
socketMode
public SocketModeClient socketMode(String appToken, SocketModeClient.Backend backend) throws IOException- Throws:
IOException
-
issueSocketModeUrl
- Throws:
IOException
-
rtm
Creates an RTM API client.- Throws:
IOException
- See Also:
- Slack RTM API, RTM's Rate Limits
-
rtmConnect
Creates an RTM API client using `/rtm.connect`.- Throws:
IOException
- See Also:
- Slack RTM API, RTM's Rate Limits
-
rtmConnect
Creates an RTM API client using `/rtm.connect`.- Throws:
IOException
- See Also:
- Slack RTM API, RTM's Rate Limits
-
rtmStart
Creates an RTM API client using `/rtm.start`.- Throws:
IOException
- See Also:
- Slack RTM API, RTM's Rate Limits
-
rtmStart
Creates an RTM API client using `/rtm.start`.- Throws:
IOException
- See Also:
- Slack RTM API, RTM's Rate Limits
-
statusLegacy
Creates a Status API client. -
status
-
scim
Creates a SCIM API client. -
scim
-
scimAsync
-
scimStats
-
scimStats
-
audit
Creates a Audit Logs API client. -
audit
-
auditAsync
-
auditStats
-
auditStats
-
methods
Creates a Methods API client. -
methods
-
methods
-
methodsAsync
-
methodsAsync
-
methodsAsync
-
methodsStats
-
methodsStats
-