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

fix: Teams Meeting Notification interface structure changes #4416

Merged
merged 8 commits into from
Feb 10, 2023
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
6 changes: 3 additions & 3 deletions libraries/botbuilder/etc/botbuilder.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import { InvokeResponse } from 'botbuilder-core';
import { IReceiveRequest } from 'botframework-streaming';
import { IStreamingTransportServer } from 'botframework-streaming';
import { MeetingEndEventDetails } from 'botbuilder-core';
import { MeetingNotification } from 'botbuilder-core';
import { MeetingNotificationResponse } from 'botbuilder-core';
import { MeetingStartEventDetails } from 'botbuilder-core';
import { MessagingExtensionAction } from 'botbuilder-core';
import { MessagingExtensionActionResponse } from 'botbuilder-core';
Expand Down Expand Up @@ -70,8 +72,6 @@ import { TeamDetails } from 'botbuilder-core';
import { TeamInfo } from 'botbuilder-core';
import { TeamsChannelAccount } from 'botbuilder-core';
import { TeamsMeetingInfo } from 'botbuilder-core';
import { TeamsMeetingNotification } from 'botbuilder-core';
import { TeamsMeetingNotificationRecipientFailureInfos } from 'botbuilder-core';
import { TeamsMeetingParticipant } from 'botbuilder-core';
import { TeamsPagedMembersResult } from 'botbuilder-core';
import { TenantInfo } from 'botbuilder-core';
Expand Down Expand Up @@ -458,7 +458,7 @@ export class TeamsInfo {
static getTeamMember(context: TurnContext, teamId?: string, userId?: string): Promise<TeamsChannelAccount>;
// @deprecated
static getTeamMembers(context: TurnContext, teamId?: string): Promise<TeamsChannelAccount[]>;
static sendMeetingNotification(context: TurnContext, notification: TeamsMeetingNotification, meetingId?: string): Promise<TeamsMeetingNotificationRecipientFailureInfos | {}>;
static sendMeetingNotification(context: TurnContext, notification: MeetingNotification, meetingId?: string): Promise<MeetingNotificationResponse>;
static sendMessageToTeamsChannel(context: TurnContext, activity: Activity, teamsChannelId: string, botAppId?: string): Promise<[ConversationReference, string]>;
}

Expand Down
10 changes: 5 additions & 5 deletions libraries/botbuilder/src/teamsInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import {
TeamsMeetingParticipant,
TeamsMeetingInfo,
Channels,
TeamsMeetingNotification,
TeamsMeetingNotificationRecipientFailureInfos,
MeetingNotification,
MeetingNotificationResponse,
} from 'botbuilder-core';
import { ConnectorClient, TeamsConnectorClient, TeamsConnectorModels } from 'botframework-connector';

