Skip to content
Open
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
1 change: 1 addition & 0 deletions .java-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.8
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ If you're not familiar with Java 8's `CompletableFuture` API, know that you can
- [@mlr46](https://github.com/mlr46) | [:computer:](https://github.com/HubSpot/slack-client/commits?author=mlr46)
- [@mindspin311](https://github.com/mindspin311) | [:computer:](https://github.com/HubSpot/slack-client/commits?author=mindspin311)
- [@Ulya0302](https://github.com/Ulya0302) | [:computer:](https://github.com/HubSpot/slack-client/commits?author=Ulya0302)
- [@bdros](https://github.com/bdros) | [:computer:](https://github.com/HubSpot/slack-client/commits?author=bdros)

## License

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.hubspot.slack.client.methods.interceptor;

public interface HasToken {

String getToken();
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
public abstract class AbstractChatMessageParams implements MessageParams {
@JsonProperty("channel")
public abstract String getChannelId();
public abstract String getToken();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you need this? I would have expected that given that this implements HasToken via MessageParams, you shouldn't need to explicitly define it here, right? Failing that, seems like it should have an @Override tag

public abstract Optional<String> getText();
public abstract Optional<String> getThreadTs();
public abstract Optional<String> getUsername();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.hubspot.slack.client.methods.params.chat;

import com.hubspot.slack.client.methods.interceptor.HasToken;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
Expand All @@ -10,7 +11,7 @@
import com.hubspot.slack.client.models.Attachment;
import com.hubspot.slack.client.models.blocks.Block;

public interface MessageParams extends HasChannel {
public interface MessageParams extends HasChannel, HasToken {
Optional<String> getText();

List<Attachment> getAttachments();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ public class MessageParamsTest {
@Test
public void itBuildsWithAttachmentsAndNoText() {
ChatPostEphemeralMessageParams.builder()
.setToken("testToken")
.setChannelId("testChannelId")
.setUserToSendTo("testUserId")
.addAttachments(Attachment.builder().build())
.build();

ChatPostMessageParams.builder()
.setToken("testToken")
.setChannelId("testChannelId")
.addAttachments(Attachment.builder().build())
.build();

ChatUpdateMessageParams.builder()
.setToken("testToken")
.setTs("testTs")
.setChannelId("testChannelId")
.addAttachments(Attachment.builder().build())
Expand All @@ -32,17 +35,20 @@ public void itBuildsWithAttachmentsAndNoText() {
@Test
public void itBuildsWithTextAndNoAttachments() {
ChatPostEphemeralMessageParams.builder()
.setToken("testToken")
.setChannelId("testChannelId")
.setUserToSendTo("testUserId")
.setText("testText")
.build();

ChatPostMessageParams.builder()
.setToken("testToken")
.setChannelId("testChannelId")
.setText("testText")
.build();

ChatUpdateMessageParams.builder()
.setToken("testToken")
.setTs("testTs")
.setChannelId("testChannelId")
.setText("testText")
Expand All @@ -55,6 +61,7 @@ public void itFailsToBuildWithoutTextOrAttachments() {

try {
ChatPostEphemeralMessageParams.builder()
.setToken("testToken")
.setChannelId("testChannelId")
.setUserToSendTo("testUserId")
.build();
Expand All @@ -65,6 +72,7 @@ public void itFailsToBuildWithoutTextOrAttachments() {

try {
ChatPostMessageParams.builder()
.setToken("testToken")
.setChannelId("testChannelId")
.build();
success = false;
Expand All @@ -74,6 +82,7 @@ public void itFailsToBuildWithoutTextOrAttachments() {

try {
ChatUpdateMessageParams.builder()
.setToken("testToken")
.setTs("testTs")
.setChannelId("testChannelId")
.build();
Expand Down