@azure-rest/communication-job-router 1.1.0-beta.1 → 1.1.0-beta.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.
Files changed (204) hide show
  1. package/README.md +168 -115
  2. package/dist/browser/azureCommunicationRoutingServiceClient.d.ts +14 -0
  3. package/dist/browser/azureCommunicationRoutingServiceClient.d.ts.map +1 -0
  4. package/dist/browser/azureCommunicationRoutingServiceClient.js +40 -0
  5. package/dist/browser/azureCommunicationRoutingServiceClient.js.map +1 -0
  6. package/dist/browser/azureCommunicationRoutingServiceCustmizedClient.d.ts +17 -0
  7. package/dist/browser/azureCommunicationRoutingServiceCustmizedClient.d.ts.map +1 -0
  8. package/dist/browser/azureCommunicationRoutingServiceCustmizedClient.js +29 -0
  9. package/dist/browser/azureCommunicationRoutingServiceCustmizedClient.js.map +1 -0
  10. package/dist/browser/clientDefinitions.d.ts +159 -0
  11. package/dist/browser/clientDefinitions.d.ts.map +1 -0
  12. package/dist/browser/clientDefinitions.js +4 -0
  13. package/dist/browser/clientDefinitions.js.map +1 -0
  14. package/dist/browser/index.d.ts +11 -0
  15. package/dist/browser/index.d.ts.map +1 -0
  16. package/dist/browser/index.js +13 -0
  17. package/dist/browser/index.js.map +1 -0
  18. package/dist/browser/isUnexpected.d.ts +35 -0
  19. package/dist/browser/isUnexpected.d.ts.map +1 -0
  20. package/{dist-esm/src → dist/browser}/isUnexpected.js +1 -1
  21. package/dist/browser/isUnexpected.js.map +1 -0
  22. package/dist/browser/logger.d.ts +2 -0
  23. package/dist/browser/logger.d.ts.map +1 -0
  24. package/{dist-esm/src → dist/browser}/logger.js +1 -1
  25. package/{dist-esm/src → dist/browser}/logger.js.map +1 -1
  26. package/dist/browser/models.d.ts +562 -0
  27. package/dist/browser/models.d.ts.map +1 -0
  28. package/dist/browser/models.js +4 -0
  29. package/dist/browser/models.js.map +1 -0
  30. package/dist/browser/outputModels.d.ts +683 -0
  31. package/dist/browser/outputModels.d.ts.map +1 -0
  32. package/dist/browser/outputModels.js +4 -0
  33. package/dist/browser/outputModels.js.map +1 -0
  34. package/dist/browser/package.json +3 -0
  35. package/dist/browser/paginateHelper.d.ts +68 -0
  36. package/dist/browser/paginateHelper.d.ts.map +1 -0
  37. package/dist/browser/paginateHelper.js +167 -0
  38. package/dist/browser/paginateHelper.js.map +1 -0
  39. package/dist/browser/parameters.d.ts +245 -0
  40. package/dist/browser/parameters.d.ts.map +1 -0
  41. package/dist/browser/parameters.js +4 -0
  42. package/dist/browser/parameters.js.map +1 -0
  43. package/dist/browser/responses.d.ts +616 -0
  44. package/dist/browser/responses.d.ts.map +1 -0
  45. package/dist/browser/responses.js +4 -0
  46. package/dist/browser/responses.js.map +1 -0
  47. package/dist/commonjs/azureCommunicationRoutingServiceClient.d.ts +14 -0
  48. package/dist/commonjs/azureCommunicationRoutingServiceClient.d.ts.map +1 -0
  49. package/dist/commonjs/azureCommunicationRoutingServiceClient.js +43 -0
  50. package/dist/commonjs/azureCommunicationRoutingServiceClient.js.map +1 -0
  51. package/dist/commonjs/azureCommunicationRoutingServiceCustmizedClient.d.ts +17 -0
  52. package/dist/commonjs/azureCommunicationRoutingServiceCustmizedClient.d.ts.map +1 -0
  53. package/dist/commonjs/azureCommunicationRoutingServiceCustmizedClient.js +33 -0
  54. package/dist/commonjs/azureCommunicationRoutingServiceCustmizedClient.js.map +1 -0
  55. package/dist/commonjs/clientDefinitions.d.ts +159 -0
  56. package/dist/commonjs/clientDefinitions.d.ts.map +1 -0
  57. package/dist/commonjs/clientDefinitions.js +5 -0
  58. package/dist/commonjs/clientDefinitions.js.map +1 -0
  59. package/dist/commonjs/index.d.ts +11 -0
  60. package/dist/commonjs/index.d.ts.map +1 -0
  61. package/dist/commonjs/index.js +16 -0
  62. package/dist/commonjs/index.js.map +1 -0
  63. package/dist/commonjs/isUnexpected.d.ts +35 -0
  64. package/dist/commonjs/isUnexpected.d.ts.map +1 -0
  65. package/dist/commonjs/isUnexpected.js +105 -0
  66. package/dist/commonjs/isUnexpected.js.map +1 -0
  67. package/dist/commonjs/logger.d.ts +2 -0
  68. package/dist/commonjs/logger.d.ts.map +1 -0
  69. package/dist/commonjs/logger.js +8 -0
  70. package/dist/commonjs/logger.js.map +1 -0
  71. package/dist/commonjs/models.d.ts +562 -0
  72. package/dist/commonjs/models.d.ts.map +1 -0
  73. package/dist/commonjs/models.js +5 -0
  74. package/dist/commonjs/models.js.map +1 -0
  75. package/dist/commonjs/outputModels.d.ts +683 -0
  76. package/dist/commonjs/outputModels.d.ts.map +1 -0
  77. package/dist/commonjs/outputModels.js +5 -0
  78. package/dist/commonjs/outputModels.js.map +1 -0
  79. package/dist/commonjs/package.json +3 -0
  80. package/dist/commonjs/paginateHelper.d.ts +68 -0
  81. package/dist/commonjs/paginateHelper.d.ts.map +1 -0
  82. package/dist/commonjs/paginateHelper.js +170 -0
  83. package/dist/commonjs/paginateHelper.js.map +1 -0
  84. package/dist/commonjs/parameters.d.ts +245 -0
  85. package/dist/commonjs/parameters.d.ts.map +1 -0
  86. package/dist/commonjs/parameters.js +5 -0
  87. package/dist/commonjs/parameters.js.map +1 -0
  88. package/dist/commonjs/responses.d.ts +616 -0
  89. package/dist/commonjs/responses.d.ts.map +1 -0
  90. package/dist/commonjs/responses.js +5 -0
  91. package/dist/commonjs/responses.js.map +1 -0
  92. package/dist/commonjs/tsdoc-metadata.json +11 -0
  93. package/dist/esm/azureCommunicationRoutingServiceClient.d.ts +14 -0
  94. package/dist/esm/azureCommunicationRoutingServiceClient.d.ts.map +1 -0
  95. package/dist/esm/azureCommunicationRoutingServiceClient.js +40 -0
  96. package/dist/esm/azureCommunicationRoutingServiceClient.js.map +1 -0
  97. package/dist/esm/azureCommunicationRoutingServiceCustmizedClient.d.ts +17 -0
  98. package/dist/esm/azureCommunicationRoutingServiceCustmizedClient.d.ts.map +1 -0
  99. package/dist/esm/azureCommunicationRoutingServiceCustmizedClient.js +29 -0
  100. package/dist/esm/azureCommunicationRoutingServiceCustmizedClient.js.map +1 -0
  101. package/dist/esm/clientDefinitions.d.ts +159 -0
  102. package/dist/esm/clientDefinitions.d.ts.map +1 -0
  103. package/dist/esm/clientDefinitions.js +4 -0
  104. package/dist/esm/clientDefinitions.js.map +1 -0
  105. package/dist/esm/index.d.ts +11 -0
  106. package/dist/esm/index.d.ts.map +1 -0
  107. package/dist/esm/index.js +13 -0
  108. package/dist/esm/index.js.map +1 -0
  109. package/dist/esm/isUnexpected.d.ts +35 -0
  110. package/dist/esm/isUnexpected.d.ts.map +1 -0
  111. package/dist/esm/isUnexpected.js +102 -0
  112. package/dist/esm/isUnexpected.js.map +1 -0
  113. package/dist/esm/logger.d.ts +2 -0
  114. package/dist/esm/logger.d.ts.map +1 -0
  115. package/dist/esm/logger.js +5 -0
  116. package/dist/esm/logger.js.map +1 -0
  117. package/dist/esm/models.d.ts +562 -0
  118. package/dist/esm/models.d.ts.map +1 -0
  119. package/dist/esm/models.js +4 -0
  120. package/dist/esm/models.js.map +1 -0
  121. package/dist/esm/outputModels.d.ts +683 -0
  122. package/dist/esm/outputModels.d.ts.map +1 -0
  123. package/dist/esm/outputModels.js +4 -0
  124. package/dist/esm/outputModels.js.map +1 -0
  125. package/dist/esm/package.json +3 -0
  126. package/dist/esm/paginateHelper.d.ts +68 -0
  127. package/dist/esm/paginateHelper.d.ts.map +1 -0
  128. package/dist/esm/paginateHelper.js +167 -0
  129. package/dist/esm/paginateHelper.js.map +1 -0
  130. package/dist/esm/parameters.d.ts +245 -0
  131. package/dist/esm/parameters.d.ts.map +1 -0
  132. package/dist/esm/parameters.js +4 -0
  133. package/dist/esm/parameters.js.map +1 -0
  134. package/dist/esm/responses.d.ts +616 -0
  135. package/dist/esm/responses.d.ts.map +1 -0
  136. package/dist/esm/responses.js +4 -0
  137. package/dist/esm/responses.js.map +1 -0
  138. package/dist/react-native/azureCommunicationRoutingServiceClient.d.ts +14 -0
  139. package/dist/react-native/azureCommunicationRoutingServiceClient.d.ts.map +1 -0
  140. package/dist/react-native/azureCommunicationRoutingServiceClient.js +40 -0
  141. package/dist/react-native/azureCommunicationRoutingServiceClient.js.map +1 -0
  142. package/dist/react-native/azureCommunicationRoutingServiceCustmizedClient.d.ts +17 -0
  143. package/dist/react-native/azureCommunicationRoutingServiceCustmizedClient.d.ts.map +1 -0
  144. package/dist/react-native/azureCommunicationRoutingServiceCustmizedClient.js +29 -0
  145. package/dist/react-native/azureCommunicationRoutingServiceCustmizedClient.js.map +1 -0
  146. package/dist/react-native/clientDefinitions.d.ts +159 -0
  147. package/dist/react-native/clientDefinitions.d.ts.map +1 -0
  148. package/dist/react-native/clientDefinitions.js +4 -0
  149. package/dist/react-native/clientDefinitions.js.map +1 -0
  150. package/dist/react-native/index.d.ts +11 -0
  151. package/dist/react-native/index.d.ts.map +1 -0
  152. package/dist/react-native/index.js +13 -0
  153. package/dist/react-native/index.js.map +1 -0
  154. package/dist/react-native/isUnexpected.d.ts +35 -0
  155. package/dist/react-native/isUnexpected.d.ts.map +1 -0
  156. package/dist/react-native/isUnexpected.js +102 -0
  157. package/dist/react-native/isUnexpected.js.map +1 -0
  158. package/dist/react-native/logger.d.ts +2 -0
  159. package/dist/react-native/logger.d.ts.map +1 -0
  160. package/dist/react-native/logger.js +5 -0
  161. package/dist/react-native/logger.js.map +1 -0
  162. package/dist/react-native/models.d.ts +562 -0
  163. package/dist/react-native/models.d.ts.map +1 -0
  164. package/dist/react-native/models.js +4 -0
  165. package/dist/react-native/models.js.map +1 -0
  166. package/dist/react-native/outputModels.d.ts +683 -0
  167. package/dist/react-native/outputModels.d.ts.map +1 -0
  168. package/dist/react-native/outputModels.js +4 -0
  169. package/dist/react-native/outputModels.js.map +1 -0
  170. package/dist/react-native/package.json +3 -0
  171. package/dist/react-native/paginateHelper.d.ts +68 -0
  172. package/dist/react-native/paginateHelper.d.ts.map +1 -0
  173. package/dist/react-native/paginateHelper.js +167 -0
  174. package/dist/react-native/paginateHelper.js.map +1 -0
  175. package/dist/react-native/parameters.d.ts +245 -0
  176. package/dist/react-native/parameters.d.ts.map +1 -0
  177. package/dist/react-native/parameters.js +4 -0
  178. package/dist/react-native/parameters.js.map +1 -0
  179. package/dist/react-native/responses.d.ts +616 -0
  180. package/dist/react-native/responses.d.ts.map +1 -0
  181. package/dist/react-native/responses.js +4 -0
  182. package/dist/react-native/responses.js.map +1 -0
  183. package/package.json +79 -63
  184. package/dist/index.js +0 -229
  185. package/dist/index.js.map +0 -1
  186. package/dist-esm/src/azureCommunicationRoutingServiceClient.js +0 -42
  187. package/dist-esm/src/azureCommunicationRoutingServiceClient.js.map +0 -1
  188. package/dist-esm/src/clientDefinitions.js +0 -4
  189. package/dist-esm/src/clientDefinitions.js.map +0 -1
  190. package/dist-esm/src/index.js +0 -13
  191. package/dist-esm/src/index.js.map +0 -1
  192. package/dist-esm/src/isUnexpected.js.map +0 -1
  193. package/dist-esm/src/models.js +0 -4
  194. package/dist-esm/src/models.js.map +0 -1
  195. package/dist-esm/src/outputModels.js +0 -4
  196. package/dist-esm/src/outputModels.js.map +0 -1
  197. package/dist-esm/src/paginateHelper.js +0 -70
  198. package/dist-esm/src/paginateHelper.js.map +0 -1
  199. package/dist-esm/src/parameters.js +0 -4
  200. package/dist-esm/src/parameters.js.map +0 -1
  201. package/dist-esm/src/responses.js +0 -4
  202. package/dist-esm/src/responses.js.map +0 -1
  203. package/review/communication-job-router.api.md +0 -2485
  204. package/types/communication-job-router.d.ts +0 -2677
