UNPKG

@microsoft/agents-hosting-extensions-teams

Version:

Microsoft 365 Agents SDK for JavaScript. Teams extensions

147 lines (146 loc) 7.19 kB
import { Activity, ChannelAccount } from '@microsoft/agents-activity'; import { TeamsChannelAccount } from '../activity-extensions/teamsChannelAccount'; import { MeetingInfo } from '../meeting/meetingInfo'; import { MeetingNotification } from '../meeting/meetingNotification'; import { MeetingNotificationResponse } from '../meeting/meetingNotificationResponse'; import { ChannelInfo } from '../activity-extensions/channelInfo'; import { BatchFailedEntriesResponse, BatchOperationStateResponse, CancelOperationResponse, TeamDetails, TeamsBatchOperationResponse, TeamsMember, TeamsPagedMembersResult } from './teamsConnectorClient.types'; import { ConnectorClient } from '@microsoft/agents-hosting'; /** * A client for interacting with Microsoft Teams APIs. * Extends the ConnectorClient class to provide Teams-specific functionalities. */ export declare class TeamsConnectorClient { private client; private axiosInstance; constructor(client: ConnectorClient); /** * Retrieves a member from a conversation or team. * @param activity - The activity containing the context. * @param userId - The ID of the user to retrieve. * @returns A TeamsChannelAccount representing the member. */ static getMember(activity: Activity, userId: string): Promise<TeamsChannelAccount>; /** * Retrieves the team ID from an activity. * @param activity - The activity containing the context. * @returns The team ID as a string. * @throws Error if the activity is missing or invalid. */ private static getTeamId; /** * Retrieves a member from a team. * @param activity - The activity containing the context. * @param teamId - The ID of the team. * @param userId - The ID of the user to retrieve. * @returns A TeamsChannelAccount representing the team member. * @throws Error if the teamId or userId is missing. */ static getTeamMember(activity: any, teamId?: string, userId?: string): Promise<ChannelAccount>; /** * Retrieves a member from a conversation. * @param conversationId - The ID of the conversation. * @param userId - The ID of the user to retrieve. * @returns A ChannelAccount representing the conversation member. */ getConversationMember(conversationId: string, userId: string): Promise<ChannelAccount>; /** * Retrieves a member from a conversation or team internally. * @param activity - The activity containing the context. * @param conversationId - The ID of the conversation. * @param userId - The ID of the user to retrieve. * @returns A ChannelAccount representing the member. * @throws Error if the conversationId is missing or the client is unavailable. */ static getMemberInternal(activity: any, conversationId: string | undefined, userId: string): Promise<ChannelAccount>; /** * Retrieves paged members of a conversation. * @param conversationId - The ID of the conversation. * @param pageSize - The number of members per page. * @param continuationToken - The token for pagination. * @returns A TeamsPagedMembersResult containing the paged members. */ getConversationPagedMember(conversationId: string, pageSize: number, continuationToken: string): Promise<TeamsPagedMembersResult>; /** * Fetches the list of channels in a team. * @param teamId - The ID of the team. * @returns An array of ChannelInfo objects representing the channels. */ fetchChannelList(teamId: string): Promise<ChannelInfo[]>; /** * Fetches the details of a team. * @param teamId - The ID of the team. * @returns A TeamDetails object containing the team details. */ fetchTeamDetails(teamId: string): Promise<TeamDetails>; /** * Fetches information about a meeting participant. * @param meetingId - The ID of the meeting. * @param participantId - The ID of the participant. * @param tenantId - The tenant ID. * @returns A string containing participant information. */ fetchMeetingParticipant(meetingId: string, participantId: string, tenantId: string): Promise<string>; /** * Fetches information about a meeting. * @param meetingId - The ID of the meeting. * @returns A MeetingInfo object containing the meeting information. */ fetchMeetingInfo(meetingId: string): Promise<MeetingInfo>; /** * Sends a notification to a meeting. * @param meetingId - The ID of the meeting. * @param notification - The notification to send. * @returns A MeetingNotificationResponse object containing the response. */ sendMeetingNotification(meetingId: string, notification: MeetingNotification): Promise<MeetingNotificationResponse>; /** * Sends a message to a list of users. * @param activity - The activity to send. * @param tenantId - The tenant ID. * @param members - The list of members to send the message to. * @returns A TeamsBatchOperationResponse object containing the response. */ sendMessageToListOfUsers(activity: Activity, tenantId: string, members: TeamsMember[]): Promise<TeamsBatchOperationResponse>; /** * Sends a message to all users in a tenant. * @param activity - The activity to send. * @param tenandId - The tenant ID. * @returns A TeamsBatchOperationResponse object containing the response. */ sendMessageToAllUsersInTenant(activity: Activity, tenandId: string): Promise<TeamsBatchOperationResponse>; /** * Sends a message to all users in a team. * @param activity - The activity to send. * @param tenantId - The tenant ID. * @param teamId - The team ID. * @returns A TeamsBatchOperationResponse object containing the response. */ sendMessageToAllUsersInTeam(activity: Activity, tenantId: string, teamId: string): Promise<TeamsBatchOperationResponse>; /** * Sends a message to a list of channels. * @param activity - The activity to send. * @param tenantId - The tenant ID. * @param members - The list of members to send the message to. * @returns A TeamsBatchOperationResponse object containing the response. */ sendMessageToListOfChannels(activity: Activity, tenantId: string, members: TeamsMember[]): Promise<TeamsBatchOperationResponse>; /** * Retrieves the state of a batch operation. * @param operationId - The ID of the operation. * @returns A BatchOperationStateResponse object containing the operation state. */ getOperationState(operationId: string): Promise<BatchOperationStateResponse>; /** * Retrieves the failed entries of a batch operation. * @param operationId - The ID of the operation. * @returns A BatchFailedEntriesResponse object containing the failed entries. */ getFailedEntries(operationId: string): Promise<BatchFailedEntriesResponse>; /** * Cancels a batch operation. * @param operationId - The ID of the operation. * @returns A CancelOperationResponse object containing the response. */ cancelOperation(operationId: string): Promise<CancelOperationResponse>; }