@azure/communication-chat 1.5.0-beta.2 → 1.6.0-alpha.20240502.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@
2
2
  // Licensed under the MIT license.
3
3
  /// <reference lib="esnext.asynciterable" />
4
4
  import { __asyncDelegator, __asyncGenerator, __asyncValues, __await } from "tslib";
5
+ import { ConnectionState, } from "@azure/communication-signaling";
5
6
  import { mapToChatParticipantRestModel, mapToCreateChatThreadOptionsRestModel, mapToCreateChatThreadResultSdkModel, } from "./models/mappers";
6
7
  import { ChatApiClient } from "./generated/src";
7
8
  import { ChatThreadClient } from "./chatThreadClient";
@@ -28,16 +29,16 @@ export class ChatClient {
28
29
  this.emitter = new EventEmitter();
29
30
  this.isRealtimeNotificationsStarted = false;
30
31
  this.tokenCredential = credential;
31
- this.clientOptions = Object.assign({}, options);
32
32
  const internalPipelineOptions = Object.assign(Object.assign({}, options), {
33
33
  loggingOptions: {
34
34
  logger: logger.info,
35
35
  },
36
36
  });
37
37
  this.client = new ChatApiClient(this.endpoint, Object.assign({ endpoint: this.endpoint }, internalPipelineOptions));
38
- this.clientOptions.signalingClientOptions = Object.assign(Object.assign({}, this.clientOptions.signalingClientOptions), { resourceEndpoint: this.endpoint, gatewayApiVersion: this.client.apiVersion });
39
38
  const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
40
39
  this.client.pipeline.addPolicy(authPolicy);
40
+ this.clientOptions = Object.assign({}, options);
41
+ this.clientOptions.signalingClientOptions = Object.assign(Object.assign({}, this.clientOptions.signalingClientOptions), { resourceEndpoint: this.endpoint, gatewayApiVersion: this.client.apiVersion });
41
42
  this.signalingClient = getSignalingClient(credential, logger, this.clientOptions.signalingClientOptions);
42
43
  }
43
44
  /**
@@ -62,13 +63,12 @@ export class ChatClient {
62
63
  const result = await this.client.chat.createChatThread({
63
64
  topic: request.topic,
64
65
  participants: (_b = options.participants) === null || _b === void 0 ? void 0 : _b.map((participant) => mapToChatParticipantRestModel(participant)),
65
- metadata: options.metadata,
66
66
  }, updatedRestModelOptions);
67
67
  return mapToCreateChatThreadResultSdkModel(result);
68
68
  });
69
69
  }
70
- listChatThreadsPage(continuationState, options = {}) {
71
- return __asyncGenerator(this, arguments, function* listChatThreadsPage_1() {
70
+ listChatThreadsPage(continuationState_1) {
71
+ return __asyncGenerator(this, arguments, function* listChatThreadsPage_1(continuationState, options = {}) {
72
72
  if (!continuationState.continuationToken) {
73
73
  const currentSetResponse = yield __await(this.client.chat.listChatThreads(options));
74
74
  continuationState.continuationToken = currentSetResponse.nextLink;
@@ -198,10 +198,10 @@ export class ChatClient {
198
198
  throw new Error("Realtime notifications are only supported in the browser.");
199
199
  }
200
200
  this.signalingClient.on("connectionChanged", (payload) => {
201
- if (payload === 2 /* ConnectionState.Connected */) {
201
+ if (payload === ConnectionState.Connected) {
202
202
  this.emitter.emit("realTimeNotificationConnected");
203
203
  }
204
- else if (payload === 3 /* ConnectionState.Disconnected */) {
204
+ else if (payload === ConnectionState.Disconnected) {
205
205
  this.emitter.emit("realTimeNotificationDisconnected");
206
206
  }
207
207
  });
