Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions json-logs/samples/api/chat.appendStream.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ok": false,
"error": "",
"needed": "",
"provided": "",
"channel": "C00000000",
"ts": "0000000000.000000"
}
8 changes: 8 additions & 0 deletions json-logs/samples/api/chat.startStream.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ok": false,
"ts": "0000000000.000000",
"error": "",
"needed": "",
"provided": "",
"channel": "C00000000"
}
7 changes: 7 additions & 0 deletions json-logs/samples/api/chat.stopStream.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"ok": false,
"error": "",
"needed": "",
"provided": ""
}

3 changes: 3 additions & 0 deletions metadata/web-api/rate_limit_tiers.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"channels.setPurpose": "Tier2",
"channels.setTopic": "Tier2",
"channels.unarchive": "Tier2",
"chat.appendStream": "Tier4",
"chat.delete": "Tier3",
"chat.deleteScheduledMessage": "Tier3",
"chat.getPermalink": "SpecialTier_chat_getPermalink",
Expand All @@ -158,6 +159,8 @@
"chat.postMessage": "SpecialTier_chat_postMessage",
"chat.scheduleMessage": "Tier3",
"chat.scheduledMessages.list": "Tier3",
"chat.startStream": "Tier2",
"chat.stopStream": "Tier2",
"chat.unfurl": "Tier3",
"chat.update": "Tier3",
"conversations.acceptSharedInvite": "Tier1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,10 @@ CompletableFuture<AdminConversationsWhitelistListGroupsLinkedToChannelResponse>
// chat
// ------------------------------

CompletableFuture<ChatAppendStreamResponse> chatAppendStream(ChatAppendStreamRequest req);

CompletableFuture<ChatAppendStreamResponse> chatAppendStream(RequestConfigurator<ChatAppendStreamRequest.ChatAppendStreamRequestBuilder> req);

CompletableFuture<ChatGetPermalinkResponse> chatGetPermalink(ChatGetPermalinkRequest req);

CompletableFuture<ChatGetPermalinkResponse> chatGetPermalink(RequestConfigurator<ChatGetPermalinkRequest.ChatGetPermalinkRequestBuilder> req);
Expand Down Expand Up @@ -967,6 +971,14 @@ CompletableFuture<AdminConversationsWhitelistListGroupsLinkedToChannelResponse>

CompletableFuture<ChatScheduleMessageResponse> chatScheduleMessage(RequestConfigurator<ChatScheduleMessageRequest.ChatScheduleMessageRequestBuilder> req);

CompletableFuture<ChatStartStreamResponse> chatStartStream(ChatStartStreamRequest req);

CompletableFuture<ChatStartStreamResponse> chatStartStream(RequestConfigurator<ChatStartStreamRequest.ChatStartStreamRequestBuilder> req);

CompletableFuture<ChatStopStreamResponse> chatStopStream(ChatStopStreamRequest req);

CompletableFuture<ChatStopStreamResponse> chatStopStream(RequestConfigurator<ChatStopStreamRequest.ChatStopStreamRequestBuilder> req);

CompletableFuture<ChatUpdateResponse> chatUpdate(ChatUpdateRequest req);

