UNPKG

botbuilder-core

Version:

Core components for Microsoft Bot Builder. Components in this library can run either in a browser or on the server.

59 lines 2.12 kB
/** * @module botbuilder */ /** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { BotState } from './botState'; import { TurnContext } from './turnContext'; /** * A collection of `BotState` plugins that should be loaded or saved in parallel as a single unit. * See `AutoSaveStateMiddleware` for an implementation of this class. */ export declare class BotStateSet { /** * Array of the sets `BotState` plugins. */ readonly botStates: BotState[]; /** * Creates a new BotStateSet instance. * * @param botStates One or more BotState plugins to register. */ constructor(...botStates: BotState[]); /** * Registers one or more `BotState` plugins with the set. * * @param botStates One or more BotState plugins to register. * @returns The updated BotStateSet. */ add(...botStates: BotState[]): this; /** * Calls `BotState.load()` on all of the BotState plugins in the set. * * @remarks * This will trigger all of the plugins to read in their state in parallel. * * ```JavaScript * await stateSet.readAll(context); * ``` * @param context Context for current turn of conversation with the user. * @param force (Optional) If `true` the cache will be bypassed and the state will always be read in directly from storage. Defaults to `false`. */ loadAll(context: TurnContext, force?: boolean): Promise<void>; /** * Calls `BotState.saveChanges()` on all of the BotState plugins in the set. * * @remarks * This will trigger all of the plugins to write out their state in parallel. * * ```JavaScript * await stateSet.saveAllChanges(context); * ``` * @param context Context for current turn of conversation with the user. * @param force (Optional) if `true` the state will always be written out regardless of its change state. Defaults to `false`. */ saveAllChanges(context: TurnContext, force?: boolean): Promise<void>; } //# sourceMappingURL=botStateSet.d.ts.map