Package com.slack.api.util.http
Class SlackHttpClient
- java.lang.Object
-
- com.slack.api.util.http.SlackHttpClient
-
- All Implemented Interfaces:
AutoCloseable
public class SlackHttpClient extends Object implements AutoCloseable
The Slack API HTTP Client.
-
-
Constructor Summary
Constructors Constructor Description SlackHttpClient()
SlackHttpClient(SlackConfig config, Map<String,String> userAgentCustomInfo)
SlackHttpClient(Map<String,String> userAgentCustomInfo)
SlackHttpClient(okhttp3.OkHttpClient okHttpClient)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static okhttp3.OkHttpClient
buildOkHttpClient(SlackConfig config)
static okhttp3.OkHttpClient
buildOkHttpClient(SlackConfig config, Map<String,String> userAgentCustomInfo)
static SlackHttpClient
buildSlackHttpClient(SlackConfig config)
static SlackHttpClient
buildSlackHttpClient(SlackConfig config, Map<String,String> userAgentCustomInfo)
void
close()
okhttp3.Response
delete(okhttp3.Request.Builder requestBuilder)
okhttp3.Response
get(String url, Map<String,String> query, String token)
SlackConfig
getConfig()
okhttp3.Response
patchCamelCaseJsonBodyWithBearerHeader(String url, String token, Object obj)
okhttp3.Response
postCamelCaseJsonBodyWithBearerHeader(String url, String token, Object obj)
okhttp3.Response
postForm(String url, okhttp3.FormBody formBody)
okhttp3.Response
postFormWithAuthorizationHeader(String url, String authorizationHeader, okhttp3.FormBody formBody)
okhttp3.Response
postFormWithBearerHeader(String url, String token, okhttp3.FormBody formBody)
okhttp3.Response
postJsonBody(String url, Object obj)
okhttp3.Response
postMultipart(String url, String token, okhttp3.MultipartBody multipartBody)
okhttp3.Response
putCamelCaseJsonBodyWithBearerHeader(String url, String token, Object obj)
void
runHttpResponseListeners(okhttp3.Response response, String body)
void
setConfig(SlackConfig config)
-
-
-
Constructor Detail
-
SlackHttpClient
public SlackHttpClient()
-
SlackHttpClient
public SlackHttpClient(SlackConfig config, Map<String,String> userAgentCustomInfo)
-
SlackHttpClient
public SlackHttpClient(okhttp3.OkHttpClient okHttpClient)
-
-
Method Detail
-
buildSlackHttpClient
public static SlackHttpClient buildSlackHttpClient(SlackConfig config)
-
buildSlackHttpClient
public static SlackHttpClient buildSlackHttpClient(SlackConfig config, Map<String,String> userAgentCustomInfo)
-
buildOkHttpClient
public static okhttp3.OkHttpClient buildOkHttpClient(SlackConfig config)
-
buildOkHttpClient
public static okhttp3.OkHttpClient buildOkHttpClient(SlackConfig config, Map<String,String> userAgentCustomInfo)
-
close
public void close() throws Exception
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-
getConfig
public SlackConfig getConfig()
-
setConfig
public void setConfig(SlackConfig config)
-
get
public okhttp3.Response get(String url, Map<String,String> query, String token) throws IOException
- Throws:
IOException
-
postMultipart
public okhttp3.Response postMultipart(String url, String token, okhttp3.MultipartBody multipartBody) throws IOException
- Throws:
IOException
-
postForm
public okhttp3.Response postForm(String url, okhttp3.FormBody formBody) throws IOException
- Throws:
IOException
-
postFormWithBearerHeader
public okhttp3.Response postFormWithBearerHeader(String url, String token, okhttp3.FormBody formBody) throws IOException
- Throws:
IOException
-
postFormWithAuthorizationHeader
public okhttp3.Response postFormWithAuthorizationHeader(String url, String authorizationHeader, okhttp3.FormBody formBody) throws IOException
- Throws:
IOException
-
postJsonBody
public okhttp3.Response postJsonBody(String url, Object obj) throws IOException
- Throws:
IOException
-
postCamelCaseJsonBodyWithBearerHeader
public okhttp3.Response postCamelCaseJsonBodyWithBearerHeader(String url, String token, Object obj) throws IOException
- Throws:
IOException
-
patchCamelCaseJsonBodyWithBearerHeader
public okhttp3.Response patchCamelCaseJsonBodyWithBearerHeader(String url, String token, Object obj) throws IOException
- Throws:
IOException
-
putCamelCaseJsonBodyWithBearerHeader
public okhttp3.Response putCamelCaseJsonBodyWithBearerHeader(String url, String token, Object obj) throws IOException
- Throws:
IOException
-
delete
public okhttp3.Response delete(okhttp3.Request.Builder requestBuilder) throws IOException
- Throws:
IOException
-
runHttpResponseListeners
public void runHttpResponseListeners(okhttp3.Response response, String body)
-
-