CompletableFuture<ChatUpdateResponse> chatUpdate(RequestConfigurator<ChatUpdateRequest.ChatUpdateRequestBuilder> req);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,16 @@ private Methods() {
// chat
// ------------------------------

public static final String CHAT_APPEND_STREAM = "chat.appendStream";
public static final String CHAT_DELETE = "chat.delete";
public static final String CHAT_DELETE_SCHEDULED_MESSAGE = "chat.deleteScheduledMessage";
public static final String CHAT_GET_PERMALINK = "chat.getPermalink";
public static final String CHAT_ME_MESSAGE = "chat.meMessage";
public static final String CHAT_POST_EPHEMERAL = "chat.postEphemeral";
public static final String CHAT_POST_MESSAGE = "chat.postMessage";
public static final String CHAT_SCHEDULE_MESSAGE = "chat.scheduleMessage";
public static final String CHAT_START_STREAM = "chat.startStream";
public static final String CHAT_STOP_STREAM = "chat.stopStream";
public static final String CHAT_UNFURL = "chat.unfurl";
public static final String CHAT_UPDATE = "chat.update";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,10 @@ AdminUsergroupsRemoveChannelsResponse adminUsergroupsRemoveChannels(
// chat
// ------------------------------

ChatAppendStreamResponse chatAppendStream(ChatAppendStreamRequest req) throws IOException, SlackApiException;

ChatAppendStreamResponse chatAppendStream(RequestConfigurator<ChatAppendStreamRequest.ChatAppendStreamRequestBuilder> req) throws IOException, SlackApiException;

ChatGetPermalinkResponse chatGetPermalink(ChatGetPermalinkRequest req) throws IOException, SlackApiException;

ChatGetPermalinkResponse chatGetPermalink(RequestConfigurator<ChatGetPermalinkRequest.ChatGetPermalinkRequestBuilder> req) throws IOException, SlackApiException;
Expand Down Expand Up @@ -1253,6 +1257,14 @@ AdminUsergroupsRemoveChannelsResponse adminUsergroupsRemoveChannels(

ChatScheduleMessageResponse chatScheduleMessage(RequestConfigurator<ChatScheduleMessageRequest.ChatScheduleMessageRequestBuilder> req) throws IOException, SlackApiException;

ChatStartStreamResponse chatStartStream(ChatStartStreamRequest req) throws IOException, SlackApiException;

ChatStartStreamResponse chatStartStream(RequestConfigurator<ChatStartStreamRequest.ChatStartStreamRequestBuilder> req) throws IOException, SlackApiException;

ChatStopStreamResponse chatStopStream(ChatStopStreamRequest req) throws IOException, SlackApiException;

ChatStopStreamResponse chatStopStream(RequestConfigurator<ChatStopStreamRequest.ChatStopStreamRequestBuilder> req) throws IOException, SlackApiException;

ChatUpdateResponse chatUpdate(ChatUpdateRequest req) throws IOException, SlackApiException;

ChatUpdateResponse chatUpdate(RequestConfigurator<ChatUpdateRequest.ChatUpdateRequestBuilder> req) throws IOException, SlackApiException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
/**
* The comprehensive list of Slack Web API rate limits.
*
* @see <a href="https://docs.slack.dev/apis/web-api/rate-limits">api.slack.com document</a>
* @see <a href="https://docs.slack.dev/apis/web-api/rate-limits">API reference</a>
*/
@Slf4j
public class MethodsRateLimits {
Expand Down Expand Up @@ -257,13 +257,16 @@ public static void setRateLimitTier(String methodName, MethodsRateLimitTier tier
setRateLimitTier(CANVASES_SECTIONS_LOOKUP, Tier3);
setRateLimitTier(CONVERSATIONS_CANVASES_CREATE, Tier2);

setRateLimitTier(CHAT_APPEND_STREAM, Tier4);
setRateLimitTier(CHAT_DELETE, Tier3);
setRateLimitTier(CHAT_DELETE_SCHEDULED_MESSAGE, Tier3);
setRateLimitTier(CHAT_GET_PERMALINK, SpecialTier_chat_getPermalink);
setRateLimitTier(CHAT_ME_MESSAGE, Tier3);
setRateLimitTier(CHAT_POST_EPHEMERAL, Tier4);
setRateLimitTier(CHAT_POST_MESSAGE, SpecialTier_chat_postMessage);
setRateLimitTier(CHAT_SCHEDULE_MESSAGE, Tier3);
setRateLimitTier(CHAT_START_STREAM, Tier2);
setRateLimitTier(CHAT_STOP_STREAM, Tier2);
setRateLimitTier(CHAT_UNFURL, Tier3);
setRateLimitTier(CHAT_UPDATE, Tier3);
setRateLimitTier(CHAT_SCHEDULED_MESSAGES_LIST, Tier3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1447,10 +1447,11 @@ public static FormBody.Builder toForm(ChannelsUnarchiveRequest req) {
return form;
}

public static FormBody.Builder toForm(ChatGetPermalinkRequest req) {
public static FormBody.Builder toForm(ChatAppendStreamRequest req) {
FormBody.Builder form = new FormBody.Builder();
setIfNotNull("channel", req.getChannel(), form);
setIfNotNull("message_ts", req.getMessageTs(), form);
setIfNotNull("ts", req.getTs(), form);
setIfNotNull("markdown_text", req.getMarkdownText(), form);
return form;
}

Expand All @@ -1470,6 +1471,13 @@ public static FormBody.Builder toForm(ChatDeleteScheduledMessageRequest req) {
return form;
}

public static FormBody.Builder toForm(ChatGetPermalinkRequest req) {
FormBody.Builder form = new FormBody.Builder();
setIfNotNull("channel", req.getChannel(), form);
setIfNotNull("message_ts", req.getMessageTs(), form);
return form;
}

public static FormBody.Builder toForm(ChatMeMessageRequest req) {
FormBody.Builder form = new FormBody.Builder();
setIfNotNull("channel", req.getChannel(), form);
Expand Down Expand Up @@ -1619,6 +1627,40 @@ public static FormBody.Builder toForm(ChatPostMessageRequest req) {
return form;
}

public static FormBody.Builder toForm(ChatStartStreamRequest req) {
FormBody.Builder form = new FormBody.Builder();
setIfNotNull("channel", req.getChannel(), form);
setIfNotNull("thread_ts", req.getThreadTs(), form);
setIfNotNull("markdown_text", req.getMarkdownText(), form);
setIfNotNull("recipient_user_id", req.getRecipientUserId(), form);
setIfNotNull("recipient_team_id", req.getRecipientTeamId(), form);
return form;
}

public static FormBody.Builder toForm(ChatStopStreamRequest req) {
FormBody.Builder form = new FormBody.Builder();
setIfNotNull("channel", req.getChannel(), form);
setIfNotNull("ts", req.getTs(), form);
setIfNotNull("markdown_text", req.getMarkdownText(), form);

if (req.getMetadataAsString() != null) {
form.add("metadata", req.getMetadataAsString());
} else if (req.getMetadata() != null) {
String json = GSON.toJson(req.getMetadata());
form.add("metadata", json);
}
if (req.getBlocksAsString() != null) {
form.add("blocks", req.getBlocksAsString());
} else if (req.getBlocks() != null) {
String json = getJsonWithGsonAnonymInnerClassHandling(req.getBlocks());
form.add("blocks", json);
}
if (req.getBlocksAsString() != null && req.getBlocks() != null) {
log.warn("Although you set both blocksAsString and blocks, only blocksAsString was used.");
}
return form;
}

public static FormBody.Builder toForm(ChatUpdateRequest req) {
warnIfEitherTextOrAttachmentFallbackIsMissing(
"chat.update",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1595,13 +1595,13 @@ public CompletableFuture<CanvasesSectionsLookupResponse> canvasesSectionsLookup(
}

@Override
public CompletableFuture<ChatGetPermalinkResponse> chatGetPermalink(ChatGetPermalinkRequest req) {
return executor.execute(CHAT_GET_PERMALINK, toMap(req), () -> methods.chatGetPermalink(req));
public CompletableFuture<ChatAppendStreamResponse> chatAppendStream(ChatAppendStreamRequest req) {
return executor.execute(CHAT_APPEND_STREAM, toMap(req), () -> methods.chatAppendStream(req));
}

@Override
public CompletableFuture<ChatGetPermalinkResponse> chatGetPermalink(RequestConfigurator<ChatGetPermalinkRequest.ChatGetPermalinkRequestBuilder> req) {
return chatGetPermalink(req.configure(ChatGetPermalinkRequest.builder()).build());
public CompletableFuture<ChatAppendStreamResponse> chatAppendStream(RequestConfigurator<ChatAppendStreamRequest.ChatAppendStreamRequestBuilder> req) {
return chatAppendStream(req.configure(ChatAppendStreamRequest.builder()).build());
}

@Override
Expand All @@ -1624,6 +1624,16 @@ public CompletableFuture<ChatDeleteScheduledMessageResponse> chatDeleteScheduled
return chatDeleteScheduledMessage(req.configure(ChatDeleteScheduledMessageRequest.builder()).build());
}

@Override
public CompletableFuture<ChatGetPermalinkResponse> chatGetPermalink(ChatGetPermalinkRequest req) {
return executor.execute(CHAT_GET_PERMALINK, toMap(req), () -> methods.chatGetPermalink(req));
}

@Override
public CompletableFuture<ChatGetPermalinkResponse> chatGetPermalink(RequestConfigurator<ChatGetPermalinkRequest.ChatGetPermalinkRequestBuilder> req) {
return chatGetPermalink(req.configure(ChatGetPermalinkRequest.builder()).build());
}

@Override
public CompletableFuture<ChatMeMessageResponse> chatMeMessage(ChatMeMessageRequest req) {
return executor.execute(CHAT_ME_MESSAGE, toMap(req), () -> methods.chatMeMessage(req));
Expand Down Expand Up @@ -1667,6 +1677,26 @@ public CompletableFuture<ChatScheduleMessageResponse> chatScheduleMessage(Reques
return chatScheduleMessage(req.configure(ChatScheduleMessageRequest.builder()).build());
}

@Override
public CompletableFuture<ChatStartStreamResponse> chatStartStream(ChatStartStreamRequest req) {
return executor.execute(CHAT_START_STREAM, toMap(req), () -> methods.chatStartStream(req));
}

@Override
public CompletableFuture<ChatStartStreamResponse> chatStartStream(RequestConfigurator<ChatStartStreamRequest.ChatStartStreamRequestBuilder> req) {
return chatStartStream(req.configure(ChatStartStreamRequest.builder()).build());
}

@Override
public CompletableFuture<ChatStopStreamResponse> chatStopStream(ChatStopStreamRequest req) {
return executor.execute(CHAT_STOP_STREAM, toMap(req), () -> methods.chatStopStream(req));
}

@Override
public CompletableFuture<ChatStopStreamResponse> chatStopStream(RequestConfigurator<ChatStopStreamRequest.ChatStopStreamRequestBuilder> req) {
return chatStopStream(req.configure(ChatStopStreamRequest.builder()).build());
}

@Override
public CompletableFuture<ChatUpdateResponse> chatUpdate(ChatUpdateRequest req) {
return executor.execute(CHAT_UPDATE, toMap(req), () -> methods.chatUpdate(req));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1832,13 +1832,13 @@ public ChannelsUnarchiveResponse channelsUnarchive(RequestConfigurator<ChannelsU
}

@Override
public ChatGetPermalinkResponse chatGetPermalink(ChatGetPermalinkRequest req) throws IOException, SlackApiException {
return postFormWithTokenAndParseResponse(toForm(req), Methods.CHAT_GET_PERMALINK, getToken(req), ChatGetPermalinkResponse.class);
public ChatAppendStreamResponse chatAppendStream(ChatAppendStreamRequest req) throws IOException, SlackApiException {
return postFormWithTokenAndParseResponse(toForm(req), Methods.CHAT_APPEND_STREAM, getToken(req), ChatAppendStreamResponse.class);
}

@Override
public ChatGetPermalinkResponse chatGetPermalink(RequestConfigurator<ChatGetPermalinkRequest.ChatGetPermalinkRequestBuilder> req) throws IOException, SlackApiException {
return chatGetPermalink(req.configure(ChatGetPermalinkRequest.builder()).build());
public ChatAppendStreamResponse chatAppendStream(RequestConfigurator<ChatAppendStreamRequest.ChatAppendStreamRequestBuilder> req) throws IOException, SlackApiException {
return chatAppendStream(req.configure(ChatAppendStreamRequest.builder()).build());
}

@Override
Expand All @@ -1861,6 +1861,17 @@ public ChatDeleteScheduledMessageResponse chatDeleteScheduledMessage(RequestConf
return chatDeleteScheduledMessage(req.configure(ChatDeleteScheduledMessageRequest.builder()).build());
}

@Override
public ChatGetPermalinkResponse chatGetPermalink(ChatGetPermalinkRequest req) throws IOException, SlackApiException {
return postFormWithTokenAndParseResponse(toForm(req), Methods.CHAT_GET_PERMALINK, getToken(req), ChatGetPermalinkResponse.class);
}

@Override
public ChatGetPermalinkResponse chatGetPermalink(RequestConfigurator<ChatGetPermalinkRequest.ChatGetPermalinkRequestBuilder> req) throws IOException, SlackApiException {
return chatGetPermalink(req.configure(ChatGetPermalinkRequest.builder()).build());
}


@Override
public ChatMeMessageResponse chatMeMessage(ChatMeMessageRequest req) throws IOException, SlackApiException {
return postFormWithTokenAndParseResponse(toForm(req), Methods.CHAT_ME_MESSAGE, getToken(req), ChatMeMessageResponse.class);
Expand Down Expand Up @@ -1901,6 +1912,26 @@ public ChatScheduleMessageResponse chatScheduleMessage(RequestConfigurator<ChatS
return chatScheduleMessage(req.configure(ChatScheduleMessageRequest.builder()).build());
}

@Override
public ChatStartStreamResponse chatStartStream(ChatStartStreamRequest req) throws IOException, SlackApiException {
return postFormWithTokenAndParseResponse(toForm(req), Methods.CHAT_START_STREAM, getToken(req), ChatStartStreamResponse.class);
}

@Override
public ChatStartStreamResponse chatStartStream(RequestConfigurator<ChatStartStreamRequest.ChatStartStreamRequestBuilder> req) throws IOException, SlackApiException {
return chatStartStream(req.configure(ChatStartStreamRequest.builder()).build());
}

@Override
public ChatStopStreamResponse chatStopStream(ChatStopStreamRequest req) throws IOException, SlackApiException {
return postFormWithTokenAndParseResponse(toForm(req), Methods.CHAT_STOP_STREAM, getToken(req), ChatStopStreamResponse.class);
}

@Override
public ChatStopStreamResponse chatStopStream(RequestConfigurator<ChatStopStreamRequest.ChatStopStreamRequestBuilder> req) throws IOException, SlackApiException {
return chatStopStream(req.configure(ChatStopStreamRequest.builder()).build());
}

@Override
public ChatUpdateResponse chatUpdate(ChatUpdateRequest req) throws IOException, SlackApiException {
return postFormWithTokenAndParseResponse(toForm(req), Methods.CHAT_UPDATE, getToken(req), ChatUpdateResponse.class);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.slack.api.methods.request.chat;

import com.slack.api.methods.SlackApiRequest;
import lombok.Builder;
import lombok.Data;

/**
* https://docs.slack.dev/reference/methods/chat.appendStream
*/
@Data
@Builder
public class ChatAppendStreamRequest implements SlackApiRequest {

/**
* Authentication token. Requires scope: `chat:write`
*/
private String token;

/**
* An encoded ID that represents a channel, private group, or DM.
*/
private String channel;

/**
* The timestamp of the streaming message.
*/
private String ts;

/**
* Accepts message text formatted in markdown. Limit this field to 12,000 characters. This text is what will be appended to the message received so far.
*/
private String markdownText;
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class ChatPostMessageRequest implements SlackApiRequest {
private String token;

/**
* aSet your bot's user name.
* Set your bot's user name.
* Must be used in conjunction with `as_user` set to false, otherwise ignored. See [authorship](#authorship) below.
*/
private String username;
Expand Down
Loading