botbuilder-dialogs-adaptive
Version:
Rule system for the Microsoft BotBuilder dialog system.
176 lines • 5.19 kB
TypeScript
import { BoolProperty, EnumProperty, StringProperty, UnknownProperty } from '../properties';
import { Headers } from 'node-fetch';
import { BoolExpression, EnumExpression, StringExpression, ValueExpression } from 'adaptive-expressions';
import { Converter, ConverterFactory, DialogContext, Dialog, DialogTurnResult, DialogConfiguration } from 'botbuilder-dialogs';
type HeadersInput = Record<string, string>;
type HeadersOutput = Record<string, StringExpression>;
export declare enum ResponsesTypes {
/**
* No response expected
*/
None = 0,
/**
* Plain JSON response
*/
Json = 1,
/**
* JSON Activity object to send to the user
*/
Activity = 2,
/**
* Json Array of activity objects to send to the user
*/
Activities = 3,
/**
* Binary data parsing from http response content
*/
Binary = 4
}
export declare enum HttpMethod {
/**
* Http GET
*/
GET = "GET",
/**
* Http POST
*/
POST = "POST",
/**
* Http PATCH
*/
PATCH = "PATCH",
/**
* Http PUT
*/
PUT = "PUT",
/**
* Http DELETE
*/
DELETE = "DELETE",
/**
* Http HEAD
*/
HEAD = "HEAD"
}
/**
* Result data of HTTP operation.
*/
export declare class Result {
/**
* Initialize a new instance of Result class.
*
* @param headers Response headers.
*/
constructor(headers?: Headers);
/**
* The status code from the response to HTTP operation.
*/
statusCode?: number;
/**
* The reason phrase from the response to HTTP operation.
*/
reasonPhrase?: string;
/**
* The headers from the response to HTTP operation.
*/
headers?: {
[key: string]: string;
};
/**
* The content body from the response to HTTP operation.
*/
content?: any;
}
export interface HttpRequestConfiguration extends DialogConfiguration {
method?: HttpMethod;
contentType?: StringProperty;
url?: StringProperty;
headers?: HeadersInput | HeadersOutput;
body?: UnknownProperty;
responseType?: EnumProperty<ResponsesTypes>;
resultProperty: StringProperty;
disabled?: BoolProperty;
}
/**
* Action for performing an `HttpRequest`.
*/
export declare class HttpRequest<O extends object = {}> extends Dialog<O> implements HttpRequestConfiguration {
static $kind: string;
constructor();
/**
* Initializes a new instance of the [HttpRequest](xref:botbuilder-dialogs-adaptive.HttpRequest) class.
*
* @param method The [HttpMethod](xref:botbuilder-dialogs-adaptive.HttpMethod), for example POST, GET, DELETE or PUT.
* @param url URL for the request.
* @param headers The headers of the request.
* @param body The raw body of the request.
*/
constructor(method: HttpMethod, url: string, headers: {
[key: string]: string;
}, body: any);
/**
* Http Method
*/
method?: HttpMethod;
/**
* Content type of request body
*/
contentType?: StringExpression;
/**
* Http Url
*/
url?: StringExpression;
/**
* Http Headers
*/
headers?: {
[key: string]: StringExpression;
};
/**
* Http Body
*/
body?: ValueExpression;
/**
* The response type of the response
*/
responseType?: EnumExpression<ResponsesTypes>;
/**
* Gets or sets the property expression to store the HTTP response in.
*/
resultProperty: StringExpression;
/**
* An optional expression which if is true will disable this action.
*/
disabled?: BoolExpression;
/**
* @param property The key of the conditional selector configuration.
* @returns The converter for the selector configuration.
*/
getConverter(property: keyof HttpRequestConfiguration): Converter | ConverterFactory;
/**
* Starts a new [Dialog](xref:botbuilder-dialogs.Dialog) and pushes it onto the dialog stack.
*
* @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation.
* @param _options Optional. Initial information to pass to the dialog.
* @returns A `Promise` representing the asynchronous operation.
*/
beginDialog(dc: DialogContext, _options?: O): Promise<DialogTurnResult>;
/**
* Writes Trace Activity for the http request and response values and returns the actionResult as the result of this operation.
*
* @param dc The [DialogContext](xref:botbuilder-dialogs.DialogContext) for the current turn of conversation.
* @param result Value returned from the dialog that was called. The type
* of the value returned is dependent on the child dialog.
* @param traceInfo Trace information to be written.
* @returns A `Promise` representing the asynchronous operation.
*/
private endDialogWithResult;
/**
* @protected
* Builds the compute Id for the [Dialog](xref:botbuilder-dialogs.Dialog).
* @returns A `string` representing the compute Id.
*/
protected onComputeId(): string;
}
export {};
//# sourceMappingURL=httpRequest.d.ts.map