-
Notifications
You must be signed in to change notification settings - Fork 218
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
5 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
...api-model/src/main/java/com/slack/api/model/event/MessageChannelConvertToPublicEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.slack.api.model.event; | ||
|
||
import lombok.Data; | ||
|
||
/** | ||
* https://api.slack.com/events/message/channel_convert_to_public | ||
*/ | ||
@Data | ||
public class MessageChannelConvertToPublicEvent implements Event { | ||
|
||
public static final String TYPE_NAME = "message"; | ||
public static final String SUBTYPE_NAME = "channel_convert_to_public"; | ||
|
||
private final String type = TYPE_NAME; | ||
private final String subtype = SUBTYPE_NAME; | ||
|
||
private String user; | ||
private String text; | ||
private String channel; | ||
private String ts; | ||
private String eventTs; | ||
private String channelType; // "channel" | ||
} |
53 changes: 53 additions & 0 deletions
53
...el/src/test/java/test_locally/api/model/event/MessageChannelConvertToPublicEventTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package test_locally.api.model.event; | ||
|
||
import com.slack.api.model.event.MessageChannelConvertToPublicEvent; | ||
import org.junit.Test; | ||
import test_locally.unit.GsonFactory; | ||
|
||
import static org.hamcrest.CoreMatchers.is; | ||
import static org.hamcrest.MatcherAssert.assertThat; | ||
|
||
public class MessageChannelConvertToPublicEventTest { | ||
|
||
@Test | ||
public void typeName() { | ||
assertThat(MessageChannelConvertToPublicEvent.TYPE_NAME, is("message")); | ||
assertThat(MessageChannelConvertToPublicEvent.SUBTYPE_NAME, is("channel_convert_to_public")); | ||
} | ||
|
||
@Test | ||
public void deserialize_simple() { | ||
String json = "{\n" + | ||
" \"subtype\": \"channel_convert_to_public\",\n" + | ||
" \"user\": \"W013QGS7BPF\",\n" + | ||
" \"text\": \"made this channel *public*. Any member in this workspace can see and join it.\",\n" + | ||
" \"type\": \"message\",\n" + | ||
" \"ts\": \"1728976211.166339\",\n" + | ||
" \"channel\": \"C07RP9QHR2S\",\n" + | ||
" \"event_ts\": \"1728976211.166339\",\n" + | ||
" \"channel_type\": \"channel\"\n" + | ||
"}"; | ||
MessageChannelConvertToPublicEvent event = GsonFactory.createSnakeCase(true, true).fromJson(json, MessageChannelConvertToPublicEvent.class); | ||
assertThat(event.getType(), is("message")); | ||
assertThat(event.getSubtype(), is("channel_convert_to_public")); | ||
assertThat(event.getUser(), is("W013QGS7BPF")); | ||
} | ||
|
||
@Test | ||
public void deserialize_api_document() { | ||
String json = "{\n" + | ||
" \"type\": \"message\",\n" + | ||
" \"subtype\": \"channel_convert_to_public\",\n" + | ||
" \"ts\": \"1723680078.026719\",\n" + | ||
" \"text\": \"Made this channel public. Any member in this workspace can see and join it.\",\n" + | ||
" \"user\": \"U123ABC456\",\n" + | ||
" \"channel\": \"C123ABC456\",\n" + | ||
" \"event_ts\": \"1614215651.001300\",\n" + | ||
" \"channel_type\": \"channel\"\n" + | ||
"}"; | ||
MessageChannelConvertToPublicEvent event = GsonFactory.createSnakeCase(true, true).fromJson(json, MessageChannelConvertToPublicEvent.class); | ||
assertThat(event.getType(), is("message")); | ||
assertThat(event.getSubtype(), is("channel_convert_to_public")); | ||
assertThat(event.getUser(), is("U123ABC456")); | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
...n/java/com/slack/api/app_backend/events/handler/MessageChannelConvertToPublicHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.slack.api.app_backend.events.handler; | ||
|
||
import com.slack.api.app_backend.events.EventHandler; | ||
import com.slack.api.app_backend.events.payload.MessageChannelConvertToPublicPayload; | ||
import com.slack.api.model.event.MessageChannelConvertToPublicEvent; | ||
|
||
public abstract class MessageChannelConvertToPublicHandler extends EventHandler<MessageChannelConvertToPublicPayload> { | ||
|
||
@Override | ||
public String getEventType() { | ||
return MessageChannelConvertToPublicEvent.TYPE_NAME; | ||
} | ||
|
||
@Override | ||
public String getEventSubtype() { | ||
return MessageChannelConvertToPublicEvent.SUBTYPE_NAME; | ||
} | ||
} |
25 changes: 25 additions & 0 deletions
25
...n/java/com/slack/api/app_backend/events/payload/MessageChannelConvertToPublicPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.slack.api.app_backend.events.payload; | ||
|
||
import com.slack.api.model.event.MessageChannelConvertToPublicEvent; | ||
import lombok.Data; | ||
|
||
import java.util.List; | ||
|
||
@Data | ||
public class MessageChannelConvertToPublicPayload implements EventsApiPayload<MessageChannelConvertToPublicEvent> { | ||
|
||
private String token; | ||
private String enterpriseId; | ||
private String teamId; | ||
private String apiAppId; | ||
private String type; | ||
private List<String> authedUsers; | ||
private List<String> authedTeams; | ||
private List<Authorization> authorizations; | ||
private boolean isExtSharedChannel; | ||
private String eventId; | ||
private Integer eventTime; | ||
private String eventContext; | ||
|
||
private MessageChannelConvertToPublicEvent event; | ||
} |
1 change: 0 additions & 1 deletion
1
...ain/java/com/slack/api/app_backend/events/payload/SharedChannelInviteReceivedPayload.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters