250 lines
No EOL
12 KiB
TypeScript
250 lines
No EOL
12 KiB
TypeScript
/**
|
|
* Copyright(c) Microsoft Corporation.All rights reserved.
|
|
* Licensed under the MIT License.
|
|
*/
|
|
import { IEndOfConversationActivity, IEventActivity, IMessageActivity, IContactRelationUpdateActivity, IConversationUpdateActivity, ITypingActivity, IHandoffActivity, IInvokeActivity, ITraceActivity, IInstallationUpdateActivity, IMessageUpdateActivity, IMessageDeleteActivity, IMessageReactionActivity, ISuggestionActivity } from './activityInterfaces';
|
|
import { Activity, ConversationReference, ICommandActivity, ICommandResultActivity, Mention } from './index';
|
|
export declare namespace ActivityEx {
|
|
/**
|
|
* Creates an Activity as an IMessageActivity object.
|
|
*
|
|
* @returns The new message activity.
|
|
*/
|
|
function createMessageActivity(): Partial<IMessageActivity>;
|
|
/**
|
|
* Creates an Activity as an IContactRelationUpdateActivity object.
|
|
*
|
|
* @returns The new contact relation update activity.
|
|
*/
|
|
function createContactRelationUpdateActivity(): Partial<IContactRelationUpdateActivity>;
|
|
/**
|
|
* Creates an Activity as an IConversationUpdateActivity object.
|
|
*
|
|
* @returns The new conversation update activity.
|
|
*/
|
|
function createConversationUpdateActivity(): Partial<IConversationUpdateActivity>;
|
|
/**
|
|
* Creates an Activity as an ITypingActivity object.
|
|
*
|
|
* @returns The new typing activity.
|
|
*/
|
|
function createTypingActivity(): Partial<ITypingActivity>;
|
|
/**
|
|
* Creates an Activity as an IHandoffActivity object.
|
|
*
|
|
* @returns The new handoff activity.
|
|
*/
|
|
function createHandoffActivity(): Partial<IHandoffActivity>;
|
|
/**
|
|
* Creates an Activity as an IEndOfConversationActivity object.
|
|
*
|
|
* @returns The new end of conversation activity.
|
|
*/
|
|
function createEndOfConversationActivity(): Partial<IEndOfConversationActivity>;
|
|
/**
|
|
* Creates an Activity as an IEventActivity object.
|
|
*
|
|
* @returns The new event activity.
|
|
*/
|
|
function createEventActivity(): Partial<IEventActivity>;
|
|
/**
|
|
* Creates an Activity as an IInvokeActivity object.
|
|
*
|
|
* @returns The new invoke activity.
|
|
*/
|
|
function createInvokeActivity(): Partial<IInvokeActivity>;
|
|
/**
|
|
* Creates an Activity as an ITraceActivity object.
|
|
*
|
|
* @param name The name of the trace operation to create.
|
|
* @param valueType Optional, identifier for the format of the @param value . Default is the name of type of the @param value .
|
|
* @param value Optional, the content for this trace operation.
|
|
* @param label Optional, a descriptive label for this trace operation.
|
|
* @returns The new trace activity.
|
|
*/
|
|
function createTraceActivity(name: string, valueType?: string, value?: unknown, label?: string): Partial<ITraceActivity>;
|
|
/**
|
|
* Creates a new message activity as a response to this activity.
|
|
*
|
|
* @param source The activity to respond.
|
|
* @param text The text of the reply.
|
|
* @param locale The language code for the @param text .
|
|
* @returns The new message activity.
|
|
* @remarks The new activity sets up routing information based on this activity.
|
|
*/
|
|
function createReply(source: Activity, text?: string, locale?: string): Activity;
|
|
/**
|
|
* Creates a new trace activity based on the source activity.
|
|
*
|
|
* @param source The activity to base the trace.
|
|
* @param name The name of the trace operation to create.
|
|
* @param value Optional, the content for this trace operation.
|
|
* @param valueType Optional, identifier for the format of the @param value . Default is the name of type of the @param value .
|
|
* @param label Optional, a descriptive label for this trace operation.
|
|
* @returns The new trace activity.
|
|
*/
|
|
function createTrace(source: Activity, name: string, value?: unknown, valueType?: string, label?: string): ITraceActivity;
|
|
/**
|
|
* Returns the source activity as an IMessageActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a message activity; or null.
|
|
*/
|
|
function asMessageActivity(source: Partial<Activity>): Partial<IMessageActivity>;
|
|
/**
|
|
* Returns the source activity as an IContactRelationUpdateActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a contact relation update activity; or null.
|
|
*/
|
|
function asContactRelationUpdateActivity(source: Partial<Activity>): Partial<IContactRelationUpdateActivity>;
|
|
/**
|
|
* Returns the source activity as an IInstallationUpdateActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as an installation update activity; or null.
|
|
*/
|
|
function asInstallationUpdateActivity(source: Partial<Activity>): Partial<IInstallationUpdateActivity>;
|
|
/**
|
|
* Returns the source activity as an IConversationUpdateActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as an conversation update activity; or null.
|
|
*/
|
|
function asConversationUpdateActivity(source: Partial<Activity>): Partial<IConversationUpdateActivity>;
|
|
/**
|
|
* Returns the source activity as an ITypingActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a typing activity; or null.
|
|
*/
|
|
function asTypingActivity(source: Partial<Activity>): Partial<ITypingActivity>;
|
|
/**
|
|
* Returns the source activity as an IEndOfConversationActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as an end of conversation activity; or null.
|
|
*/
|
|
function asEndOfConversationActivity(source: Partial<Activity>): Partial<IEndOfConversationActivity>;
|
|
/**
|
|
* Returns the source activity as an IEventActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as an event activity; or null.
|
|
*/
|
|
function asEventActivity(source: Partial<Activity>): Partial<IEventActivity>;
|
|
/**
|
|
* Returns the source activity as an IInvokeActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as an invoke activity; or null.
|
|
*/
|
|
function asInvokeActivity(source: Partial<Activity>): Partial<IInvokeActivity>;
|
|
/**
|
|
* Returns the source activity as an IMessageUpdateActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a message update request; or null.
|
|
*/
|
|
function asMessageUpdateActivity(source: Partial<Activity>): Partial<IMessageUpdateActivity>;
|
|
/**
|
|
* Returns the source activity as an IMessageDeleteActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a message delete request; or null.
|
|
*/
|
|
function asMessageDeleteActivity(source: Partial<Activity>): Partial<IMessageDeleteActivity>;
|
|
/**
|
|
* Returns the source activity as an IMessageReactionActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a message reaction activity; or null.
|
|
*/
|
|
function asMessageReactionActivity(source: Partial<Activity>): Partial<IMessageReactionActivity>;
|
|
/**
|
|
* Returns the source activity as an ISuggestionActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a suggestion activity; or null.
|
|
*/
|
|
function asSuggestionActivity(source: Partial<Activity>): Partial<ISuggestionActivity>;
|
|
/**
|
|
* Returns the source activity as an ITraceActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a trace activity; or null.
|
|
*/
|
|
function asTraceActivity(source: Partial<Activity>): Partial<ITraceActivity>;
|
|
/**
|
|
* Returns the source activity as an IHandoffActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a handoff activity; or null.
|
|
*/
|
|
function asHandoffActivity(source: Partial<Activity>): Partial<IHandoffActivity>;
|
|
/**
|
|
* Returns the source activity as an ICommandActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a command activity; or null.
|
|
*/
|
|
function asCommandActivity<T = unknown>(source: Partial<Activity>): Partial<ICommandActivity<T>>;
|
|
/**
|
|
* Returns the source activity as an ICommandResultActivity object; or null, if this is not that type of activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns This activity as a command result activity; or null.
|
|
*/
|
|
function asCommandResultActivity<T = unknown>(source: Partial<Activity>): Partial<ICommandResultActivity<T>>;
|
|
/**
|
|
* Indicates whether the source activity has content.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns True, if this activity has any content to send; otherwise, false.
|
|
* @remarks This method is only intended for use with a message activity, where the Activity Type is set to Message.
|
|
*/
|
|
function hasContent(source: Partial<Activity>): boolean;
|
|
/**
|
|
* Resolves the mentions from the entities of the source activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns The array of mentions; or an empty array, if none are found.
|
|
* @remarks This method is only intended for use with a message activity, where the Activity Type is set to Message.
|
|
* @see cref="entities" .
|
|
* @see cref="mention" .
|
|
*/
|
|
function getMentions(source: Partial<Activity>): Mention[];
|
|
/**
|
|
* Creates a ConversationReference based on the source activity.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns A conversation reference for the conversation that contains the activity.
|
|
*/
|
|
function getConversationReference(source: Partial<Activity>): ConversationReference;
|
|
/**
|
|
* Creates an Activity from conversation reference as it is posted to bot.
|
|
*
|
|
* @param reference the conversation reference
|
|
* @returns the activity
|
|
*/
|
|
function getContinuationActivity(reference: Partial<ConversationReference>): Partial<Activity>;
|
|
/**
|
|
* Determines if the Activity was sent via an Http/Https connection or Streaming.
|
|
* This can be determined by looking at the ServiceUrl property:
|
|
* (1) All channels that send messages via http/https are not streaming
|
|
* (2) Channels that send messages via streaming have a ServiceUrl that does not begin with http/https.
|
|
*
|
|
* @param source The source activity.
|
|
* @returns True if the Activity was originate from a streaming connection.
|
|
*/
|
|
function isFromStreamingConnection(source: Partial<Activity>): boolean;
|
|
/**
|
|
* Indicates whether this activity is of a specified activity type.
|
|
*
|
|
* @param source The source activity.
|
|
* @param activityType The activity type to check for.
|
|
* @returns True if the activity is of the specified activity type; otherwise, false.
|
|
*/
|
|
function isActivity(source: Partial<Activity>, activityType: string): boolean;
|
|
}
|
|
//# sourceMappingURL=activityEx.d.ts.map
|