@azure/communication-chat 1.4.0 → 1.5.0-beta.1

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.
package/dist/index.js CHANGED
@@ -139,7 +139,7 @@ const mapToReadReceiptSdkModel = (readReceipt) => {
139
139
  const tracingClient = coreTracing.createTracingClient({
140
140
  namespace: "Azure.Communication",
141
141
  packageName: "@azure/communication-chat",
142
- packageVersion: "1.4.0"
142
+ packageVersion: "1.5.0-beta.1"
143
143
  });
144
144
 
145
145
  /*
@@ -630,6 +630,13 @@ const ChatParticipant = {
630
630
  type: {
631
631
  name: "DateTime"
632
632
  }
633
+ },
634
+ metadata: {
635
+ serializedName: "metadata",
636
+ type: {
637
+ name: "Dictionary",
638
+ value: { type: { name: "String" } }
639
+ }
633
640
  }
634
641
  }
635
642
  }
@@ -647,11 +654,11 @@ const ChatAttachment = {
647
654
  }
648
655
  },
649
656
  attachmentType: {
650
- defaultValue: "image",
651
- isConstant: true,
652
657
  serializedName: "attachmentType",
658
+ required: true,
653
659
  type: {
654
- name: "String"
660
+ name: "Enum",
661
+ allowedValues: ["image", "file"]
655
662
  }
656
663
  },
657
664
  name: {
@@ -789,6 +796,13 @@ const CreateChatThreadRequest = {
789
796
  }
790
797
  }
791
798
  }
799
+ },
800
+ metadata: {
801
+ serializedName: "metadata",
802
+ type: {
803
+ name: "Dictionary",
804
+ value: { type: { name: "String" } }
805
+ }
792
806
  }
793
807
  }
794
808
  }
@@ -859,6 +873,13 @@ const ChatThreadProperties = {
859
873
  type: {
860
874
  name: "DateTime"
861
875
  }
876
+ },
877
+ metadata: {
878
+ serializedName: "metadata",
879
+ type: {
880
+ name: "Dictionary",
881
+ value: { type: { name: "String" } }
882
+ }
862
883
  }
863
884
  }
864
885
  }
@@ -936,6 +957,13 @@ const UpdateChatThreadRequest = {
936
957
  type: {
937
958
  name: "String"
938
959
  }
960
+ },
961
+ metadata: {
962
+ serializedName: "metadata",
963
+ type: {
964
+ name: "Dictionary",
965
+ value: { type: { name: "String" } }
966
+ }
939
967
  }
940
968
  }
941
969
  }
@@ -1046,7 +1074,7 @@ const skip = {
1046
1074
  const apiVersion = {
1047
1075
  parameterPath: "apiVersion",
1048
1076
  mapper: {
1049
- defaultValue: "2023-11-07",
1077
+ defaultValue: "2023-11-15-preview",
1050
1078
  isConstant: true,
1051
1079
  serializedName: "api-version",
1052
1080
  type: {
@@ -2046,7 +2074,7 @@ class ChatApiClient extends coreClient__namespace.ServiceClient {
2046
2074
  const defaults = {
2047
2075
  requestContentType: "application/json; charset=utf-8"
2048
2076
  };
2049
- const packageDetails = `azsdk-js-communication-chat/1.4.0`;
2077
+ const packageDetails = `azsdk-js-communication-chat/1.5.0-beta.1`;
2050
2078
  const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
2051
2079
  ? `${options.userAgentOptions.userAgentPrefix} ${packageDetails}`
2052
2080
  : `${packageDetails}`;
@@ -2057,7 +2085,7 @@ class ChatApiClient extends coreClient__namespace.ServiceClient {
2057
2085
  // Parameter assignments
2058
2086
  this.endpoint = endpoint;
2059
2087
  // Assigning values to Constant parameters
2060
- this.apiVersion = options.apiVersion || "2023-11-07";
2088
+ this.apiVersion = options.apiVersion || "2023-11-15-preview";
2061
2089
  this.chatThread = new ChatThreadImpl(this);
2062
2090
  this.chat = new ChatImpl(this);
2063
2091
  this.addCustomApiVersionPolicy(options.apiVersion);
@@ -2152,6 +2180,15 @@ class ChatThreadClient {
2152
2180
  await this.client.chatThread.updateChatThreadProperties(this.threadId, { topic: topic }, updatedOptions);
2153
2181
  });
2154
2182
  }
2183
+ /**
2184
+ * Updates a thread's properties.
2185
+ * @param options - Operation options.
2186
+ */
2187
+ updateProperties(options = {}) {
2188
+ return tracingClient.withSpan("ChatThreadClient-UpdateProperties", options, async (updatedOptions) => {
2189
+ await this.client.chatThread.updateChatThreadProperties(this.threadId, options, updatedOptions);
2190
+ });
2191
+ }
2155
2192
  /**
2156
2193
  * Sends a chat message to a thread identified by threadId.
2157
2194
  * Returns the id of the created message.
@@ -2494,12 +2531,13 @@ function generateUuid() {
2494
2531
  // Copyright (c) Microsoft Corporation.
2495
2532
  // Licensed under the MIT license.
2496
2533
  const getSignalingClient = (credential, logger, options) => {
2497
- var _a, _b;
2534
+ var _a, _b, _c;
2498
2535
  if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
2499
2536
  // In React Native
2500
2537
  return new communicationSignaling.CommunicationSignalingClient(credential, logger, {
2501
2538
  environment: (_a = options === null || options === void 0 ? void 0 : options.environment) !== null && _a !== void 0 ? _a : undefined,
2502
2539
  resourceEndpoint: (_b = options === null || options === void 0 ? void 0 : options.resourceEndpoint) !== null && _b !== void 0 ? _b : undefined,
2540
+ gatewayApiVersion: (_c = options === null || options === void 0 ? void 0 : options.gatewayApiVersion) !== null && _c !== void 0 ? _c : undefined,
2503
2541
  });
2504
2542
  }
2505
2543
  // In node js
@@ -2527,13 +2565,13 @@ class ChatClient {
2527
2565
  this.isRealtimeNotificationsStarted = false;
2528
2566
  this.tokenCredential = credential;
2529
2567
  this.clientOptions = Object.assign({}, options);
2530
- this.clientOptions.signalingClientOptions = Object.assign(Object.assign({}, this.clientOptions.signalingClientOptions), { resourceEndpoint: this.endpoint });
2531
2568
  const internalPipelineOptions = Object.assign(Object.assign({}, options), {
2532
2569
  loggingOptions: {
2533
2570
  logger: logger.info,
2534
2571
  },
2535
2572
  });
2536
2573
  this.client = new ChatApiClient(this.endpoint, Object.assign({ endpoint: this.endpoint }, internalPipelineOptions));
2574
+ this.clientOptions.signalingClientOptions = Object.assign(Object.assign({}, this.clientOptions.signalingClientOptions), { resourceEndpoint: this.endpoint, gatewayApiVersion: this.client.apiVersion });
2537
2575
  const authPolicy = createCommunicationTokenCredentialPolicy(this.tokenCredential);
2538
2576
  this.client.pipeline.addPolicy(authPolicy);
2539
2577
  this.signalingClient = getSignalingClient(credential, logger, this.clientOptions.signalingClientOptions);
@@ -2560,6 +2598,7 @@ class ChatClient {
2560
2598
  const result = await this.client.chat.createChatThread({
2561
2599
  topic: request.topic,
2562
2600
  participants: (_b = options.participants) === null || _b === void 0 ? void 0 : _b.map((participant) => mapToChatParticipantRestModel(participant)),
2601
+ metadata: options.metadata,
2563
2602
  }, updatedRestModelOptions);
2564
2603
  return mapToCreateChatThreadResultSdkModel(result);
2565
2604
  });