@@ -1 +1 @@
1
- {"version":3,"file":"chatClient.js","sourceRoot":"","sources":["../../src/chatClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;AA2B5C,OAAO,EACL,6BAA6B,EAC7B,qCAAqC,EACrC,mCAAmC,GACpC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,EAAE,wCAAwC,EAAE,MAAM,iDAAiD,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,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jE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,mBAAmB,EAAE,CAAC,OAAO,EAAE,EAAE;YACvD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE;YACzD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport {\n ChatClientOptions,\n CreateChatThreadOptions,\n DeleteChatThreadOptions,\n ListChatThreadsOptions,\n} from \"./models/options\";\nimport {\n ChatEventId,\n ChatMessageDeletedEvent,\n ChatMessageEditedEvent,\n ChatMessageReceivedEvent,\n ChatThreadCreatedEvent,\n ChatThreadDeletedEvent,\n ChatThreadPropertiesUpdatedEvent,\n ParticipantsAddedEvent,\n ParticipantsRemovedEvent,\n ReadReceiptReceivedEvent,\n TypingIndicatorReceivedEvent,\n} from \"./models/events\";\nimport { ChatThreadItem, CreateChatThreadResult, ListPageSettings } from \"./models/models\";\nimport {\n ConnectionState,\n SignalingClient,\n SignalingClientOptions,\n} from \"@azure/communication-signaling\";\nimport {\n mapToChatParticipantRestModel,\n mapToCreateChatThreadOptionsRestModel,\n mapToCreateChatThreadResultSdkModel,\n} from \"./models/mappers\";\n\nimport { ChatApiClient } from \"./generated/src\";\nimport { ChatThreadClient } from \"./chatThreadClient\";\nimport { CommunicationTokenCredential } from \"@azure/communication-common\";\nimport { CreateChatThreadRequest } from \"./models/requests\";\nimport { EventEmitter } from \"events\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { createCommunicationTokenCredentialPolicy } from \"./credential/communicationTokenCredentialPolicy\";\nimport { generateUuid } from \"./models/uuid\";\nimport { getSignalingClient } from \"./signaling/signalingClient\";\nimport { logger } from \"./models/logger\";\nimport { tracingClient } from \"./generated/src/tracing\";\n\ndeclare interface InternalChatClientOptions extends ChatClientOptions {\n signalingClientOptions?: SignalingClientOptions;\n}\n\n/**\n * The client to do chat operations\n */\nexport class ChatClient {\n private readonly tokenCredential: CommunicationTokenCredential;\n private readonly clientOptions: InternalChatClientOptions;\n private readonly client: ChatApiClient;\n private readonly signalingClient: SignalingClient | undefined = undefined;\n private readonly emitter = new EventEmitter();\n private isRealtimeNotificationsStarted: boolean = false;\n\n /**\n * Creates an instance of the ChatClient for a given resource and user.\n *\n * @param endpoint - The url of the Communication Services resource.\n * @param credential - The token credential. Use AzureCommunicationTokenCredential from \\@azure/communication-common to create a credential.\n * @param options - Additional client options.\n */\n constructor(\n private readonly endpoint: string,\n credential: CommunicationTokenCredential,\n options: ChatClientOptions = {},\n ) {\n this.tokenCredential = credential;\n this.clientOptions = { ...options };\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new ChatApiClient(this.endpoint, {\n endpoint: this.endpoint,\n ...internalPipelineOptions,\n });\n\n this.clientOptions.signalingClientOptions = {\n ...this.clientOptions.signalingClientOptions,\n resourceEndpoint: this.endpoint,\n gatewayApiVersion: this.client.apiVersion,\n };\n\n const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);\n this.client.pipeline.addPolicy(authPolicy);\n\n this.signalingClient = getSignalingClient(\n credential,\n logger,\n this.clientOptions.signalingClientOptions,\n );\n }\n\n /**\n * Returns ChatThreadClient with the specific thread id.\n * @param threadId - Thread ID for the ChatThreadClient\n */\n public getChatThreadClient(threadId: string): ChatThreadClient {\n return new ChatThreadClient(this.endpoint, threadId, this.tokenCredential, this.clientOptions);\n }\n\n /**\n * Creates a chat thread.\n * Returns thread client with the id of the created thread.\n * @param request - Request for creating a chat thread.\n * @param options - Operation options.\n */\n public async createChatThread(\n request: CreateChatThreadRequest,\n options: CreateChatThreadOptions = {},\n ): Promise<CreateChatThreadResult> {\n return tracingClient.withSpan(\n \"ChatClient-CreateChatThread\",\n options,\n async (updatedOptions) => {\n // We generate an UUID if the user does not provide an idempotencyToken value\n updatedOptions.idempotencyToken = updatedOptions.idempotencyToken ?? generateUuid();\n const updatedRestModelOptions = mapToCreateChatThreadOptionsRestModel(updatedOptions);\n\n const result = await this.client.chat.createChatThread(\n {\n topic: request.topic,\n participants: options.participants?.map((participant) =>\n mapToChatParticipantRestModel(participant),\n ),\n metadata: options.metadata,\n },\n updatedRestModelOptions,\n );\n return mapToCreateChatThreadResultSdkModel(result);\n },\n );\n }\n\n private async *listChatThreadsPage(\n continuationState: ListPageSettings,\n options: ListChatThreadsOptions = {},\n ): AsyncIterableIterator<ChatThreadItem[]> {\n if (!continuationState.continuationToken) {\n const currentSetResponse = await this.client.chat.listChatThreads(options);\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value;\n }\n }\n\n while (continuationState.continuationToken) {\n const currentSetResponse = await this.client.chat.listChatThreadsNext(\n continuationState.continuationToken,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value;\n } else {\n break;\n }\n }\n }\n\n private async *listChatThreadsAll(\n options: ListChatThreadsOptions,\n ): AsyncIterableIterator<ChatThreadItem> {\n for await (const page of this.listChatThreadsPage({}, options)) {\n yield* page;\n }\n }\n\n /**\n * Gets the list of chat threads of a user.\n * @param options - List chat threads options.\n */\n public listChatThreads(\n options: ListChatThreadsOptions = {},\n ): PagedAsyncIterableIterator<ChatThreadItem> {\n const { span, updatedOptions } = tracingClient.startSpan(\"ChatClient-ListChatThreads\", options);\n try {\n const iter = this.listChatThreadsAll(updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}) => {\n return this.listChatThreadsPage(settings, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({\n error: e,\n status: \"error\",\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes a chat thread.\n * @param threadId - The ID of the thread to delete.\n * @param options - Operation options.\n */\n public async deleteChatThread(\n threadId: string,\n options: DeleteChatThreadOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"ChatClient-DeleteChatThread\",\n options,\n async (updatedOptions) => {\n await this.client.chat.deleteChatThread(threadId, updatedOptions);\n },\n );\n }\n\n /**\n * Start receiving realtime notifications.\n * Call this function before subscribing to any event.\n */\n public async startRealtimeNotifications(): Promise<void> {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are not supported in node js.\");\n }\n\n if (this.isRealtimeNotificationsStarted) {\n return;\n }\n\n this.isRealtimeNotificationsStarted = true;\n await this.signalingClient.start();\n this.subscribeToSignalingEvents();\n }\n\n /**\n * Stop receiving realtime notifications.\n * This function would unsubscribe to all events.\n */\n public async stopRealtimeNotifications(): Promise<void> {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are not supported in node js.\");\n }\n\n this.isRealtimeNotificationsStarted = false;\n await this.signalingClient.stop();\n this.emitter.removeAllListeners();\n }\n\n /**\n * Subscribe function for chatMessageReceived.\n * The initial sender will also receive this event.\n * You need to call startRealtimeNotifications before subscribing to any event.\n * @param event - The ChatMessageReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatMessageReceived\", listener: (e: ChatMessageReceivedEvent) => void): void;\n\n /**\n * Subscribe function for chatMessageEdited.\n * The initial sender will also receive this event.\n * @param event - The ChatMessageEditedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatMessageEdited\", listener: (e: ChatMessageEditedEvent) => void): void;\n\n /**\n * Subscribe function for chatMessageDeleted.\n * The initial sender will also receive this event.\n * @param event - The ChatMessageDeletedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatMessageDeleted\", listener: (e: ChatMessageDeletedEvent) => void): void;\n\n /**\n * Subscribe function for typingIndicatorReceived.\n * The initial sender will also receive this event.\n * @param event - The TypingIndicatorReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(\n event: \"typingIndicatorReceived\",\n listener: (e: TypingIndicatorReceivedEvent) => void,\n ): void;\n\n /**\n * Subscribe function for readReceiptReceived.\n * @param event - The ReadReceiptReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"readReceiptReceived\", listener: (e: ReadReceiptReceivedEvent) => void): void;\n\n /**\n * Subscribe function for chatThreadCreated.\n * @param event - The ChatThreadCreatedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatThreadCreated\", listener: (e: ChatThreadCreatedEvent) => void): void;\n\n /**\n * Subscribe function for chatThreadDeleted.\n * @param event - The ChatThreadDeletedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatThreadDeleted\", listener: (e: ChatThreadDeletedEvent) => void): void;\n\n /**\n * Subscribe function for chatThreadPropertiesUpdated.\n * @param event - The ChatThreadPropertiesUpdatedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(\n event: \"chatThreadPropertiesUpdated\",\n listener: (e: ChatThreadPropertiesUpdatedEvent) => void,\n ): void;\n\n /**\n * Subscribe function for participantsAdded.\n * @param event - The ParticipantsAddedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"participantsAdded\", listener: (e: ParticipantsAddedEvent) => void): void;\n\n /**\n * Subscribe function for participantsRemoved.\n * @param event - The ParticipantsRemovedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"participantsRemoved\", listener: (e: ParticipantsRemovedEvent) => void): void;\n\n /**\n * Subscribe function for realTimeNotificationConnected.\n * @param event - The realTimeNotificationConnected Event\n * @param listener - The listener to handle the event.\n */\n public on(event: \"realTimeNotificationConnected\", listener: () => void): void;\n\n /**\n * Subscribe function for realTimeNotificationDisconnected.\n * @param event - The realTimeNotificationDisconnected Event\n * @param listener - The listener to handle the event.\n */\n public on(event: \"realTimeNotificationDisconnected\", listener: () => void): void;\n\n public on(event: ChatEventId, listener: (e?: any) => void): void {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are only supported in the browser.\");\n }\n if (\n !this.isRealtimeNotificationsStarted &&\n event !== \"realTimeNotificationConnected\" &&\n event !== \"realTimeNotificationDisconnected\"\n ) {\n throw new Error(\n \"You must call startRealtimeNotifications before you can subscribe to events.\",\n );\n }\n\n this.emitter.on(event, listener);\n }\n\n /**\n * Unsubscribe from chatMessageReceived.\n * @param event - The ChatMessageReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatMessageReceived\", listener: (e: ChatMessageReceivedEvent) => void): void;\n\n /**\n * Unsubscribe from chatMessageEdited.\n * @param event - The ChatMessageEditedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatMessageEdited\", listener: (e: ChatMessageEditedEvent) => void): void;\n\n /**\n * Unsubscribe from chatMessageDeleted.\n * @param event - The ChatMessageDeletedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatMessageDeleted\", listener: (e: ChatMessageDeletedEvent) => void): void;\n\n /**\n * Unsubscribe from typingIndicatorReceived.\n * @param event - The TypingIndicatorReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(\n event: \"typingIndicatorReceived\",\n listener: (e: TypingIndicatorReceivedEvent) => void,\n ): void;\n\n /**\n * Unsubscribe from readReceiptReceived.\n * @param event - The ReadReceiptReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"readReceiptReceived\", listener: (e: ReadReceiptReceivedEvent) => void): void;\n\n /**\n * Unsubscribe from chatThreadCreated.\n * @param event - The ChatThreadCreatedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatThreadCreated\", listener: (e: ChatThreadCreatedEvent) => void): void;\n\n /**\n * Unsubscribe from chatThreadDeleted.\n * @param event - The ChatThreadDeletedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatThreadDeleted\", listener: (e: ChatThreadDeletedEvent) => void): void;\n\n /**\n * Unsubscribe from chatThreadPropertiesUpdated.\n * @param event - The ChatThreadPropertiesUpdatedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(\n event: \"chatThreadPropertiesUpdated\",\n listener: (e: ChatThreadPropertiesUpdatedEvent) => void,\n ): void;\n\n /**\n * Unsubscribe from participantsAdded.\n * @param event - The ParticipantsAddedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"participantsAdded\", listener: (e: ParticipantsAddedEvent) => void): void;\n\n /**\n * Unsubscribe from participantsRemoved.\n * @param event - The ParticipantsRemovedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"participantsRemoved\", listener: (e: ParticipantsRemovedEvent) => void): void;\n\n public off(event: ChatEventId, listener: (e: any) => void): void {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are only supported in the browser.\");\n }\n\n this.emitter.removeListener(event, listener);\n }\n\n private subscribeToSignalingEvents(): void {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are only supported in the browser.\");\n }\n\n this.signalingClient.on(\"connectionChanged\", (payload) => {\n if (payload === ConnectionState.Connected) {\n this.emitter.emit(\"realTimeNotificationConnected\");\n } else if (payload === ConnectionState.Disconnected) {\n this.emitter.emit(\"realTimeNotificationDisconnected\");\n }\n });\n\n this.signalingClient.on(\"chatMessageReceived\", (payload) => {\n this.emitter.emit(\"chatMessageReceived\", payload);\n });\n\n this.signalingClient.on(\"chatMessageEdited\", (payload) => {\n this.emitter.emit(\"chatMessageEdited\", payload);\n });\n\n this.signalingClient.on(\"chatMessageDeleted\", (payload) => {\n this.emitter.emit(\"chatMessageDeleted\", payload);\n });\n\n this.signalingClient.on(\"typingIndicatorReceived\", (payload) => {\n this.emitter.emit(\"typingIndicatorReceived\", payload);\n });\n\n this.signalingClient.on(\"readReceiptReceived\", (payload) => {\n this.emitter.emit(\"readReceiptReceived\", payload);\n });\n\n this.signalingClient.on(\"chatThreadCreated\", (payload) => {\n this.emitter.emit(\"chatThreadCreated\", payload);\n });\n\n this.signalingClient.on(\"chatThreadDeleted\", (payload) => {\n this.emitter.emit(\"chatThreadDeleted\", payload);\n });\n\n this.signalingClient.on(\"chatThreadPropertiesUpdated\", (payload) => {\n this.emitter.emit(\"chatThreadPropertiesUpdated\", payload);\n });\n\n this.signalingClient.on(\"participantsAdded\", (payload) => {\n this.emitter.emit(\"participantsAdded\", payload);\n });\n\n this.signalingClient.on(\"participantsRemoved\", (payload) => {\n this.emitter.emit(\"participantsRemoved\", payload);\n });\n }\n}\n"]}
1
+ {"version":3,"file":"chatClient.js","sourceRoot":"","sources":["../../src/chatClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;AAsB5C,OAAO,EACL,eAAe,GAGhB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,6BAA6B,EAC7B,qCAAqC,EACrC,mCAAmC,GACpC,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAGtD,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAGtC,OAAO,EAAE,wCAAwC,EAAE,MAAM,iDAAiD,CAAC;AAC3G,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAMxD;;GAEG;AACH,MAAM,OAAO,UAAU;IAQrB;;;;;;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AE,EAAE;YACvD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,mBAAmB,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,eAAe,CAAC,EAAE,CAAC,qBAAqB,EAAE,CAAC,OAAO,EAAE,EAAE;YACzD,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n/// <reference lib=\"esnext.asynciterable\" />\n\nimport {\n ChatClientOptions,\n CreateChatThreadOptions,\n DeleteChatThreadOptions,\n ListChatThreadsOptions,\n} from \"./models/options\";\nimport {\n ChatEventId,\n ChatMessageDeletedEvent,\n ChatMessageEditedEvent,\n ChatMessageReceivedEvent,\n ChatThreadCreatedEvent,\n ChatThreadDeletedEvent,\n ChatThreadPropertiesUpdatedEvent,\n ParticipantsAddedEvent,\n ParticipantsRemovedEvent,\n ReadReceiptReceivedEvent,\n TypingIndicatorReceivedEvent,\n} from \"./models/events\";\nimport { ChatThreadItem, CreateChatThreadResult, ListPageSettings } from \"./models/models\";\nimport {\n ConnectionState,\n SignalingClient,\n SignalingClientOptions,\n} from \"@azure/communication-signaling\";\nimport {\n mapToChatParticipantRestModel,\n mapToCreateChatThreadOptionsRestModel,\n mapToCreateChatThreadResultSdkModel,\n} from \"./models/mappers\";\n\nimport { ChatApiClient } from \"./generated/src\";\nimport { ChatThreadClient } from \"./chatThreadClient\";\nimport { CommunicationTokenCredential } from \"@azure/communication-common\";\nimport { CreateChatThreadRequest } from \"./models/requests\";\nimport { EventEmitter } from \"events\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport { createCommunicationTokenCredentialPolicy } from \"./credential/communicationTokenCredentialPolicy\";\nimport { generateUuid } from \"./models/uuid\";\nimport { getSignalingClient } from \"./signaling/signalingClient\";\nimport { logger } from \"./models/logger\";\nimport { tracingClient } from \"./generated/src/tracing\";\n\ndeclare interface InternalChatClientOptions extends ChatClientOptions {\n signalingClientOptions?: SignalingClientOptions;\n}\n\n/**\n * The client to do chat operations\n */\nexport class ChatClient {\n private readonly tokenCredential: CommunicationTokenCredential;\n private readonly clientOptions: InternalChatClientOptions;\n private readonly client: ChatApiClient;\n private readonly signalingClient: SignalingClient | undefined = undefined;\n private readonly emitter = new EventEmitter();\n private isRealtimeNotificationsStarted: boolean = false;\n\n /**\n * Creates an instance of the ChatClient for a given resource and user.\n *\n * @param endpoint - The url of the Communication Services resource.\n * @param credential - The token credential. Use AzureCommunicationTokenCredential from \\@azure/communication-common to create a credential.\n * @param options - Additional client options.\n */\n constructor(\n private readonly endpoint: string,\n credential: CommunicationTokenCredential,\n options: ChatClientOptions = {},\n ) {\n this.tokenCredential = credential;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new ChatApiClient(this.endpoint, {\n endpoint: this.endpoint,\n ...internalPipelineOptions,\n });\n\n const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);\n this.client.pipeline.addPolicy(authPolicy);\n\n this.clientOptions = { ...options };\n this.clientOptions.signalingClientOptions = {\n ...this.clientOptions.signalingClientOptions,\n resourceEndpoint: this.endpoint,\n gatewayApiVersion: this.client.apiVersion,\n };\n\n this.signalingClient = getSignalingClient(\n credential,\n logger,\n this.clientOptions.signalingClientOptions,\n );\n }\n\n /**\n * Returns ChatThreadClient with the specific thread id.\n * @param threadId - Thread ID for the ChatThreadClient\n */\n public getChatThreadClient(threadId: string): ChatThreadClient {\n return new ChatThreadClient(this.endpoint, threadId, this.tokenCredential, this.clientOptions);\n }\n\n /**\n * Creates a chat thread.\n * Returns thread client with the id of the created thread.\n * @param request - Request for creating a chat thread.\n * @param options - Operation options.\n */\n public async createChatThread(\n request: CreateChatThreadRequest,\n options: CreateChatThreadOptions = {},\n ): Promise<CreateChatThreadResult> {\n return tracingClient.withSpan(\n \"ChatClient-CreateChatThread\",\n options,\n async (updatedOptions) => {\n // We generate an UUID if the user does not provide an idempotencyToken value\n updatedOptions.idempotencyToken = updatedOptions.idempotencyToken ?? generateUuid();\n const updatedRestModelOptions = mapToCreateChatThreadOptionsRestModel(updatedOptions);\n\n const result = await this.client.chat.createChatThread(\n {\n topic: request.topic,\n participants: options.participants?.map((participant) =>\n mapToChatParticipantRestModel(participant),\n ),\n },\n updatedRestModelOptions,\n );\n return mapToCreateChatThreadResultSdkModel(result);\n },\n );\n }\n\n private async *listChatThreadsPage(\n continuationState: ListPageSettings,\n options: ListChatThreadsOptions = {},\n ): AsyncIterableIterator<ChatThreadItem[]> {\n if (!continuationState.continuationToken) {\n const currentSetResponse = await this.client.chat.listChatThreads(options);\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value;\n }\n }\n\n while (continuationState.continuationToken) {\n const currentSetResponse = await this.client.chat.listChatThreadsNext(\n continuationState.continuationToken,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value;\n } else {\n break;\n }\n }\n }\n\n private async *listChatThreadsAll(\n options: ListChatThreadsOptions,\n ): AsyncIterableIterator<ChatThreadItem> {\n for await (const page of this.listChatThreadsPage({}, options)) {\n yield* page;\n }\n }\n\n /**\n * Gets the list of chat threads of a user.\n * @param options - List chat threads options.\n */\n public listChatThreads(\n options: ListChatThreadsOptions = {},\n ): PagedAsyncIterableIterator<ChatThreadItem> {\n const { span, updatedOptions } = tracingClient.startSpan(\"ChatClient-ListChatThreads\", options);\n try {\n const iter = this.listChatThreadsAll(updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}) => {\n return this.listChatThreadsPage(settings, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({\n error: e,\n status: \"error\",\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes a chat thread.\n * @param threadId - The ID of the thread to delete.\n * @param options - Operation options.\n */\n public async deleteChatThread(\n threadId: string,\n options: DeleteChatThreadOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"ChatClient-DeleteChatThread\",\n options,\n async (updatedOptions) => {\n await this.client.chat.deleteChatThread(threadId, updatedOptions);\n },\n );\n }\n\n /**\n * Start receiving realtime notifications.\n * Call this function before subscribing to any event.\n */\n public async startRealtimeNotifications(): Promise<void> {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are not supported in node js.\");\n }\n\n if (this.isRealtimeNotificationsStarted) {\n return;\n }\n\n this.isRealtimeNotificationsStarted = true;\n await this.signalingClient.start();\n this.subscribeToSignalingEvents();\n }\n\n /**\n * Stop receiving realtime notifications.\n * This function would unsubscribe to all events.\n */\n public async stopRealtimeNotifications(): Promise<void> {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are not supported in node js.\");\n }\n\n this.isRealtimeNotificationsStarted = false;\n await this.signalingClient.stop();\n this.emitter.removeAllListeners();\n }\n\n /**\n * Subscribe function for chatMessageReceived.\n * The initial sender will also receive this event.\n * You need to call startRealtimeNotifications before subscribing to any event.\n * @param event - The ChatMessageReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatMessageReceived\", listener: (e: ChatMessageReceivedEvent) => void): void;\n\n /**\n * Subscribe function for chatMessageEdited.\n * The initial sender will also receive this event.\n * @param event - The ChatMessageEditedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatMessageEdited\", listener: (e: ChatMessageEditedEvent) => void): void;\n\n /**\n * Subscribe function for chatMessageDeleted.\n * The initial sender will also receive this event.\n * @param event - The ChatMessageDeletedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatMessageDeleted\", listener: (e: ChatMessageDeletedEvent) => void): void;\n\n /**\n * Subscribe function for typingIndicatorReceived.\n * The initial sender will also receive this event.\n * @param event - The TypingIndicatorReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(\n event: \"typingIndicatorReceived\",\n listener: (e: TypingIndicatorReceivedEvent) => void,\n ): void;\n\n /**\n * Subscribe function for readReceiptReceived.\n * @param event - The ReadReceiptReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"readReceiptReceived\", listener: (e: ReadReceiptReceivedEvent) => void): void;\n\n /**\n * Subscribe function for chatThreadCreated.\n * @param event - The ChatThreadCreatedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatThreadCreated\", listener: (e: ChatThreadCreatedEvent) => void): void;\n\n /**\n * Subscribe function for chatThreadDeleted.\n * @param event - The ChatThreadDeletedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"chatThreadDeleted\", listener: (e: ChatThreadDeletedEvent) => void): void;\n\n /**\n * Subscribe function for chatThreadPropertiesUpdated.\n * @param event - The ChatThreadPropertiesUpdatedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(\n event: \"chatThreadPropertiesUpdated\",\n listener: (e: ChatThreadPropertiesUpdatedEvent) => void,\n ): void;\n\n /**\n * Subscribe function for participantsAdded.\n * @param event - The ParticipantsAddedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"participantsAdded\", listener: (e: ParticipantsAddedEvent) => void): void;\n\n /**\n * Subscribe function for participantsRemoved.\n * @param event - The ParticipantsRemovedEvent.\n * @param listener - The listener to handle the event.\n */\n public on(event: \"participantsRemoved\", listener: (e: ParticipantsRemovedEvent) => void): void;\n\n /**\n * Subscribe function for realTimeNotificationConnected.\n * @param event - The realTimeNotificationConnected Event\n * @param listener - The listener to handle the event.\n */\n public on(event: \"realTimeNotificationConnected\", listener: () => void): void;\n\n /**\n * Subscribe function for realTimeNotificationDisconnected.\n * @param event - The realTimeNotificationDisconnected Event\n * @param listener - The listener to handle the event.\n */\n public on(event: \"realTimeNotificationDisconnected\", listener: () => void): void;\n\n public on(event: ChatEventId, listener: (e?: any) => void): void {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are only supported in the browser.\");\n }\n if (\n !this.isRealtimeNotificationsStarted &&\n event !== \"realTimeNotificationConnected\" &&\n event !== \"realTimeNotificationDisconnected\"\n ) {\n throw new Error(\n \"You must call startRealtimeNotifications before you can subscribe to events.\",\n );\n }\n\n this.emitter.on(event, listener);\n }\n\n /**\n * Unsubscribe from chatMessageReceived.\n * @param event - The ChatMessageReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatMessageReceived\", listener: (e: ChatMessageReceivedEvent) => void): void;\n\n /**\n * Unsubscribe from chatMessageEdited.\n * @param event - The ChatMessageEditedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatMessageEdited\", listener: (e: ChatMessageEditedEvent) => void): void;\n\n /**\n * Unsubscribe from chatMessageDeleted.\n * @param event - The ChatMessageDeletedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatMessageDeleted\", listener: (e: ChatMessageDeletedEvent) => void): void;\n\n /**\n * Unsubscribe from typingIndicatorReceived.\n * @param event - The TypingIndicatorReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(\n event: \"typingIndicatorReceived\",\n listener: (e: TypingIndicatorReceivedEvent) => void,\n ): void;\n\n /**\n * Unsubscribe from readReceiptReceived.\n * @param event - The ReadReceiptReceivedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"readReceiptReceived\", listener: (e: ReadReceiptReceivedEvent) => void): void;\n\n /**\n * Unsubscribe from chatThreadCreated.\n * @param event - The ChatThreadCreatedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatThreadCreated\", listener: (e: ChatThreadCreatedEvent) => void): void;\n\n /**\n * Unsubscribe from chatThreadDeleted.\n * @param event - The ChatThreadDeletedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"chatThreadDeleted\", listener: (e: ChatThreadDeletedEvent) => void): void;\n\n /**\n * Unsubscribe from chatThreadPropertiesUpdated.\n * @param event - The ChatThreadPropertiesUpdatedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(\n event: \"chatThreadPropertiesUpdated\",\n listener: (e: ChatThreadPropertiesUpdatedEvent) => void,\n ): void;\n\n /**\n * Unsubscribe from participantsAdded.\n * @param event - The ParticipantsAddedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"participantsAdded\", listener: (e: ParticipantsAddedEvent) => void): void;\n\n /**\n * Unsubscribe from participantsRemoved.\n * @param event - The ParticipantsRemovedEvent.\n * @param listener - The listener to handle the event.\n */\n public off(event: \"participantsRemoved\", listener: (e: ParticipantsRemovedEvent) => void): void;\n\n public off(event: ChatEventId, listener: (e: any) => void): void {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are only supported in the browser.\");\n }\n\n this.emitter.removeListener(event, listener);\n }\n\n private subscribeToSignalingEvents(): void {\n if (this.signalingClient === undefined) {\n throw new Error(\"Realtime notifications are only supported in the browser.\");\n }\n\n this.signalingClient.on(\"connectionChanged\", (payload) => {\n if (payload === ConnectionState.Connected) {\n this.emitter.emit(\"realTimeNotificationConnected\");\n } else if (payload === ConnectionState.Disconnected) {\n this.emitter.emit(\"realTimeNotificationDisconnected\");\n }\n });\n\n this.signalingClient.on(\"chatMessageReceived\", (payload) => {\n this.emitter.emit(\"chatMessageReceived\", payload);\n });\n\n this.signalingClient.on(\"chatMessageEdited\", (payload) => {\n this.emitter.emit(\"chatMessageEdited\", payload);\n });\n\n this.signalingClient.on(\"chatMessageDeleted\", (payload) => {\n this.emitter.emit(\"chatMessageDeleted\", payload);\n });\n\n this.signalingClient.on(\"typingIndicatorReceived\", (payload) => {\n this.emitter.emit(\"typingIndicatorReceived\", payload);\n });\n\n this.signalingClient.on(\"readReceiptReceived\", (payload) => {\n this.emitter.emit(\"readReceiptReceived\", payload);\n });\n\n this.signalingClient.on(\"chatThreadCreated\", (payload) => {\n this.emitter.emit(\"chatThreadCreated\", payload);\n });\n\n this.signalingClient.on(\"chatThreadDeleted\", (payload) => {\n this.emitter.emit(\"chatThreadDeleted\", payload);\n });\n\n this.signalingClient.on(\"chatThreadPropertiesUpdated\", (payload) => {\n this.emitter.emit(\"chatThreadPropertiesUpdated\", payload);\n });\n\n this.signalingClient.on(\"participantsAdded\", (payload) => {\n this.emitter.emit(\"participantsAdded\", payload);\n });\n\n this.signalingClient.on(\"participantsRemoved\", (payload) => {\n this.emitter.emit(\"participantsRemoved\", payload);\n });\n }\n}\n"]}
@@ -47,15 +47,6 @@ export class ChatThreadClient {
47
47
  await this.client.chatThread.updateChatThreadProperties(this.threadId, { topic: topic }, updatedOptions);
48
48
  });
