Skip to content
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

Add missing event data types #1332

Merged
merged 1 commit into from
Jul 3, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.slack.api.model.connect;

import com.google.gson.annotations.SerializedName;
import lombok.Data;

@Data
public class ConnectRequestActor {
private String id;
private String name;
@SerializedName("is_bot")
private boolean bot;
private String teamId;
private String timezone;
private String realName;
private String displayName;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.slack.api.model.event;

import lombok.Data;

/**
* https://api.slack.com/events/app_deleted
*/
@Data
public class AppDeletedEvent implements Event {

public static final String TYPE_NAME = "app_deleted";

private final String type = TYPE_NAME;
private String appId;
private String appName;
private String appOwnerId;
private String teamId;
private String teamDomain;
private String eventTs;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.slack.api.model.event;

import lombok.Data;

/**
* https://api.slack.com/events/app_installed
*/
@Data
public class AppInstalledEvent implements Event {

public static final String TYPE_NAME = "app_installed";

private final String type = TYPE_NAME;
private String appId;
private String appName;
private String appOwnerId;
private String user_id;
private String teamId;
private String teamDomain;
private String eventTs;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.slack.api.model.event;

import lombok.Data;

/**
* https://api.slack.com/events/app_uninstalled_team
*/
@Data
public class AppUninstalledTeamEvent implements Event {

public static final String TYPE_NAME = "app_uninstalled_team";

private final String type = TYPE_NAME;
private String appId;
private String appName;
private String appOwnerId;
private String user_id;
private String teamId;
private String teamDomain;
private String eventTs;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.slack.api.model.event;

import com.google.gson.annotations.SerializedName;
import com.slack.api.model.connect.ConnectRequestActor;
import com.slack.api.model.connect.ConnectTeam;
import lombok.Data;

import java.util.List;

/**
* https://api.slack.com/events/shared_channel_invite_requested
*/
@Data
public class SharedChannelInviteRequestedEvent implements Event {

public static final String TYPE_NAME = "shared_channel_invite_requested";

private final String type = TYPE_NAME;
private ConnectRequestActor actor;
private String channelId;
private String eventType;
private String channelName;
private String channelType;
private List<TargetUser> targetUsers;
private List<ConnectTeam> teamsInChannel;
@SerializedName("is_external_limited")
private boolean externalLimited;
private Integer channelDateCreated;
private Integer channelMessageLatestCountedTimestamp;
private String eventTs;

@Data
public static class TargetUser {
private String email;
private String inviteId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.slack.api.app_backend.events.handler;
Copy link
Member Author

Choose a reason for hiding this comment

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

These handlers are legacy ones (meaning these are not used in bolt-java), but I've added them this time. In the future, we may want to deprecate them since v2.


import com.slack.api.app_backend.events.EventHandler;
import com.slack.api.app_backend.events.payload.AppDeletedPayload;
import com.slack.api.model.event.AppDeletedEvent;

public abstract class AppDeletedHandler extends EventHandler<AppDeletedPayload> {

Check warning on line 7 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppDeletedHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppDeletedHandler.java#L7

Added line #L7 was not covered by tests

@Override
public String getEventType() {
return AppDeletedEvent.TYPE_NAME;

Check warning on line 11 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppDeletedHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppDeletedHandler.java#L11

Added line #L11 was not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.slack.api.app_backend.events.handler;

import com.slack.api.app_backend.events.EventHandler;
import com.slack.api.app_backend.events.payload.AppInstalledPayload;
import com.slack.api.model.event.AppInstalledEvent;

public abstract class AppInstalledHandler extends EventHandler<AppInstalledPayload> {

Check warning on line 7 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppInstalledHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppInstalledHandler.java#L7

Added line #L7 was not covered by tests

@Override
public String getEventType() {
return AppInstalledEvent.TYPE_NAME;

Check warning on line 11 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppInstalledHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppInstalledHandler.java#L11

Added line #L11 was not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.slack.api.app_backend.events.handler;

import com.slack.api.app_backend.events.EventHandler;
import com.slack.api.app_backend.events.payload.AppUninstalledTeamPayload;
import com.slack.api.model.event.AppUninstalledTeamEvent;

public abstract class AppUninstalledTeamHandler extends EventHandler<AppUninstalledTeamPayload> {

Check warning on line 7 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppUninstalledTeamHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppUninstalledTeamHandler.java#L7

Added line #L7 was not covered by tests

@Override
public String getEventType() {
return AppUninstalledTeamEvent.TYPE_NAME;

Check warning on line 11 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppUninstalledTeamHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/AppUninstalledTeamHandler.java#L11

Added line #L11 was not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.slack.api.app_backend.events.handler;

import com.slack.api.app_backend.events.EventHandler;
import com.slack.api.app_backend.events.payload.FunctionExecutedPayload;
import com.slack.api.model.event.FunctionExecutedEvent;

public abstract class FunctionExecutedHandler extends EventHandler<FunctionExecutedPayload> {

Check warning on line 7 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/FunctionExecutedHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/FunctionExecutedHandler.java#L7

Added line #L7 was not covered by tests

@Override
public String getEventType() {
return FunctionExecutedEvent.TYPE_NAME;

Check warning on line 11 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/FunctionExecutedHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/FunctionExecutedHandler.java#L11

Added line #L11 was not covered by tests
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.slack.api.app_backend.events.handler;

import com.slack.api.app_backend.events.EventHandler;
import com.slack.api.app_backend.events.payload.SharedChannelInviteRequestedPayload;
import com.slack.api.model.event.SharedChannelInviteRequestedEvent;

public abstract class SharedChannelInviteRequestedHandler extends EventHandler<SharedChannelInviteRequestedPayload> {

Check warning on line 7 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/SharedChannelInviteRequestedHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/SharedChannelInviteRequestedHandler.java#L7

Added line #L7 was not covered by tests

@Override
public String getEventType() {
return SharedChannelInviteRequestedEvent.TYPE_NAME;

Check warning on line 11 in slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/SharedChannelInviteRequestedHandler.java

View check run for this annotation

Codecov / codecov/patch

slack-app-backend/src/main/java/com/slack/api/app_backend/events/handler/SharedChannelInviteRequestedHandler.java#L11

Added line #L11 was not covered by tests
}
}
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.AppDeletedEvent;
import lombok.Data;

import java.util.List;

@Data
public class AppDeletedPayload implements EventsApiPayload<AppDeletedEvent> {

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 AppDeletedEvent event;
}
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.AppInstalledEvent;
import lombok.Data;

import java.util.List;

@Data
public class AppInstalledPayload implements EventsApiPayload<AppInstalledEvent> {

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 AppInstalledEvent event;
}
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.AppUninstalledTeamEvent;
import lombok.Data;

import java.util.List;

@Data
public class AppUninstalledTeamPayload implements EventsApiPayload<AppUninstalledTeamEvent> {

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 AppUninstalledTeamEvent event;
}
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.SharedChannelInviteRequestedEvent;
import lombok.Data;

import java.util.List;

@Data
public class SharedChannelInviteRequestedPayload implements EventsApiPayload<SharedChannelInviteRequestedEvent> {

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 SharedChannelInviteRequestedEvent event;
}