package/README.md CHANGED
@@ -11,7 +11,6 @@ Key links:
11
11
  - [Package (NPM)](https://www.npmjs.com/package/@azure-rest/communication-job-router)
12
12
  - [Samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/communication/communication-job-router-rest/samples)
13
13
 
14
-
15
14
  ## Getting started
16
15
 
17
16
  ### Currently supported environments
@@ -83,10 +82,11 @@ In the `RouterQuickStart` folder, install the ACS Job Router SDK by executing `n
83
82
 
84
83
  First we need to construct an `AzureCommunicationRoutingServiceClient`.
85
84
 
86
- ```js
87
- const JobRouterClient = require("@azure-rest/communication-job-router").default;
85
+ ```ts snippet:ReadmeSampleCreateClient
86
+ import JobRouterClient from "@azure-rest/communication-job-router";
88
87
 
89
- const connectionString = "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
88
+ const connectionString =
89
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
90
90
  const routerClient = JobRouterClient(connectionString);
91
91
  ```
92
92
 
@@ -94,35 +94,50 @@ const routerClient = JobRouterClient(connectionString);
94
94
 
95
95
  This policy determines which workers will receive job offers as jobs are distributed off their queues.
96
96
 
97
- ```js
98
- const distributionPolicyId = "distribution-policy-id-1";
99
- const distributionPolicy = await routerClient.path("/routing/distributionPolicies/{id}", distributionPolicyId).patch({
100
- contentType: "application/merge-patch+json",
101
- body: {
102
- name: "Default Distribution Policy",
103
- offerExpiresAfterSeconds: 30,
104
- mode: {
105
- kind: "longestIdle",
106
- minConcurrentOffers: 1,
107
- maxConcurrentOffers: 3,
97
+ ```ts snippet:ReadmeSampleCreateDistributionPolicy
98
+ import JobRouterClient from "@azure-rest/communication-job-router";
99
+
100
+ const connectionString =
101
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
102
+ const routerClient = JobRouterClient(connectionString);
103
+
104
+ const id = "distribution-policy-123";
105
+ const result = await routerClient
106
+ .path("/routing/distributionPolicies/{distributionPolicyId}", id)
107
+ .patch({
108
+ contentType: "application/merge-patch+json",
109
+ body: {
110
+ name: "distribution-policy-123",
111
+ mode: {
112
+ kind: "longestIdle",
113
+ minConcurrentOffers: 1,
114
+ maxConcurrentOffers: 5,
115
+ bypassSelectors: false,
116
+ },
117
+ offerExpiresAfterSeconds: 120,
108
118
  },
109
- }
110
- });
119
+ });
111
120
  ```
112
121
 
113
122
  ### Create a Queue
114
123
 
115
124
  This queue offers jobs to workers according to our previously created distribution policy.
116
125
 
117
- ```js
118
- const salesQueueId = "sales-queue-id-1";
119
- const salesQueue = await routerClient.path("/routing/queues/{id}", salesQueueId).patch({
126
+ ```ts snippet:ReadmeSampleCreateQueue
127
+ import JobRouterClient from "@azure-rest/communication-job-router";
128
+
129
+ const connectionString =
130
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
131
+ const routerClient = JobRouterClient(connectionString);
132
+
133
+ const distributionPolicyId = "distribution-policy-123";
134
+ const queueId = "queue-123";
135
+ const result = await routerClient.path("/routing/queues/{queueId}", queueId).patch({
120
136
  contentType: "application/merge-patch+json",
121
137
  body: {
122
138
  distributionPolicyId: distributionPolicyId,
123
139
  name: "Main",
124
- labels: {},
125
- }
140
+ },
126
141
  });
127
142
  ```
128
143
 
@@ -133,44 +148,20 @@ These workers are assigned to our previously created "Sales" queue and have some
133
148
  - setting `availableForOffers` to `true` means these workers are ready to accept job offers.
134
149
  - refer to our [labels documentation](https://learn.microsoft.com/azure/communication-services/concepts/router/concepts#labels) to better understand labels and label selectors.
135
150
 
136
- ```js
137
- // Create worker "Alice".
138
- const workerAliceId = "773accfb-476e-42f9-a202-b211b41a4ea4";
139
- const workerAlice = await routerClient.path("/routing/workers/{id}", workerAliceId).patch({
140
- contentType: "application/merge-patch+json",
141
- body: {
142
- capacity: 120,
143
- queues: [salesQueueId],
144
- labels: {
145
- Xbox: 5,
146
- german: 4,
147
- name: "Alice"
148
- },
149
- channels: [
150
- {
151
- channelId: "CustomChatChannel",
152
- capacityCostPerJob: 10,
153
- },
154
- {
155
- channelId: "CustomVoiceChannel",
156
- capacityCostPerJob: 100,
157
- },
158
- ],
159
- }
160
- });
151
+ ```ts snippet:ReadmeSampleCreateWorkers
152
+ import JobRouterClient from "@azure-rest/communication-job-router";
161
153
 
162
- // Create worker "Bob".
163
- const workerBobId = "21837c88-6967-4078-86b9-1207821a8392";
164
- const workerBob = await routerClient.path("/routing/workers/{id}", workerBobId).patch({
154
+ const connectionString =
155
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
156
+ const routerClient = JobRouterClient(connectionString);
157
+
158
+ const id = "router-worker-123";
159
+ const result = await routerClient.path("/routing/workers/{workerId}", id).patch({
165
160
  contentType: "application/merge-patch+json",
166
161
  body: {
167
162
  capacity: 100,
168
- queues: [salesQueueId],
169
- labels: {
170
- Xbox: 5,
171
- english: 3,
172
- name: "Alice"
173
- },
163
+ queues: ["MainQueue", "SecondaryQueue"],
164
+ labels: {},
174
165
  channels: [
175
166
  {
176
167
  channelId: "CustomChatChannel",
@@ -181,7 +172,7 @@ const workerBob = await routerClient.path("/routing/workers/{id}", workerBobId).
181
172
  capacityCostPerJob: 100,
182
173
  },
183
174
  ],
184
- }
175
+ },
185
176
  });
186
177
  ```
187
178
 
@@ -191,19 +182,26 @@ Refer to our [job lifecycle documentation](https://learn.microsoft.com/azure/com
191
182
 
192
183
  ### Create a Job
193
184
 
194
- This job is enqueued on our previously created "Sales" queue.
185
+ We can create a job with the following:
195
186
 
196
- ```js
187
+ ```ts snippet:ReadmeSampleCreateJob
188
+ import JobRouterClient from "@azure-rest/communication-job-router";
189
+
190
+ const connectionString =
191
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
192
+ const routerClient = JobRouterClient(connectionString);
193
+
194
+ const queueId = "queue-123";
197
195
  const jobId = "router-job-123";
198
- const result = await routerClient.path("/routing/jobs/{id}", jobId).patch({
196
+ const result = await routerClient.path("/routing/jobs/{jobId}", jobId).patch({
199
197
  contentType: "application/merge-patch+json",
200
198
  body: {
201
- channelReference: "66e4362e-aad5-4d71-bb51-448672ebf492",
202
- channelId: "voice",
199
+ channelId: "ChatChannel",
200
+ queueId: queueId,
201
+ channelReference: "abc",
203
202
  priority: 2,
204
- queueId: salesQueueId,
205
203
  labels: {},
206
- }
204
+ },
207
205
  });
208
206
  ```
209
207
 
@@ -213,32 +211,43 @@ const result = await routerClient.path("/routing/jobs/{id}", jobId).patch({
213
211
 
214
212
  This policy classifies jobs upon creation.
215
213
 
216
- ```js
217
- const classificationPolicyId = "classification-policy-1";
218
- const classificationPolicy = await routerClient.path("/routing/classificationPolicies/{id}", classificationPolicyId).patch({
219
- contentType: "application/merge-patch+json",
220
- body: {
221
- name: "Default Classification Policy",
222
- fallbackQueueId: salesQueueId,
223
- queueSelectorAttachments: [
224
- {
214
+ ```ts snippet:ReadmeSampleCreateClassificationPolicy
215
+ import JobRouterClient from "@azure-rest/communication-job-router";
216
+
217
+ const connectionString =
218
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
219
+ const routerClient = JobRouterClient(connectionString);
220
+
221
+ const classificationPolicyId = "classification-policy-123";
222
+
223
+ const result = await routerClient
224
+ .path("/routing/classificationPolicies/{classificationPolicyId}", classificationPolicyId)
225
+ .patch({
226
+ contentType: "application/merge-patch+json",
227
+ body: {
228
+ name: "test-policy",
229
+ fallbackQueueId: "queue-123",
230
+ queueSelectorAttachments: [
231
+ {
232
+ kind: "conditional",
233
+ queueSelectors: [
234
+ {
235
+ key: "foo",
236
+ labelOperator: "equal",
237
+ value: { default: 10 },
238
+ },
239
+ ],
240
+ condition: {
241
+ kind: "direct-map-rule",
242
+ },
243
+ },
244
+ ],
245
+ prioritizationRule: {
225
246
  kind: "static",
226
- queueSelector: { key: "department", labelOperator: "equal", value: "xbox" }
247
+ value: { default: 2 },
227
248
  },
228
- ],
229
- workerSelectorAttachments: [
230
- {
231
- kind: "static",
232
- workerSelector: { key: "english", labelOperator: "greaterThan", value: 5 }
233
- }
234
- ],
235
- prioritizationRule: {
236
- kind: "expression",
237
- language: "powerFx",
238
- expression: "If(job.department = \"xbox\", 2, 1)"
239
- }
240
- }
241
- });
249
+ },
250
+ });
242
251
  ```
243
252
 
244
253
  - Refer to our [classification concepts documentation](https://learn.microsoft.com/azure/communication-services/concepts/router/classification-concepts) to better understand queue selectors and worker selectors.
@@ -248,23 +257,31 @@ const classificationPolicy = await routerClient.path("/routing/classificationPol
248
257
 
249
258
  This job will be classified with our previously created classification policy. It also has a label.
250
259
 
251
- ```js
252
- const job = await routerClient.path("/routing/jobs/{id}", jobId).patch({
260
+ ```ts snippet:ReadmeSampleCreateJobWithClassificationPolicy
261
+ import JobRouterClient from "@azure-rest/communication-job-router";
262
+
263
+ const connectionString =
264
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
265
+ const routerClient = JobRouterClient(connectionString);
266
+
267
+ const jobId = "router-job-123";
268
+ const classificationPolicyId = "classification-policy-123";
269
+ const job = await routerClient.path("/routing/jobs/{jobId}", jobId).patch({
253
270
  contentType: "application/merge-patch+json",
254
271
  body: {
255
272
  channelReference: "66e4362e-aad5-4d71-bb51-448672ebf492",
256
273
  channelId: "voice",
257
- classificationPolicyId: classificationPolicy.body.id,
274
+ classificationPolicyId: classificationPolicyId,
258
275
  labels: {
259
- department: "xbox"
276
+ department: "xbox",
260
277
  },
261
- }
278
+ },
262
279
  });
263
280
  ```
264
281
 
265
282
  ## Events
266
283
 
267
- Job Router events are delivered via Azure Event Grid. Refer to our [Azure Event Grid documentation](https://docs.microsoft.com/azure/event-grid/overview) to better understand Azure Event Grid.
284
+ Job Router events are delivered via Azure Event Grid. Refer to our [Azure Event Grid documentation](https://learn.microsoft.com/azure/event-grid/overview) to better understand Azure Event Grid.
268
285
 
269
286
  In the previous example:
270
287
 
@@ -316,9 +333,7 @@ One way to subscribe to ACS Job Router events is through the Azure Portal.
316
333
 
317
334
  Refer to our ["subscribe to Job Router events" documentation](https://learn.microsoft.com/azure/communication-services/how-tos/router-sdk/subscribe-events) to better understand subscribing to Job Router events.
318
335
 
319
- The route in your NodeJS application that receives events may look something like this:
320
-
321
- ```js
336
+ ```ts snippet:ignore
322
337
  app.post('/event', (req, res) => {
323
338
  req.body.forEach(eventGridEvent => {
324
339
  // Deserialize the event data into the appropriate type
@@ -339,34 +354,72 @@ Once you receive a `RouterWorkerOfferIssued` event you can accept or decline the
339
354
  - `workerId` - Id of the worker accepting or declining the job offer.
340
355
  - `offerId` - Id of the offer being accepted or declined.
341
356
 
342
- ```js
343
- const acceptResponse = await routerClient.path("/routing/workers/{workerId}/offers/{offerId}:accept", workerId, offerId).post();
344
- // or
345
- const declineResponse = await routerClient.path("/routing/workers/{workerId}/offers/{offerId}:decline", workerId, offerId).post();
357
+ ```ts snippet:ReadmeSampleAcceptOrDeclineOffer
358
+ import JobRouterClient from "@azure-rest/communication-job-router";
359
+
360
+ const connectionString =
361
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
362
+ const routerClient = JobRouterClient(connectionString);
363
+
364
+ const workerId = "router-worker-123";
365
+ const offerId = "offer-id";
366
+
367
+ // Accept the job offer
368
+ const acceptResponse = await routerClient
369
+ .path("/routing/workers/{workerId}/offers/{offerId}:accept", workerId, offerId)
370
+ .post();
371
+ // or decline the job offer
372
+ const declineResponse = await routerClient
373
+ .path("/routing/workers/{workerId}/offers/{offerId}:decline", workerId, offerId)
374
+ .post();
346
375
  ```
347
376
 
348
377
  ### Complete the Job
349
378
 
350
379
  The `assignmentId` received from the previous step's response is required to complete the job. Completing the job puts it in the wrap-up phase of its lifecycle.
351
380
 
352
- ```ts
353
- const completeJob = await routerClient.path("/routing/jobs/{jobId}/assignments/{assignmentId}:complete", jobId, acceptResponse.body.assignmentId).post({
354
- body: {
355
- note: `Job has been completed by ${workerId} at ${new Date()}`
356
- }
357
- });
381
+ ```ts snippet:ReadmeSampleCompleteJob
382
+ import JobRouterClient from "@azure-rest/communication-job-router";
383
+
384
+ const connectionString =
385
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
386
+ const routerClient = JobRouterClient(connectionString);
387
+
388
+ const workerId = "router-worker-123";
389
+ const jobId = "job-id";
390
+ const assignmentId = "assignment-id";
391
+
392
+ const completeJob = await routerClient
393
+ .path("/routing/jobs/{jobId}/assignments/{assignmentId}:complete", jobId, assignmentId)
394
+ .post({
395
+ body: {
396
+ note: `Job has been completed by ${workerId} at ${new Date()}`,
397
+ },
398
+ });
358
399
  ```
359
400
 
360
401
  ### Close the Job
361
402
 
362
403
  Once the worker has completed the wrap-up phase of the job we can close the job and attach a note to it for future reference.
363
404
 
364
- ```ts
365
- const closeJob = await routerClient.path("/routing/jobs/{jobId}/assignments/{assignmentId}:close", jobId, acceptResponse.body.assignmentId).post({
366
- body: {
367
- note: `Job has been closed by ${workerId} at ${new Date()}`
368
- }
369
- });
405
+ ```ts snippet:ReadmeSampleCloseJob
406
+ import JobRouterClient from "@azure-rest/communication-job-router";
407
+
408
+ const connectionString =
409
+ "endpoint=https://<YOUR_ACS>.communication.azure.com/;accesskey=<YOUR_ACCESS_KEY>";
410
+ const routerClient = JobRouterClient(connectionString);
411
+
412
+ const workerId = "router-worker-123";
413
+ const jobId = "job-id";
414
+ const assignmentId = "assignment-id";
415
+
416
+ const closeJob = await routerClient
417
+ .path("/routing/jobs/{jobId}/assignments/{assignmentId}:close", jobId, assignmentId)
418
+ .post({
419
+ body: {
420
+ note: `Job has been closed by ${workerId} at ${new Date()}`,
421
+ },
422
+ });
370
423
  ```
371
424
 
372
425
  ## Troubleshooting
@@ -375,8 +428,8 @@ const closeJob = await routerClient.path("/routing/jobs/{jobId}/assignments/{ass
375
428
 
376
429
  Enabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:
377
430
 
378
- ```javascript
379
- const { setLogLevel } = require("@azure/logger");
431
+ ```ts snippet:SetLogLevel
432
+ import { setLogLevel } from "@azure/logger";
380
433
 
381
434
  setLogLevel("info");
382
435
  ```
@@ -0,0 +1,14 @@
1
+ import type { ClientOptions } from "@azure-rest/core-client";
2
+ import type { AzureCommunicationRoutingServiceClient } from "./clientDefinitions.js";
3
+ /** The optional parameters for the client */
4
+ export interface AzureCommunicationRoutingServiceClientOptions extends ClientOptions {
5
+ /** The api version option of the client */
6
+ apiVersion?: string;
7
+ }
8
+ /**
9
+ * Initialize a new instance of `AzureCommunicationRoutingServiceClient`
10
+ * @param endpointParam - Uri of your Communication resource
11
+ * @param options - the parameter for all optional parameters
12
+ */
13
+ export default function createClient(endpointParam: string, { apiVersion, ...options }?: AzureCommunicationRoutingServiceClientOptions): AzureCommunicationRoutingServiceClient;
14
+ //# sourceMappingURL=azureCommunicationRoutingServiceClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azureCommunicationRoutingServiceClient.d.ts","sourceRoot":"","sources":["../../src/azureCommunicationRoutingServiceClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAG7D,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,wBAAwB,CAAC;AAErF,6CAA6C;AAC7C,MAAM,WAAW,6CAA8C,SAAQ,aAAa;IAClF,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAa,EAAE,MAAM,EACrB,EACE,UAAiC,EACjC,GAAG,OAAO,EACX,GAAE,6CAAkD,GACpD,sCAAsC,CAmCxC"}
@@ -0,0 +1,40 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { __rest } from "tslib";
4
+ import { getClient } from "@azure-rest/core-client";
5
+ import { logger } from "./logger.js";
6
+ /**
7
+ * Initialize a new instance of `AzureCommunicationRoutingServiceClient`
8
+ * @param endpointParam - Uri of your Communication resource
9
+ * @param options - the parameter for all optional parameters
10
+ */
11
+ export default function createClient(endpointParam, _a = {}) {
12
+ var _b, _c, _d, _e;
13
+ var { apiVersion = "2024-01-18-preview" } = _a, options = __rest(_a, ["apiVersion"]);
14
+ const endpointUrl = (_c = (_b = options.endpoint) !== null && _b !== void 0 ? _b : options.baseUrl) !== null && _c !== void 0 ? _c : `${endpointParam}`;
15
+ const userAgentInfo = `azsdk-js-communication-job-router-rest/1.0.0-beta.1`;
16
+ const userAgentPrefix = options.userAgentOptions && options.userAgentOptions.userAgentPrefix
17
+ ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`
18
+ : `${userAgentInfo}`;
19
+ options = Object.assign(Object.assign({}, options), { userAgentOptions: {
20
+ userAgentPrefix,
21
+ }, loggingOptions: {
22
+ logger: (_e = (_d = options.loggingOptions) === null || _d === void 0 ? void 0 : _d.logger) !== null && _e !== void 0 ? _e : logger.info,
23
+ } });
24
+ const client = getClient(endpointUrl, options);
25
+ client.pipeline.removePolicy({ name: "ApiVersionPolicy" });
26
+ client.pipeline.addPolicy({
27
+ name: "ClientApiVersionPolicy",
28
+ sendRequest: (req, next) => {
29
+ // Use the apiVersion defined in request url directly
30
+ // Append one if there is no apiVersion and we have one at client options
31
+ const url = new URL(req.url);
32
+ if (!url.searchParams.get("api-version") && apiVersion) {
33
+ req.url = `${req.url}${Array.from(url.searchParams.keys()).length > 0 ? "&" : "?"}api-version=${apiVersion}`;
34
+ }
35
+ return next(req);
36
+ },
37
+ });
38
+ return client;
39
+ }
40
+ //# sourceMappingURL=azureCommunicationRoutingServiceClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azureCommunicationRoutingServiceClient.js","sourceRoot":"","sources":["../../src/azureCommunicationRoutingServiceClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;;AAGlC,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AASrC;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,aAAqB,EACrB,KAGmD,EAAE;;QAHrD,EACE,UAAU,GAAG,oBAAoB,OAEkB,EADhD,OAAO,cAFZ,cAGC,CADW;IAGZ,MAAM,WAAW,GAAG,MAAA,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC,OAAO,mCAAI,GAAG,aAAa,EAAE,CAAC;IAC9E,MAAM,aAAa,GAAG,qDAAqD,CAAC;IAC5E,MAAM,eAAe,GACnB,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,CAAC,eAAe;QAClE,CAAC,CAAC,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,IAAI,aAAa,EAAE;QAChE,CAAC,CAAC,GAAG,aAAa,EAAE,CAAC;IACzB,OAAO,mCACF,OAAO,KACV,gBAAgB,EAAE;YAChB,eAAe;SAChB,EACD,cAAc,EAAE;YACd,MAAM,EAAE,MAAA,MAAA,OAAO,CAAC,cAAc,0CAAE,MAAM,mCAAI,MAAM,CAAC,IAAI;SACtD,GACF,CAAC;IACF,MAAM,MAAM,GAAG,SAAS,CAAC,WAAW,EAAE,OAAO,CAA2C,CAAC;IAEzF,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;IAC3D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC;QACxB,IAAI,EAAE,wBAAwB;QAC9B,WAAW,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE;YACzB,qDAAqD;YACrD,yEAAyE;YACzE,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAC7B,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,UAAU,EAAE,CAAC;gBACvD,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,GAAG,GAClB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GACzD,eAAe,UAAU,EAAE,CAAC;YAC9B,CAAC;YACD,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC;QACnB,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport { getClient } from \"@azure-rest/core-client\";\nimport { logger } from \"./logger.js\";\nimport type { AzureCommunicationRoutingServiceClient } from \"./clientDefinitions.js\";\n\n/** The optional parameters for the client */\nexport interface AzureCommunicationRoutingServiceClientOptions extends ClientOptions {\n /** The api version option of the client */\n apiVersion?: string;\n}\n\n/**\n * Initialize a new instance of `AzureCommunicationRoutingServiceClient`\n * @param endpointParam - Uri of your Communication resource\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpointParam: string,\n {\n apiVersion = \"2024-01-18-preview\",\n ...options\n }: AzureCommunicationRoutingServiceClientOptions = {},\n): AzureCommunicationRoutingServiceClient {\n const endpointUrl = options.endpoint ?? options.baseUrl ?? `${endpointParam}`;\n const userAgentInfo = `azsdk-js-communication-job-router-rest/1.0.0-beta.1`;\n const userAgentPrefix =\n options.userAgentOptions && options.userAgentOptions.userAgentPrefix\n ? `${options.userAgentOptions.userAgentPrefix} ${userAgentInfo}`\n : `${userAgentInfo}`;\n options = {\n ...options,\n userAgentOptions: {\n userAgentPrefix,\n },\n loggingOptions: {\n logger: options.loggingOptions?.logger ?? logger.info,\n },\n };\n const client = getClient(endpointUrl, options) as AzureCommunicationRoutingServiceClient;\n\n client.pipeline.removePolicy({ name: \"ApiVersionPolicy\" });\n client.pipeline.addPolicy({\n name: \"ClientApiVersionPolicy\",\n sendRequest: (req, next) => {\n // Use the apiVersion defined in request url directly\n // Append one if there is no apiVersion and we have one at client options\n const url = new URL(req.url);\n if (!url.searchParams.get(\"api-version\") && apiVersion) {\n req.url = `${req.url}${\n Array.from(url.searchParams.keys()).length > 0 ? \"&\" : \"?\"\n }api-version=${apiVersion}`;\n }\n return next(req);\n },\n });\n\n return client;\n}\n"]}
@@ -0,0 +1,17 @@
1
+ import type { ClientOptions } from "@azure-rest/core-client";
2
+ import type { KeyCredential, TokenCredential } from "@azure/core-auth";
3
+ import type { AzureCommunicationRoutingServiceClient } from "./clientDefinitions.js";
4
+ /**
5
+ * Initialize a new instance of `AzureCommunicationRoutingServiceClient`
6
+ * @param connectionString - The connectionString or url of your Communication Services resource.
7
+ * @param options - the parameter for all optional parameters
8
+ */
9
+ export default function createClient(connectionString: string, options: ClientOptions): AzureCommunicationRoutingServiceClient;
10
+ /**
11
+ * Initialize a new instance of `AzureCommunicationRoutingServiceClient`
12
+ * @param endpoint - Uri of your Communication resource
13
+ * @param credentialOrOptions - The key or token credential.
14
+ * @param options - the parameter for all optional parameters
15
+ */
16
+ export default function createClient(endpoint: string, credentialOrOptions?: KeyCredential | TokenCredential, options?: ClientOptions): AzureCommunicationRoutingServiceClient;
17
+ //# sourceMappingURL=azureCommunicationRoutingServiceCustmizedClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azureCommunicationRoutingServiceCustmizedClient.d.ts","sourceRoot":"","sources":["../../src/azureCommunicationRoutingServiceCustmizedClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEvE,OAAO,KAAK,EAAE,sCAAsC,EAAE,MAAM,wBAAwB,CAAC;AAQrF;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,gBAAgB,EAAE,MAAM,EACxB,OAAO,EAAE,aAAa,GACrB,sCAAsC,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,QAAQ,EAAE,MAAM,EAChB,mBAAmB,CAAC,EAAE,aAAa,GAAG,eAAe,EACrD,OAAO,CAAC,EAAE,aAAa,GACtB,sCAAsC,CAAC"}
@@ -0,0 +1,29 @@
1
+ // Copyright (c) Microsoft Corporation.
2
+ // Licensed under the MIT License.
3
+ import { isTokenCredential } from "@azure/core-auth";
4
+ import { createCommunicationAuthPolicy, isKeyCredential, parseClientArguments, } from "@azure/communication-common";
5
+ import createGeneratedClient from "./azureCommunicationRoutingServiceClient.js";
6
+ // Implementation
7
+ export default function createClient(arg1, arg2, arg3) {
8
+ let credentialOrOptions;
9
+ let options;
10
+ const connectionStringOrUrl = arg1;
11
+ // Determine which constructor is being called based on the types of the arguments
12
+ if (isTokenCredential(arg2) || isKeyCredential(arg2)) {
13
+ credentialOrOptions = arg2;
14
+ options = arg3;
15
+ }
16
+ else {
17
+ options = arg2;
18
+ }
19
+ if (options === undefined) {
20
+ options = {};
21
+ }
22
+ // Rest of the function remains the same, using connectionStringOrUrl or endpoint as needed
23
+ const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);
24
+ const client = createGeneratedClient(url, options);
25
+ const authPolicy = createCommunicationAuthPolicy(credential);
26
+ client.pipeline.addPolicy(authPolicy);
27
+ return client;
28
+ }
29
+ //# sourceMappingURL=azureCommunicationRoutingServiceCustmizedClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"azureCommunicationRoutingServiceCustmizedClient.js","sourceRoot":"","sources":["../../src/azureCommunicationRoutingServiceCustmizedClient.ts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAIlC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EACL,6BAA6B,EAC7B,eAAe,EACf,oBAAoB,GACrB,MAAM,6BAA6B,CAAC;AACrC,OAAO,qBAAqB,MAAM,6CAA6C,CAAC;AAwBhF,iBAAiB;AACjB,MAAM,CAAC,OAAO,UAAU,YAAY,CAClC,IAAY,EACZ,IAAwD,EACxD,IAAoB;IAEpB,IAAI,mBAAgE,CAAC;IACrE,IAAI,OAAkC,CAAC;IACvC,MAAM,qBAAqB,GAAG,IAAI,CAAC;IAEnC,kFAAkF;IAClF,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;QACrD,mBAAmB,GAAG,IAAuC,CAAC;QAC9D,OAAO,GAAG,IAAqB,CAAC;IAClC,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,IAAqB,CAAC;IAClC,CAAC;IACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,GAAG,EAAE,CAAC;IACf,CAAC;IAED,2FAA2F;IAC3F,MAAM,EAAE,GAAG,EAAE,UAAU,EAAE,GAAG,oBAAoB,CAAC,qBAAqB,EAAE,mBAAmB,CAAC,CAAC;IAC7F,MAAM,MAAM,GAAG,qBAAqB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACnD,MAAM,UAAU,GAAG,6BAA6B,CAAC,UAAU,CAAC,CAAC;IAC7D,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;IAEtC,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { ClientOptions } from \"@azure-rest/core-client\";\nimport type { KeyCredential, TokenCredential } from \"@azure/core-auth\";\nimport { isTokenCredential } from \"@azure/core-auth\";\nimport type { AzureCommunicationRoutingServiceClient } from \"./clientDefinitions.js\";\nimport {\n createCommunicationAuthPolicy,\n isKeyCredential,\n parseClientArguments,\n} from \"@azure/communication-common\";\nimport createGeneratedClient from \"./azureCommunicationRoutingServiceClient.js\";\n\n/**\n * Initialize a new instance of `AzureCommunicationRoutingServiceClient`\n * @param connectionString - The connectionString or url of your Communication Services resource.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n connectionString: string,\n options: ClientOptions,\n): AzureCommunicationRoutingServiceClient;\n\n/**\n * Initialize a new instance of `AzureCommunicationRoutingServiceClient`\n * @param endpoint - Uri of your Communication resource\n * @param credentialOrOptions - The key or token credential.\n * @param options - the parameter for all optional parameters\n */\nexport default function createClient(\n endpoint: string,\n credentialOrOptions?: KeyCredential | TokenCredential,\n options?: ClientOptions,\n): AzureCommunicationRoutingServiceClient;\n\n// Implementation\nexport default function createClient(\n arg1: string,\n arg2?: ClientOptions | (KeyCredential | TokenCredential),\n arg3?: ClientOptions,\n): AzureCommunicationRoutingServiceClient {\n let credentialOrOptions: KeyCredential | TokenCredential | undefined;\n let options: ClientOptions | undefined;\n const connectionStringOrUrl = arg1;\n\n // Determine which constructor is being called based on the types of the arguments\n if (isTokenCredential(arg2) || isKeyCredential(arg2)) {\n credentialOrOptions = arg2 as KeyCredential | TokenCredential;\n options = arg3 as ClientOptions;\n } else {\n options = arg2 as ClientOptions;\n }\n if (options === undefined) {\n options = {};\n }\n\n // Rest of the function remains the same, using connectionStringOrUrl or endpoint as needed\n const { url, credential } = parseClientArguments(connectionStringOrUrl, credentialOrOptions);\n const client = createGeneratedClient(url, options);\n const authPolicy = createCommunicationAuthPolicy(credential);\n client.pipeline.addPolicy(authPolicy);\n\n return client;\n}\n"]}