@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
107 lines (103 loc) • 5.72 kB
text/typescript
import { Client, ClientOptions } from '@microsoft/teams.common';
import { TeamsChannelAccount } from './models/account.mjs';
import { Resource } from './models/resource.mjs';
import { IAdaptiveCard } from '@microsoft/teams.cards';
import { ApiClientSettings } from './clients/api-client-settings.mjs';
import { M as MessageActivity, a as IMessageActivityInput } from './message-BhoTpQct.mjs';
import { TypingActivity, ITypingActivityInput } from './activities/typing.mjs';
/**
* Legacy full activity builders that are still accepted as send input while callers
* migrate to the outbound input builders.
*
* @deprecated Use {@link IMessageActivityInput} or {@link ITypingActivityInput} instead.
*/
type DeprecatedInputActivity = MessageActivity | TypingActivity;
/**
* represents anything that can be transformed
* into an activity in an automated way.
*
* The structured-activity portion is narrowed to message/typing inputs rather than
* "any partial activity", so `send()`/`reply()`/`quote()` only accept what the app can send.
*/
type ActivityLike = IMessageActivityInput | ITypingActivityInput | string | IAdaptiveCard;
/**
* represents an activity that was sent
*/
type SentActivity = {
id: string;
} & ActivityParams;
/**
* Payload accepted by the low-level conversation activity client.
*
* The OUTBOUND activity union: an app only sends message or typing activity inputs.
* Kept as a named export for backwards compatibility.
*/
type ActivityParams = IMessageActivityInput | ITypingActivityInput;
type ActivityParamsLike = ActivityParams | DeprecatedInputActivity;
declare class ConversationActivityClient {
readonly serviceUrl: string;
get http(): Client;
set http(v: Client);
protected _http: Client;
protected _apiClientSettings: Partial<ApiClientSettings>;
constructor(serviceUrl: string, options?: Client | ClientOptions, apiClientSettings?: Partial<ApiClientSettings>);
/**
* @deprecated Use MessageActivityInput or TypingActivityInput instead.
*/
create(conversationId: string, params: DeprecatedInputActivity): Promise<Resource>;
create(conversationId: string, params: ActivityParams): Promise<Resource>;
create(conversationId: string, params: ActivityParamsLike): Promise<Resource>;
/**
* @deprecated Use MessageActivityInput or TypingActivityInput instead.
*/
update(conversationId: string, id: string, params: DeprecatedInputActivity): Promise<Resource>;
update(conversationId: string, id: string, params: ActivityParams): Promise<Resource>;
update(conversationId: string, id: string, params: ActivityParamsLike): Promise<Resource>;
/**
* @deprecated Use MessageActivityInput or TypingActivityInput instead.
*/
reply(conversationId: string, id: string, params: DeprecatedInputActivity): Promise<Resource>;
reply(conversationId: string, id: string, params: ActivityParams): Promise<Resource>;
reply(conversationId: string, id: string, params: ActivityParamsLike): Promise<Resource>;
/**
* Create an activity inside a reply chain (thread).
*
* @param conversationId the id of the chat or channel: `channelData.chat.id` or `channelData.channel.id`, **not** `conversation.id`.
* @param id the id of the message at the root of the reply chain: `channelData.replyChain.id`
* @param params the activity to send
* @throws Error when `conversationId` or `id` is empty or blank
* @throws Error when `conversationId` or `id` is a dot segment (`.` or `..`)
*
* @experimental This API is in preview and may change in the future. Diagnostic: ExperimentalTeamsThreading
*/
createReplyChain(conversationId: string, id: string, params: ActivityParams): Promise<Resource>;
/**
* Create an activity inside a reply chain (thread) that is visible only to the specified recipient.
*
* @param conversationId the id of the chat or channel: `channelData.chat.id` or `channelData.channel.id`, **not** `conversation.id`.
* @param id the id of the message at the root of the reply chain: `channelData.replyChain.id`
* @param params the activity to send
* @throws Error when `conversationId` or `id` is empty or blank
* @throws Error when `conversationId` or `id` is a dot segment (`.` or `..`)
*
* @experimental This API is in preview and may change in the future. Diagnostic: ExperimentalTeamsThreading
*/
createTargetedReplyChain(conversationId: string, id: string, params: ActivityParams): Promise<Resource>;
delete(conversationId: string, id: string): Promise<void>;
getMembers(conversationId: string, id: string): Promise<TeamsChannelAccount[]>;
/**
* @deprecated Use MessageActivityInput or TypingActivityInput instead.
*/
createTargeted(conversationId: string, params: DeprecatedInputActivity): Promise<Resource>;
createTargeted(conversationId: string, params: ActivityParams): Promise<Resource>;
createTargeted(conversationId: string, params: ActivityParamsLike): Promise<Resource>;
/**
* @deprecated Use MessageActivityInput or TypingActivityInput instead.
*/
updateTargeted(conversationId: string, id: string, params: DeprecatedInputActivity): Promise<Resource>;
updateTargeted(conversationId: string, id: string, params: ActivityParams): Promise<Resource>;
updateTargeted(conversationId: string, id: string, params: ActivityParamsLike): Promise<Resource>;
deleteTargeted(conversationId: string, id: string): Promise<void>;
private sendInReplyChain;
}
export { type ActivityLike as A, ConversationActivityClient as C, type DeprecatedInputActivity as D, type SentActivity as S, type ActivityParams as a };