@azure/communication-chat 1.3.2-beta.2 → 1.3.2

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.
@@ -37,7 +37,6 @@ export class ChatClient {
37
37
  this.client = new ChatApiClient(this.endpoint, Object.assign({ endpoint: this.endpoint }, internalPipelineOptions));
38
38
  const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
39
39
  this.client.pipeline.addPolicy(authPolicy);
40
- options.signalingClientOptions = Object.assign(Object.assign({}, options.signalingClientOptions), { resourceEndpoint: this.endpoint });
41
40
  this.signalingClient = getSignalingClient(credential, logger, options.signalingClientOptions);
42
41
  }
43
42
  /**
@@ -89,17 +88,24 @@ export class ChatClient {
89
88
  }
90
89
  listChatThreadsAll(options) {
91
90
  return __asyncGenerator(this, arguments, function* listChatThreadsAll_1() {
92
- var e_1, _a;
91
+ var _a, e_1, _b, _c;
93
92
  try {
94
- for (var _b = __asyncValues(this.listChatThreadsPage({}, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
95
- const page = _c.value;
96
- yield __await(yield* __asyncDelegator(__asyncValues(page)));
93
+ for (var _d = true, _e = __asyncValues(this.listChatThreadsPage({}, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
94
+ _c = _f.value;
95
+ _d = false;
96
+ try {
97
+ const page = _c;
98
+ yield __await(yield* __asyncDelegator(__asyncValues(page)));
99
+ }
100
+ finally {
101
+ _d = true;
102
+ }
97
103
  }
98
104
  }
99
105
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
100
106
  finally {
101
107
  try {
102
- if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
108
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
103
109
  }
104
110
  finally { if (e_1) throw e_1.error; }
105
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chatClient.js","sourceRoot":"","sources":["../../src/chatClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,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C,OAAO,EAAE,EAAE;YACjE,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 { ConnectionState, SignalingClient } 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\n/**\n * The client to do chat operations\n */\nexport class ChatClient {\n private readonly tokenCredential: CommunicationTokenCredential;\n private readonly clientOptions: ChatClientOptions;\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 const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);\n this.client.pipeline.addPolicy(authPolicy);\n\n (options as any).signalingClientOptions = {\n ...(options as any).signalingClientOptions,\n resourceEndpoint: this.endpoint,\n };\n\n this.signalingClient = getSignalingClient(\n credential,\n logger,\n (options as any).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"]}
1
+ {"version":3,"file":"chatClient.js","sourceRoot":"","sources":["../../src/chatClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAClC,4CAA4C;;AAuB5C,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;AAExD;;GAEG;AACH,MAAM,OAAO,UAAU;IAQrB;;;;;;OAMG;IACH,YACmB,QAAgB,EACjC,UAAwC,EACxC,UAA6B,EAAE;QAFd,aAAQ,GAAR,QAAQ,CAAQ;QAZlB,oBAAe,GAAgC,SAAS,CAAC;QACzD,YAAO,GAAG,IAAI,YAAY,EAAE,CAAC;QACtC,mCAA8B,GA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AAC,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,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,6BAA6B,EAAE,CAAC,OAAO,EAAE,EAAE;YACjE,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 { ConnectionState, SignalingClient } 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\n/**\n * The client to do chat operations\n */\nexport class ChatClient {\n private readonly tokenCredential: CommunicationTokenCredential;\n private readonly clientOptions: ChatClientOptions;\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 const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);\n this.client.pipeline.addPolicy(authPolicy);\n\n this.signalingClient = getSignalingClient(\n credential,\n logger,\n (options as any).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"]}
@@ -96,17 +96,24 @@ export class ChatThreadClient {
96
96
  }
97
97
  listMessagesAll(options) {
98
98
  return __asyncGenerator(this, arguments, function* listMessagesAll_1() {
99
- var e_1, _a;
99
+ var _a, e_1, _b, _c;
100
100
  try {
101
- for (var _b = __asyncValues(this.listMessagesPage({}, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
102
- const page = _c.value;
103
- yield __await(yield* __asyncDelegator(__asyncValues(page)));
101
+ for (var _d = true, _e = __asyncValues(this.listMessagesPage({}, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
102
+ _c = _f.value;
103
+ _d = false;
104
+ try {
105
+ const page = _c;
106
+ yield __await(yield* __asyncDelegator(__asyncValues(page)));
107
+ }
108
+ finally {
109
+ _d = true;
110
+ }
104
111
  }
105
112
  }
106
113
  catch (e_1_1) { e_1 = { error: e_1_1 }; }
107
114
  finally {
108
115
  try {
109
- if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
116
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
110
117
  }
111
118
  finally { if (e_1) throw e_1.error; }
112
119
  }
@@ -198,17 +205,24 @@ export class ChatThreadClient {
198
205
  }
199
206
  listParticipantsAll(options) {
200
207
  return __asyncGenerator(this, arguments, function* listParticipantsAll_1() {
201
- var e_2, _a;
208
+ var _a, e_2, _b, _c;
202
209
  try {
203
- for (var _b = __asyncValues(this.listParticipantsPage({}, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
204
- const page = _c.value;
205
- yield __await(yield* __asyncDelegator(__asyncValues(page)));
210
+ for (var _d = true, _e = __asyncValues(this.listParticipantsPage({}, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
211
+ _c = _f.value;
212
+ _d = false;
213
+ try {
214
+ const page = _c;
215
+ yield __await(yield* __asyncDelegator(__asyncValues(page)));
216
+ }
217
+ finally {
218
+ _d = true;
219
+ }
206
220
  }
207
221
  }
208
222
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
209
223
  finally {
210
224
  try {
211
- if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
225
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
212
226
  }
213
227
  finally { if (e_2) throw e_2.error; }
214
228
  }
@@ -308,17 +322,24 @@ export class ChatThreadClient {
308
322
  }
309
323
  listReadReceiptsAll(options) {
310
324
  return __asyncGenerator(this, arguments, function* listReadReceiptsAll_1() {
311
- var e_3, _a;
325
+ var _a, e_3, _b, _c;
312
326
  try {
313
- for (var _b = __asyncValues(this.listReadReceiptsPage({}, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
314
- const page = _c.value;
315
- yield __await(yield* __asyncDelegator(__asyncValues(page)));
327
+ for (var _d = true, _e = __asyncValues(this.listReadReceiptsPage({}, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a;) {
328
+ _c = _f.value;
329
+ _d = false;
330
+ try {
331
+ const page = _c;
332
+ yield __await(yield* __asyncDelegator(__asyncValues(page)));
333
+ }
334
+ finally {
335
+ _d = true;
336
+ }
316
337
  }
317
338
  }
318
339
  catch (e_3_1) { e_3 = { error: e_3_1 }; }
319
340
  finally {
320
341
  try {
321
- if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
342
+ if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
322
343
  }
323
344
  finally { if (e_3) throw e_3.error; }
324
345
  }
@@ -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;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;QAH3B,4BAAuB,GAAqB,SAAS,CAAC;QAQ5D,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,eAAe,GAAG,UAAU,CAAC;QAElC,MAAM,uBAAuB,mCACxB,OAAO,GACP;YACD,cAAc,EAAE;gBACd,MAAM,EAAE,MA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C,OAAa;QAC7C,IAAI,IAAI,CAAC,uBAAuB,EAAE;YAChC,MAAM,kCAAkC,GACtC,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC;YAE7D,IAAI,kCAAkC,GAAG,mCAAmC,EAAE;gBAC5E,MAAM,CAAC,IAAI,CAAC,+CAA+C,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;gBAC5F,OAAO,KAAK,CAAC;aACd;SACF;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"]}
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,E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M,EAAE,CAAC,WAA6B,EAAE,EAAE,EAAE;oBAC1C,OAAO,IAAI,CAAC,oBAAoB,CAAC,QAAQ,EAAE,cAAc,CAAC,CAAC;gBAC7D,CAAC;aACF,CAAC;SACH;QAAC,OAAO,CAAM,EAAE;YACf,IAAI,CAAC,SAAS,CAAC;gBACb,MAAM,EAAE,OAAO;gBACf,KAAK,EAAE,CAAC;aACT,CAAC,CAAC;YACH,MAAM,CAAC,CAAC;SACT;gBAAS;YACR,IAAI,CAAC,GAAG,EAAE,CAAC;SACZ;IACH,CAAC;IAEO,yBAAyB,CAAC,OAAa;QAC7C,IAAI,IAAI,CAAC,uBAAuB,EAAE;YAChC,MAAM,kCAAkC,GACtC,OAAO,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,uBAAuB,CAAC,OAAO,EAAE,CAAC;YAE7D,IAAI,kCAAkC,GAAG,mCAAmC,EAAE;gBAC5E,MAAM,CAAC,IAAI,CAAC,+CAA+C,IAAI,CAAC,uBAAuB,GAAG,CAAC,CAAC;gBAC5F,OAAO,KAAK,CAAC;aACd;SACF;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,18 +25,18 @@ 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.3.2-beta.2`;
28
+ const packageDetails = `azsdk-js-communication-chat/1.3.2`;
29
29
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
30
30
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
31
31
  : `${packageDetails}`;
32
32
  const optionsWithDefaults = Object.assign(Object.assign(Object.assign({}, defaults), options), { userAgentOptions: {
33
33
  userAgentPrefix
34
- }, endpoint: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{endpoint}" });
34
+ }, baseUri: (_b = (_a = options.endpoint) !== null && _a !== void 0 ? _a : options.baseUri) !== null && _b !== void 0 ? _b : "{endpoint}" });
35
35
  super(optionsWithDefaults);
36
36
  // Parameter assignments
37
37
  this.endpoint = endpoint;
38
38
  // Assigning values to Constant parameters
39
- this.apiVersion = options.apiVersion || "2023-07-01-preview";
39
+ this.apiVersion = options.apiVersion || "2021-09-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;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,QAAQ,GAAgC;YAC5C,kBAAkB,EAAE,iCAAiC;SACtD,CAAC;QAEF,MAAM,cAAc,GAAG,0CAA0C,CAAC;QAClE,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,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EAAE;4BACpC,OAAO,cAAc,GAAG,UAAU,CAAC;yBACpC;6BAAM;4BACL,OAAO,IAAI,CAAC;yBACb;oBACH,CAAC,CAAC,CAAC;oBACH,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBACpD;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.3.2-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 || \"2023-07-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;YAC1B,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAC9C;QAED,0CAA0C;QAC1C,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,EAAE,CAAC;SACd;QACD,MAAM,QAAQ,GAAgC;YAC5C,kBAAkB,EAAE,iCAAiC;SAC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AG,CAAC,CAAC,IAAI,EAAE,EAAE;wBACjD,IAAI,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,EAAE;4BACpC,OAAO,cAAc,GAAG,UAAU,CAAC;yBACpC;6BAAM;4BACL,OAAO,IAAI,CAAC;yBACb;oBACH,CAAC,CAAC,CAAC;oBACH,OAAO,CAAC,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;iBACpD;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.3.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 baseUri: 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 || \"2021-09-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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/generated/src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAsSH,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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\nexport interface CommunicationIdentifierModel {\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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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: AttachmentType;\n /** The type of content of the attachment, if available */\n contentType?: string;\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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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 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 AttachmentType. */\nexport type AttachmentType = \"teamsInlineImage\" | \"teamsImage\" | \"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 = 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 = 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 = 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;AAoRH,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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\nexport interface CommunicationIdentifierModel {\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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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 /** Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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/** 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 must be interpreted as a union: Apart from rawId, at most one further property may be set. */\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 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\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 = 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 /** 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 listChatReadReceiptsNext operation. */\nexport type ChatThreadListChatReadReceiptsNextResponse = ChatMessageReadReceiptsCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadListChatMessagesNextOptionalParams\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 listChatMessagesNext operation. */\nexport type ChatThreadListChatMessagesNextResponse = ChatMessagesCollection;\n\n/** Optional parameters. */\nexport interface ChatThreadListChatParticipantsNextOptionalParams\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 listChatParticipantsNext operation. */\nexport type ChatThreadListChatParticipantsNextResponse = 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 /** 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 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"]}
@@ -435,18 +435,6 @@ export const ChatMessageContent = {
435
435
  }
436
436
  }
437
437
  },
438
- attachments: {
439
- serializedName: "attachments",
440
- type: {
441
- name: "Sequence",
442
- element: {
443
- type: {
444
- name: "Composite",
445
- className: "ChatAttachment"
446
- }
447
- }
448
- }
449
- },
450
438
  initiatorCommunicationIdentifier: {
451
439
  serializedName: "initiatorCommunicationIdentifier",
452
440
  type: {
@@ -484,54 +472,6 @@ export const ChatParticipant = {
484
472
  }
485
473
  }
486
474
  };
487
- export const ChatAttachment = {
488
- type: {
489
- name: "Composite",
490
- className: "ChatAttachment",
491
- modelProperties: {
492
- id: {
493
- serializedName: "id",
494
- required: true,
495
- type: {
496
- name: "String"
497
- }
498
- },
499
- attachmentType: {
500
- serializedName: "attachmentType",
501
- required: true,
502
- type: {
503
- name: "Enum",
504
- allowedValues: ["teamsInlineImage", "teamsImage", "file"]
505
- }
506
- },
507
- contentType: {
508
- serializedName: "contentType",
509
- type: {
510
- name: "String"
511
- }
512
- },
513
- name: {
514
- serializedName: "name",
515
- type: {
516
- name: "String"
517
- }
518
- },
519
- url: {
520
- serializedName: "url",
521
- required: true,
522
- type: {
523
- name: "String"
524
- }
525
- },
526
- previewUrl: {
527
- serializedName: "previewUrl",
528
- type: {
529
- name: "String"
530
- }
531
- }
532
- }
533
- }
534
- };
535
475
  export const UpdateChatMessageRequest = {
536
476
  type: {
537
477
  name: "Composite",