49
49
  }
50
- /**
51
- * Updates a thread's properties.
52
- * @param options - Operation options.
53
- */
54
- updateProperties(options = {}) {
55
- return tracingClient.withSpan("ChatThreadClient-UpdateProperties", options, async (updatedOptions) => {
56
- await this.client.chatThread.updateChatThreadProperties(this.threadId, options, updatedOptions);
57
- });
58
- }
59
50
  /**
60
51
  * Sends a chat message to a thread identified by threadId.
61
52
  * Returns the id of the created message.
@@ -82,8 +73,8 @@ export class ChatThreadClient {
82
73
  return mapToChatMessageSdkModel(result);
83
74
  });
84
75
  }
85
- listMessagesPage(pageSettings, options = {}) {
86
- return __asyncGenerator(this, arguments, function* listMessagesPage_1() {
76
+ listMessagesPage(pageSettings_1) {
77
+ return __asyncGenerator(this, arguments, function* listMessagesPage_1(pageSettings, options = {}) {
87
78
  if (!pageSettings.continuationToken) {
88
79
  const currentSetResponse = yield __await(this.client.chatThread.listChatMessages(this.threadId, options));
89
80
  pageSettings.continuationToken = currentSetResponse.nextLink;
@@ -186,8 +177,8 @@ export class ChatThreadClient {
186
177
  return result;
187
178
  });
188
179
  }
189
- listParticipantsPage(continuationState, options = {}) {
190
- return __asyncGenerator(this, arguments, function* listParticipantsPage_1() {
180
+ listParticipantsPage(continuationState_1) {
181
+ return __asyncGenerator(this, arguments, function* listParticipantsPage_1(continuationState, options = {}) {
191
182
  if (!continuationState.continuationToken) {
192
183
  const currentSetResponse = yield __await(this.client.chatThread.listChatParticipants(this.threadId, options));
193
184
  continuationState.continuationToken = currentSetResponse.nextLink;
@@ -298,8 +289,8 @@ export class ChatThreadClient {
298
289
  await this.client.chatThread.sendChatReadReceipt(this.threadId, request, updatedOptions);
299
290
  });
300
291
  }
301
- listReadReceiptsPage(continuationState, options = {}) {
302
- return __asyncGenerator(this, arguments, function* listReadReceiptsPage_1() {
292
+ listReadReceiptsPage(continuationState_1) {
293
+ return __asyncGenerator(this, arguments, function* listReadReceiptsPage_1(continuationState, options = {}) {
303
294
  if (!continuationState.continuationToken) {
304
295
  const currentSetResponse = yield __await(this.client.chatThread.listChatReadReceipts(this.threadId, options));
305
296
  continuationState.continuationToken = currentSetResponse.nextLink;
@@ -1 +1 @@
1
- {"version":3,"file":"chatThreadClient.js","sourceRoot":"","sources":["../../src/chatThreadClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAGL,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AAiBrC,OAAO,EACL,wCAAwC,EACxC,wBAAwB,EACxB,4BAA4B,EAC5B,iCAAiC,EACjC,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAkB1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,wCAAwC,EAAE,MAAM,iDAAiD,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,mCAAmC,GAAW,IAAI,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAW3B,YACmB,QAAgB,EACjC,QAAgB,EAChB,UAAwC,EACxC,UAAmC,EAAE;QAHpB,aAAQ,GAAR,QAAQ,CAAQ;QAH3B,4BAAuB,GAAqB,SAAS,CAAC;QAQ5D,IAAI,CA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,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { logger } from \"./models/logger\";\nimport {\n CommunicationIdentifier,\n CommunicationTokenCredential,\n serializeCommunicationIdentifier,\n} from \"@azure/communication-common\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport {\n AddParticipantsRequest,\n SendMessageRequest,\n SendReadReceiptRequest,\n} from \"./models/requests\";\n\nimport {\n AddChatParticipantsResult,\n ChatMessage,\n ChatMessageReadReceipt,\n ChatParticipant,\n ChatThreadProperties,\n ListPageSettings,\n SendChatMessageResult,\n} from \"./models/models\";\nimport {\n mapToAddChatParticipantsRequestRestModel,\n mapToChatMessageSdkModel,\n mapToChatParticipantSdkModel,\n mapToChatThreadPropertiesSdkModel,\n mapToReadReceiptSdkModel,\n} from \"./models/mappers\";\nimport {\n AddParticipantsOptions,\n ChatThreadClientOptions,\n DeleteMessageOptions,\n GetMessageOptions,\n GetPropertiesOptions,\n ListMessagesOptions,\n ListParticipantsOptions,\n ListReadReceiptsOptions,\n RemoveParticipantOptions,\n SendMessageOptions,\n SendReadReceiptOptions,\n SendTypingNotificationOptions,\n UpdateMessageOptions,\n UpdateTopicOptions,\n UpdateChatThreadPropertiesOptions,\n} from \"./models/options\";\nimport { ChatApiClient } from \"./generated/src\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { createCommunicationTokenCredentialPolicy } from \"./credential/communicationTokenCredentialPolicy\";\nimport { tracingClient } from \"./generated/src/tracing\";\n\nconst minimumTypingIntervalInMilliSeconds: number = 8000;\n\n/**\n * The client to do chat operations\n */\nexport class ChatThreadClient {\n /**\n * Thread ID of the ChatThreadClient\n */\n readonly threadId: string;\n\n private readonly tokenCredential: CommunicationTokenCredential;\n private readonly client: ChatApiClient;\n\n private timeOfLastTypingRequest: Date | undefined = undefined;\n\n constructor(\n private readonly endpoint: string,\n threadId: string,\n credential: CommunicationTokenCredential,\n options: ChatThreadClientOptions = {},\n ) {\n this.threadId = threadId;\n this.tokenCredential = credential;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new ChatApiClient(this.endpoint, {\n endpoint: this.endpoint,\n ...internalPipelineOptions,\n });\n\n const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);\n this.client.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Gets a chat thread.\n * Returns the chat thread.\n * @param options - Operation options.\n */\n public getProperties(options: GetPropertiesOptions = {}): Promise<ChatThreadProperties> {\n return tracingClient.withSpan(\"ChatClient-GetProperties\", options, async (updatedOptions) => {\n const result = await this.client.chatThread.getChatThreadProperties(\n this.threadId,\n updatedOptions,\n );\n return mapToChatThreadPropertiesSdkModel(result);\n });\n }\n\n /**\n * Updates a thread's topic.\n * @param topic - The topic needs to be updated to.\n * @param options - Operation options.\n */\n public updateTopic(topic: string, options: UpdateTopicOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-UpdateTopic\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.updateChatThreadProperties(\n this.threadId,\n { topic: topic },\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Updates a thread's properties.\n * @param options - Operation options.\n */\n public updateProperties(options: UpdateChatThreadPropertiesOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-UpdateProperties\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.updateChatThreadProperties(\n this.threadId,\n options,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Sends a chat message to a thread identified by threadId.\n * Returns the id of the created message.\n * @param request - Request for sending a message.\n * @param options - Operation options.\n */\n public sendMessage(\n request: SendMessageRequest,\n options: SendMessageOptions = {},\n ): Promise<SendChatMessageResult> {\n return tracingClient.withSpan(\n \"ChatThreadClient-SendMessage\",\n options,\n async (updatedOptions) => {\n // reset typing notification clock\n this.timeOfLastTypingRequest = undefined;\n\n const result = await this.client.chatThread.sendChatMessage(\n this.threadId,\n { ...request, ...options },\n updatedOptions,\n );\n return result;\n },\n );\n }\n\n /**\n * Gets a chat message identified by messageId.\n * Returns the specific message.\n * @param messageId - The message id of the message.\n * @param options - Operation options.\n */\n public getMessage(messageId: string, options: GetMessageOptions = {}): Promise<ChatMessage> {\n return tracingClient.withSpan(\n \"ChatThreadClient-GetMessage\",\n options,\n async (updatedOptions) => {\n const result = await this.client.chatThread.getChatMessage(\n this.threadId,\n messageId,\n updatedOptions,\n );\n return mapToChatMessageSdkModel(result);\n },\n );\n }\n\n private async *listMessagesPage(\n pageSettings: ListPageSettings,\n options: ListMessagesOptions = {},\n ): AsyncIterableIterator<ChatMessage[]> {\n if (!pageSettings.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatMessages(\n this.threadId,\n options,\n );\n pageSettings.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToChatMessageSdkModel, this);\n }\n }\n\n while (pageSettings.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatMessagesNext(\n this.threadId,\n pageSettings.continuationToken,\n options,\n );\n pageSettings.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToChatMessageSdkModel, this);\n } else {\n break;\n }\n }\n }\n\n private async *listMessagesAll(options: ListMessagesOptions): AsyncIterableIterator<ChatMessage> {\n for await (const page of this.listMessagesPage({}, options)) {\n yield* page;\n }\n }\n\n /**\n * Gets a list of message from a thread identified by threadId.\n * Returns the list of the messages.\n * @param options - Get messages options.\n */\n public listMessages(options: ListMessagesOptions = {}): PagedAsyncIterableIterator<ChatMessage> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ChatThreadClient-ListMessages\",\n options,\n );\n\n try {\n const iter = this.listMessagesAll(updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}) => {\n return this.listMessagesPage(settings, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes a message identified by threadId and messageId\n * @param messageId - The message id of the message.\n * @param options - Operation options.\n */\n public deleteMessage(messageId: string, options: DeleteMessageOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-DeleteMessage\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.deleteChatMessage(this.threadId, messageId, updatedOptions);\n },\n );\n }\n\n /**\n * Updates a message identified by threadId and messageId\n * @param messageId - The message id of the message.\n * @param options - Operation options.\n */\n public async updateMessage(messageId: string, options: UpdateMessageOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-UpdateMessage\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.updateChatMessage(\n this.threadId,\n messageId,\n options,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Adds the details of chat participants belonging to the thread identified by threadId.\n * @param request - Thread participants' details to add in the thread roster\n * @param options - Operation options.\n */\n public async addParticipants(\n request: AddParticipantsRequest,\n options: AddParticipantsOptions = {},\n ): Promise<AddChatParticipantsResult> {\n return tracingClient.withSpan(\n \"ChatThreadClient-AddParticipants\",\n options,\n async (updatedOptions) => {\n const result = await this.client.chatThread.addChatParticipants(\n this.threadId,\n mapToAddChatParticipantsRequestRestModel(request),\n updatedOptions,\n );\n return result;\n },\n );\n }\n\n private async *listParticipantsPage(\n continuationState: ListPageSettings,\n options: ListParticipantsOptions = {},\n ): AsyncIterableIterator<ChatParticipant[]> {\n if (!continuationState.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatParticipants(\n this.threadId,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToChatParticipantSdkModel, this);\n }\n }\n\n while (continuationState.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatParticipantsNext(\n this.threadId,\n continuationState.continuationToken,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToChatParticipantSdkModel, this);\n } else {\n break;\n }\n }\n }\n\n private async *listParticipantsAll(\n options: ListParticipantsOptions,\n ): AsyncIterableIterator<ChatParticipant> {\n for await (const page of this.listParticipantsPage({}, options)) {\n yield* page;\n }\n }\n\n /**\n * Gets the participants of the thread identified by threadId.\n * Returns the lists of the participants.\n * @param options - Operation options.\n */\n public listParticipants(\n options: ListParticipantsOptions = {},\n ): PagedAsyncIterableIterator<ChatParticipant> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ChatThreadClient-ListParticipants\",\n options,\n );\n\n try {\n const iter = this.listParticipantsAll(updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}) => {\n return this.listParticipantsPage(settings, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Removes participant from the thread identified by threadId.\n * @param participant - Thread participant to remove from the thread roster\n * @param options - Operation options.\n */\n public async removeParticipant(\n participant: CommunicationIdentifier,\n options: RemoveParticipantOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-RemoveParticipant\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.removeChatParticipant(\n this.threadId,\n serializeCommunicationIdentifier(participant),\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Sends a typing notification to the thread.\n * Doesn't attempt to send if the time since last notification is smaller than the minimum typing interval\n * @param options - - Operation options\n * @returns True if the typing message notification could be sent, otherwise false.\n */\n public async sendTypingNotification(\n options: SendTypingNotificationOptions = {},\n ): Promise<boolean> {\n return tracingClient.withSpan(\n \"ChatThreadClient-SendTypingNotification\",\n options,\n async (updatedOptions) => {\n const dateNow = new Date();\n const { senderDisplayName, ...restOptions } = updatedOptions;\n\n if (this.canPostTypingNotification(dateNow)) {\n this.timeOfLastTypingRequest = dateNow;\n\n await this.client.chatThread.sendTypingNotification(this.threadId, {\n sendTypingNotificationRequest: { senderDisplayName: senderDisplayName },\n ...restOptions,\n });\n return true;\n }\n\n logger.info(`Typing Notification NOT Send. [thread_id=${this.threadId}]`);\n return false;\n },\n );\n }\n\n /**\n * Sends a read receipt to the thread identified by threadId.\n * @param request - Request for sending a read receipt\n * @param options - Operation options.\n */\n public async sendReadReceipt(\n request: SendReadReceiptRequest,\n options: SendReadReceiptOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-SendReadReceipt\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.sendChatReadReceipt(this.threadId, request, updatedOptions);\n },\n );\n }\n\n private async *listReadReceiptsPage(\n continuationState: ListPageSettings,\n options: ListReadReceiptsOptions = {},\n ): AsyncIterableIterator<ChatMessageReadReceipt[]> {\n if (!continuationState.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatReadReceipts(\n this.threadId,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToReadReceiptSdkModel, this);\n }\n }\n\n while (continuationState.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatReadReceiptsNext(\n this.threadId,\n continuationState.continuationToken,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToReadReceiptSdkModel, this);\n } else {\n break;\n }\n }\n }\n\n private async *listReadReceiptsAll(\n options: ListReadReceiptsOptions,\n ): AsyncIterableIterator<ChatMessageReadReceipt> {\n for await (const page of this.listReadReceiptsPage({}, options)) {\n yield* page;\n }\n }\n\n /**\n * Gets a list of read receipt from a thread identified by threadId.\n * Returns the list of the messages.\n * @param options - Get messages options.\n */\n public listReadReceipts(\n options: ListReadReceiptsOptions = {},\n ): PagedAsyncIterableIterator<ChatMessageReadReceipt> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ChatThreadClient-ListChatReadReceipts\",\n options,\n );\n\n try {\n const iter = this.listReadReceiptsAll(updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}) => {\n return this.listReadReceiptsPage(settings, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n private canPostTypingNotification(dateNow: Date): boolean {\n if (this.timeOfLastTypingRequest) {\n const timeSinceLastRequestInMilliSeconds =\n dateNow.getTime() - this.timeOfLastTypingRequest.getTime();\n\n if (timeSinceLastRequestInMilliSeconds < minimumTypingIntervalInMilliSeconds) {\n logger.info(`Typing interval check failed. [last_request=${this.timeOfLastTypingRequest}]`);\n return false;\n }\n }\n\n return true;\n }\n}\n"]}
1
+ {"version":3,"file":"chatThreadClient.js","sourceRoot":"","sources":["../../src/chatThreadClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAElC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAGL,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AAiBrC,OAAO,EACL,wCAAwC,EACxC,wBAAwB,EACxB,4BAA4B,EAC5B,iCAAiC,EACjC,wBAAwB,GACzB,MAAM,kBAAkB,CAAC;AAiB1B,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAE,wCAAwC,EAAE,MAAM,iDAAiD,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,mCAAmC,GAAW,IAAI,CAAC;AAEzD;;GAEG;AACH,MAAM,OAAO,gBAAgB;IAW3B,YACmB,QAAgB,EACjC,QAAgB,EAChB,UAAwC,EACxC,UAAmC,EAAE;QAHpB,aAAQ,GAAR,QAAQ,CAAQ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,CACR,CAAC;QAEF,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,IAAI,CAAC,mBAAmB,CAAC,cAAc,CAAC,CAAC;YACtD,OAAO;gBACL,IAAI;oBACF,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;gBACrB,CAAC;gBACD,CAAC,MAAM,CAAC,aAAa,CAAC;oBACpB,OAAO,IAAI,CAAC;gBACd,CAAC;gBACD,MAAM,EAAE,CAAC,WAA6B,EAAE,EAAE,EAAE;oBAC1C,OAAO,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;gBAC7D,CAAC;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,CAAM,EAAE,CAAC;YAChB,IAAI,CAAC,SAAS,CAAC;gBACb,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;QACV,CAAC;gBAAS,CAAC;YACT,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,CAAC;IACH,CAAC;IAEO,yBAAyB,CAAC,OAAa;QAC7C,IAAI,IAAI,CAAC,uBAAuB,EAAE,CAAC;YACjC,MAAM,kCAAkC,GACtC,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC;YAE7D,IAAI,kCAAkC,GAAG,mCAAmC,EAAE,CAAC;gBAC7E,MAAM,CAAC,IAAI,CAAC,+CAA+C,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;gBAC5F,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT license.\n\nimport { logger } from \"./models/logger\";\nimport {\n CommunicationIdentifier,\n CommunicationTokenCredential,\n serializeCommunicationIdentifier,\n} from \"@azure/communication-common\";\nimport { PagedAsyncIterableIterator } from \"@azure/core-paging\";\nimport {\n AddParticipantsRequest,\n SendMessageRequest,\n SendReadReceiptRequest,\n} from \"./models/requests\";\n\nimport {\n AddChatParticipantsResult,\n ChatMessage,\n ChatMessageReadReceipt,\n ChatParticipant,\n ChatThreadProperties,\n ListPageSettings,\n SendChatMessageResult,\n} from \"./models/models\";\nimport {\n mapToAddChatParticipantsRequestRestModel,\n mapToChatMessageSdkModel,\n mapToChatParticipantSdkModel,\n mapToChatThreadPropertiesSdkModel,\n mapToReadReceiptSdkModel,\n} from \"./models/mappers\";\nimport {\n AddParticipantsOptions,\n ChatThreadClientOptions,\n DeleteMessageOptions,\n GetMessageOptions,\n GetPropertiesOptions,\n ListMessagesOptions,\n ListParticipantsOptions,\n ListReadReceiptsOptions,\n RemoveParticipantOptions,\n SendMessageOptions,\n SendReadReceiptOptions,\n SendTypingNotificationOptions,\n UpdateMessageOptions,\n UpdateTopicOptions,\n} from \"./models/options\";\nimport { ChatApiClient } from \"./generated/src\";\nimport { InternalPipelineOptions } from \"@azure/core-rest-pipeline\";\nimport { createCommunicationTokenCredentialPolicy } from \"./credential/communicationTokenCredentialPolicy\";\nimport { tracingClient } from \"./generated/src/tracing\";\n\nconst minimumTypingIntervalInMilliSeconds: number = 8000;\n\n/**\n * The client to do chat operations\n */\nexport class ChatThreadClient {\n /**\n * Thread ID of the ChatThreadClient\n */\n readonly threadId: string;\n\n private readonly tokenCredential: CommunicationTokenCredential;\n private readonly client: ChatApiClient;\n\n private timeOfLastTypingRequest: Date | undefined = undefined;\n\n constructor(\n private readonly endpoint: string,\n threadId: string,\n credential: CommunicationTokenCredential,\n options: ChatThreadClientOptions = {},\n ) {\n this.threadId = threadId;\n this.tokenCredential = credential;\n\n const internalPipelineOptions: InternalPipelineOptions = {\n ...options,\n ...{\n loggingOptions: {\n logger: logger.info,\n },\n },\n };\n\n this.client = new ChatApiClient(this.endpoint, {\n endpoint: this.endpoint,\n ...internalPipelineOptions,\n });\n\n const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);\n this.client.pipeline.addPolicy(authPolicy);\n }\n\n /**\n * Gets a chat thread.\n * Returns the chat thread.\n * @param options - Operation options.\n */\n public getProperties(options: GetPropertiesOptions = {}): Promise<ChatThreadProperties> {\n return tracingClient.withSpan(\"ChatClient-GetProperties\", options, async (updatedOptions) => {\n const result = await this.client.chatThread.getChatThreadProperties(\n this.threadId,\n updatedOptions,\n );\n return mapToChatThreadPropertiesSdkModel(result);\n });\n }\n\n /**\n * Updates a thread's topic.\n * @param topic - The topic needs to be updated to.\n * @param options - Operation options.\n */\n public updateTopic(topic: string, options: UpdateTopicOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-UpdateTopic\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.updateChatThreadProperties(\n this.threadId,\n { topic: topic },\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Sends a chat message to a thread identified by threadId.\n * Returns the id of the created message.\n * @param request - Request for sending a message.\n * @param options - Operation options.\n */\n public sendMessage(\n request: SendMessageRequest,\n options: SendMessageOptions = {},\n ): Promise<SendChatMessageResult> {\n return tracingClient.withSpan(\n \"ChatThreadClient-SendMessage\",\n options,\n async (updatedOptions) => {\n // reset typing notification clock\n this.timeOfLastTypingRequest = undefined;\n\n const result = await this.client.chatThread.sendChatMessage(\n this.threadId,\n { ...request, ...options },\n updatedOptions,\n );\n return result;\n },\n );\n }\n\n /**\n * Gets a chat message identified by messageId.\n * Returns the specific message.\n * @param messageId - The message id of the message.\n * @param options - Operation options.\n */\n public getMessage(messageId: string, options: GetMessageOptions = {}): Promise<ChatMessage> {\n return tracingClient.withSpan(\n \"ChatThreadClient-GetMessage\",\n options,\n async (updatedOptions) => {\n const result = await this.client.chatThread.getChatMessage(\n this.threadId,\n messageId,\n updatedOptions,\n );\n return mapToChatMessageSdkModel(result);\n },\n );\n }\n\n private async *listMessagesPage(\n pageSettings: ListPageSettings,\n options: ListMessagesOptions = {},\n ): AsyncIterableIterator<ChatMessage[]> {\n if (!pageSettings.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatMessages(\n this.threadId,\n options,\n );\n pageSettings.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToChatMessageSdkModel, this);\n }\n }\n\n while (pageSettings.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatMessagesNext(\n this.threadId,\n pageSettings.continuationToken,\n options,\n );\n pageSettings.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToChatMessageSdkModel, this);\n } else {\n break;\n }\n }\n }\n\n private async *listMessagesAll(options: ListMessagesOptions): AsyncIterableIterator<ChatMessage> {\n for await (const page of this.listMessagesPage({}, options)) {\n yield* page;\n }\n }\n\n /**\n * Gets a list of message from a thread identified by threadId.\n * Returns the list of the messages.\n * @param options - Get messages options.\n */\n public listMessages(options: ListMessagesOptions = {}): PagedAsyncIterableIterator<ChatMessage> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ChatThreadClient-ListMessages\",\n options,\n );\n\n try {\n const iter = this.listMessagesAll(updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}) => {\n return this.listMessagesPage(settings, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Deletes a message identified by threadId and messageId\n * @param messageId - The message id of the message.\n * @param options - Operation options.\n */\n public deleteMessage(messageId: string, options: DeleteMessageOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-DeleteMessage\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.deleteChatMessage(this.threadId, messageId, updatedOptions);\n },\n );\n }\n\n /**\n * Updates a message identified by threadId and messageId\n * @param messageId - The message id of the message.\n * @param options - Operation options.\n */\n public async updateMessage(messageId: string, options: UpdateMessageOptions = {}): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-UpdateMessage\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.updateChatMessage(\n this.threadId,\n messageId,\n options,\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Adds the details of chat participants belonging to the thread identified by threadId.\n * @param request - Thread participants' details to add in the thread roster\n * @param options - Operation options.\n */\n public async addParticipants(\n request: AddParticipantsRequest,\n options: AddParticipantsOptions = {},\n ): Promise<AddChatParticipantsResult> {\n return tracingClient.withSpan(\n \"ChatThreadClient-AddParticipants\",\n options,\n async (updatedOptions) => {\n const result = await this.client.chatThread.addChatParticipants(\n this.threadId,\n mapToAddChatParticipantsRequestRestModel(request),\n updatedOptions,\n );\n return result;\n },\n );\n }\n\n private async *listParticipantsPage(\n continuationState: ListPageSettings,\n options: ListParticipantsOptions = {},\n ): AsyncIterableIterator<ChatParticipant[]> {\n if (!continuationState.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatParticipants(\n this.threadId,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToChatParticipantSdkModel, this);\n }\n }\n\n while (continuationState.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatParticipantsNext(\n this.threadId,\n continuationState.continuationToken,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToChatParticipantSdkModel, this);\n } else {\n break;\n }\n }\n }\n\n private async *listParticipantsAll(\n options: ListParticipantsOptions,\n ): AsyncIterableIterator<ChatParticipant> {\n for await (const page of this.listParticipantsPage({}, options)) {\n yield* page;\n }\n }\n\n /**\n * Gets the participants of the thread identified by threadId.\n * Returns the lists of the participants.\n * @param options - Operation options.\n */\n public listParticipants(\n options: ListParticipantsOptions = {},\n ): PagedAsyncIterableIterator<ChatParticipant> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ChatThreadClient-ListParticipants\",\n options,\n );\n\n try {\n const iter = this.listParticipantsAll(updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}) => {\n return this.listParticipantsPage(settings, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n /**\n * Removes participant from the thread identified by threadId.\n * @param participant - Thread participant to remove from the thread roster\n * @param options - Operation options.\n */\n public async removeParticipant(\n participant: CommunicationIdentifier,\n options: RemoveParticipantOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-RemoveParticipant\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.removeChatParticipant(\n this.threadId,\n serializeCommunicationIdentifier(participant),\n updatedOptions,\n );\n },\n );\n }\n\n /**\n * Sends a typing notification to the thread.\n * Doesn't attempt to send if the time since last notification is smaller than the minimum typing interval\n * @param options - - Operation options\n * @returns True if the typing message notification could be sent, otherwise false.\n */\n public async sendTypingNotification(\n options: SendTypingNotificationOptions = {},\n ): Promise<boolean> {\n return tracingClient.withSpan(\n \"ChatThreadClient-SendTypingNotification\",\n options,\n async (updatedOptions) => {\n const dateNow = new Date();\n const { senderDisplayName, ...restOptions } = updatedOptions;\n\n if (this.canPostTypingNotification(dateNow)) {\n this.timeOfLastTypingRequest = dateNow;\n\n await this.client.chatThread.sendTypingNotification(this.threadId, {\n sendTypingNotificationRequest: { senderDisplayName: senderDisplayName },\n ...restOptions,\n });\n return true;\n }\n\n logger.info(`Typing Notification NOT Send. [thread_id=${this.threadId}]`);\n return false;\n },\n );\n }\n\n /**\n * Sends a read receipt to the thread identified by threadId.\n * @param request - Request for sending a read receipt\n * @param options - Operation options.\n */\n public async sendReadReceipt(\n request: SendReadReceiptRequest,\n options: SendReadReceiptOptions = {},\n ): Promise<void> {\n return tracingClient.withSpan(\n \"ChatThreadClient-SendReadReceipt\",\n options,\n async (updatedOptions) => {\n await this.client.chatThread.sendChatReadReceipt(this.threadId, request, updatedOptions);\n },\n );\n }\n\n private async *listReadReceiptsPage(\n continuationState: ListPageSettings,\n options: ListReadReceiptsOptions = {},\n ): AsyncIterableIterator<ChatMessageReadReceipt[]> {\n if (!continuationState.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatReadReceipts(\n this.threadId,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToReadReceiptSdkModel, this);\n }\n }\n\n while (continuationState.continuationToken) {\n const currentSetResponse = await this.client.chatThread.listChatReadReceiptsNext(\n this.threadId,\n continuationState.continuationToken,\n options,\n );\n continuationState.continuationToken = currentSetResponse.nextLink;\n if (currentSetResponse.value) {\n yield currentSetResponse.value.map(mapToReadReceiptSdkModel, this);\n } else {\n break;\n }\n }\n }\n\n private async *listReadReceiptsAll(\n options: ListReadReceiptsOptions,\n ): AsyncIterableIterator<ChatMessageReadReceipt> {\n for await (const page of this.listReadReceiptsPage({}, options)) {\n yield* page;\n }\n }\n\n /**\n * Gets a list of read receipt from a thread identified by threadId.\n * Returns the list of the messages.\n * @param options - Get messages options.\n */\n public listReadReceipts(\n options: ListReadReceiptsOptions = {},\n ): PagedAsyncIterableIterator<ChatMessageReadReceipt> {\n const { span, updatedOptions } = tracingClient.startSpan(\n \"ChatThreadClient-ListChatReadReceipts\",\n options,\n );\n\n try {\n const iter = this.listReadReceiptsAll(updatedOptions);\n return {\n next() {\n return iter.next();\n },\n [Symbol.asyncIterator]() {\n return this;\n },\n byPage: (settings: ListPageSettings = {}) => {\n return this.listReadReceiptsPage(settings, updatedOptions);\n },\n };\n } catch (e: any) {\n span.setStatus({\n status: \"error\",\n error: e,\n });\n throw e;\n } finally {\n span.end();\n }\n }\n\n private canPostTypingNotification(dateNow: Date): boolean {\n if (this.timeOfLastTypingRequest) {\n const timeSinceLastRequestInMilliSeconds =\n dateNow.getTime() - this.timeOfLastTypingRequest.getTime();\n\n if (timeSinceLastRequestInMilliSeconds < minimumTypingIntervalInMilliSeconds) {\n logger.info(`Typing interval check failed. [last_request=${this.timeOfLastTypingRequest}]`);\n return false;\n }\n }\n\n return true;\n }\n}\n"]}
@@ -25,7 +25,7 @@ export class ChatApiClient extends coreClient.ServiceClient {
25
25
  const defaults = {
26
26
  requestContentType: "application/json; charset=utf-8",
27
27
  };
28
- const packageDetails = `azsdk-js-communication-chat/1.5.0-beta.2`;
28
+ const packageDetails = `azsdk-js-communication-chat/1.5.0`;
29
29
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
30
30
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
31
31
  : `${packageDetails}`;
@@ -36,7 +36,7 @@ export class ChatApiClient extends coreClient.ServiceClient {
36
36
  // Parameter assignments
37
37
  this.endpoint = endpoint;
38
38
  // Assigning values to Constant parameters
39
- this.apiVersion = options.apiVersion || "2024-03-01-preview";
39
+ this.apiVersion = options.apiVersion || "2024-03-07";
40
40
  this.chatThread = new ChatThreadImpl(this);
41
41
  this.chat = new ChatImpl(this);
42
42
  this.addCustomApiVersionPolicy(options.apiVersion);
@@ -1 +1 @@
1
- {"version":3,"file":"chatApiClient.js","sourceRoot":"","sources":["../../../../src/generated/src/chatApiClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAMjD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIxD,MAAM,OAAO,aAAc,SAAQ,UAAU,CAAC,aAAa;IAIzD;;;;OAIG;IACH,YAAY,QAAgB,EAAE,OAAqC;;QACjE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC/C,CAAC;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,GAAG,EAAE,CAAC;QACf,CAAC;QACD,MAAM,QAAQ,GAAgC;YAC5C,kBAAkB,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,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;wBACjD,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;4BACrC,OAAO,cAAc,GAAG,UAAU,CAAC;wBACrC,CAAC;6BAAM,CAAC;4BACN,OAAO,IAAI,CAAC;wBACd,CAAC;oBACH,CAAC,CAAC,CAAC;oBACH,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACrD,CAAC;gBACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;CAIF","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { ChatThreadImpl, ChatImpl } from \"./operations\";\nimport { ChatThread, Chat } from \"./operationsInterfaces\";\nimport { ChatApiClientOptionalParams } from \"./models\";\n\nexport class ChatApiClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the ChatApiClient class.\n * @param endpoint The endpoint of the Azure Communication resource.\n * @param options The parameter options\n */\n constructor(endpoint: string, options?: ChatApiClientOptionalParams) {\n if (endpoint === undefined) {\n throw new Error(\"'endpoint' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: ChatApiClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\",\n };\n\n const packageDetails = `azsdk-js-communication-chat/1.5.0-beta.2`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n endpoint: options.endpoint ?? options.baseUri ?? \"{endpoint}\",\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2024-03-01-preview\";\n this.chatThread = new ChatThreadImpl(this);\n this.chat = new ChatImpl(this);\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest,\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n },\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n chatThread: ChatThread;\n chat: Chat;\n}\n"]}
1
+ {"version":3,"file":"chatApiClient.js","sourceRoot":"","sources":["../../../../src/generated/src/chatApiClient.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,UAAU,MAAM,oBAAoB,CAAC;AAMjD,OAAO,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIxD,MAAM,OAAO,aAAc,SAAQ,UAAU,CAAC,aAAa;IAIzD;;;;OAIG;IACH,YAAY,QAAgB,EAAE,OAAqC;;QACjE,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,MAAM,IA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B,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACrC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACrB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;wBACjD,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;4BACrC,OAAO,cAAc,GAAG,UAAU,CAAC;wBACrC,CAAC;6BAAM,CAAC;4BACN,OAAO,IAAI,CAAC;wBACd,CAAC;oBACH,CAAC,CAAC,CAAC;oBACH,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACrD,CAAC;gBACD,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC;YACvB,CAAC;SACF,CAAC;QACF,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC;IAC5C,CAAC;CAIF","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\nimport {\n PipelineRequest,\n PipelineResponse,\n SendRequest,\n} from \"@azure/core-rest-pipeline\";\nimport { ChatThreadImpl, ChatImpl } from \"./operations\";\nimport { ChatThread, Chat } from \"./operationsInterfaces\";\nimport { ChatApiClientOptionalParams } from \"./models\";\n\nexport class ChatApiClient extends coreClient.ServiceClient {\n endpoint: string;\n apiVersion: string;\n\n /**\n * Initializes a new instance of the ChatApiClient class.\n * @param endpoint The endpoint of the Azure Communication resource.\n * @param options The parameter options\n */\n constructor(endpoint: string, options?: ChatApiClientOptionalParams) {\n if (endpoint === undefined) {\n throw new Error(\"'endpoint' cannot be null\");\n }\n\n // Initializing default values for options\n if (!options) {\n options = {};\n }\n const defaults: ChatApiClientOptionalParams = {\n requestContentType: \"application/json; charset=utf-8\",\n };\n\n const packageDetails = `azsdk-js-communication-chat/1.5.0`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`\n : `${packageDetails}`;\n\n const optionsWithDefaults = {\n ...defaults,\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n endpoint: options.endpoint ?? options.baseUri ?? \"{endpoint}\",\n };\n super(optionsWithDefaults);\n // Parameter assignments\n this.endpoint = endpoint;\n\n // Assigning values to Constant parameters\n this.apiVersion = options.apiVersion || \"2024-03-07\";\n this.chatThread = new ChatThreadImpl(this);\n this.chat = new ChatImpl(this);\n this.addCustomApiVersionPolicy(options.apiVersion);\n }\n\n /** A function that adds a policy that sets the api-version (or equivalent) to reflect the library version. */\n private addCustomApiVersionPolicy(apiVersion?: string) {\n if (!apiVersion) {\n return;\n }\n const apiVersionPolicy = {\n name: \"CustomApiVersionPolicy\",\n async sendRequest(\n request: PipelineRequest,\n next: SendRequest,\n ): Promise<PipelineResponse> {\n const param = request.url.split(\"?\");\n if (param.length > 1) {\n const newParams = param[1].split(\"&\").map((item) => {\n if (item.indexOf(\"api-version\") > -1) {\n return \"api-version=\" + apiVersion;\n } else {\n return item;\n }\n });\n request.url = param[0] + \"?\" + newParams.join(\"&\");\n }\n return next(request);\n },\n };\n this.pipeline.addPolicy(apiVersionPolicy);\n }\n\n chatThread: ChatThread;\n chat: Chat;\n}\n"]}
@@ -16,6 +16,8 @@ export var KnownCommunicationIdentifierModelKind;
16
16
  KnownCommunicationIdentifierModelKind["PhoneNumber"] = "phoneNumber";
17
17
  /** MicrosoftTeamsUser */
18
18
  KnownCommunicationIdentifierModelKind["MicrosoftTeamsUser"] = "microsoftTeamsUser";
19
+ /** MicrosoftTeamsApp */
20
+ KnownCommunicationIdentifierModelKind["MicrosoftTeamsApp"] = "microsoftTeamsApp";
19
21
  })(KnownCommunicationIdentifierModelKind || (KnownCommunicationIdentifierModelKind = {}));
20
22
  /** Known values of {@link CommunicationCloudEnvironmentModel} that the service accepts. */
21
23
  export var KnownCommunicationCloudEnvironmentModel;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generated/src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8SH,yFAAyF;AACzF,MAAM,CAAN,IAAY,qCASX;AATD,WAAY,qCAAqC;IAC/C,cAAc;IACd,4DAAmB,CAAA;IACnB,wBAAwB;IACxB,gFAAuC,CAAA;IACvC,kBAAkB;IAClB,oEAA2B,CAAA;IAC3B,yBAAyB;IACzB,kFAAyC,CAAA;AAC3C,CAAC,EATW,qCAAqC,KAArC,qCAAqC,QAShD;AAcD,2FAA2F;AAC3F,MAAM,CAAN,IAAY,uCAOX;AAPD,WAAY,uCAAuC;IACjD,aAAa;IACb,4DAAiB,CAAA;IACjB,UAAU;IACV,sDAAW,CAAA;IACX,WAAW;IACX,wDAAa,CAAA;AACf,CAAC,EAPW,uCAAuC,KAAvC,uCAAuC,QAOlD","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\n\n/** A paged collection of chat message read receipts. */\nexport interface ChatMessageReadReceiptsCollection {\n /** Collection of chat message read receipts. */\n value: ChatMessageReadReceipt[];\n /**\n * If there are more chat message read receipts that can be retrieved, the next link will be populated.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly nextLink?: string;\n}\n\n/** A chat message read receipt indicates the time a chat message was read by a recipient. */\nexport interface ChatMessageReadReceipt {\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n senderCommunicationIdentifier: CommunicationIdentifierModel;\n /** Id of the chat message that has been read. This id is generated by the server. */\n chatMessageId: string;\n /** The time at which the message was read. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n readOn: Date;\n}\n\n/** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\nexport interface CommunicationIdentifierModel {\n /** The identifier kind. Only required in responses. */\n kind?: CommunicationIdentifierModelKind;\n /** Raw Id of the identifier. Optional in requests, required in responses. */\n rawId?: string;\n /** The communication user. */\n communicationUser?: CommunicationUserIdentifierModel;\n /** The phone number. */\n phoneNumber?: PhoneNumberIdentifierModel;\n /** The Microsoft Teams user. */\n microsoftTeamsUser?: MicrosoftTeamsUserIdentifierModel;\n}\n\n/** A user that got created with an Azure Communication Services resource. */\nexport interface CommunicationUserIdentifierModel {\n /** The Id of the communication user. */\n id: string;\n}\n\n/** A phone number. */\nexport interface PhoneNumberIdentifierModel {\n /** The phone number in E.164 format. */\n value: string;\n}\n\n/** A Microsoft Teams user. */\nexport interface MicrosoftTeamsUserIdentifierModel {\n /** The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. */\n userId: string;\n /** True if the Microsoft Teams user is anonymous. By default false if missing. */\n isAnonymous?: boolean;\n /** The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. */\n cloud?: CommunicationCloudEnvironmentModel;\n}\n\n/** The Communication Services error. */\nexport interface CommunicationErrorResponse {\n /** The Communication Services error. */\n error: ChatError;\n}\n\n/** The Communication Services error. */\nexport interface ChatError {\n /** The error code. */\n code: string;\n /** The error message. */\n message: string;\n /**\n * The error target.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly target?: string;\n /**\n * Further details about specific errors that led to this error.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly details?: ChatError[];\n /**\n * The inner error if any.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly innerError?: ChatError;\n}\n\n/** Request payload for sending a read receipt. */\nexport interface SendReadReceiptRequest {\n /** Id of the latest chat message read by the user. */\n chatMessageId: string;\n}\n\n/** Details of the message to send. */\nexport interface SendChatMessageRequest {\n /** Chat message content. */\n content: string;\n /** The display name of the chat message sender. This property is used to populate sender name for push notifications. */\n senderDisplayName?: string;\n /** The chat message type. */\n type?: ChatMessageType;\n /** Message metadata. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** Result of the send message operation. */\nexport interface SendChatMessageResult {\n /** A server-generated message id. */\n id: string;\n}\n\n/** Collection of chat messages for a particular chat thread. */\nexport interface ChatMessagesCollection {\n /** Collection of chat messages. */\n value: ChatMessage[];\n /**\n * If there are more chat messages that can be retrieved, the next link will be populated.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly nextLink?: string;\n}\n\n/** Chat message. */\nexport interface ChatMessage {\n /** The id of the chat message. This id is server generated. */\n id: string;\n /** The chat message type. */\n type: ChatMessageType;\n /** Sequence of the chat message in the conversation. */\n sequenceId: string;\n /** Version of the chat message. */\n version: string;\n /** Content of a chat message. */\n content?: ChatMessageContent;\n /** The display name of the chat message sender. This property is used to populate sender name for push notifications. */\n senderDisplayName?: string;\n /** The timestamp when the chat message arrived at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n createdOn: Date;\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n senderCommunicationIdentifier?: CommunicationIdentifierModel;\n /** The timestamp (if applicable) when the message was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n /** The last timestamp (if applicable) when the message was edited. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n editedOn?: Date;\n /** Message metadata. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** Content of a chat message. */\nexport interface ChatMessageContent {\n /** Chat message content for messages of types text or html. */\n message?: string;\n /** Chat message content for messages of type topicUpdated. */\n topic?: string;\n /** Chat message content for messages of types participantAdded or participantRemoved. */\n participants?: ChatParticipant[];\n /** List of attachments for this message */\n attachments?: ChatAttachment[];\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n initiatorCommunicationIdentifier?: CommunicationIdentifierModel;\n}\n\n/** A participant of the chat thread. */\nexport interface ChatParticipant {\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n communicationIdentifier: CommunicationIdentifierModel;\n /** Display name for the chat participant. */\n displayName?: string;\n /** Time from which the chat history is shared with the participant. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n shareHistoryTime?: Date;\n /** Contextual metadata for the chat participant. The metadata consists of name/value pairs. The total size of all metadata pairs can be up to 1KB in size. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** An attachment in a chat message. Currently only supported in Teams Interop scenarios. */\nexport interface ChatAttachment {\n /** Id of the attachment */\n id: string;\n /** The type of attachment. */\n attachmentType: ChatAttachmentType;\n /** The name of the attachment content. */\n name?: string;\n /** The URL where the attachment can be downloaded */\n url?: string;\n /** The URL where the preview of attachment can be downloaded */\n previewUrl?: string;\n}\n\n/** Request payload for updating a chat message. */\nexport interface UpdateChatMessageRequest {\n /** Chat message content. */\n content?: string;\n /** Message metadata. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** Collection of participants belong to a particular thread. */\nexport interface ChatParticipantsCollection {\n /** Chat participants. */\n value: ChatParticipant[];\n /**\n * If there are more chat participants that can be retrieved, the next link will be populated.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly nextLink?: string;\n}\n\n/** Participants to be added to the thread. */\nexport interface AddChatParticipantsRequest {\n /** Participants to add to a chat thread. */\n participants: ChatParticipant[];\n}\n\n/** Result of the add chat participants operation. */\nexport interface AddChatParticipantsResult {\n /**\n * The participants that failed to be added to the chat thread.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly invalidParticipants?: ChatError[];\n}\n\n/** Request payload for creating a chat thread. */\nexport interface CreateChatThreadRequest {\n /** The chat thread topic. */\n topic: string;\n /** Participants to be added to the chat thread. */\n participants?: ChatParticipant[];\n /** Contextual metadata for the thread. The metadata consists of name/value pairs. The total size of all metadata pairs can be up to 1KB in size. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** Result of the create chat thread operation. */\nexport interface CreateChatThreadResult {\n /** Chat thread. */\n chatThread?: ChatThreadProperties;\n /**\n * The participants that failed to be added to the chat thread.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly invalidParticipants?: ChatError[];\n}\n\n/** Chat thread. */\nexport interface ChatThreadProperties {\n /** Chat thread id. */\n id: string;\n /** Chat thread topic. */\n topic: string;\n /** The timestamp when the chat thread was created. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n createdOn: Date;\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n createdByCommunicationIdentifier: CommunicationIdentifierModel;\n /** The timestamp when the chat thread was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n /** Contextual metadata for the thread. The metadata consists of name/value pairs. The total size of all metadata pairs can be up to 1KB in size. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** Collection of chat threads. */\nexport interface ChatThreadsItemCollection {\n /** Collection of chat threads. */\n value: ChatThreadItem[];\n /**\n * If there are more chat threads that can be retrieved, the next link will be populated.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly nextLink?: string;\n}\n\n/** Summary information of a chat thread. */\nexport interface ChatThreadItem {\n /** Chat thread id. */\n id: string;\n /** Chat thread topic. */\n topic: string;\n /** The timestamp when the chat thread was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n /**\n * The timestamp when the last message arrived at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly lastMessageReceivedOn?: Date;\n}\n\n/** Request payload for updating a chat thread. */\nexport interface UpdateChatThreadRequest {\n /** Chat thread topic. */\n topic?: string;\n /** Contextual metadata for the thread. The metadata consists of name/value pairs. The total size of all metadata pairs can be up to 1KB in size. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** Request payload for typing notifications. */\nexport interface SendTypingNotificationRequest {\n /** The display name of the typing notification sender. This property is used to populate sender name for push notifications. */\n senderDisplayName?: string;\n}\n\n/** Known values of {@link CommunicationIdentifierModelKind} that the service accepts. */\nexport enum KnownCommunicationIdentifierModelKind {\n /** Unknown */\n Unknown = \"unknown\",\n /** CommunicationUser */\n CommunicationUser = \"communicationUser\",\n /** PhoneNumber */\n PhoneNumber = \"phoneNumber\",\n /** MicrosoftTeamsUser */\n MicrosoftTeamsUser = \"microsoftTeamsUser\",\n}\n\n/**\n * Defines values for CommunicationIdentifierModelKind. \\\n * {@link KnownCommunicationIdentifierModelKind} can be used interchangeably with CommunicationIdentifierModelKind,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **unknown** \\\n * **communicationUser** \\\n * **phoneNumber** \\\n * **microsoftTeamsUser**\n */\nexport type CommunicationIdentifierModelKind = string;\n\n/** Known values of {@link CommunicationCloudEnvironmentModel} that the service accepts. */\nexport enum KnownCommunicationCloudEnvironmentModel {\n /** Public */\n Public = \"public\",\n /** Dod */\n Dod = \"dod\",\n /** Gcch */\n Gcch = \"gcch\",\n}\n\n/**\n * Defines values for CommunicationCloudEnvironmentModel. \\\n * {@link KnownCommunicationCloudEnvironmentModel} can be used interchangeably with CommunicationCloudEnvironmentModel,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **public** \\\n * **dod** \\\n * **gcch**\n */\nexport type CommunicationCloudEnvironmentModel = string;\n/** Defines values for ChatMessageType. */\nexport type ChatMessageType =\n | \"text\"\n | \"html\"\n | \"topicUpdated\"\n | \"participantAdded\"\n | \"participantRemoved\";\n/** Defines values for ChatAttachmentType. */\nexport type ChatAttachmentType = \"image\" | \"file\";\n\n/** Optional parameters. */\nexport interface ChatThreadListChatReadReceiptsOptionalParams\n extends coreClient.OperationOptions {\n /** The maximum number of chat message read receipts to be returned per page. */\n maxPageSize?: number;\n /** Skips chat message read receipts up to a specified position in response. */\n skip?: number;\n}\n\n/** Contains response data for the listChatReadReceipts operation. */\nexport type ChatThreadListChatReadReceiptsResponse =\n ChatMessageReadReceiptsCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadSendChatReadReceiptOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadSendChatMessageOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the sendChatMessage operation. */\nexport type ChatThreadSendChatMessageResponse = SendChatMessageResult;\n\n/** Optional parameters. */\nexport interface ChatThreadListChatMessagesOptionalParams\n extends coreClient.OperationOptions {\n /** The maximum number of messages to be returned per page. */\n maxPageSize?: number;\n /** The earliest point in time to get messages up to. The timestamp should be in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n startTime?: Date;\n}\n\n/** Contains response data for the listChatMessages operation. */\nexport type ChatThreadListChatMessagesResponse = ChatMessagesCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadGetChatMessageOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getChatMessage operation. */\nexport type ChatThreadGetChatMessageResponse = ChatMessage;\n\n/** Optional parameters. */\nexport interface ChatThreadUpdateChatMessageOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadDeleteChatMessageOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadListChatParticipantsOptionalParams\n extends coreClient.OperationOptions {\n /** The maximum number of participants to be returned per page. */\n maxPageSize?: number;\n /** Skips participants up to a specified position in response. */\n skip?: number;\n}\n\n/** Contains response data for the listChatParticipants operation. */\nexport type ChatThreadListChatParticipantsResponse = ChatParticipantsCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadRemoveChatParticipantOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadAddChatParticipantsOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the addChatParticipants operation. */\nexport type ChatThreadAddChatParticipantsResponse = AddChatParticipantsResult;\n\n/** Optional parameters. */\nexport interface ChatThreadUpdateChatThreadPropertiesOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadGetChatThreadPropertiesOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getChatThreadProperties operation. */\nexport type ChatThreadGetChatThreadPropertiesResponse = ChatThreadProperties;\n\n/** Optional parameters. */\nexport interface ChatThreadSendTypingNotificationOptionalParams\n extends coreClient.OperationOptions {\n /** Details of the typing notification request. */\n sendTypingNotificationRequest?: SendTypingNotificationRequest;\n}\n\n/** Optional parameters. */\nexport interface ChatThreadListChatReadReceiptsNextOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the listChatReadReceiptsNext operation. */\nexport type ChatThreadListChatReadReceiptsNextResponse =\n ChatMessageReadReceiptsCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadListChatMessagesNextOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the listChatMessagesNext operation. */\nexport type ChatThreadListChatMessagesNextResponse = ChatMessagesCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadListChatParticipantsNextOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the listChatParticipantsNext operation. */\nexport type ChatThreadListChatParticipantsNextResponse =\n ChatParticipantsCollection;\n\n/** Optional parameters. */\nexport interface ChatCreateChatThreadOptionalParams\n extends coreClient.OperationOptions {\n /** If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. */\n repeatabilityRequestId?: string;\n}\n\n/** Contains response data for the createChatThread operation. */\nexport type ChatCreateChatThreadResponse = CreateChatThreadResult;\n\n/** Optional parameters. */\nexport interface ChatListChatThreadsOptionalParams\n extends coreClient.OperationOptions {\n /** The maximum number of chat threads returned per page. */\n maxPageSize?: number;\n /** The earliest point in time to get chat threads up to. The timestamp should be in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n startTime?: Date;\n}\n\n/** Contains response data for the listChatThreads operation. */\nexport type ChatListChatThreadsResponse = ChatThreadsItemCollection;\n\n/** Optional parameters. */\nexport interface ChatDeleteChatThreadOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatListChatThreadsNextOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the listChatThreadsNext operation. */\nexport type ChatListChatThreadsNextResponse = ChatThreadsItemCollection;\n\n/** Optional parameters. */\nexport interface ChatApiClientOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Api Version */\n apiVersion?: string;\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generated/src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgTH,yFAAyF;AACzF,MAAM,CAAN,IAAY,qCAWX;AAXD,WAAY,qCAAqC;IAC/C,cAAc;IACd,4DAAmB,CAAA;IACnB,wBAAwB;IACxB,gFAAuC,CAAA;IACvC,kBAAkB;IAClB,oEAA2B,CAAA;IAC3B,yBAAyB;IACzB,kFAAyC,CAAA;IACzC,wBAAwB;IACxB,gFAAuC,CAAA;AACzC,CAAC,EAXW,qCAAqC,KAArC,qCAAqC,QAWhD;AAeD,2FAA2F;AAC3F,MAAM,CAAN,IAAY,uCAOX;AAPD,WAAY,uCAAuC;IACjD,aAAa;IACb,4DAAiB,CAAA;IACjB,UAAU;IACV,sDAAW,CAAA;IACX,WAAW;IACX,wDAAa,CAAA;AACf,CAAC,EAPW,uCAAuC,KAAvC,uCAAuC,QAOlD","sourcesContent":["/*\n * Copyright (c) Microsoft Corporation.\n * Licensed under the MIT License.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * Changes may cause incorrect behavior and will be lost if the code is regenerated.\n */\n\nimport * as coreClient from \"@azure/core-client\";\n\n/** A paged collection of chat message read receipts. */\nexport interface ChatMessageReadReceiptsCollection {\n /** Collection of chat message read receipts. */\n value: ChatMessageReadReceipt[];\n /**\n * If there are more chat message read receipts that can be retrieved, the next link will be populated.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly nextLink?: string;\n}\n\n/** A chat message read receipt indicates the time a chat message was read by a recipient. */\nexport interface ChatMessageReadReceipt {\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n senderCommunicationIdentifier: CommunicationIdentifierModel;\n /** Id of the chat message that has been read. This id is generated by the server. */\n chatMessageId: string;\n /** The time at which the message was read. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n readOn: Date;\n}\n\n/** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\nexport interface CommunicationIdentifierModel {\n /** The identifier kind. Only required in responses. */\n kind?: CommunicationIdentifierModelKind;\n /** Raw Id of the identifier. Optional in requests, required in responses. */\n rawId?: string;\n /** The communication user. */\n communicationUser?: CommunicationUserIdentifierModel;\n /** The phone number. */\n phoneNumber?: PhoneNumberIdentifierModel;\n /** The Microsoft Teams user. */\n microsoftTeamsUser?: MicrosoftTeamsUserIdentifierModel;\n /** The Microsoft Teams application. */\n microsoftTeamsApp?: MicrosoftTeamsAppIdentifierModel;\n}\n\n/** A user that got created with an Azure Communication Services resource. */\nexport interface CommunicationUserIdentifierModel {\n /** The Id of the communication user. */\n id: string;\n}\n\n/** A phone number. */\nexport interface PhoneNumberIdentifierModel {\n /** The phone number in E.164 format. */\n value: string;\n}\n\n/** A Microsoft Teams user. */\nexport interface MicrosoftTeamsUserIdentifierModel {\n /** The Id of the Microsoft Teams user. If not anonymous, this is the AAD object Id of the user. */\n userId: string;\n /** True if the Microsoft Teams user is anonymous. By default false if missing. */\n isAnonymous?: boolean;\n /** The cloud that the Microsoft Teams user belongs to. By default 'public' if missing. */\n cloud?: CommunicationCloudEnvironmentModel;\n}\n\n/** A Microsoft Teams application. */\nexport interface MicrosoftTeamsAppIdentifierModel {\n /** The Id of the Microsoft Teams application. */\n appId: string;\n /** The cloud that the Microsoft Teams application belongs to. By default 'public' if missing. */\n cloud?: CommunicationCloudEnvironmentModel;\n}\n\n/** The Communication Services error. */\nexport interface CommunicationErrorResponse {\n /** The Communication Services error. */\n error: ChatError;\n}\n\n/** The Communication Services error. */\nexport interface ChatError {\n /** The error code. */\n code: string;\n /** The error message. */\n message: string;\n /**\n * The error target.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly target?: string;\n /**\n * Further details about specific errors that led to this error.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly details?: ChatError[];\n /**\n * The inner error if any.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly innerError?: ChatError;\n}\n\n/** Request payload for sending a read receipt. */\nexport interface SendReadReceiptRequest {\n /** Id of the latest chat message read by the user. */\n chatMessageId: string;\n}\n\n/** Details of the message to send. */\nexport interface SendChatMessageRequest {\n /** Chat message content. */\n content: string;\n /** The display name of the chat message sender. This property is used to populate sender name for push notifications. */\n senderDisplayName?: string;\n /** The chat message type. */\n type?: ChatMessageType;\n /** Message metadata. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** Result of the send message operation. */\nexport interface SendChatMessageResult {\n /** A server-generated message id. */\n id: string;\n}\n\n/** Collection of chat messages for a particular chat thread. */\nexport interface ChatMessagesCollection {\n /** Collection of chat messages. */\n value: ChatMessage[];\n /**\n * If there are more chat messages that can be retrieved, the next link will be populated.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly nextLink?: string;\n}\n\n/** Chat message. */\nexport interface ChatMessage {\n /** The id of the chat message. This id is server generated. */\n id: string;\n /** The chat message type. */\n type: ChatMessageType;\n /** Sequence of the chat message in the conversation. */\n sequenceId: string;\n /** Version of the chat message. */\n version: string;\n /** Content of a chat message. */\n content?: ChatMessageContent;\n /** The display name of the chat message sender. This property is used to populate sender name for push notifications. */\n senderDisplayName?: string;\n /** The timestamp when the chat message arrived at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n createdOn: Date;\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n senderCommunicationIdentifier?: CommunicationIdentifierModel;\n /** The timestamp (if applicable) when the message was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n /** The last timestamp (if applicable) when the message was edited. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n editedOn?: Date;\n /** Message metadata. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** Content of a chat message. */\nexport interface ChatMessageContent {\n /** Chat message content for messages of types text or html. */\n message?: string;\n /** Chat message content for messages of type topicUpdated. */\n topic?: string;\n /** Chat message content for messages of types participantAdded or participantRemoved. */\n participants?: ChatParticipant[];\n /** List of attachments for this message */\n attachments?: ChatAttachment[];\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n initiatorCommunicationIdentifier?: CommunicationIdentifierModel;\n}\n\n/** A participant of the chat thread. */\nexport interface ChatParticipant {\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n communicationIdentifier: CommunicationIdentifierModel;\n /** Display name for the chat participant. */\n displayName?: string;\n /** Time from which the chat history is shared with the participant. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n shareHistoryTime?: Date;\n}\n\n/** An attachment in a chat message. */\nexport interface ChatAttachment {\n /** Id of the attachment */\n id: string;\n /** The type of attachment. */\n attachmentType: ChatAttachmentType;\n /** The name of the attachment content. */\n name?: string;\n /** The URL where the attachment can be downloaded */\n url?: string;\n /** The URL where the preview of attachment can be downloaded */\n previewUrl?: string;\n}\n\n/** Request payload for updating a chat message. */\nexport interface UpdateChatMessageRequest {\n /** Chat message content. */\n content?: string;\n /** Message metadata. */\n metadata?: { [propertyName: string]: string };\n}\n\n/** Collection of participants belong to a particular thread. */\nexport interface ChatParticipantsCollection {\n /** Chat participants. */\n value: ChatParticipant[];\n /**\n * If there are more chat participants that can be retrieved, the next link will be populated.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly nextLink?: string;\n}\n\n/** Participants to be added to the thread. */\nexport interface AddChatParticipantsRequest {\n /** Participants to add to a chat thread. */\n participants: ChatParticipant[];\n}\n\n/** Result of the add chat participants operation. */\nexport interface AddChatParticipantsResult {\n /**\n * The participants that failed to be added to the chat thread.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly invalidParticipants?: ChatError[];\n}\n\n/** Request payload for creating a chat thread. */\nexport interface CreateChatThreadRequest {\n /** The chat thread topic. */\n topic: string;\n /** Participants to be added to the chat thread. */\n participants?: ChatParticipant[];\n}\n\n/** Result of the create chat thread operation. */\nexport interface CreateChatThreadResult {\n /** Chat thread. */\n chatThread?: ChatThreadProperties;\n /**\n * The participants that failed to be added to the chat thread.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly invalidParticipants?: ChatError[];\n}\n\n/** Chat thread. */\nexport interface ChatThreadProperties {\n /** Chat thread id. */\n id: string;\n /** Chat thread topic. */\n topic: string;\n /** The timestamp when the chat thread was created. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n createdOn: Date;\n /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model is polymorphic: Apart from kind and rawId, at most one further property may be set which must match the kind enum value. */\n createdByCommunicationIdentifier: CommunicationIdentifierModel;\n /** The timestamp when the chat thread was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n}\n\n/** Collection of chat threads. */\nexport interface ChatThreadsItemCollection {\n /** Collection of chat threads. */\n value: ChatThreadItem[];\n /**\n * If there are more chat threads that can be retrieved, the next link will be populated.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly nextLink?: string;\n}\n\n/** Summary information of a chat thread. */\nexport interface ChatThreadItem {\n /** Chat thread id. */\n id: string;\n /** Chat thread topic. */\n topic: string;\n /** The timestamp when the chat thread was deleted. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n deletedOn?: Date;\n /**\n * The timestamp when the last message arrived at the server. The timestamp is in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`.\n * NOTE: This property will not be serialized. It can only be populated by the server.\n */\n readonly lastMessageReceivedOn?: Date;\n}\n\n/** Request payload for updating a chat thread. */\nexport interface UpdateChatThreadRequest {\n /** Chat thread topic. */\n topic?: string;\n}\n\n/** Request payload for typing notifications. */\nexport interface SendTypingNotificationRequest {\n /** The display name of the typing notification sender. This property is used to populate sender name for push notifications. */\n senderDisplayName?: string;\n}\n\n/** Known values of {@link CommunicationIdentifierModelKind} that the service accepts. */\nexport enum KnownCommunicationIdentifierModelKind {\n /** Unknown */\n Unknown = \"unknown\",\n /** CommunicationUser */\n CommunicationUser = \"communicationUser\",\n /** PhoneNumber */\n PhoneNumber = \"phoneNumber\",\n /** MicrosoftTeamsUser */\n MicrosoftTeamsUser = \"microsoftTeamsUser\",\n /** MicrosoftTeamsApp */\n MicrosoftTeamsApp = \"microsoftTeamsApp\",\n}\n\n/**\n * Defines values for CommunicationIdentifierModelKind. \\\n * {@link KnownCommunicationIdentifierModelKind} can be used interchangeably with CommunicationIdentifierModelKind,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **unknown** \\\n * **communicationUser** \\\n * **phoneNumber** \\\n * **microsoftTeamsUser** \\\n * **microsoftTeamsApp**\n */\nexport type CommunicationIdentifierModelKind = string;\n\n/** Known values of {@link CommunicationCloudEnvironmentModel} that the service accepts. */\nexport enum KnownCommunicationCloudEnvironmentModel {\n /** Public */\n Public = \"public\",\n /** Dod */\n Dod = \"dod\",\n /** Gcch */\n Gcch = \"gcch\",\n}\n\n/**\n * Defines values for CommunicationCloudEnvironmentModel. \\\n * {@link KnownCommunicationCloudEnvironmentModel} can be used interchangeably with CommunicationCloudEnvironmentModel,\n * this enum contains the known values that the service supports.\n * ### Known values supported by the service\n * **public** \\\n * **dod** \\\n * **gcch**\n */\nexport type CommunicationCloudEnvironmentModel = string;\n/** Defines values for ChatMessageType. */\nexport type ChatMessageType =\n | \"text\"\n | \"html\"\n | \"topicUpdated\"\n | \"participantAdded\"\n | \"participantRemoved\";\n/** Defines values for ChatAttachmentType. */\nexport type ChatAttachmentType = \"image\" | \"file\";\n\n/** Optional parameters. */\nexport interface ChatThreadListChatReadReceiptsOptionalParams\n extends coreClient.OperationOptions {\n /** The maximum number of chat message read receipts to be returned per page. */\n maxPageSize?: number;\n /** Skips chat message read receipts up to a specified position in response. */\n skip?: number;\n}\n\n/** Contains response data for the listChatReadReceipts operation. */\nexport type ChatThreadListChatReadReceiptsResponse =\n ChatMessageReadReceiptsCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadSendChatReadReceiptOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadSendChatMessageOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the sendChatMessage operation. */\nexport type ChatThreadSendChatMessageResponse = SendChatMessageResult;\n\n/** Optional parameters. */\nexport interface ChatThreadListChatMessagesOptionalParams\n extends coreClient.OperationOptions {\n /** The maximum number of messages to be returned per page. */\n maxPageSize?: number;\n /** The earliest point in time to get messages up to. The timestamp should be in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n startTime?: Date;\n}\n\n/** Contains response data for the listChatMessages operation. */\nexport type ChatThreadListChatMessagesResponse = ChatMessagesCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadGetChatMessageOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getChatMessage operation. */\nexport type ChatThreadGetChatMessageResponse = ChatMessage;\n\n/** Optional parameters. */\nexport interface ChatThreadUpdateChatMessageOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadDeleteChatMessageOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadListChatParticipantsOptionalParams\n extends coreClient.OperationOptions {\n /** The maximum number of participants to be returned per page. */\n maxPageSize?: number;\n /** Skips participants up to a specified position in response. */\n skip?: number;\n}\n\n/** Contains response data for the listChatParticipants operation. */\nexport type ChatThreadListChatParticipantsResponse = ChatParticipantsCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadRemoveChatParticipantOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadAddChatParticipantsOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the addChatParticipants operation. */\nexport type ChatThreadAddChatParticipantsResponse = AddChatParticipantsResult;\n\n/** Optional parameters. */\nexport interface ChatThreadUpdateChatThreadPropertiesOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatThreadGetChatThreadPropertiesOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the getChatThreadProperties operation. */\nexport type ChatThreadGetChatThreadPropertiesResponse = ChatThreadProperties;\n\n/** Optional parameters. */\nexport interface ChatThreadSendTypingNotificationOptionalParams\n extends coreClient.OperationOptions {\n /** Details of the typing notification request. */\n sendTypingNotificationRequest?: SendTypingNotificationRequest;\n}\n\n/** Optional parameters. */\nexport interface ChatThreadListChatReadReceiptsNextOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the listChatReadReceiptsNext operation. */\nexport type ChatThreadListChatReadReceiptsNextResponse =\n ChatMessageReadReceiptsCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadListChatMessagesNextOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the listChatMessagesNext operation. */\nexport type ChatThreadListChatMessagesNextResponse = ChatMessagesCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadListChatParticipantsNextOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the listChatParticipantsNext operation. */\nexport type ChatThreadListChatParticipantsNextResponse =\n ChatParticipantsCollection;\n\n/** Optional parameters. */\nexport interface ChatCreateChatThreadOptionalParams\n extends coreClient.OperationOptions {\n /** If specified, the client directs that the request is repeatable; that is, that the client can make the request multiple times with the same Repeatability-Request-Id and get back an appropriate response without the server executing the request multiple times. The value of the Repeatability-Request-Id is an opaque string representing a client-generated, globally unique for all time, identifier for the request. It is recommended to use version 4 (random) UUIDs. */\n repeatabilityRequestId?: string;\n}\n\n/** Contains response data for the createChatThread operation. */\nexport type ChatCreateChatThreadResponse = CreateChatThreadResult;\n\n/** Optional parameters. */\nexport interface ChatListChatThreadsOptionalParams\n extends coreClient.OperationOptions {\n /** The maximum number of chat threads returned per page. */\n maxPageSize?: number;\n /** The earliest point in time to get chat threads up to. The timestamp should be in RFC3339 format: `yyyy-MM-ddTHH:mm:ssZ`. */\n startTime?: Date;\n}\n\n/** Contains response data for the listChatThreads operation. */\nexport type ChatListChatThreadsResponse = ChatThreadsItemCollection;\n\n/** Optional parameters. */\nexport interface ChatDeleteChatThreadOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Optional parameters. */\nexport interface ChatListChatThreadsNextOptionalParams\n extends coreClient.OperationOptions {}\n\n/** Contains response data for the listChatThreadsNext operation. */\nexport type ChatListChatThreadsNextResponse = ChatThreadsItemCollection;\n\n/** Optional parameters. */\nexport interface ChatApiClientOptionalParams\n extends coreClient.ServiceClientOptions {\n /** Api Version */\n apiVersion?: string;\n /** Overrides client endpoint. */\n endpoint?: string;\n}\n"]}