From 70865b9adcc7057b58c1a520174655804f327b60 Mon Sep 17 00:00:00 2001 From: "Weiyang Ding(MSFT)" <155502284+v-weiyding@users.noreply.github.com> Date: Fri, 16 Feb 2024 00:45:49 +0800 Subject: [PATCH] Fix Communication JobRouter Sample Issues (#28517) Fixes #28124 @joheredi, @lfraleigh, @mayurid for notification. --------- Co-authored-by: Di Jiao --- .../ClassificationPolicy_Create.ts | 31 +++++++++---------- .../ClassificationPolicy_Delete.ts | 7 +++-- .../samples-dev/ClassificationPolicy_Get.ts | 13 +++----- .../samples-dev/ClassificationPolicy_List.ts | 15 ++++----- .../ClassificationPolicy_Update.ts | 8 ++--- .../samples-dev/DistributionPolicy_Create.ts | 8 +++-- .../samples-dev/DistributionPolicy_Delete.ts | 10 +++--- .../samples-dev/DistributionPolicy_Get.ts | 10 +++--- .../samples-dev/DistributionPolicy_List.ts | 14 ++++----- .../samples-dev/DistributionPolicy_Update.ts | 7 +++-- .../samples-dev/ExceptionPolicy_Create.ts | 15 ++++----- .../samples-dev/ExceptionPolicy_Delete.ts | 13 +++----- .../samples-dev/ExceptionPolicy_Get.ts | 13 +++----- .../samples-dev/ExceptionPolicy_List.ts | 13 +++----- .../samples-dev/ExceptionPolicy_Update.ts | 6 ++-- .../samples-dev/QuickStart.ts | 12 ++++--- .../samples-dev/RouterJob_Create.ts | 14 ++++----- .../samples-dev/RouterJob_Delete.ts | 13 +++----- .../samples-dev/RouterJob_Get.ts | 7 +++-- .../samples-dev/RouterJob_List.ts | 10 +++--- .../samples-dev/RouterJob_Update.ts | 7 +++-- .../samples-dev/RouterQueue_Create.ts | 8 ++--- .../samples-dev/RouterQueue_Delete.ts | 13 +++----- .../samples-dev/RouterQueue_Get.ts | 13 +++----- .../samples-dev/RouterQueue_GetStatistics.ts | 10 +++--- .../samples-dev/RouterQueue_List.ts | 11 ++++--- .../samples-dev/RouterQueue_Update.ts | 6 ++-- .../samples-dev/RouterWorker_Create.ts | 13 +++----- .../samples-dev/RouterWorker_Delete.ts | 13 +++----- .../samples-dev/RouterWorker_Get.ts | 9 +++--- .../samples-dev/RouterWorker_List.ts | 10 +++--- .../samples-dev/RouterWorker_Update.ts | 7 +++-- .../javascript/ClassificationPolicy_Create.js | 5 ++- .../javascript/ClassificationPolicy_Delete.js | 9 +++++- .../javascript/ClassificationPolicy_Get.js | 9 +++++- .../javascript/ClassificationPolicy_List.js | 11 +++++-- .../javascript/ClassificationPolicy_Update.js | 9 +++++- .../javascript/DistributionPolicy_Create.js | 9 +++++- .../javascript/DistributionPolicy_Delete.js | 9 +++++- .../javascript/DistributionPolicy_Get.js | 9 +++++- .../javascript/DistributionPolicy_List.js | 5 +-- .../javascript/DistributionPolicy_Update.js | 9 +++++- .../javascript/ExceptionPolicy_Create.js | 8 ++++- .../javascript/ExceptionPolicy_Delete.js | 8 ++++- .../v1-beta/javascript/ExceptionPolicy_Get.js | 8 ++++- .../javascript/ExceptionPolicy_List.js | 5 +-- .../javascript/ExceptionPolicy_Update.js | 8 ++++- .../samples/v1-beta/javascript/QuickStart.js | 11 ++++--- .../v1-beta/javascript/RouterJob_Create.js | 8 ++++- .../v1-beta/javascript/RouterJob_Delete.js | 8 ++++- .../v1-beta/javascript/RouterJob_Get.js | 8 ++++- .../v1-beta/javascript/RouterJob_List.js | 5 +-- .../v1-beta/javascript/RouterJob_Update.js | 3 +- .../v1-beta/javascript/RouterQueue_Create.js | 8 ++++- .../v1-beta/javascript/RouterQueue_Delete.js | 8 ++++- .../v1-beta/javascript/RouterQueue_Get.js | 8 ++++- .../javascript/RouterQueue_GetStatistics.js | 9 +++++- .../v1-beta/javascript/RouterQueue_List.js | 5 +-- .../v1-beta/javascript/RouterQueue_Update.js | 3 +- .../v1-beta/javascript/RouterWorker_Create.js | 8 ++++- .../v1-beta/javascript/RouterWorker_Delete.js | 8 ++++- .../v1-beta/javascript/RouterWorker_Get.js | 9 ++++-- .../v1-beta/javascript/RouterWorker_List.js | 5 +-- .../v1-beta/javascript/RouterWorker_Update.js | 3 +- .../src/ClassificationPolicy_Create.ts | 31 +++++++++---------- .../src/ClassificationPolicy_Delete.ts | 7 +++-- .../src/ClassificationPolicy_Get.ts | 13 +++----- .../src/ClassificationPolicy_List.ts | 15 ++++----- .../src/ClassificationPolicy_Update.ts | 8 ++--- .../src/DistributionPolicy_Create.ts | 8 +++-- .../src/DistributionPolicy_Delete.ts | 10 +++--- .../typescript/src/DistributionPolicy_Get.ts | 10 +++--- .../typescript/src/DistributionPolicy_List.ts | 14 ++++----- .../src/DistributionPolicy_Update.ts | 7 +++-- .../typescript/src/ExceptionPolicy_Create.ts | 15 ++++----- .../typescript/src/ExceptionPolicy_Delete.ts | 13 +++----- .../typescript/src/ExceptionPolicy_Get.ts | 13 +++----- .../typescript/src/ExceptionPolicy_List.ts | 13 +++----- .../typescript/src/ExceptionPolicy_Update.ts | 6 ++-- .../v1-beta/typescript/src/QuickStart.ts | 12 ++++--- .../typescript/src/RouterJob_Create.ts | 14 ++++----- .../typescript/src/RouterJob_Delete.ts | 13 +++----- .../v1-beta/typescript/src/RouterJob_Get.ts | 7 +++-- .../v1-beta/typescript/src/RouterJob_List.ts | 10 +++--- .../typescript/src/RouterJob_Update.ts | 7 +++-- .../typescript/src/RouterQueue_Create.ts | 8 ++--- .../typescript/src/RouterQueue_Delete.ts | 13 +++----- .../v1-beta/typescript/src/RouterQueue_Get.ts | 13 +++----- .../src/RouterQueue_GetStatistics.ts | 10 +++--- .../typescript/src/RouterQueue_List.ts | 11 ++++--- .../typescript/src/RouterQueue_Update.ts | 6 ++-- .../typescript/src/RouterWorker_Create.ts | 13 +++----- .../typescript/src/RouterWorker_Delete.ts | 13 +++----- .../typescript/src/RouterWorker_Get.ts | 9 +++--- .../typescript/src/RouterWorker_List.ts | 10 +++--- .../typescript/src/RouterWorker_Update.ts | 7 +++-- 96 files changed, 533 insertions(+), 423 deletions(-) diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Create.ts b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Create.ts index bec9bea9766..29262438065 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Create.ts @@ -5,12 +5,10 @@ import * as dotenv from "dotenv"; /** * @summary Classification policy crud */ -import { - QueueLengthExceptionTrigger -} from "../src"; - -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; +import JobRouter, { + QueueLengthExceptionTrigger, + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; dotenv.config(); @@ -49,15 +47,15 @@ async function createClassificationPolicy(): Promise { body: { name: "test-policy", exceptionRules: [{ - id: "MaxWaitTimeExceeded", - actions: [{ - kind: "reclassify", - classificationPolicyId: "Main", - labelsToUpsert: { - escalated: true, - }, - }], - trigger: queueLengthExceptionTrigger, + id: "MaxWaitTimeExceeded", + actions: [{ + kind: "reclassify", + classificationPolicyId: "Main", + labelsToUpsert: { + escalated: true, + }, + }], + trigger: queueLengthExceptionTrigger, }] } }) @@ -98,7 +96,6 @@ async function createClassificationPolicy(): Promise { } }) - const result = await routerClient.path("/routing/classificationPolicies/{classificationPolicyId}", classificationPolicyId).patch({ contentType: "application/merge-patch+json", body: { @@ -107,7 +104,7 @@ async function createClassificationPolicy(): Promise { queueSelectorAttachments: [ { kind: "conditional", - queueSelectors : [{ + queueSelectors: [{ key: "foo", labelOperator: "equal", value: { default: 10 }, diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Delete.ts b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Delete.ts index 439e20b0415..e685fafcc21 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Delete.ts @@ -5,12 +5,13 @@ /** * @summary Classification policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Delete classification policy async function deleteClassificationPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Get.ts b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Get.ts index 25f7f3d3d85..2e593305e54 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Get.ts @@ -4,17 +4,14 @@ /** * @summary Classification policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Get a classification policy async function getClassificationPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_List.ts b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_List.ts index 3306dda5332..35add20dfba 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_List.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_List.ts @@ -4,17 +4,15 @@ /** * @summary Classification policy crud */ -import { - AzureCommunicationRoutingServiceClient -} from "../src"; -import JobRouter from "../src"; -import { paginate } from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient, + paginate +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - // List classification policies async function listClassificationPolicies(): Promise { // Create the Router Client @@ -24,7 +22,7 @@ async function listClassificationPolicies(): Promise { // let pagesCount = 1; const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/classificationPolicies").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/classificationPolicies").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. @@ -36,7 +34,6 @@ async function listClassificationPolicies(): Promise { } } - } listClassificationPolicies().catch(console.error); diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Update.ts b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Update.ts index 1bcf7530b8a..2639fabc16e 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ClassificationPolicy_Update.ts @@ -4,13 +4,13 @@ /** * @summary Classification policy crud */ -import { +import JobRouter, { AzureCommunicationRoutingServiceClient, -} from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a classification policy async function updateClassificationPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Create.ts b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Create.ts index 8adb8bb6b18..4b2642f2609 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Create.ts @@ -5,9 +5,12 @@ */ -import { AzureCommunicationRoutingServiceClient } from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Create an distribution policy @@ -16,7 +19,6 @@ async function createDistributionPolicy(): Promise { const routerClient: AzureCommunicationRoutingServiceClient = JobRouter(connectionString); - const id = "distribution-policy-123"; const result = await routerClient.path("/routing/distributionPolicies/{distributionPolicyId}", id).patch({ contentType: "application/merge-patch+json", diff --git a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Delete.ts b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Delete.ts index 60888d007f1..eb29349c0bc 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Delete.ts @@ -5,14 +5,14 @@ */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // Delete distribution policy async function deleteDistributionPolicy(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Get.ts b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Get.ts index 17f82022f78..fb274ccfc6b 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Get.ts @@ -5,14 +5,14 @@ */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // Get a distribution policy async function getDistributionPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_List.ts b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_List.ts index 50f04eb796e..5fd95065937 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_List.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_List.ts @@ -5,17 +5,15 @@ */ -import { - AzureCommunicationRoutingServiceClient, paginate -} from "../src"; -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient, + paginate +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // List distribution policies async function listDistributionPolicies(): Promise { // Create the Router Client @@ -24,7 +22,7 @@ async function listDistributionPolicies(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/distributionPolicies").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/distributionPolicies").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Update.ts b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Update.ts index 91082fba432..c65935dc048 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/DistributionPolicy_Update.ts @@ -5,11 +5,12 @@ */ -import { +import JobRouter, { AzureCommunicationRoutingServiceClient, -} from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a distribution policy diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Create.ts b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Create.ts index 5989fce3d4e..af77e7bae8f 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Create.ts @@ -3,18 +3,15 @@ /** * @summary Exception policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient, + QueueLengthExceptionTrigger +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - -import { QueueLengthExceptionTrigger } from "../src"; - - - - // Create an exception policy async function createExceptionPolicy(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Delete.ts b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Delete.ts index 7a98182ebbf..aed2576f232 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Delete.ts @@ -3,17 +3,14 @@ /** * @summary Exception policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Delete exception policy async function deleteExceptionPolicy(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Get.ts b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Get.ts index 398b341371f..b461493de37 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Get.ts @@ -3,17 +3,14 @@ /** * @summary Exception policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Get a exception policy async function getExceptionPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_List.ts b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_List.ts index d6ac34e0b4e..f355e290b1e 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_List.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_List.ts @@ -6,18 +6,15 @@ -import { - AzureCommunicationRoutingServiceClient, +import JobRouter, { + AzureCommunicationRoutingServiceClient, paginate -} from "../src"; -import JobRouter from "../src"; +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // List exception policies async function listExceptionPolicies(): Promise { // Create the Router Client @@ -26,7 +23,7 @@ async function listExceptionPolicies(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/exceptionPolicies").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/exceptionPolicies").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Update.ts b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Update.ts index abc94163d20..e5e8f8ac184 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/ExceptionPolicy_Update.ts @@ -4,11 +4,11 @@ * @summary Exception policy crud */ -import { +import JobRouter, { QueueLengthExceptionTrigger, AzureCommunicationRoutingServiceClient, -} from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; diff --git a/sdk/communication/communication-job-router-rest/samples-dev/QuickStart.ts b/sdk/communication/communication-job-router-rest/samples-dev/QuickStart.ts index f58ba455222..3116d360863 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/QuickStart.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/QuickStart.ts @@ -3,20 +3,22 @@ /** * @summary Quick start workflow for creating queue, job and worker, routing/matching job with worker */ -import JobRouter, { RouterWorkerOutput } from "../src"; +import JobRouter, { + RouterWorkerOutput, + AzureCommunicationRoutingServiceClient, + AcceptJobOfferResultOutput, + RouterJobOutput +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; -import { AcceptJobOfferResultOutput, RouterJobOutput } from "../src"; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; async function quickStart(): Promise { // Create the Router Client const routerClient: AzureCommunicationRoutingServiceClient = JobRouter(connectionString); - // Create a Distribution Policy const distributionPolicyId = "distribution-policy-123"; await routerClient.path("/routing/distributionPolicies/{distributionPolicyId}", distributionPolicyId).patch({ diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Create.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Create.ts index a9e8a5b67a7..2ef9cc882b7 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Create.ts @@ -3,17 +3,15 @@ /** * @summary router job crud */ -import { AzureCommunicationRoutingServiceClient, QueueLengthExceptionTrigger } from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient, + QueueLengthExceptionTrigger +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Create a router job async function createRouterJob(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Delete.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Delete.ts index 83d7684097d..6ef5ac115e7 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Delete.ts @@ -3,17 +3,14 @@ /** * @summary router job crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Delete router job async function deleteRouterJob(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Get.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Get.ts index 47ad7c53346..96462330aee 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Get.ts @@ -3,9 +3,12 @@ /** * @summary router job crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Get a router job diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_List.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_List.ts index 0c11aea26eb..a4ac94a1eae 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_List.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_List.ts @@ -3,12 +3,14 @@ /** * @summary router job crud */ -import JobRouter, { paginate } from "../src"; +import JobRouter, { + paginate, + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List exception policies async function listRouterJobs(): Promise { @@ -18,7 +20,7 @@ async function listRouterJobs(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/jobs").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/jobs").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Update.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Update.ts index af4f463a2d2..1c2e1b042a0 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterJob_Update.ts @@ -3,11 +3,13 @@ /** * @summary router job crud */ -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; // Update a router job async function updateRouterJob(): Promise { @@ -26,7 +28,6 @@ async function updateRouterJob(): Promise { } }) - const jobId = "router-job-123"; const result = await routerClient.path("/routing/jobs/{jobId}", jobId).patch({ contentType: "application/merge-patch+json", diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Create.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Create.ts index b126f3a39e8..561d6c626e2 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Create.ts @@ -3,13 +3,13 @@ /** * @summary job queue crud */ -import { +import JobRouter, { AzureCommunicationRoutingServiceClient, -} from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Create a router jobQueue async function createJobQueue(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Delete.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Delete.ts index 3de2ff6291b..26d57b1027e 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Delete.ts @@ -3,17 +3,14 @@ /** * @summary job queue crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Delete router jobQueue async function deleteJobQueue(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Get.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Get.ts index 33577e424e0..086be0aca66 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Get.ts @@ -3,17 +3,14 @@ /** * @summary job queue crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Get a router jobQueue async function getJobQueue(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_GetStatistics.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_GetStatistics.ts index 79dcae6fbf6..9a2b05e1b78 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_GetStatistics.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_GetStatistics.ts @@ -6,14 +6,14 @@ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // Get a router jobQueue's statistics async function getJobQueueStatistics(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_List.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_List.ts index 34a29954315..2c0f5e44194 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_List.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_List.ts @@ -3,13 +3,14 @@ /** * @summary job queue crud */ -import JobRouter, { paginate } from "../src"; +import JobRouter, { + paginate, + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; - - // List exception policies async function listJobQueues(): Promise { @@ -19,7 +20,7 @@ async function listJobQueues(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/queues").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/queues").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Update.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Update.ts index 20ae9247186..d15672edfce 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterQueue_Update.ts @@ -3,11 +3,13 @@ /** * @summary job queue crud */ -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; // Update a router jobQueue async function updateJobQueue(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Create.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Create.ts index 37ccfbd367b..76114640cf7 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Create.ts @@ -3,17 +3,14 @@ /** * @summary router worker crud */ -import { AzureCommunicationRoutingServiceClient } from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Create a router worker async function createRouterWorker(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Delete.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Delete.ts index b453ffea39c..e95fa8ca593 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Delete.ts @@ -3,17 +3,14 @@ /** * @summary router worker crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router" +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Delete router worker async function deleteRouterWorker(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Get.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Get.ts index 6ed3749451d..32c6da924dd 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Get.ts @@ -3,14 +3,15 @@ /** * @summary router worker crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - // Get a router worker - async function getRouterWorker(): Promise { // Create the Router Client const routerClient: AzureCommunicationRoutingServiceClient = diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_List.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_List.ts index 13c989dfb0d..48b13f8ab71 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_List.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_List.ts @@ -3,12 +3,14 @@ /** * @summary router worker crud */ -import JobRouter, { paginate } from "../src"; +import JobRouter, { + paginate, + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List exception policies async function listRouterWorkers(): Promise { @@ -18,7 +20,7 @@ async function listRouterWorkers(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/queues").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/queues").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Update.ts b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Update.ts index 34f36bbb747..1b5e79dfd90 100644 --- a/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples-dev/RouterWorker_Update.ts @@ -3,12 +3,13 @@ /** * @summary router worker crud */ -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a router worker async function updateRouterWorker(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Create.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Create.js index 3867e055c9c..5abd575782b 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Create.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Create.js @@ -2,7 +2,10 @@ // Licensed under the MIT License. const dotenv = require("dotenv"); -const JobRouter = require("../src").default; +/** + * @summary Classification policy crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; dotenv.config(); diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Delete.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Delete.js index 3e38ca9cc5c..71f33b62692 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Delete.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Delete.js @@ -1,5 +1,12 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Classification policy crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Delete classification policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Get.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Get.js index 1e7e650b660..2c953bfa8ca 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Get.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Get.js @@ -1,5 +1,12 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Classification policy crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Get a classification policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_List.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_List.js index 76c2da614e0..85061a8aa1b 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_List.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_List.js @@ -1,6 +1,13 @@ -const JobRouter = require("../src").default; -const { paginate } = require("../src"); +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Classification policy crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default, + { paginate } = require("@azure-rest/communication-job-router"); require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List classification policies diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Update.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Update.js index ce1da1afd41..d9a024ba8f1 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Update.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ClassificationPolicy_Update.js @@ -1,5 +1,12 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +/** + * @summary Classification policy crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a classification policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Create.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Create.js index 44bbef70ff2..fa0b465eba2 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Create.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Create.js @@ -1,5 +1,12 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary Distribution policy crud + */ + +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Create an distribution policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Delete.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Delete.js index bc08d5d1970..7bf75819aaf 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Delete.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Delete.js @@ -1,5 +1,12 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary Distribution policy crud + */ + +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Delete distribution policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Get.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Get.js index c72c3ad8628..2c078a6e584 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Get.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Get.js @@ -1,5 +1,12 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary Distribution policy crud + */ + +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Get a distribution policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_List.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_List.js index 6086cc82253..199c728f104 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_List.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_List.js @@ -4,9 +4,10 @@ * @summary Distribution policy crud */ -const { paginate } = require("../src"); -const JobRouter = require("../src").default; +const { paginate } = require("@azure-rest/communication-job-router"); +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List distribution policies diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Update.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Update.js index 474ae19aa8d..a7b4a17a702 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Update.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/DistributionPolicy_Update.js @@ -1,5 +1,12 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary Distribution policy crud + */ + +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a distribution policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Create.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Create.js index ef3a8d84514..c7e8b9446b2 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Create.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Create.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary Exception policy crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Create an exception policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Delete.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Delete.js index 7e1520c417b..19540a656d2 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Delete.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Delete.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary Exception policy crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Delete exception policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Get.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Get.js index 23da5c8649c..1e8d7b941b6 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Get.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Get.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary Exception policy crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Get a exception policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_List.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_List.js index 8fba68bee03..6cc4e8114fa 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_List.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_List.js @@ -4,9 +4,10 @@ * @summary Exception policy crud */ -const { paginate } = require("../src"); -const JobRouter = require("../src").default; +const { paginate } = require("@azure-rest/communication-job-router"); +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List exception policies diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Update.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Update.js index 04ea55ebb4d..393434debc4 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Update.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/ExceptionPolicy_Update.js @@ -1,4 +1,10 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary Exception policy crud + */ + +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/QuickStart.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/QuickStart.js index db49460c025..1f7e192485b 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/QuickStart.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/QuickStart.js @@ -3,8 +3,9 @@ /** * @summary Quick start workflow for creating queue, job and worker, routing/matching job with worker */ -const JobRouter = require("../src").default; +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; async function quickStart() { @@ -114,7 +115,7 @@ async function quickStart() { console.log(`Offer: ${jobOffer.offerId} sent to worker: ${workerId} has been accepted`); console.log( - `Job has been assigned to worker: ${workerId} with assignment: ${acceptJobOfferResult.assignmentId}` + `Job has been assigned to worker: ${workerId} with assignment: ${acceptJobOfferResult.assignmentId}`, ); // verify job assignment is populated when querying job @@ -136,7 +137,7 @@ async function quickStart() { .path( "/routing/jobs/{jobId}/assignments/{assignmentId}:complete", jobId, - acceptJobOfferResult.assignmentId + acceptJobOfferResult.assignmentId, ) .post({ body: { @@ -153,7 +154,7 @@ async function quickStart() { .path( "/routing/jobs/{jobId}/assignments/{assignmentId}:close", jobId, - acceptJobOfferResult.assignmentId + acceptJobOfferResult.assignmentId, ) .post({ body: { @@ -169,7 +170,7 @@ async function quickStart() { .path( "/routing/jobs/{jobId}/assignments/{assignmentId}:close", jobId, - acceptJobOfferResult.assignmentId + acceptJobOfferResult.assignmentId, ) .post({ body: { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Create.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Create.js index 364d748bd54..7e09ad55c95 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Create.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Create.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary router job crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Create a router job diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Delete.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Delete.js index 264f71a9a11..37b4dc29634 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Delete.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Delete.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary router job crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Delete router job diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Get.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Get.js index cdc0b9ef843..3081917bbc1 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Get.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Get.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary router job crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Get a router job diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_List.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_List.js index c76ea038b2e..849eaef5171 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_List.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_List.js @@ -3,9 +3,10 @@ /** * @summary router job crud */ -const JobRouter = require("../src").default, - { paginate } = require("../src"); +const JobRouter = require("@azure-rest/communication-job-router").default, + { paginate } = require("@azure-rest/communication-job-router"); require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List exception policies diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Update.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Update.js index d0cd3684436..8384e5d0741 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Update.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterJob_Update.js @@ -3,8 +3,9 @@ /** * @summary router job crud */ -const JobRouter = require("../src").default; +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a router job diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Create.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Create.js index 2af7c79dcac..6ad3c4ab33f 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Create.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Create.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary job queue crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Create a router jobQueue diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Delete.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Delete.js index 27a12b23981..e28a32e3a74 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Delete.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Delete.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary job queue crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Delete router jobQueue diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Get.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Get.js index b94ecf86c80..9a30c08111c 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Get.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Get.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary job queue crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Get a router jobQueue diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_GetStatistics.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_GetStatistics.js index 2be218a1e42..73df2cd1f5b 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_GetStatistics.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_GetStatistics.js @@ -1,5 +1,12 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary job queue crud + */ + +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Get a router jobQueue's statistics diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_List.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_List.js index a45433c0dfd..3a75ea593e4 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_List.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_List.js @@ -3,9 +3,10 @@ /** * @summary job queue crud */ -const JobRouter = require("../src").default, - { paginate } = require("../src"); +const JobRouter = require("@azure-rest/communication-job-router").default, + { paginate } = require("@azure-rest/communication-job-router"); require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List exception policies diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Update.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Update.js index f0a6e7cca15..04c9960289a 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Update.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterQueue_Update.js @@ -3,8 +3,9 @@ /** * @summary job queue crud */ -const JobRouter = require("../src").default; +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a router jobQueue diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Create.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Create.js index 0f8904eb078..9035b810b6d 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Create.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Create.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary router worker crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Create a router worker diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Delete.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Delete.js index 105f2895301..8fd74c24779 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Delete.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Delete.js @@ -1,5 +1,11 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary router worker crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Delete router worker diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Get.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Get.js index 0ea0c1265c7..03a69906185 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Get.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Get.js @@ -1,9 +1,14 @@ -const JobRouter = require("../src").default; +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. +/** + * @summary router worker crud + */ +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Get a router worker - async function getRouterWorker() { // Create the Router Client const routerClient = JobRouter(connectionString); diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_List.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_List.js index 5c84f02203e..2f00526c893 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_List.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_List.js @@ -3,9 +3,10 @@ /** * @summary router worker crud */ -const JobRouter = require("../src").default, - { paginate } = require("../src"); +const JobRouter = require("@azure-rest/communication-job-router").default, + { paginate } = require("@azure-rest/communication-job-router"); require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List exception policies diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Update.js b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Update.js index 5c18abb8f40..d08e7a526ed 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Update.js +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/javascript/RouterWorker_Update.js @@ -3,8 +3,9 @@ /** * @summary router worker crud */ -const JobRouter = require("../src").default; +const JobRouter = require("@azure-rest/communication-job-router").default; require("dotenv").config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a router worker diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Create.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Create.ts index bec9bea9766..29262438065 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Create.ts @@ -5,12 +5,10 @@ import * as dotenv from "dotenv"; /** * @summary Classification policy crud */ -import { - QueueLengthExceptionTrigger -} from "../src"; - -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; +import JobRouter, { + QueueLengthExceptionTrigger, + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; dotenv.config(); @@ -49,15 +47,15 @@ async function createClassificationPolicy(): Promise { body: { name: "test-policy", exceptionRules: [{ - id: "MaxWaitTimeExceeded", - actions: [{ - kind: "reclassify", - classificationPolicyId: "Main", - labelsToUpsert: { - escalated: true, - }, - }], - trigger: queueLengthExceptionTrigger, + id: "MaxWaitTimeExceeded", + actions: [{ + kind: "reclassify", + classificationPolicyId: "Main", + labelsToUpsert: { + escalated: true, + }, + }], + trigger: queueLengthExceptionTrigger, }] } }) @@ -98,7 +96,6 @@ async function createClassificationPolicy(): Promise { } }) - const result = await routerClient.path("/routing/classificationPolicies/{classificationPolicyId}", classificationPolicyId).patch({ contentType: "application/merge-patch+json", body: { @@ -107,7 +104,7 @@ async function createClassificationPolicy(): Promise { queueSelectorAttachments: [ { kind: "conditional", - queueSelectors : [{ + queueSelectors: [{ key: "foo", labelOperator: "equal", value: { default: 10 }, diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Delete.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Delete.ts index 439e20b0415..e685fafcc21 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Delete.ts @@ -5,12 +5,13 @@ /** * @summary Classification policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Delete classification policy async function deleteClassificationPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Get.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Get.ts index 25f7f3d3d85..2e593305e54 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Get.ts @@ -4,17 +4,14 @@ /** * @summary Classification policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Get a classification policy async function getClassificationPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_List.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_List.ts index 3306dda5332..35add20dfba 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_List.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_List.ts @@ -4,17 +4,15 @@ /** * @summary Classification policy crud */ -import { - AzureCommunicationRoutingServiceClient -} from "../src"; -import JobRouter from "../src"; -import { paginate } from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient, + paginate +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - // List classification policies async function listClassificationPolicies(): Promise { // Create the Router Client @@ -24,7 +22,7 @@ async function listClassificationPolicies(): Promise { // let pagesCount = 1; const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/classificationPolicies").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/classificationPolicies").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. @@ -36,7 +34,6 @@ async function listClassificationPolicies(): Promise { } } - } listClassificationPolicies().catch(console.error); diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Update.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Update.ts index 1bcf7530b8a..2639fabc16e 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ClassificationPolicy_Update.ts @@ -4,13 +4,13 @@ /** * @summary Classification policy crud */ -import { +import JobRouter, { AzureCommunicationRoutingServiceClient, -} from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a classification policy async function updateClassificationPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Create.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Create.ts index 8adb8bb6b18..4b2642f2609 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Create.ts @@ -5,9 +5,12 @@ */ -import { AzureCommunicationRoutingServiceClient } from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Create an distribution policy @@ -16,7 +19,6 @@ async function createDistributionPolicy(): Promise { const routerClient: AzureCommunicationRoutingServiceClient = JobRouter(connectionString); - const id = "distribution-policy-123"; const result = await routerClient.path("/routing/distributionPolicies/{distributionPolicyId}", id).patch({ contentType: "application/merge-patch+json", diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Delete.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Delete.ts index 60888d007f1..eb29349c0bc 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Delete.ts @@ -5,14 +5,14 @@ */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // Delete distribution policy async function deleteDistributionPolicy(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Get.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Get.ts index 17f82022f78..fb274ccfc6b 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Get.ts @@ -5,14 +5,14 @@ */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // Get a distribution policy async function getDistributionPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_List.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_List.ts index 50f04eb796e..5fd95065937 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_List.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_List.ts @@ -5,17 +5,15 @@ */ -import { - AzureCommunicationRoutingServiceClient, paginate -} from "../src"; -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient, + paginate +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // List distribution policies async function listDistributionPolicies(): Promise { // Create the Router Client @@ -24,7 +22,7 @@ async function listDistributionPolicies(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/distributionPolicies").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/distributionPolicies").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Update.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Update.ts index 91082fba432..c65935dc048 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/DistributionPolicy_Update.ts @@ -5,11 +5,12 @@ */ -import { +import JobRouter, { AzureCommunicationRoutingServiceClient, -} from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a distribution policy diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Create.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Create.ts index 5989fce3d4e..af77e7bae8f 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Create.ts @@ -3,18 +3,15 @@ /** * @summary Exception policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient, + QueueLengthExceptionTrigger +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - -import { QueueLengthExceptionTrigger } from "../src"; - - - - // Create an exception policy async function createExceptionPolicy(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Delete.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Delete.ts index 7a98182ebbf..aed2576f232 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Delete.ts @@ -3,17 +3,14 @@ /** * @summary Exception policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Delete exception policy async function deleteExceptionPolicy(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Get.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Get.ts index 398b341371f..b461493de37 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Get.ts @@ -3,17 +3,14 @@ /** * @summary Exception policy crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Get a exception policy async function getExceptionPolicy(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_List.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_List.ts index d6ac34e0b4e..f355e290b1e 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_List.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_List.ts @@ -6,18 +6,15 @@ -import { - AzureCommunicationRoutingServiceClient, +import JobRouter, { + AzureCommunicationRoutingServiceClient, paginate -} from "../src"; -import JobRouter from "../src"; +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // List exception policies async function listExceptionPolicies(): Promise { // Create the Router Client @@ -26,7 +23,7 @@ async function listExceptionPolicies(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/exceptionPolicies").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/exceptionPolicies").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Update.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Update.ts index abc94163d20..e5e8f8ac184 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/ExceptionPolicy_Update.ts @@ -4,11 +4,11 @@ * @summary Exception policy crud */ -import { +import JobRouter, { QueueLengthExceptionTrigger, AzureCommunicationRoutingServiceClient, -} from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/QuickStart.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/QuickStart.ts index f58ba455222..3116d360863 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/QuickStart.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/QuickStart.ts @@ -3,20 +3,22 @@ /** * @summary Quick start workflow for creating queue, job and worker, routing/matching job with worker */ -import JobRouter, { RouterWorkerOutput } from "../src"; +import JobRouter, { + RouterWorkerOutput, + AzureCommunicationRoutingServiceClient, + AcceptJobOfferResultOutput, + RouterJobOutput +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; -import { AcceptJobOfferResultOutput, RouterJobOutput } from "../src"; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; async function quickStart(): Promise { // Create the Router Client const routerClient: AzureCommunicationRoutingServiceClient = JobRouter(connectionString); - // Create a Distribution Policy const distributionPolicyId = "distribution-policy-123"; await routerClient.path("/routing/distributionPolicies/{distributionPolicyId}", distributionPolicyId).patch({ diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Create.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Create.ts index a9e8a5b67a7..2ef9cc882b7 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Create.ts @@ -3,17 +3,15 @@ /** * @summary router job crud */ -import { AzureCommunicationRoutingServiceClient, QueueLengthExceptionTrigger } from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient, + QueueLengthExceptionTrigger +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Create a router job async function createRouterJob(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Delete.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Delete.ts index 83d7684097d..6ef5ac115e7 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Delete.ts @@ -3,17 +3,14 @@ /** * @summary router job crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Delete router job async function deleteRouterJob(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Get.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Get.ts index 47ad7c53346..96462330aee 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Get.ts @@ -3,9 +3,12 @@ /** * @summary router job crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Get a router job diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_List.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_List.ts index 0c11aea26eb..a4ac94a1eae 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_List.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_List.ts @@ -3,12 +3,14 @@ /** * @summary router job crud */ -import JobRouter, { paginate } from "../src"; +import JobRouter, { + paginate, + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List exception policies async function listRouterJobs(): Promise { @@ -18,7 +20,7 @@ async function listRouterJobs(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/jobs").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/jobs").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Update.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Update.ts index af4f463a2d2..1c2e1b042a0 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterJob_Update.ts @@ -3,11 +3,13 @@ /** * @summary router job crud */ -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; // Update a router job async function updateRouterJob(): Promise { @@ -26,7 +28,6 @@ async function updateRouterJob(): Promise { } }) - const jobId = "router-job-123"; const result = await routerClient.path("/routing/jobs/{jobId}", jobId).patch({ contentType: "application/merge-patch+json", diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Create.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Create.ts index b126f3a39e8..561d6c626e2 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Create.ts @@ -3,13 +3,13 @@ /** * @summary job queue crud */ -import { +import JobRouter, { AzureCommunicationRoutingServiceClient, -} from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Create a router jobQueue async function createJobQueue(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Delete.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Delete.ts index 3de2ff6291b..26d57b1027e 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Delete.ts @@ -3,17 +3,14 @@ /** * @summary job queue crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Delete router jobQueue async function deleteJobQueue(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Get.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Get.ts index 33577e424e0..086be0aca66 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Get.ts @@ -3,17 +3,14 @@ /** * @summary job queue crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Get a router jobQueue async function getJobQueue(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_GetStatistics.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_GetStatistics.ts index 79dcae6fbf6..9a2b05e1b78 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_GetStatistics.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_GetStatistics.ts @@ -6,14 +6,14 @@ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - // Get a router jobQueue's statistics async function getJobQueueStatistics(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_List.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_List.ts index 34a29954315..2c0f5e44194 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_List.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_List.ts @@ -3,13 +3,14 @@ /** * @summary job queue crud */ -import JobRouter, { paginate } from "../src"; +import JobRouter, { + paginate, + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; - - // List exception policies async function listJobQueues(): Promise { @@ -19,7 +20,7 @@ async function listJobQueues(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/queues").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/queues").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Update.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Update.ts index 20ae9247186..d15672edfce 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterQueue_Update.ts @@ -3,11 +3,13 @@ /** * @summary job queue crud */ -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; // Update a router jobQueue async function updateJobQueue(): Promise { diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Create.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Create.ts index 37ccfbd367b..76114640cf7 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Create.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Create.ts @@ -3,17 +3,14 @@ /** * @summary router worker crud */ -import { AzureCommunicationRoutingServiceClient } from "../src"; -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Create a router worker async function createRouterWorker(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Delete.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Delete.ts index b453ffea39c..e95fa8ca593 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Delete.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Delete.ts @@ -3,17 +3,14 @@ /** * @summary router worker crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router" +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - - - - - - // Delete router worker async function deleteRouterWorker(): Promise { // Create the Router Client diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Get.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Get.ts index 6ed3749451d..32c6da924dd 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Get.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Get.ts @@ -3,14 +3,15 @@ /** * @summary router worker crud */ -import { AzureCommunicationRoutingServiceClient } from "../src" -import JobRouter from "../src"; import * as dotenv from "dotenv"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; +import * as dotenv from "dotenv"; dotenv.config(); + const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; - // Get a router worker - async function getRouterWorker(): Promise { // Create the Router Client const routerClient: AzureCommunicationRoutingServiceClient = diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_List.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_List.ts index 13c989dfb0d..48b13f8ab71 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_List.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_List.ts @@ -3,12 +3,14 @@ /** * @summary router worker crud */ -import JobRouter, { paginate } from "../src"; +import JobRouter, { + paginate, + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // List exception policies async function listRouterWorkers(): Promise { @@ -18,7 +20,7 @@ async function listRouterWorkers(): Promise { const maxPageSize = 3; // Get the first page which also contains information on how to get the next page. - const initialResponse = await routerClient.path("/routing/queues").get({ queryParameters: { maxpagesize: maxPageSize} }) + const initialResponse = await routerClient.path("/routing/queues").get({ queryParameters: { maxpagesize: maxPageSize } }) if (initialResponse.status == "200") { // The paginate helper creates a paged async iterator using metadata from the first page. diff --git a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Update.ts b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Update.ts index 34f36bbb747..1b5e79dfd90 100644 --- a/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Update.ts +++ b/sdk/communication/communication-job-router-rest/samples/v1-beta/typescript/src/RouterWorker_Update.ts @@ -3,12 +3,13 @@ /** * @summary router worker crud */ -import JobRouter from "../src"; +import JobRouter, { + AzureCommunicationRoutingServiceClient +} from "@azure-rest/communication-job-router"; import * as dotenv from "dotenv"; dotenv.config(); -const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; -import { AzureCommunicationRoutingServiceClient } from "../src"; +const connectionString = process.env["COMMUNICATION_CONNECTION_STRING"] || ""; // Update a router worker async function updateRouterWorker(): Promise {