-
Notifications
You must be signed in to change notification settings - Fork 229
Adding ping message and pong event to RTM client #459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
seratch
merged 5 commits into
slackapi:master
from
eidosmontreal:ping_pong_message_and_event
May 21, 2020
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
cf1c97d
Adding ping message and pong event to RTM client
0fe9218
Fixing Pong field to `reply_to` and adding unit tests for ping-pong m…
5aa6712
Merge branch 'master' into ping_pong_message_and_event
a4608d3
Renamed reply_to -> replyTo since Gson is handling snake_case
b8c0cee
Merge branch 'master' into ping_pong_message_and_event
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
slack-api-client/src/main/java/com/slack/api/rtm/message/PingMessage.java
This file contains hidden or 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,21 @@ | ||
| package com.slack.api.rtm.message; | ||
|
|
||
| import lombok.AllArgsConstructor; | ||
| import lombok.Builder; | ||
| import lombok.Data; | ||
| import lombok.NoArgsConstructor; | ||
|
|
||
| import java.time.Instant; | ||
|
|
||
| @Data | ||
| @Builder | ||
| @NoArgsConstructor | ||
| @AllArgsConstructor | ||
| public class PingMessage implements RTMMessage { | ||
|
|
||
| public static final String TYPE_NAME = "ping"; | ||
|
|
||
| private Long id; | ||
| private final String type = TYPE_NAME; | ||
| private Instant time; | ||
| } |
This file contains hidden or 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
21 changes: 21 additions & 0 deletions
21
slack-api-model/src/main/java/com/slack/api/model/event/PongEvent.java
This file contains hidden or 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,21 @@ | ||
| package com.slack.api.model.event; | ||
|
|
||
| import lombok.Data; | ||
|
|
||
| import java.time.Instant; | ||
|
|
||
| /** | ||
| * The pong event is sent in response to a 'ping' message previously sent. The id and | ||
| * other fields will match that of the ping message. | ||
| * <p> | ||
| * https://api.slack.com/rtm | ||
| */ | ||
| @Data | ||
| public class PongEvent implements Event | ||
| { | ||
| public static final String TYPE_NAME = "pong"; | ||
| private final String type = TYPE_NAME; | ||
|
|
||
| private final Long reply_to; | ||
| private final Instant time; | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you define this field as
private Long replyTo(camelCase + no need to havefinalfor this) instead? Lombok generatesLong getReplyTo()andvoid setReplyTo(Long)for you.Regarding the conversion from snake_cased JSON keys, Gson in this project automatically translates snake_case to camelCase. https://github.com/slackapi/java-slack-sdk/blob/v1.0.7/slack-api-client/src/main/java/com/slack/api/rtm/RTMEventsDispatcherImpl.java#L53
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks - good to know!