Expand Down Expand Up @@ -342,14 +342,14 @@ export class TeamsInfo {
* @param notification The meeting notification payload.
* @param meetingId Id of the Teams meeting.
* @returns Promise with either an empty object if notifications were successfully sent to all recipients or
* [TeamsMeetingNotificationRecipientFailureInfos](xref:botframework-schema.TeamsMeetingNotificationRecipientFailureInfos) if notifications
* [MeetingNotificationResponse](xref:botframework-schema.MeetingNotificationResponse) if notifications
* were sent to some but not all recipients.
*/
static async sendMeetingNotification(
context: TurnContext,
notification: TeamsMeetingNotification,
notification: MeetingNotification,
meetingId?: string
): Promise<TeamsMeetingNotificationRecipientFailureInfos | {}> {
): Promise<MeetingNotificationResponse> {
const activity = context.activity;

if (meetingId == null) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/botbuilder/tests/teamsInfo.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1028,7 +1028,7 @@ describe('TeamsInfo', function () {
assert(isEmptyObject(sendTeamsMeetingNotification));
});

it('should return a TeamsMeetingNotificationRecipientFailureInfos if a 207 status code was returned', async function () {
it('should return a MeetingNotificationResponse if a 207 status code was returned', async function () {
const notification = {};
const meetingId = 'randomGUID';
const { expectedAuthHeader, expectation: fetchOauthToken } = nockOauth();
Expand Down
6 changes: 3 additions & 3 deletions libraries/botframework-connector/src/teams/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
ConversationList,
TeamDetails,
TeamsMeetingInfo,
TeamsMeetingNotificationRecipientFailureInfos,
MeetingNotificationResponse,
TeamsMeetingParticipant,
} from 'botframework-schema';

Expand Down Expand Up @@ -128,7 +128,7 @@ export type TeamsMeetingInfoResponse = TeamsMeetingInfo & {
/**
* Contains response data for the sendMeetingNotification operation.
*/
export type TeamsSendMeetingNotificationResponse = TeamsMeetingNotificationRecipientFailureInfos & {
export type TeamsMeetingNotificationResponse = MeetingNotificationResponse & {
singhk97 marked this conversation as resolved.
Show resolved Hide resolved
/**
* The underlying HTTP response.
*/
Expand All @@ -140,6 +140,6 @@ export type TeamsSendMeetingNotificationResponse = TeamsMeetingNotificationRecip
/**
* The response body as parsed JSON or XML
*/
parsedBody: TeamsMeetingNotificationRecipientFailureInfos | {};
parsedBody: MeetingNotificationResponse | {};
};
};
101 changes: 19 additions & 82 deletions libraries/botframework-connector/src/teams/models/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -434,44 +434,11 @@ export const TeamsMeetingDetails: msRest.CompositeMapper = {
},
};

export const TeamsMeetingNotificationInfo: msRest.CompositeMapper = {
serializedName: 'TeamsMeetingNotificationInfo',
export const MeetingNotification: msRest.CompositeMapper = {
serializedName: 'MeetingNotification',
type: {
name: 'Composite',
className: 'TeamsMeetingNotificationInfo',
modelProperties: {
recipients: {
serializedName: 'recipients',
type: {
name: 'Sequence',
element: {
type: {
name: 'String',
},
},
},
},
surfaces: {
serializedName: 'surfaces',
type: {
name: 'Sequence',
element: {
type: {
name: 'Composite',
className: 'TeamsMeetingNotificationSurface',
},
},
},
},
},
},
};

export const TeamsMeetingNotification: msRest.CompositeMapper = {
serializedName: 'TeamsMeetingNotification',
type: {
name: 'Composite',
className: 'TeamsMeetingNotification',
className: 'MeetingNotification',
modelProperties: {
type: {
serializedName: 'type',
Expand All @@ -482,55 +449,25 @@ export const TeamsMeetingNotification: msRest.CompositeMapper = {
value: {
serializedName: 'value',
type: {
name: 'Composite',
className: 'TeamsMeetingNotificationInfo',
name: 'any',
},
},
channelData: {
serializedName: 'channelData',
type: {
name: 'Composite',
className: 'TeamsMeetingNotificationChannelData',
},
},
},
},
};

export const TeamsMeetingNotificationSurface: msRest.CompositeMapper = {
serializedName: 'TeamsMeetingNotificationSurface',
type: {
name: 'Composite',
className: 'TeamsMeetingNotificationSurface',
modelProperties: {
surface: {
serializedName: 'surface',
type: {
name: 'String',
},
},
contentType: {
serializedName: 'contentType',
type: {
name: 'String',
},
},
content: {
serializedName: 'content',
type: {
name: 'Composite',
className: 'TaskModuleContinueResponse',
className: 'MeetingNotificationChannelData',
},
},
},
},
};

export const TeamsMeetingNotificationChannelData = {
serializedName: 'TeamsMeetingNotificationChannelData',
export const MeetingNotificationChannelData = {
serializedName: 'MeetingNotificationChannelData',
type: {
name: 'Composite',
className: 'TeamsMeetingNotificationChannelData',
className: 'MeetingNotificationChannelData',
modelProperties: {
onBehalfOf: {
serializedName: 'onBehalfOf',
Expand All @@ -539,7 +476,7 @@ export const TeamsMeetingNotificationChannelData = {
element: {
type: {
name: 'Composite',
className: 'TeamsMeetingOnBehalfOf',
className: 'OnBehalfOf',
},
},
},
Expand All @@ -548,11 +485,11 @@ export const TeamsMeetingNotificationChannelData = {
},
};

export const TeamsMeetingOnBehalfOf: msRest.CompositeMapper = {
serializedName: 'TeamsMeetingOnBehalfOf',
export const OnBehalfOf: msRest.CompositeMapper = {
serializedName: 'OnBehalfOf',
type: {
name: 'Composite',
className: 'TeamsMeetingOnBehalfOf',
className: 'OnBehalfOf',
modelProperties: {
itemid: {
serializedName: 'itemid',
Expand Down Expand Up @@ -582,11 +519,11 @@ export const TeamsMeetingOnBehalfOf: msRest.CompositeMapper = {
},
};

export const TeamsMeetingNotificationRecipientFailureInfo: msRest.CompositeMapper = {
serializedName: 'TeamsMeetingNotificationRecipientFailureInfo',
export const MeetingNotificationRecipientFailureInfo: msRest.CompositeMapper = {
serializedName: 'MeetingNotificationRecipientFailureInfo',
type: {
name: 'Composite',
className: 'TeamsMeetingNotificationRecipientFailureInfo',
className: 'MeetingNotificationRecipientFailureInfo',
modelProperties: {
recipientMri: {
serializedName: 'recipientMri',
Expand All @@ -610,11 +547,11 @@ export const TeamsMeetingNotificationRecipientFailureInfo: msRest.CompositeMappe
},
};

export const TeamsMeetingNotificationRecipientFailureInfos: msRest.CompositeMapper = {
serializedName: 'TeamsMeetingNotificationRecipientFailureInfos',
export const MeetingNotificationResponse: msRest.CompositeMapper = {
serializedName: 'MeetingNotificationResponse',
type: {
name: 'Composite',
className: 'TeamsMeetingNotificationRecipientFailureInfos',
className: 'MeetingNotificationResponse',
modelProperties: {
recipientsFailureInfo: {
serializedName: 'recipientsFailureInfo',
Expand All @@ -623,7 +560,7 @@ export const TeamsMeetingNotificationRecipientFailureInfos: msRest.CompositeMapp
element: {
type: {
name: 'Composite',
className: 'TeamsMeetingNotificationRecipientFailureInfo',
className: 'MeetingNotificationRecipientFailureInfo',
},
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@ export {
TeamsMeetingDetails,
TeamsMeetingInfo,
TeamsMeetingParticipant,
TeamsMeetingNotification,
TeamsMeetingNotificationInfo,
TeamsMeetingNotificationSurface,
TeamsMeetingNotificationChannelData,
TeamsMeetingOnBehalfOf,
TeamsMeetingNotificationRecipientFailureInfo,
TeamsMeetingNotificationRecipientFailureInfos,
MeetingNotification,
MeetingNotificationChannelData,
OnBehalfOf,
MeetingNotificationRecipientFailureInfo,
MeetingNotificationResponse,
TaskModuleContinueResponse,
TaskModuleTaskInfo,
Attachment,
Expand Down
30 changes: 15 additions & 15 deletions libraries/botframework-connector/src/teams/operations/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import * as Models from '../models';
import * as Mappers from '../models/teamsMappers';
import * as Parameters from '../models/parameters';
import { TeamsConnectorClientContext } from '../';
import { ConversationList, TeamDetails, TeamsMeetingInfo, TeamsMeetingParticipant, TeamsMeetingNotificationRecipientFailureInfos, TeamsMeetingNotification } from 'botframework-schema';
import { ConversationList, TeamDetails, TeamsMeetingInfo, TeamsMeetingParticipant, MeetingNotificationResponse, MeetingNotification } from 'botframework-schema';

/** Class representing a Teams. */
export class Teams {
Expand Down Expand Up @@ -250,18 +250,18 @@ export class Teams {
*/
sendMeetingNotification(
meetingId: string,
notification: TeamsMeetingNotification,
notification: MeetingNotification,
options?: msRest.RequestOptionsBase,
): Promise<Models.TeamsSendMeetingNotificationResponse>
): Promise<Models.TeamsMeetingNotificationResponse>
singhk97 marked this conversation as resolved.
Show resolved Hide resolved
/**
* @param meetingId Meeting Id.
* @param notification The content and configuration for the notification to send.
* @param callback The callback.
*/
sendMeetingNotification(
meetingId: string,
notification: TeamsMeetingNotification,
callback: msRest.ServiceCallback<TeamsMeetingNotificationRecipientFailureInfos | {}>
notification: MeetingNotification,
callback: msRest.ServiceCallback<MeetingNotificationResponse>
): void;
/**
* @param meetingId Meeting Id.
Expand All @@ -271,23 +271,23 @@ export class Teams {
*/
sendMeetingNotification(
meetingId: string,
notification: TeamsMeetingNotification,
notification: MeetingNotification,
options: msRest.RequestOptionsBase,
callback: msRest.ServiceCallback<TeamsMeetingNotificationRecipientFailureInfos | {}>
callback: msRest.ServiceCallback<MeetingNotificationResponse>
): void;
/**
* @param meetingId Meeting Id.
* @param notification The content and configuration for the notification to send.
* @param options The optional parameters.
* @param callback The callback.
* @returns Promise with either TeamsMeetingNotificationRecipientFailureInfos or an empty object.
* @returns Promise with either MeetingNotificationResponse or an empty object.
*/
sendMeetingNotification(
meetingId: string,
notification: TeamsMeetingNotification,
notification: MeetingNotification,
options?: msRest.RequestOptionsBase,
callback?: msRest.ServiceCallback<TeamsMeetingNotificationRecipientFailureInfos | {}>
): Promise<Models.TeamsSendMeetingNotificationResponse> {
callback?: msRest.ServiceCallback<MeetingNotificationResponse>
): Promise<Models.TeamsMeetingNotificationResponse> {
return this.client.sendOperationRequest(
{
meetingId,
Expand All @@ -296,7 +296,7 @@ export class Teams {
},
sendMeetingNotificationOperationSpec,
callback
) as Promise<Models.TeamsSendMeetingNotificationResponse>;
) as Promise<Models.TeamsMeetingNotificationResponse>;
}
}

Expand Down Expand Up @@ -362,16 +362,16 @@ const sendMeetingNotificationOperationSpec: msRest.OperationSpec = {
requestBody: {
parameterPath: 'notification',
mapper: {
...Mappers.TeamsMeetingNotification,
...Mappers.MeetingNotification,
required: true
}
},
responses: {
202: {
bodyMapper: Mappers.TeamsMeetingNotificationRecipientFailureInfos
bodyMapper: Mappers.MeetingNotificationResponse
},
207: {
bodyMapper: Mappers.TeamsMeetingNotificationRecipientFailureInfos
bodyMapper: Mappers.MeetingNotificationResponse
},
default: {
bodyMapper: Mappers.ErrorResponse
Expand Down
Loading