UNPKG

@microsoft/agents-hosting-teams

Version:

Microsoft 365 Agents SDK for JavaScript

52 lines (51 loc) 3.27 kB
/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { RouteSelector, TurnContext, TurnState } from '@microsoft/agents-hosting'; import { TeamsApplication } from '../teamsApplication'; import { AgentConfigAuth } from '../../agent-config/agentConfigAuth'; import { TaskModuleResponse } from '../../task/taskModuleResponse'; import { TaskModuleTaskInfo } from '../../task/taskModuleTaskInfo'; /** * Manages task modules for Teams applications, handling fetch and submit operations. * @template TState Type extending TurnState to be used by the application */ export declare class TaskModules<TState extends TurnState> { private readonly _app; /** * Creates a new TaskModules instance. * @param app The TeamsApplication instance to associate with this TaskModules instance */ constructor(app: TeamsApplication<TState>); /** * Handles task module fetch requests, which occur when a task module is initially requested. * @template TData Type of data expected in the task module request * @param verb Identifier for the task module (string, RegExp, or RouteSelector) * @param handler Function to handle the task module fetch request * @returns The TeamsApplication instance for chaining */ fetch<TData extends Record<string, any> = Record<string, any>>(verb: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<TaskModuleTaskInfo | string>): TeamsApplication<TState>; /** * Handles task module submit requests, which occur when a task module form is submitted. * @template TData Type of data expected in the task module submit request * @param verb Identifier for the task module (string, RegExp, or RouteSelector) * @param handler Function to handle the task module submit request * @returns The TeamsApplication instance for chaining */ submit<TData extends Record<string, any> = Record<string, any>>(verb: string | RegExp | RouteSelector | (string | RegExp | RouteSelector)[], handler: (context: TurnContext, state: TState, data: TData) => Promise<TaskModuleTaskInfo | string | null | undefined>): TeamsApplication<TState>; /** * Handles configuration fetch requests for agent configuration in Teams. * @template TData Type of data expected in the configuration fetch request * @param handler Function to handle the configuration fetch request * @returns The TeamsApplication instance for chaining */ configFetch<TData extends Record<string, any>>(handler: (context: TurnContext, state: TState, data: TData) => Promise<AgentConfigAuth | TaskModuleResponse>): TeamsApplication<TState>; /** * Handles configuration submit requests for agent configuration in Teams. * @template TData Type of data expected in the configuration submit request * @param handler Function to handle the configuration submit request * @returns The TeamsApplication instance for chaining */ configSubmit<TData extends Record<string, any>>(handler: (context: TurnContext, state: TState, data: TData) => Promise<AgentConfigAuth | TaskModuleResponse>): TeamsApplication<TState>; }