AttachmentDownloader class
A utility class for downloading input files from activity attachments.
Remarks
This class provides functionality to filter and download attachments from a turn context, supporting various content types and handling authentication for secure URLs.
Constructors
| Attachment |
Creates an instance of AttachmentDownloader. This class is responsible for downloading input files from attachments. |
Methods
| download |
Downloads files from the attachments in the current turn context and stores them in state. |
| download |
Downloads files from the attachments in the current turn context. |
Constructor Details
AttachmentDownloader<TState>(string)
Creates an instance of AttachmentDownloader. This class is responsible for downloading input files from attachments.
new AttachmentDownloader(stateKey?: string)
Parameters
- stateKey
-
string
The key to store files in state. Defaults to 'inputFiles'.
Method Details
downloadAndStoreFiles(TurnContext, TState)
Downloads files from the attachments in the current turn context and stores them in state.
function downloadAndStoreFiles(context: TurnContext, state: TState): Promise<void>
Parameters
- context
- TurnContext
The turn context containing the activity with attachments.
- state
-
TState
The turn state to store the files in.
Returns
Promise<void>
A promise that resolves when the downloaded files are stored.
downloadFiles(TurnContext)
Downloads files from the attachments in the current turn context.
function downloadFiles(context: TurnContext): Promise<InputFile[]>
Parameters
- context
- TurnContext
The turn context containing the activity with attachments.
Returns
Promise<InputFile[]>
A promise that resolves to an array of downloaded input files.