Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.
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
Expand Up @@ -3,6 +3,8 @@

package com.microsoft.bot.schema;

import com.microsoft.bot.schema.teams.TeamChannelData;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import com.fasterxml.jackson.annotation.JsonFormat;
Expand Down Expand Up @@ -1504,4 +1506,44 @@ public static String removeMentionTextImmutable(Activity activity, String id) {

return text;
}
}

/**
* Check if this actvity is from microsoft teams.
* @return true if the activity is from microsoft teams.
*/
public boolean isTeamsActivity() {
return "msteams".equals(channelId);
}

/**
* Get unique identifier representing a channel.
*
* @throws JsonProcessingException when channel data can't be parsed to TeamChannelData
* @return Unique identifier representing a channel
*/
public String teamsGetChannelId() throws JsonProcessingException {
TeamChannelData teamsChannelData = getChannelData(TeamChannelData.class);
String teamsChannelId = teamsChannelData.getTeamsChannelId();
if (teamsChannelId == null && teamsChannelData.getChannel() != null) {
teamsChannelId = teamsChannelData.getChannel().getId();
}

return teamsChannelId;
}

/**
* Get unique identifier representing a team.
*
* @throws JsonProcessingException when channel data can't be parsed to TeamChannelData
* @return Unique identifier representing a team.
*/
public String teamsGetTeamId() throws JsonProcessingException {
TeamChannelData teamsChannelData = getChannelData(TeamChannelData.class);
String teamId = teamsChannelData.getTeamsTeamId();
if (teamId == null && teamsChannelData.getTeam() != null) {
teamId = teamsChannelData.getTeam().getId();
}

return teamId;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package com.microsoft.bot.schema.teams;

import com.fasterxml.jackson.annotation.JsonProperty;


/**
* A channel info object which describes the channel.
*/
public class ChannelInfo {
@JsonProperty(value = "id")
private String id;

/**
* name of the channel.
*/
@JsonProperty(value = "name")
private String name;

/**
* Get the unique identifier representing a channel.
* @return the unique identifier representing a channel.
*/
public final String getId() {
return id;
}

/**
* Set unique identifier representing a channel.
* @param withId the unique identifier representing a channel.
*/
public void setId(String withId) {
this.id = withId;
}

/**
* Get the name of the channel.
* @return name of the channel.
*/
public String getName() {
return name;
}

/**
* Sets name of the channel.
* @param withName the name of the channel.
*/
public void setName(String withName) {
this.name = withName;
}

/**
* Initializes a new instance of the ChannelInfo class.
* @param withId identifier representing a channel.
* @param withName Name of the channel.
*/
public ChannelInfo(String withId, String withName) {
this.id = withId;
this.name = withName;
}

/**
* Initializes a new instance of the ChannelInfo class.
*/
public ChannelInfo() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.microsoft.bot.schema.teams;

import com.fasterxml.jackson.annotation.JsonProperty;
/**
* Specifies if a notification is to be sent for the mentions.
*/
public class NotificationInfo {
/**
* Gets or sets true if notification is to be sent to the user, false.
*/
@JsonProperty(value = "alert")
private Boolean alert;

/**
* Getter for alert.
* @return return the alter value.
*/
public Boolean getAlert() {
return alert;
}

/**
* Setter for alert.
* @param withAlert the value to set.
*/
public void setAlert(Boolean withAlert) {
alert = withAlert;
}

/**
* A new instance of NotificationInfo.
* @param withAlert alert value to set.
*/
public NotificationInfo(Boolean withAlert) {
alert = withAlert;
}

/**
* A new instance of NotificationInfo.
*/
public NotificationInfo() {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,197 @@
package com.microsoft.bot.schema.teams;

import com.fasterxml.jackson.annotation.JsonProperty;


/**
* Channel data specific to messages received in Microsoft Teams.
*/
public class TeamChannelData {
@JsonProperty(value = "teamsChannelId")
private String teamsChannelId;

@JsonProperty(value = "teamsTeamId")
private String teamsTeamId;

@JsonProperty(value = "channel")
private ChannelInfo channel;

/// Gets or sets type of event.
@JsonProperty(value = "eventType")
private String eventType;

/// Gets or sets information about the team in which the message was
/// sent
@JsonProperty(value = "team")
private TeamInfo team;

/// Gets or sets notification settings for the message
@JsonProperty(value = "notification")
private NotificationInfo notification;

/// Gets or sets information about the tenant in which the message was
/// sent
@JsonProperty(value = "tenant")
private TenantInfo tenant;

/**
* Get unique identifier representing a channel.
* @return Unique identifier representing a channel.
*/
public String getTeamsChannelId() {
return teamsChannelId;
}

/**
* Set unique identifier representing a channel.
* @param withTeamsChannelId Unique identifier representing a channel.
*/
public void setTeamsChannelId(String withTeamsChannelId) {
this.teamsChannelId = withTeamsChannelId;
}

/**
* Get unique identifier representing a team.
* @return Unique identifier representing a team.
*/
public String getTeamsTeamId() {
return teamsTeamId;
}
/**
* Set unique identifier representing a team.
* @param withTeamsTeamId Unique identifier representing a team.
*/
public void setTeamsTeamId(String withTeamsTeamId) {
this.teamsTeamId = withTeamsTeamId;
}

/**
* Gets information about the channel in which the message was
* sent.
*
* @return information about the channel in which the message was
* sent.
*/
public ChannelInfo getChannel() {
return channel;
}

/**
* Sets information about the channel in which the message was
* sent.
*
* @param withChannel information about the channel in which the message was
* sent.
*/
public void setChannel(ChannelInfo withChannel) {
this.channel = withChannel;
}

/**
* Gets type of event.
*
* @return type of event.
*/
public String getEventType() {
return eventType;
}

/**
* Sets type of event.
*
* @param withEventType type of event.
*/
public void setEventType(String withEventType) {
this.eventType = withEventType;
}

/**
* Gets information about the team in which the message was
* sent.
*
* @return information about the team in which the message was
* sent.
*/
public TeamInfo getTeam() {
return team;
}

/**
* Sets information about the team in which the message was
* sent.
*
* @param withTeam information about the team in which the message was
* sent.
*/
public void setTeam(TeamInfo withTeam) {
this.team = withTeam;
}

/**
* Gets notification settings for the message.
*
* @return notification settings for the message.
*/
public NotificationInfo getNotification() {
return notification;
}

/**
* Sets notification settings for the message.
*
* @param withNotification settings for the message.
*/
public void setNotification(NotificationInfo withNotification) {
this.notification = withNotification;
}

/**
* Gets information about the tenant in which the message was.
* @return information about the tenant in which the message was.
*/
public TenantInfo getTenant() {
return tenant;
}

/**
* Sets information about the tenant in which the message was.
* @param withTenant information about the tenant in which the message was.
*/
public void setTenant(TenantInfo withTenant) {
this.tenant = withTenant;
}

/**
* A new instance of TeamChannelData.
* @param withTeamsChannelId the channelId in Teams
* @param withTeamsTeamId the teamId in Teams
* @param withChannel information about the channel in which the message was sent.
* @param withEventType type of event.
* @param withTeam information about the team in which the message was
* sent.
* @param withNotification Notification settings for the message.
* @param withTenant Information about the tenant in which the message was.
*/
public TeamChannelData(String withTeamsChannelId,
String withTeamsTeamId,
ChannelInfo withChannel,
String withEventType,
TeamInfo withTeam,
NotificationInfo withNotification,
TenantInfo withTenant) {
this.teamsChannelId = withTeamsChannelId;
this.teamsTeamId = withTeamsTeamId;
this.channel = withChannel;
this.eventType = withEventType;
this.team = withTeam;
this.notification = withNotification;
this.tenant = withTenant;
}

/**
* A new instance of TeamChannelData.
*/
public TeamChannelData() {
}

}
Loading