UNPKG

@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

241 lines (238 loc) 7.86 kB
import { ChannelID } from '../models/channel-id.mjs'; import { Account, ConversationAccount } from '../models/account.mjs'; import { ConversationReference } from '../models/conversation/conversation-reference.mjs'; import { Entity } from '../models/entity/index.mjs'; import { ChannelData } from '../models/channel-data/index.mjs'; import { MeetingInfo } from '../models/meeting/meeting-info.mjs'; import { ChannelInfo } from '../models/channel-data/channel-info.mjs'; import { TeamInfo } from '../models/channel-data/team-info.mjs'; import { NotificationInfo } from '../models/channel-data/notification-info.mjs'; import { CitationAppearance } from '../models/entity/citation-entity.mjs'; import { TenantInfo } from '../models/channel-data/tenant-info.mjs'; import '../models/membership-source.mjs'; import '../models/membership-source-types.mjs'; import '../models/membership-types.mjs'; import '../models/role.mjs'; import '../models/entity/ai-message-entity.mjs'; import '../models/entity/message-entity.mjs'; import '../models/entity/client-info-entity.mjs'; import '../models/entity/mention-entity.mjs'; import '../models/entity/sensitive-usage-entity.mjs'; import '../models/entity/stream-info-entity.mjs'; import '../models/channel-data/on-behalf-of.mjs'; import '../models/channel-data/settings.mjs'; import '../models/meeting/meeting-details.mjs'; interface IActivity<T extends string = string> { /** * Contains the type of the activity. */ readonly type: T; /** * Contains an ID that uniquely identifies the activity on the channel. */ id: string; /** * Contains the URL that specifies the channel's service endpoint. Set by the channel. */ serviceUrl?: string; /** * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format. */ timestamp?: Date; /** * A locale name for the contents of the text field. * The locale name is a combination of an ISO 639 two- or three-letter culture code associated * with a language * and an ISO 3166 two-letter subculture code associated with a country or region. * The locale name can also correspond to a valid BCP-47 language tag. */ locale?: string; /** * Contains the local date and time of the message, expressed in ISO-8601 format. * * For example, 2016-09-23T13:07:49.4714686-07:00. */ localTimestamp?: Date; /** * Contains an ID that uniquely identifies the channel. Set by the channel. */ channelId: ChannelID; /** * Identifies the sender of the message. */ from: Account; /** * Identifies the conversation to which the activity belongs. */ conversation: ConversationAccount; /** * A reference to another conversation or activity. */ relatesTo?: ConversationReference; /** * Identifies the recipient of the message. */ recipient: Account; /** * Contains the ID of the message to which this message is a reply. */ replyToId?: string; /** * Represents the entities that were mentioned in the message. */ entities?: Entity[]; /** * Contains channel-specific content. */ channelData?: ChannelData; /** * Information about the channel in which the message was sent. */ get channel(): ChannelInfo | undefined; /** * Information about the team in which the message was sent. */ get team(): TeamInfo | undefined; /** * Information about the tenant in which the message was sent. */ get meeting(): MeetingInfo | undefined; /** * Notification settings for the message. */ get notification(): NotificationInfo | undefined; /** * is this a streaming activity */ isStreaming(): boolean; } declare class Activity<T extends string = string> implements IActivity<T> { /** * Contains the type of the activity. */ readonly type: T; /** * Contains an ID that uniquely identifies the activity on the channel. */ id: string; /** * Contains the URL that specifies the channel's service endpoint. Set by the channel. */ serviceUrl?: string; /** * Contains the date and time that the message was sent, in UTC, expressed in ISO-8601 format. */ timestamp?: Date; /** * A locale name for the contents of the text field. * The locale name is a combination of an ISO 639 two- or three-letter culture code associated * with a language * and an ISO 3166 two-letter subculture code associated with a country or region. * The locale name can also correspond to a valid BCP-47 language tag. */ locale?: string; /** * Contains the local date and time of the message, expressed in ISO-8601 format. * * For example, 2016-09-23T13:07:49.4714686-07:00. */ localTimestamp?: Date; /** * Contains an ID that uniquely identifies the channel. Set by the channel. */ channelId: ChannelID; /** * Identifies the sender of the message. */ from: Account; /** * Identifies the conversation to which the activity belongs. */ conversation: ConversationAccount; /** * A reference to another conversation or activity. */ relatesTo?: ConversationReference; /** * Identifies the recipient of the message. */ recipient: Account; /** * Contains the ID of the message to which this message is a reply. */ replyToId?: string; /** * Represents the entities that were mentioned in the message. */ entities?: Entity[]; /** * Contains channel-specific content. */ channelData?: ChannelData; /** * Information about the tenant in which the message was sent. */ get tenant(): TenantInfo | undefined; /** * Information about the channel in which the message was sent. */ get channel(): ChannelInfo | undefined; /** * Information about the team in which the message was sent. */ get team(): TeamInfo | undefined; /** * Information about the tenant in which the message was sent. */ get meeting(): MeetingInfo | undefined; /** * Notification settings for the message. */ get notification(): NotificationInfo | undefined; constructor(value: Pick<IActivity<T>, 'type'> & Partial<Omit<IActivity<T>, 'type'>>); static from(activity: IActivity): Activity<string>; toInterface(): IActivity; clone(options?: Omit<Partial<IActivity>, 'type'>): Activity<string>; withId(value: string): this; withReplyToId(value: string): this; withChannelId(value: ChannelID): this; withFrom(value: Account): this; withConversation(value: ConversationAccount): this; withRelatesTo(value: ConversationReference): this; withRecipient(value: Account): this; withServiceUrl(value: string): this; withTimestamp(value: Date): this; withLocale(value: string): this; withLocalTimestamp(value: Date): this; withChannelData(value: ChannelData): this; /** * Add an entity. */ addEntity(value: Entity): this; /** * Add multiple entities */ addEntities(...value: Entity[]): this; /** * Add the `Generated By AI` label. */ addAiGenerated(): this; /** * Enable message feedback */ addFeedback(): this; /** * Add citations */ addCitation(position: number, appearance: CitationAppearance): this; /** * is this a streaming activity */ isStreaming(): boolean; /** * Get or create the base message entity. * There should only be one root level message entity. */ private ensureSingleRootLevelMessageEntity; } export { Activity, type IActivity };