Package jenkins.plugins.slack
Class StandardSlackService
- java.lang.Object
-
- jenkins.plugins.slack.StandardSlackService
-
- All Implemented Interfaces:
SlackService
public class StandardSlackService extends Object implements SlackService
-
-
Constructor Summary
Constructors Constructor Description StandardSlackService(String baseUrl, String teamDomain, boolean botUser, String roomId, boolean replyBroadcast, String populatedToken)
Deprecated.StandardSlackService(String baseUrl, String teamDomain, String authTokenCredentialId, boolean botUser, String roomId)
Deprecated.StandardSlackService(String baseUrl, String teamDomain, String token, String authTokenCredentialId, boolean botUser, String roomId)
Deprecated.StandardSlackService(String baseUrl, String teamDomain, String token, String authTokenCredentialId, boolean botUser, String roomId, boolean replyBroadcast)
Deprecated.StandardSlackService(StandardSlackServiceBuilder standardSlackServiceBuilder)
Default constructor
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addReaction(String channelId, String timestamp, String emojiName)
Add an emoji reaction to a messagestatic StandardSlackServiceBuilder
builder()
protected org.apache.http.impl.client.CloseableHttpClient
getHttpClient()
String
getResponseString()
boolean
publish(String message)
boolean
publish(String message, String color)
boolean
publish(String message, String color, String timestamp)
boolean
publish(String message, net.sf.json.JSONArray attachments, String color)
boolean
publish(String message, net.sf.json.JSONArray attachments, String color, String timestamp)
boolean
publish(SlackRequest slackRequest)
boolean
removeReaction(String channelId, String timestamp, String emojiName)
Remove an emoji reaction from a message.boolean
upload(FilePath workspace, String artifactIncludes, TaskListener log)
Make an HTTP POST upload to the Slack API
-
-
-
Constructor Detail
-
StandardSlackService
@Deprecated public StandardSlackService(String baseUrl, String teamDomain, String authTokenCredentialId, boolean botUser, String roomId)
Deprecated.- Parameters:
baseUrl
- is a base URLteamDomain
- is a teamDomainauthTokenCredentialId
-botUser
- is a bot UserroomId
- is a room Id
-
StandardSlackService
@Deprecated public StandardSlackService(String baseUrl, String teamDomain, String token, String authTokenCredentialId, boolean botUser, String roomId)
Deprecated.- Parameters:
baseUrl
- is a base URLteamDomain
- is a teamDomaintoken
- is a tokenauthTokenCredentialId
-botUser
- is a bot UserroomId
- is a room Id
-
StandardSlackService
@Deprecated public StandardSlackService(String baseUrl, String teamDomain, String token, String authTokenCredentialId, boolean botUser, String roomId, boolean replyBroadcast)
Deprecated.- Parameters:
baseUrl
- is a base URLteamDomain
- is a teamDomaintoken
- is a tokenauthTokenCredentialId
-botUser
- is a bot UserroomId
- is a room IdreplyBroadcast
- is a replyBroadcast
-
StandardSlackService
@Deprecated public StandardSlackService(String baseUrl, String teamDomain, boolean botUser, String roomId, boolean replyBroadcast, String populatedToken)
Deprecated.- Parameters:
baseUrl
- is a base URLteamDomain
- is a teamDomainbotUser
- is a bot UserroomId
- is a room IdreplyBroadcast
- is replayBroadcastpopulatedToken
- is populated Token
-
StandardSlackService
public StandardSlackService(StandardSlackServiceBuilder standardSlackServiceBuilder)
Default constructor- Parameters:
standardSlackServiceBuilder
- is a StandardSlackServiceBuilder
-
-
Method Detail
-
builder
public static StandardSlackServiceBuilder builder()
-
getResponseString
public String getResponseString()
- Specified by:
getResponseString
in interfaceSlackService
-
publish
public boolean publish(String message)
- Specified by:
publish
in interfaceSlackService
-
upload
public boolean upload(FilePath workspace, String artifactIncludes, TaskListener log)
Make an HTTP POST upload to the Slack API- Specified by:
upload
in interfaceSlackService
- Parameters:
workspace
- - job workspaceartifactIncludes
- - includes comma-separated Ant-style globs as perUtil.createFileSet(File, String, String)
using/
as a path separator;log
- - print log stream- Returns:
- boolean indicating whether the API request succeeded
-
publish
public boolean publish(SlackRequest slackRequest)
- Specified by:
publish
in interfaceSlackService
-
publish
public boolean publish(String message, String color)
- Specified by:
publish
in interfaceSlackService
-
publish
public boolean publish(String message, net.sf.json.JSONArray attachments, String color)
- Specified by:
publish
in interfaceSlackService
-
publish
public boolean publish(String message, String color, String timestamp)
- Specified by:
publish
in interfaceSlackService
-
publish
public boolean publish(String message, net.sf.json.JSONArray attachments, String color, String timestamp)
- Specified by:
publish
in interfaceSlackService
-
addReaction
public boolean addReaction(String channelId, String timestamp, String emojiName)
Add an emoji reaction to a message- Specified by:
addReaction
in interfaceSlackService
- Parameters:
channelId
- - Slack's internal channel id (i.e. what's returned in a `chat.postMessage` response)timestamp
- - Timestamp identifying the messageemojiName
- - The name of the emoji to add in reaction to the message (no colons)- Returns:
- boolean indicating whether the API request succeeded
-
removeReaction
public boolean removeReaction(String channelId, String timestamp, String emojiName)
Remove an emoji reaction from a message.- Specified by:
removeReaction
in interfaceSlackService
- Parameters:
channelId
- - Slack's internal channel id (i.e. what's returned in a `chat.postMessage` response)timestamp
- - Timestamp identifying the messageemojiName
- - The name of the emoji to add in reaction to the message (no colons)- Returns:
- boolean indicating whether the API request succeeded
-
getHttpClient
protected org.apache.http.impl.client.CloseableHttpClient getHttpClient()
-
-