@microsoft/agents-hosting-extensions-teams 0.5.1-g2e246ff274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/activity-extensions/channelInfo.d.ts +38 -0
- package/dist/src/activity-extensions/channelInfo.js +17 -0
- package/dist/src/activity-extensions/channelInfo.js.map +1 -0
- package/dist/src/activity-extensions/index.d.ts +15 -0
- package/dist/src/activity-extensions/index.js +25 -0
- package/dist/src/activity-extensions/index.js.map +1 -0
- package/dist/src/activity-extensions/notificationInfo.d.ts +38 -0
- package/dist/src/activity-extensions/notificationInfo.js +17 -0
- package/dist/src/activity-extensions/notificationInfo.js.map +1 -0
- package/dist/src/activity-extensions/onBehalfOf.d.ts +45 -0
- package/dist/src/activity-extensions/onBehalfOf.js +18 -0
- package/dist/src/activity-extensions/onBehalfOf.js.map +1 -0
- package/dist/src/activity-extensions/teamInfo.d.ts +38 -0
- package/dist/src/activity-extensions/teamInfo.js +17 -0
- package/dist/src/activity-extensions/teamInfo.js.map +1 -0
- package/dist/src/activity-extensions/teamsChannelAccount.d.ts +34 -0
- package/dist/src/activity-extensions/teamsChannelAccount.js +7 -0
- package/dist/src/activity-extensions/teamsChannelAccount.js.map +1 -0
- package/dist/src/activity-extensions/teamsChannelData.d.ts +230 -0
- package/dist/src/activity-extensions/teamsChannelData.js +39 -0
- package/dist/src/activity-extensions/teamsChannelData.js.map +1 -0
- package/dist/src/activity-extensions/teamsChannelDataParser.d.ts +12 -0
- package/dist/src/activity-extensions/teamsChannelDataParser.js +19 -0
- package/dist/src/activity-extensions/teamsChannelDataParser.js.map +1 -0
- package/dist/src/activity-extensions/teamsChannelDataSettings.d.ts +49 -0
- package/dist/src/activity-extensions/teamsChannelDataSettings.js +16 -0
- package/dist/src/activity-extensions/teamsChannelDataSettings.js.map +1 -0
- package/dist/src/activity-extensions/teamsConversationUpdateEvents.d.ts +58 -0
- package/dist/src/activity-extensions/teamsConversationUpdateEvents.js +7 -0
- package/dist/src/activity-extensions/teamsConversationUpdateEvents.js.map +1 -0
- package/dist/src/activity-extensions/teamsMeetingInfo.d.ts +24 -0
- package/dist/src/activity-extensions/teamsMeetingInfo.js +15 -0
- package/dist/src/activity-extensions/teamsMeetingInfo.js.map +1 -0
- package/dist/src/activity-extensions/teamsMessageEvents.d.ts +5 -0
- package/dist/src/activity-extensions/teamsMessageEvents.js +7 -0
- package/dist/src/activity-extensions/teamsMessageEvents.js.map +1 -0
- package/dist/src/activity-extensions/tenantInfo.d.ts +24 -0
- package/dist/src/activity-extensions/tenantInfo.js +15 -0
- package/dist/src/activity-extensions/tenantInfo.js.map +1 -0
- package/dist/src/client/index.d.ts +6 -0
- package/dist/src/client/index.js +23 -0
- package/dist/src/client/index.js.map +1 -0
- package/dist/src/client/teamsConnectorClient.d.ts +146 -0
- package/dist/src/client/teamsConnectorClient.js +313 -0
- package/dist/src/client/teamsConnectorClient.js.map +1 -0
- package/dist/src/client/teamsConnectorClient.types.d.ts +157 -0
- package/dist/src/client/teamsConnectorClient.types.js +7 -0
- package/dist/src/client/teamsConnectorClient.types.js.map +1 -0
- package/dist/src/compat/readReceipInfo.d.ts +31 -0
- package/dist/src/compat/readReceipInfo.js +48 -0
- package/dist/src/compat/readReceipInfo.js.map +1 -0
- package/dist/src/compat/teamsActivityHandler.d.ts +423 -0
- package/dist/src/compat/teamsActivityHandler.js +911 -0
- package/dist/src/compat/teamsActivityHandler.js.map +1 -0
- package/dist/src/file/fileConsentCardResponse.d.ts +26 -0
- package/dist/src/file/fileConsentCardResponse.js +7 -0
- package/dist/src/file/fileConsentCardResponse.js.map +1 -0
- package/dist/src/file/fileUploadInfo.d.ts +29 -0
- package/dist/src/file/fileUploadInfo.js +7 -0
- package/dist/src/file/fileUploadInfo.js.map +1 -0
- package/dist/src/file/index.d.ts +6 -0
- package/dist/src/file/index.js +23 -0
- package/dist/src/file/index.js.map +1 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +27 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/meeting/index.d.ts +22 -0
- package/dist/src/meeting/index.js +39 -0
- package/dist/src/meeting/index.js.map +1 -0
- package/dist/src/meeting/meeting.d.ts +115 -0
- package/dist/src/meeting/meeting.js +257 -0
- package/dist/src/meeting/meeting.js.map +1 -0
- package/dist/src/meeting/meetingDetails.d.ts +18 -0
- package/dist/src/meeting/meetingDetails.js +7 -0
- package/dist/src/meeting/meetingDetails.js.map +1 -0
- package/dist/src/meeting/meetingDetailsBase.d.ts +15 -0
- package/dist/src/meeting/meetingDetailsBase.js +7 -0
- package/dist/src/meeting/meetingDetailsBase.js.map +1 -0
- package/dist/src/meeting/meetingEndEventDetails.d.ts +12 -0
- package/dist/src/meeting/meetingEndEventDetails.js +7 -0
- package/dist/src/meeting/meetingEndEventDetails.js.map +1 -0
- package/dist/src/meeting/meetingEventDetails.d.ts +12 -0
- package/dist/src/meeting/meetingEventDetails.js +7 -0
- package/dist/src/meeting/meetingEventDetails.js.map +1 -0
- package/dist/src/meeting/meetingInfo.d.ts +24 -0
- package/dist/src/meeting/meetingInfo.js +7 -0
- package/dist/src/meeting/meetingInfo.js.map +1 -0
- package/dist/src/meeting/meetingNotification.d.ts +9 -0
- package/dist/src/meeting/meetingNotification.js +7 -0
- package/dist/src/meeting/meetingNotification.js.map +1 -0
- package/dist/src/meeting/meetingNotificationBase.d.ts +14 -0
- package/dist/src/meeting/meetingNotificationBase.js +7 -0
- package/dist/src/meeting/meetingNotificationBase.js.map +1 -0
- package/dist/src/meeting/meetingNotificationChannelData.d.ts +12 -0
- package/dist/src/meeting/meetingNotificationChannelData.js +7 -0
- package/dist/src/meeting/meetingNotificationChannelData.js.map +1 -0
- package/dist/src/meeting/meetingNotificationRecipientFailureInfo.d.ts +15 -0
- package/dist/src/meeting/meetingNotificationRecipientFailureInfo.js +7 -0
- package/dist/src/meeting/meetingNotificationRecipientFailureInfo.js.map +1 -0
- package/dist/src/meeting/meetingNotificationResponse.d.ts +14 -0
- package/dist/src/meeting/meetingNotificationResponse.js +7 -0
- package/dist/src/meeting/meetingNotificationResponse.js.map +1 -0
- package/dist/src/meeting/meetingParticipantsEventDetails.d.ts +12 -0
- package/dist/src/meeting/meetingParticipantsEventDetails.js +7 -0
- package/dist/src/meeting/meetingParticipantsEventDetails.js.map +1 -0
- package/dist/src/meeting/meetingStageSurface.d.ts +16 -0
- package/dist/src/meeting/meetingStageSurface.js +7 -0
- package/dist/src/meeting/meetingStageSurface.js.map +1 -0
- package/dist/src/meeting/meetingStartEventDetails.d.ts +14 -0
- package/dist/src/meeting/meetingStartEventDetails.js +7 -0
- package/dist/src/meeting/meetingStartEventDetails.js.map +1 -0
- package/dist/src/meeting/meetingSurface.d.ts +10 -0
- package/dist/src/meeting/meetingSurface.js +7 -0
- package/dist/src/meeting/meetingSurface.js.map +1 -0
- package/dist/src/meeting/meetingTabIconSurface.d.ts +17 -0
- package/dist/src/meeting/meetingTabIconSurface.js +7 -0
- package/dist/src/meeting/meetingTabIconSurface.js.map +1 -0
- package/dist/src/meeting/targetedMeetingNotification.d.ts +20 -0
- package/dist/src/meeting/targetedMeetingNotification.js +7 -0
- package/dist/src/meeting/targetedMeetingNotification.js.map +1 -0
- package/dist/src/meeting/targetedMeetingNotificationValue.d.ts +18 -0
- package/dist/src/meeting/targetedMeetingNotificationValue.js +7 -0
- package/dist/src/meeting/targetedMeetingNotificationValue.js.map +1 -0
- package/dist/src/meeting/teamsMeetingMember.d.ts +19 -0
- package/dist/src/meeting/teamsMeetingMember.js +7 -0
- package/dist/src/meeting/teamsMeetingMember.js.map +1 -0
- package/dist/src/meeting/teamsMeetingParticipant.d.ts +25 -0
- package/dist/src/meeting/teamsMeetingParticipant.js +7 -0
- package/dist/src/meeting/teamsMeetingParticipant.js.map +1 -0
- package/dist/src/meeting/userMeetingDetails.d.ts +17 -0
- package/dist/src/meeting/userMeetingDetails.js +7 -0
- package/dist/src/meeting/userMeetingDetails.js.map +1 -0
- package/dist/src/message-actions-payload/index.d.ts +13 -0
- package/dist/src/message-actions-payload/index.js +30 -0
- package/dist/src/message-actions-payload/index.js.map +1 -0
- package/dist/src/message-actions-payload/messageActionsPayload.d.ts +90 -0
- package/dist/src/message-actions-payload/messageActionsPayload.js +7 -0
- package/dist/src/message-actions-payload/messageActionsPayload.js.map +1 -0
- package/dist/src/message-actions-payload/messageActionsPayloadApp.d.ts +25 -0
- package/dist/src/message-actions-payload/messageActionsPayloadApp.js +7 -0
- package/dist/src/message-actions-payload/messageActionsPayloadApp.js.map +1 -0
- package/dist/src/message-actions-payload/messageActionsPayloadAttachment.d.ts +33 -0
- package/dist/src/message-actions-payload/messageActionsPayloadAttachment.js +7 -0
- package/dist/src/message-actions-payload/messageActionsPayloadAttachment.js.map +1 -0
- package/dist/src/message-actions-payload/messageActionsPayloadBody.d.ts +25 -0
- package/dist/src/message-actions-payload/messageActionsPayloadBody.js +7 -0
- package/dist/src/message-actions-payload/messageActionsPayloadBody.js.map +1 -0
- package/dist/src/message-actions-payload/messageActionsPayloadConversation.d.ts +25 -0
- package/dist/src/message-actions-payload/messageActionsPayloadConversation.js +7 -0
- package/dist/src/message-actions-payload/messageActionsPayloadConversation.js.map +1 -0
- package/dist/src/message-actions-payload/messageActionsPayloadFrom.d.ts +24 -0
- package/dist/src/message-actions-payload/messageActionsPayloadFrom.js +7 -0
- package/dist/src/message-actions-payload/messageActionsPayloadFrom.js.map +1 -0
- package/dist/src/message-actions-payload/messageActionsPayloadMention.d.ts +22 -0
- package/dist/src/message-actions-payload/messageActionsPayloadMention.js +7 -0
- package/dist/src/message-actions-payload/messageActionsPayloadMention.js.map +1 -0
- package/dist/src/message-actions-payload/messageActionsPayloadReaction.d.ts +26 -0
- package/dist/src/message-actions-payload/messageActionsPayloadReaction.js +7 -0
- package/dist/src/message-actions-payload/messageActionsPayloadReaction.js.map +1 -0
- package/dist/src/message-actions-payload/messageActionsPayloadUser.d.ts +29 -0
- package/dist/src/message-actions-payload/messageActionsPayloadUser.js +7 -0
- package/dist/src/message-actions-payload/messageActionsPayloadUser.js.map +1 -0
- package/dist/src/messageExtension/appBasedLinkQuery.d.ts +19 -0
- package/dist/src/messageExtension/appBasedLinkQuery.js +7 -0
- package/dist/src/messageExtension/appBasedLinkQuery.js.map +1 -0
- package/dist/src/messageExtension/index.d.ts +14 -0
- package/dist/src/messageExtension/index.js +29 -0
- package/dist/src/messageExtension/index.js.map +1 -0
- package/dist/src/messageExtension/messageExtension.d.ts +88 -0
- package/dist/src/messageExtension/messageExtension.js +283 -0
- package/dist/src/messageExtension/messageExtension.js.map +1 -0
- package/dist/src/messageExtension/messagingExtensionAction.d.ts +40 -0
- package/dist/src/messageExtension/messagingExtensionAction.js +7 -0
- package/dist/src/messageExtension/messagingExtensionAction.js.map +1 -0
- package/dist/src/messageExtension/messagingExtensionActionResponse.d.ts +23 -0
- package/dist/src/messageExtension/messagingExtensionActionResponse.js +7 -0
- package/dist/src/messageExtension/messagingExtensionActionResponse.js.map +1 -0
- package/dist/src/messageExtension/messagingExtensionAttachment.d.ts +14 -0
- package/dist/src/messageExtension/messagingExtensionAttachment.js +7 -0
- package/dist/src/messageExtension/messagingExtensionAttachment.js.map +1 -0
- package/dist/src/messageExtension/messagingExtensionParameter.d.ts +31 -0
- package/dist/src/messageExtension/messagingExtensionParameter.js +16 -0
- package/dist/src/messageExtension/messagingExtensionParameter.js.map +1 -0
- package/dist/src/messageExtension/messagingExtensionQuery.d.ts +84 -0
- package/dist/src/messageExtension/messagingExtensionQuery.js +31 -0
- package/dist/src/messageExtension/messagingExtensionQuery.js.map +1 -0
- package/dist/src/messageExtension/messagingExtensionQueryOptions.d.ts +31 -0
- package/dist/src/messageExtension/messagingExtensionQueryOptions.js +16 -0
- package/dist/src/messageExtension/messagingExtensionQueryOptions.js.map +1 -0
- package/dist/src/messageExtension/messagingExtensionResponse.d.ts +18 -0
- package/dist/src/messageExtension/messagingExtensionResponse.js +7 -0
- package/dist/src/messageExtension/messagingExtensionResponse.js.map +1 -0
- package/dist/src/messageExtension/messagingExtensionResult.d.ts +50 -0
- package/dist/src/messageExtension/messagingExtensionResult.js +7 -0
- package/dist/src/messageExtension/messagingExtensionResult.js.map +1 -0
- package/dist/src/messageExtension/messagingExtensionSuggestedAction.d.ts +14 -0
- package/dist/src/messageExtension/messagingExtensionSuggestedAction.js +7 -0
- package/dist/src/messageExtension/messagingExtensionSuggestedAction.js.map +1 -0
- package/dist/src/messages/messages.d.ts +40 -0
- package/dist/src/messages/messages.js +82 -0
- package/dist/src/messages/messages.js.map +1 -0
- package/dist/src/taskModule/index.d.ts +11 -0
- package/dist/src/taskModule/index.js +28 -0
- package/dist/src/taskModule/index.js.map +1 -0
- package/dist/src/taskModule/taskModule.d.ts +72 -0
- package/dist/src/taskModule/taskModule.js +210 -0
- package/dist/src/taskModule/taskModule.js.map +1 -0
- package/dist/src/taskModule/taskModuleContinueResponse.d.ts +15 -0
- package/dist/src/taskModule/taskModuleContinueResponse.js +7 -0
- package/dist/src/taskModule/taskModuleContinueResponse.js.map +1 -0
- package/dist/src/taskModule/taskModuleMessageResponse.d.ts +14 -0
- package/dist/src/taskModule/taskModuleMessageResponse.js +7 -0
- package/dist/src/taskModule/taskModuleMessageResponse.js.map +1 -0
- package/dist/src/taskModule/taskModuleRequest.d.ts +22 -0
- package/dist/src/taskModule/taskModuleRequest.js +7 -0
- package/dist/src/taskModule/taskModuleRequest.js.map +1 -0
- package/dist/src/taskModule/taskModuleRequestContext.d.ts +13 -0
- package/dist/src/taskModule/taskModuleRequestContext.js +7 -0
- package/dist/src/taskModule/taskModuleRequestContext.js.map +1 -0
- package/dist/src/taskModule/taskModuleResponse.d.ts +19 -0
- package/dist/src/taskModule/taskModuleResponse.js +7 -0
- package/dist/src/taskModule/taskModuleResponse.js.map +1 -0
- package/dist/src/taskModule/taskModuleResponseBase.d.ts +17 -0
- package/dist/src/taskModule/taskModuleResponseBase.js +7 -0
- package/dist/src/taskModule/taskModuleResponseBase.js.map +1 -0
- package/dist/src/taskModule/taskModuleTaskInfo.d.ts +38 -0
- package/dist/src/taskModule/taskModuleTaskInfo.js +7 -0
- package/dist/src/taskModule/taskModuleTaskInfo.js.map +1 -0
- package/dist/src/teamsAgentExtension.d.ts +30 -0
- package/dist/src/teamsAgentExtension.js +184 -0
- package/dist/src/teamsAgentExtension.js.map +1 -0
- package/dist/src/teamsAttachmentDownloader.d.ts +27 -0
- package/dist/src/teamsAttachmentDownloader.js +80 -0
- package/dist/src/teamsAttachmentDownloader.js.map +1 -0
- package/dist/src/teamsInfo.d.ts +174 -0
- package/dist/src/teamsInfo.js +387 -0
- package/dist/src/teamsInfo.js.map +1 -0
- package/package.json +37 -0
- package/src/activity-extensions/channelInfo.ts +33 -0
- package/src/activity-extensions/index.ts +16 -0
- package/src/activity-extensions/notificationInfo.ts +33 -0
- package/src/activity-extensions/onBehalfOf.ts +38 -0
- package/src/activity-extensions/teamInfo.ts +33 -0
- package/src/activity-extensions/teamsChannelAccount.ts +36 -0
- package/src/activity-extensions/teamsChannelData.ts +75 -0
- package/src/activity-extensions/teamsChannelDataParser.ts +17 -0
- package/src/activity-extensions/teamsChannelDataSettings.ts +28 -0
- package/src/activity-extensions/teamsConversationUpdateEvents.ts +61 -0
- package/src/activity-extensions/teamsMeetingInfo.ts +23 -0
- package/src/activity-extensions/teamsMessageEvents.ts +6 -0
- package/src/activity-extensions/tenantInfo.ts +23 -0
- package/src/client/index.ts +7 -0
- package/src/client/teamsConnectorClient.ts +340 -0
- package/src/client/teamsConnectorClient.types.ts +168 -0
- package/src/compat/readReceipInfo.ts +54 -0
- package/src/compat/teamsActivityHandler.ts +1140 -0
- package/src/file/fileConsentCardResponse.ts +31 -0
- package/src/file/fileUploadInfo.ts +34 -0
- package/src/file/index.ts +7 -0
- package/src/index.ts +10 -0
- package/src/meeting/index.ts +23 -0
- package/src/meeting/meeting.ts +307 -0
- package/src/meeting/meetingDetails.ts +20 -0
- package/src/meeting/meetingDetailsBase.ts +16 -0
- package/src/meeting/meetingEndEventDetails.ts +14 -0
- package/src/meeting/meetingEventDetails.ts +14 -0
- package/src/meeting/meetingInfo.ts +26 -0
- package/src/meeting/meetingNotification.ts +11 -0
- package/src/meeting/meetingNotificationBase.ts +15 -0
- package/src/meeting/meetingNotificationChannelData.ts +14 -0
- package/src/meeting/meetingNotificationRecipientFailureInfo.ts +16 -0
- package/src/meeting/meetingNotificationResponse.ts +16 -0
- package/src/meeting/meetingParticipantsEventDetails.ts +14 -0
- package/src/meeting/meetingStageSurface.ts +17 -0
- package/src/meeting/meetingStartEventDetails.ts +16 -0
- package/src/meeting/meetingSurface.ts +12 -0
- package/src/meeting/meetingTabIconSurface.ts +19 -0
- package/src/meeting/targetedMeetingNotification.ts +23 -0
- package/src/meeting/targetedMeetingNotificationValue.ts +21 -0
- package/src/meeting/teamsMeetingMember.ts +22 -0
- package/src/meeting/teamsMeetingParticipant.ts +29 -0
- package/src/meeting/userMeetingDetails.ts +19 -0
- package/src/message-actions-payload/index.ts +14 -0
- package/src/message-actions-payload/messageActionsPayload.ts +93 -0
- package/src/message-actions-payload/messageActionsPayloadApp.ts +27 -0
- package/src/message-actions-payload/messageActionsPayloadAttachment.ts +34 -0
- package/src/message-actions-payload/messageActionsPayloadBody.ts +27 -0
- package/src/message-actions-payload/messageActionsPayloadConversation.ts +27 -0
- package/src/message-actions-payload/messageActionsPayloadFrom.ts +26 -0
- package/src/message-actions-payload/messageActionsPayloadMention.ts +24 -0
- package/src/message-actions-payload/messageActionsPayloadReaction.ts +29 -0
- package/src/message-actions-payload/messageActionsPayloadUser.ts +31 -0
- package/src/messageExtension/appBasedLinkQuery.ts +20 -0
- package/src/messageExtension/index.ts +15 -0
- package/src/messageExtension/messageExtension.ts +324 -0
- package/src/messageExtension/messagingExtensionAction.ts +44 -0
- package/src/messageExtension/messagingExtensionActionResponse.ts +25 -0
- package/src/messageExtension/messagingExtensionAttachment.ts +16 -0
- package/src/messageExtension/messagingExtensionParameter.ts +28 -0
- package/src/messageExtension/messagingExtensionQuery.ts +51 -0
- package/src/messageExtension/messagingExtensionQueryOptions.ts +28 -0
- package/src/messageExtension/messagingExtensionResponse.ts +21 -0
- package/src/messageExtension/messagingExtensionResult.ts +60 -0
- package/src/messageExtension/messagingExtensionSuggestedAction.ts +16 -0
- package/src/messages/messages.ts +91 -0
- package/src/taskModule/index.ts +12 -0
- package/src/taskModule/taskModule.ts +241 -0
- package/src/taskModule/taskModuleContinueResponse.ts +17 -0
- package/src/taskModule/taskModuleMessageResponse.ts +16 -0
- package/src/taskModule/taskModuleRequest.ts +24 -0
- package/src/taskModule/taskModuleRequestContext.ts +14 -0
- package/src/taskModule/taskModuleResponse.ts +21 -0
- package/src/taskModule/taskModuleResponseBase.ts +19 -0
- package/src/taskModule/taskModuleTaskInfo.ts +40 -0
- package/src/teamsAgentExtension.ts +201 -0
- package/src/teamsAttachmentDownloader.ts +78 -0
- package/src/teamsInfo.ts +430 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */
|
|
2
|
+
import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'
|
|
3
|
+
import { Activity, ChannelAccount } from '@microsoft/agents-activity'
|
|
4
|
+
import { TeamsChannelAccount } from '../activity-extensions/teamsChannelAccount'
|
|
5
|
+
import { MeetingInfo } from '../meeting/meetingInfo'
|
|
6
|
+
import { MeetingNotification } from '../meeting/meetingNotification'
|
|
7
|
+
import { MeetingNotificationResponse } from '../meeting/meetingNotificationResponse'
|
|
8
|
+
import { ChannelInfo } from '../activity-extensions/channelInfo'
|
|
9
|
+
import { TeamsChannelData } from '../activity-extensions'
|
|
10
|
+
import { BatchFailedEntriesResponse, BatchOperationStateResponse, CancelOperationResponse, TeamDetails, TeamsBatchOperationResponse, TeamsMember, TeamsPagedMembersResult } from './teamsConnectorClient.types'
|
|
11
|
+
import { ConnectorClient } from '@microsoft/agents-hosting'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A client for interacting with Microsoft Teams APIs.
|
|
15
|
+
* Extends the ConnectorClient class to provide Teams-specific functionalities.
|
|
16
|
+
*/
|
|
17
|
+
export class TeamsConnectorClient {
|
|
18
|
+
private axiosInstance: AxiosInstance
|
|
19
|
+
constructor (private client: ConnectorClient) {
|
|
20
|
+
this.axiosInstance = client.axiosInstance
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves a member from a conversation or team.
|
|
25
|
+
* @param activity - The activity containing the context.
|
|
26
|
+
* @param userId - The ID of the user to retrieve.
|
|
27
|
+
* @returns A TeamsChannelAccount representing the member.
|
|
28
|
+
*/
|
|
29
|
+
static async getMember (activity: Activity, userId: string): Promise<TeamsChannelAccount> {
|
|
30
|
+
const teamsChannelData = activity.channelData as TeamsChannelData
|
|
31
|
+
const teamId = teamsChannelData.team?.id
|
|
32
|
+
if (teamId) {
|
|
33
|
+
return await this.getTeamMember(activity, teamId, userId)
|
|
34
|
+
} else {
|
|
35
|
+
const conversationId = (activity.conversation != null) && activity.conversation.id ? activity.conversation.id : undefined
|
|
36
|
+
return await this.getMemberInternal(activity, conversationId, userId)
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Retrieves the team ID from an activity.
|
|
42
|
+
* @param activity - The activity containing the context.
|
|
43
|
+
* @returns The team ID as a string.
|
|
44
|
+
* @throws Error if the activity is missing or invalid.
|
|
45
|
+
*/
|
|
46
|
+
private static getTeamId (activity: any): string {
|
|
47
|
+
if (!activity) {
|
|
48
|
+
throw new Error('Missing activity parameter')
|
|
49
|
+
}
|
|
50
|
+
const channelData = activity.channelData as TeamsChannelData
|
|
51
|
+
const team = channelData && (channelData.team != null) ? channelData.team : undefined
|
|
52
|
+
const teamId = (team != null) && typeof team.id === 'string' ? team.id : undefined
|
|
53
|
+
return teamId as string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves a member from a team.
|
|
58
|
+
* @param activity - The activity containing the context.
|
|
59
|
+
* @param teamId - The ID of the team.
|
|
60
|
+
* @param userId - The ID of the user to retrieve.
|
|
61
|
+
* @returns A TeamsChannelAccount representing the team member.
|
|
62
|
+
* @throws Error if the teamId or userId is missing.
|
|
63
|
+
*/
|
|
64
|
+
static async getTeamMember (activity: any, teamId?: string, userId?: string) {
|
|
65
|
+
const t = teamId || this.getTeamId(activity)
|
|
66
|
+
if (!t) {
|
|
67
|
+
throw new Error('This method is only valid within the scope of a MS Teams Team.')
|
|
68
|
+
}
|
|
69
|
+
if (!userId) {
|
|
70
|
+
throw new Error('userId is required')
|
|
71
|
+
}
|
|
72
|
+
return await this.getMemberInternal(activity, t, userId)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Retrieves a member from a conversation.
|
|
77
|
+
* @param conversationId - The ID of the conversation.
|
|
78
|
+
* @param userId - The ID of the user to retrieve.
|
|
79
|
+
* @returns A ChannelAccount representing the conversation member.
|
|
80
|
+
*/
|
|
81
|
+
public async getConversationMember (conversationId: string, userId: string): Promise<ChannelAccount> {
|
|
82
|
+
const config: AxiosRequestConfig = {
|
|
83
|
+
method: 'get',
|
|
84
|
+
url: `/v3/conversations/${conversationId}/members/${userId}`,
|
|
85
|
+
headers: {
|
|
86
|
+
'Content-Type': 'application/json'
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const response: AxiosResponse = await this.axiosInstance(config)
|
|
90
|
+
return response.data
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Retrieves a member from a conversation or team internally.
|
|
95
|
+
* @param activity - The activity containing the context.
|
|
96
|
+
* @param conversationId - The ID of the conversation.
|
|
97
|
+
* @param userId - The ID of the user to retrieve.
|
|
98
|
+
* @returns A ChannelAccount representing the member.
|
|
99
|
+
* @throws Error if the conversationId is missing or the client is unavailable.
|
|
100
|
+
*/
|
|
101
|
+
static async getMemberInternal (
|
|
102
|
+
activity: any,
|
|
103
|
+
conversationId: string | undefined,
|
|
104
|
+
userId: string
|
|
105
|
+
): Promise<ChannelAccount> {
|
|
106
|
+
if (!conversationId) {
|
|
107
|
+
throw new Error('conversationId is required')
|
|
108
|
+
}
|
|
109
|
+
const client : ConnectorClient = activity.turnState?.get(activity.adapter.ConnectorClientKey)
|
|
110
|
+
if (!client) {
|
|
111
|
+
throw new Error('Client is not available in the context.')
|
|
112
|
+
}
|
|
113
|
+
const teamMember: ChannelAccount = await client.getConversationMember(conversationId, userId)
|
|
114
|
+
return teamMember
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Retrieves paged members of a conversation.
|
|
119
|
+
* @param conversationId - The ID of the conversation.
|
|
120
|
+
* @param pageSize - The number of members per page.
|
|
121
|
+
* @param continuationToken - The token for pagination.
|
|
122
|
+
* @returns A TeamsPagedMembersResult containing the paged members.
|
|
123
|
+
*/
|
|
124
|
+
public async getConversationPagedMember (conversationId: string, pageSize: number, continuationToken: string): Promise<TeamsPagedMembersResult> {
|
|
125
|
+
const config: AxiosRequestConfig = {
|
|
126
|
+
method: 'get',
|
|
127
|
+
url: `v3/conversations/${conversationId}/pagedMembers`,
|
|
128
|
+
params: {
|
|
129
|
+
pageSize,
|
|
130
|
+
continuationToken
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
const response = await this.axiosInstance(config)
|
|
134
|
+
return response.data
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Fetches the list of channels in a team.
|
|
139
|
+
* @param teamId - The ID of the team.
|
|
140
|
+
* @returns An array of ChannelInfo objects representing the channels.
|
|
141
|
+
*/
|
|
142
|
+
public async fetchChannelList (teamId: string): Promise<ChannelInfo[]> {
|
|
143
|
+
const config: AxiosRequestConfig = {
|
|
144
|
+
method: 'get',
|
|
145
|
+
url: `v3/teams/${teamId}/conversations`
|
|
146
|
+
}
|
|
147
|
+
const response = await this.axiosInstance(config)
|
|
148
|
+
return response.data
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Fetches the details of a team.
|
|
153
|
+
* @param teamId - The ID of the team.
|
|
154
|
+
* @returns A TeamDetails object containing the team details.
|
|
155
|
+
*/
|
|
156
|
+
public async fetchTeamDetails (teamId: string): Promise<TeamDetails> {
|
|
157
|
+
const config: AxiosRequestConfig = {
|
|
158
|
+
method: 'get',
|
|
159
|
+
url: `v3/teams/${teamId}`
|
|
160
|
+
}
|
|
161
|
+
const response = await this.axiosInstance(config)
|
|
162
|
+
return response.data
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Fetches information about a meeting participant.
|
|
167
|
+
* @param meetingId - The ID of the meeting.
|
|
168
|
+
* @param participantId - The ID of the participant.
|
|
169
|
+
* @param tenantId - The tenant ID.
|
|
170
|
+
* @returns A string containing participant information.
|
|
171
|
+
*/
|
|
172
|
+
public async fetchMeetingParticipant (meetingId: string, participantId: string, tenantId: string): Promise<string> {
|
|
173
|
+
const config: AxiosRequestConfig = {
|
|
174
|
+
method: 'get',
|
|
175
|
+
url: `v1/meetings/${meetingId}/participants/${participantId}`,
|
|
176
|
+
params: { tenantId }
|
|
177
|
+
}
|
|
178
|
+
const response = await this.axiosInstance(config)
|
|
179
|
+
return response.data
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Fetches information about a meeting.
|
|
184
|
+
* @param meetingId - The ID of the meeting.
|
|
185
|
+
* @returns A MeetingInfo object containing the meeting information.
|
|
186
|
+
*/
|
|
187
|
+
public async fetchMeetingInfo (meetingId: string): Promise<MeetingInfo> {
|
|
188
|
+
const config: AxiosRequestConfig = {
|
|
189
|
+
method: 'get',
|
|
190
|
+
url: `v1/meetings/${meetingId}`
|
|
191
|
+
}
|
|
192
|
+
const response = await this.axiosInstance(config)
|
|
193
|
+
return response.data
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Sends a notification to a meeting.
|
|
198
|
+
* @param meetingId - The ID of the meeting.
|
|
199
|
+
* @param notification - The notification to send.
|
|
200
|
+
* @returns A MeetingNotificationResponse object containing the response.
|
|
201
|
+
*/
|
|
202
|
+
public async sendMeetingNotification (meetingId: string, notification: MeetingNotification): Promise<MeetingNotificationResponse> {
|
|
203
|
+
const config: AxiosRequestConfig = {
|
|
204
|
+
method: 'post',
|
|
205
|
+
url: `v1/meetings/${meetingId}/notification`,
|
|
206
|
+
data: notification
|
|
207
|
+
}
|
|
208
|
+
const response = await this.axiosInstance(config)
|
|
209
|
+
return response.data
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Sends a message to a list of users.
|
|
214
|
+
* @param activity - The activity to send.
|
|
215
|
+
* @param tenantId - The tenant ID.
|
|
216
|
+
* @param members - The list of members to send the message to.
|
|
217
|
+
* @returns A TeamsBatchOperationResponse object containing the response.
|
|
218
|
+
*/
|
|
219
|
+
public async sendMessageToListOfUsers (activity: Activity, tenantId: string, members: TeamsMember[]): Promise<TeamsBatchOperationResponse> {
|
|
220
|
+
const content = {
|
|
221
|
+
activity,
|
|
222
|
+
members,
|
|
223
|
+
tenantId
|
|
224
|
+
}
|
|
225
|
+
const config: AxiosRequestConfig = {
|
|
226
|
+
method: 'post',
|
|
227
|
+
url: 'v3/batch/conversation/users',
|
|
228
|
+
data: content
|
|
229
|
+
}
|
|
230
|
+
const response = await this.axiosInstance(config)
|
|
231
|
+
return response.data
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Sends a message to all users in a tenant.
|
|
236
|
+
* @param activity - The activity to send.
|
|
237
|
+
* @param tenandId - The tenant ID.
|
|
238
|
+
* @returns A TeamsBatchOperationResponse object containing the response.
|
|
239
|
+
*/
|
|
240
|
+
public async sendMessageToAllUsersInTenant (activity: Activity, tenandId: string): Promise<TeamsBatchOperationResponse> {
|
|
241
|
+
const content = {
|
|
242
|
+
activity,
|
|
243
|
+
tenandId
|
|
244
|
+
}
|
|
245
|
+
const config: AxiosRequestConfig = {
|
|
246
|
+
method: 'post',
|
|
247
|
+
url: 'v3/batch/conversation/tenant',
|
|
248
|
+
data: content
|
|
249
|
+
}
|
|
250
|
+
const response = await this.axiosInstance(config)
|
|
251
|
+
return response.data
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* Sends a message to all users in a team.
|
|
256
|
+
* @param activity - The activity to send.
|
|
257
|
+
* @param tenantId - The tenant ID.
|
|
258
|
+
* @param teamId - The team ID.
|
|
259
|
+
* @returns A TeamsBatchOperationResponse object containing the response.
|
|
260
|
+
*/
|
|
261
|
+
public async sendMessageToAllUsersInTeam (activity: Activity, tenantId: string, teamId: string): Promise<TeamsBatchOperationResponse> {
|
|
262
|
+
const content = {
|
|
263
|
+
activity,
|
|
264
|
+
tenantId,
|
|
265
|
+
teamId
|
|
266
|
+
}
|
|
267
|
+
const config: AxiosRequestConfig = {
|
|
268
|
+
method: 'post',
|
|
269
|
+
url: 'v3/batch/conversation/team',
|
|
270
|
+
data: content
|
|
271
|
+
}
|
|
272
|
+
const response = await this.axiosInstance(config)
|
|
273
|
+
return response.data
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Sends a message to a list of channels.
|
|
278
|
+
* @param activity - The activity to send.
|
|
279
|
+
* @param tenantId - The tenant ID.
|
|
280
|
+
* @param members - The list of members to send the message to.
|
|
281
|
+
* @returns A TeamsBatchOperationResponse object containing the response.
|
|
282
|
+
*/
|
|
283
|
+
public async sendMessageToListOfChannels (activity: Activity, tenantId: string, members: TeamsMember[]): Promise<TeamsBatchOperationResponse> {
|
|
284
|
+
const content = {
|
|
285
|
+
activity,
|
|
286
|
+
tenantId,
|
|
287
|
+
members
|
|
288
|
+
}
|
|
289
|
+
const config: AxiosRequestConfig = {
|
|
290
|
+
method: 'post',
|
|
291
|
+
url: 'v3/batch/conversation/channels',
|
|
292
|
+
data: content
|
|
293
|
+
}
|
|
294
|
+
const response = await this.axiosInstance(config)
|
|
295
|
+
return response.data
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* Retrieves the state of a batch operation.
|
|
300
|
+
* @param operationId - The ID of the operation.
|
|
301
|
+
* @returns A BatchOperationStateResponse object containing the operation state.
|
|
302
|
+
*/
|
|
303
|
+
public async getOperationState (operationId: string): Promise<BatchOperationStateResponse> {
|
|
304
|
+
const config: AxiosRequestConfig = {
|
|
305
|
+
method: 'get',
|
|
306
|
+
url: `v3/batch/conversation/${operationId}`
|
|
307
|
+
}
|
|
308
|
+
const response = await this.axiosInstance(config)
|
|
309
|
+
return response.data
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Retrieves the failed entries of a batch operation.
|
|
314
|
+
* @param operationId - The ID of the operation.
|
|
315
|
+
* @returns A BatchFailedEntriesResponse object containing the failed entries.
|
|
316
|
+
*/
|
|
317
|
+
public async getFailedEntries (operationId: string): Promise<BatchFailedEntriesResponse> {
|
|
318
|
+
const config: AxiosRequestConfig = {
|
|
319
|
+
method: 'get',
|
|
320
|
+
url: `v3/batch/conversation/failedentries/${operationId}`
|
|
321
|
+
}
|
|
322
|
+
const response = await this.axiosInstance(config)
|
|
323
|
+
return response.data
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/**
|
|
327
|
+
* Cancels a batch operation.
|
|
328
|
+
* @param operationId - The ID of the operation.
|
|
329
|
+
* @returns A CancelOperationResponse object containing the response.
|
|
330
|
+
*/
|
|
331
|
+
public async cancelOperation (operationId: string): Promise<CancelOperationResponse> {
|
|
332
|
+
const config: AxiosRequestConfig = {
|
|
333
|
+
method: 'delete',
|
|
334
|
+
url: `v3/batch/conversation/${operationId}`
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
const response = await this.axiosInstance(config)
|
|
338
|
+
return response.data
|
|
339
|
+
}
|
|
340
|
+
}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright(c) Microsoft Corporation.All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { TeamsChannelAccount } from '../activity-extensions/teamsChannelAccount'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents details of a Microsoft Teams team.
|
|
10
|
+
*/
|
|
11
|
+
export interface TeamDetails {
|
|
12
|
+
/**
|
|
13
|
+
* Unique identifier of the team.
|
|
14
|
+
*/
|
|
15
|
+
id?: string;
|
|
16
|
+
/**
|
|
17
|
+
* Name of the team.
|
|
18
|
+
*/
|
|
19
|
+
name?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Azure Active Directory group ID of the team.
|
|
22
|
+
*/
|
|
23
|
+
aadGroupId?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Number of channels in the team.
|
|
26
|
+
*/
|
|
27
|
+
channelCount?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Number of members in the team.
|
|
30
|
+
*/
|
|
31
|
+
memberCount?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Type of the team.
|
|
34
|
+
*/
|
|
35
|
+
type?: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Represents a member in a Microsoft Teams team.
|
|
40
|
+
*/
|
|
41
|
+
export type TeamsMember = {
|
|
42
|
+
/**
|
|
43
|
+
* Unique identifier of the member.
|
|
44
|
+
*/
|
|
45
|
+
id: string;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Represents a paged result of Teams members.
|
|
50
|
+
*/
|
|
51
|
+
export interface TeamsPagedMembersResult {
|
|
52
|
+
/**
|
|
53
|
+
* Continuation token for fetching the next page of results.
|
|
54
|
+
*/
|
|
55
|
+
continuationToken: string;
|
|
56
|
+
/**
|
|
57
|
+
* List of Teams channel accounts.
|
|
58
|
+
*/
|
|
59
|
+
members: TeamsChannelAccount[];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Represents a failed entry in a batch operation.
|
|
64
|
+
*/
|
|
65
|
+
export interface BatchFailedEntry {
|
|
66
|
+
/**
|
|
67
|
+
* Unique identifier of the failed entry.
|
|
68
|
+
*/
|
|
69
|
+
id: string;
|
|
70
|
+
/**
|
|
71
|
+
* Error message associated with the failed entry.
|
|
72
|
+
*/
|
|
73
|
+
error: string;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Represents the response for failed entries in a batch operation.
|
|
78
|
+
*/
|
|
79
|
+
export interface BatchFailedEntriesResponse {
|
|
80
|
+
/**
|
|
81
|
+
* A token to retrieve the next page of results.
|
|
82
|
+
*/
|
|
83
|
+
continuationToken: string;
|
|
84
|
+
/**
|
|
85
|
+
* A list of failed entry responses.
|
|
86
|
+
*/
|
|
87
|
+
failedEntryResponses: BatchFailedEntry[];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Represents the response of a batch operation.
|
|
92
|
+
*/
|
|
93
|
+
export interface BatchOperationResponse {
|
|
94
|
+
/**
|
|
95
|
+
* Unique identifier of the batch operation.
|
|
96
|
+
*/
|
|
97
|
+
operationId: string;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Represents the state of a batch operation.
|
|
102
|
+
*/
|
|
103
|
+
export interface BatchOperationStateResponse {
|
|
104
|
+
/**
|
|
105
|
+
* The state of the batch operation.
|
|
106
|
+
*/
|
|
107
|
+
state: string;
|
|
108
|
+
/**
|
|
109
|
+
* A map of status codes to their counts.
|
|
110
|
+
*/
|
|
111
|
+
statusMap: Record<number, number>;
|
|
112
|
+
/**
|
|
113
|
+
* The retry-after date for the batch operation.
|
|
114
|
+
*/
|
|
115
|
+
retryAfter?: Date;
|
|
116
|
+
/**
|
|
117
|
+
* The total number of entries in the batch operation.
|
|
118
|
+
*/
|
|
119
|
+
totalEntriesCount: number;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Represents the response from a cancel operation.
|
|
124
|
+
*/
|
|
125
|
+
export type CancelOperationResponse = {
|
|
126
|
+
/**
|
|
127
|
+
* The response object.
|
|
128
|
+
*/
|
|
129
|
+
_response: Response & {
|
|
130
|
+
/**
|
|
131
|
+
* The response body as text.
|
|
132
|
+
*/
|
|
133
|
+
bodyAsText: string;
|
|
134
|
+
/**
|
|
135
|
+
* The parsed response body.
|
|
136
|
+
*/
|
|
137
|
+
parsedBody: {};
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Represents a response containing a resource ID.
|
|
143
|
+
*/
|
|
144
|
+
export interface ResourceResponse {
|
|
145
|
+
/**
|
|
146
|
+
* Unique identifier of the resource.
|
|
147
|
+
*/
|
|
148
|
+
id: string;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Represents a response from a batch operation in Teams.
|
|
153
|
+
*/
|
|
154
|
+
export type TeamsBatchOperationResponse = BatchOperationResponse & {
|
|
155
|
+
/**
|
|
156
|
+
* The raw response object.
|
|
157
|
+
*/
|
|
158
|
+
_response: Response & {
|
|
159
|
+
/**
|
|
160
|
+
* The response body as text.
|
|
161
|
+
*/
|
|
162
|
+
bodyAsText: string;
|
|
163
|
+
/**
|
|
164
|
+
* The parsed response body.
|
|
165
|
+
*/
|
|
166
|
+
parsedBody: BatchOperationResponse | {};
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Class representing read receipt information.
|
|
8
|
+
*/
|
|
9
|
+
export class ReadReceiptInfo {
|
|
10
|
+
/**
|
|
11
|
+
* The ID of the last read message.
|
|
12
|
+
*/
|
|
13
|
+
lastReadMessageId: string
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Creates an instance of ReadReceiptInfo.
|
|
17
|
+
* @param {string} [lastReadMessageId=''] - The ID of the last read message.
|
|
18
|
+
*/
|
|
19
|
+
constructor (lastReadMessageId: string = '') {
|
|
20
|
+
this.lastReadMessageId = lastReadMessageId
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a message has been read.
|
|
25
|
+
* @param {string} compareMessageId - The ID of the message to compare.
|
|
26
|
+
* @param {string} lastReadMessageId - The ID of the last read message.
|
|
27
|
+
* @returns {boolean} True if the message has been read, false otherwise.
|
|
28
|
+
*/
|
|
29
|
+
static isMessageRead (compareMessageId: string, lastReadMessageId: string): boolean {
|
|
30
|
+
if (
|
|
31
|
+
compareMessageId &&
|
|
32
|
+
compareMessageId.trim().length > 0 &&
|
|
33
|
+
lastReadMessageId &&
|
|
34
|
+
lastReadMessageId.trim().length > 0
|
|
35
|
+
) {
|
|
36
|
+
const compareMessageIdNum = Number(compareMessageId)
|
|
37
|
+
const lastReadMessageIdNum = Number(lastReadMessageId)
|
|
38
|
+
|
|
39
|
+
if (compareMessageIdNum && lastReadMessageIdNum) {
|
|
40
|
+
return compareMessageIdNum <= lastReadMessageIdNum
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return false
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Checks if a message has been read using the instance's last read message ID.
|
|
48
|
+
* @param {string} compareMessageId - The ID of the message to compare.
|
|
49
|
+
* @returns {boolean} True if the message has been read, false otherwise.
|
|
50
|
+
*/
|
|
51
|
+
isMessageRead (compareMessageId: string): boolean {
|
|
52
|
+
return ReadReceiptInfo.isMessageRead(compareMessageId, this.lastReadMessageId)
|
|
53
|
+
}
|
|
54
|
+
}
|