@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
69 lines (68 loc) • 2.65 kB
TypeScript
/**
* Describes information needed to start a chat
* @module
*/
interface OpenChatRequest {
/**
* An optional message used when initiating chat
*/
message?: string;
}
/**
* Used when starting a chat with one person
*
* @see OpenGroupChatRequest for use when a chat with more than one person
*/
export interface OpenSingleChatRequest extends OpenChatRequest {
/**
* The [Microsoft Entra UPN](https://learn.microsoft.com/entra/identity/hybrid/connect/plan-connect-userprincipalname) (usually but not always an e-mail address)
* of the user with whom to begin a chat
*/
user: string;
}
/**
* Used when starting a chat with more than one person
*
* @see OpenSingleChatRequest for use in a chat with only one person
*/
export interface OpenGroupChatRequest extends OpenChatRequest {
/**
* Array containing [Microsoft Entra UPNs](https://learn.microsoft.com/entra/identity/hybrid/connect/plan-connect-userprincipalname) (usually but not always an e-mail address)
* of users with whom to begin a chat
*/
users: string[];
/**
* The display name of a conversation for 3 or more users (chats with fewer than three users will ignore this field)
*/
topic?: string;
}
/**
* Contains functionality to start chat with others
*/
/**
* Allows the user to open a chat with a single user and allows
* for the user to specify the message they wish to send.
*
* @param openChatRequest: {@link OpenSingleChatRequest}- a request object that contains a user's email as well as an optional message parameter.
*
* @returns Promise resolved upon completion
*/
export declare function openChat(openChatRequest: OpenSingleChatRequest): Promise<void>;
/**
* Allows the user to create a chat with multiple users (2+) and allows
* for the user to specify a message and name the topic of the conversation. If
* only 1 user is provided into users array default back to origin openChat.
*
* @param openChatRequest: {@link OpenGroupChatRequest} - a request object that contains a list of user emails as well as optional parameters for message and topic (display name for the group chat).
*
* @returns Promise resolved upon completion
*/
export declare function openGroupChat(openChatRequest: OpenGroupChatRequest): Promise<void>;
/**
* Checks if the chat capability is supported by the host
* @returns boolean to represent whether the chat capability is supported
*
* @throws Error if {@linkcode app.initialize} has not successfully completed
*/
export declare function isSupported(): boolean;
export {};