@microsoft/teams.api
Version:
<p> <a href="https://www.npmjs.com/package/@microsoft/teams.api" target="_blank"> <img src="https://img.shields.io/npm/v/@microsoft/teams.api/latest" /> </a> <a href="https://www.npmjs.com/package/@microsoft/teams.api?activeTab=code" t
166 lines (163 loc) • 6.17 kB
TypeScript
import { TextFormat } from '../models/text-format.js';
import { IActivity, IActivityInput, Activity, ActivityInput } from './activity.js';
import '../models/channel-id.js';
import '../models/account.js';
import '../models/agentic-identity.js';
import '../models/conversation-type.js';
import '../models/membership-source.js';
import '../models/membership-source-types.js';
import '../models/membership-types.js';
import '../models/role.js';
import '../models/conversation/conversation-reference.js';
import '../models/entity/index.js';
import '../models/entity/ai-message-entity.js';
import '../models/entity/message-entity.js';
import '../models/entity/citation-entity.js';
import '../models/entity/sensitivity-usage-info.js';
import '../models/entity/client-info-entity.js';
import '../models/entity/mention-entity.js';
import '../models/entity/product-info-entity.js';
import '../models/entity/quoted-reply-entity.js';
import '../models/entity/sensitive-usage-entity.js';
import '../models/entity/stream-info-entity.js';
import '../models/entity/targeted-message-info-entity.js';
import '../models/channel-data/index.js';
import '../models/meeting/meeting-info.js';
import '../models/meeting/meeting-details.js';
import '../models/channel-data/app-info.js';
import '../models/channel-data/channel-info.js';
import '../models/channel-data/chat-info.js';
import '../models/channel-data/feedback-loop.js';
import '../models/channel-data/notification-info.js';
import '../models/channel-data/on-behalf-of.js';
import '../models/channel-data/reply-chain-info.js';
import '../models/channel-data/settings.js';
import '../models/channel-data/source-info.js';
import '../models/channel-data/team-info.js';
import '../models/channel-data/tenant-info.js';
interface ITypingActivity extends IActivity<'typing'> {
/**
* The text content of the message.
*/
text?: string;
/**
* Format of the `text` field (ex. `'extendedmarkdown'`). Default: `'markdown'`.
*/
textFormat?: TextFormat;
}
/**
* OUTBOUND typing activity — the typing indicator the app SENDS.
*
* All server-populated base fields optional (via {@link IActivityInput}) and the
* typing-specific fields optional too, so both a plain `{ type: 'typing' }` literal
* and a {@link TypingActivityInput} builder instance are assignable. The typing fields are
* copied here instead of derived from {@link ITypingActivity}, keeping the outbound input
* shape independent from the inbound activity interface. Use {@link TypingActivityInputOptions}
* to include unmodeled extension fields when constructing a {@link TypingActivityInput}.
*/
interface ITypingActivityInput extends IActivityInput<'typing'> {
/**
* Text used by streaming updates. Ordinary typing indicators can omit this.
*/
text?: string;
/**
* Format of the `text` field (ex. `'extendedmarkdown'`). Default: `'markdown'`.
*/
textFormat?: TextFormat;
}
/**
* Constructor fields for {@link TypingActivityInput}.
*
* This accepts modeled outbound typing fields plus channel/service extension fields that
* should serialize at the top level of the outbound activity payload. The constructor owns
* the `type` discriminator; set typing text with the `text` field or
* {@link TypingActivityInput.withText}.
*/
type TypingActivityInputOptions = Omit<Partial<ITypingActivityInput>, 'type'> & Record<string, unknown>;
/**
* Builder for outbound typing activities.
*/
declare class TypingActivityInput extends ActivityInput<'typing'> implements ITypingActivityInput {
/**
* Text used by streaming updates. Ordinary typing indicators can omit this.
*/
text?: string;
/**
* Format of the `text` field (ex. `'extendedmarkdown'`). Default: `'markdown'`.
*/
textFormat?: TextFormat;
/**
* Create an outbound typing activity input.
* @param value - Initial modeled input fields and unmodeled extension fields to serialize.
*/
constructor(value?: TypingActivityInputOptions);
/**
* Copy outbound-safe fields from a typing-like activity input.
* @param activity - Typing input to copy.
*/
static from(activity: ITypingActivity): TypingActivityInput;
static from(activity: ITypingActivityInput): TypingActivityInput;
static from(activity: ITypingActivity | ITypingActivityInput): TypingActivityInput;
/**
* Set the streaming update text.
* @param value - Streaming update text.
*/
withText(value: string): this;
/**
* Append streaming update text.
* @param text - Streaming update text to append.
*/
addText(text: string): this;
/**
* Set the format of the `text` field.
* @param value - Text format.
*/
withTextFormat(value: TextFormat): this;
/**
* Add stream metadata to this typing update.
* @param sequence - Sequence number of the stream chunk.
*/
addStreamUpdate(sequence?: number): this;
}
declare class TypingActivity extends Activity<'typing'> implements ITypingActivity {
/**
* The text content of the message.
*/
text?: string;
/**
* Format of the `text` field.
*/
textFormat?: TextFormat;
constructor(value?: Omit<Partial<ITypingActivity>, 'type'>);
/**
* initialize from interface
*/
static from(activity: ITypingActivity): TypingActivity;
/**
* convert to interface
*/
toInterface(): ITypingActivity;
/**
* copy to a new instance
*/
clone(options?: Omit<Partial<ITypingActivity>, 'type'>): TypingActivity;
/**
* The text content of the message.
*/
withText(value: string): this;
/**
* Append text
*/
addText(text: string): this;
/**
* Set the format of the `text` field.
*/
withTextFormat(value: TextFormat): this;
/**
* Add stream informative update
* @param id the stream id
* @param sequence the sequence number (index) of the chunk
*/
addStreamUpdate(sequence?: number): this;
}
export { type ITypingActivity, type ITypingActivityInput, TypingActivity, TypingActivityInput, type TypingActivityInputOptions };