From 4eb3310424b85a7f8b9585467ad6a4c3e232243a Mon Sep 17 00:00:00 2001 From: Rajarshi Sarkar Date: Wed, 12 Jul 2023 15:30:48 -0700 Subject: [PATCH 1/3] missing usage of Azure.Etag in RouterQueueItem --- ...zure.Communication.JobRouter.netstandard2.0.cs | 3 +-- .../CommunicationJobRouterModelFactory.cs | 9 --------- .../src/Generated/Models/RouterQueueItem.cs | 4 +--- .../src/Models/RouterQueueItem.cs | 15 +++++++++++++++ 4 files changed, 17 insertions(+), 14 deletions(-) diff --git a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs index 6d9d83e1d3823..5de9e988e71b5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs @@ -768,7 +768,6 @@ public static partial class CommunicationJobRouterModelFactory public static Azure.Communication.JobRouter.Models.AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) { throw null; } public static Azure.Communication.JobRouter.Models.RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, System.DateTimeOffset assignedAt = default(System.DateTimeOffset), System.DateTimeOffset? completedAt = default(System.DateTimeOffset?), System.DateTimeOffset? closedAt = default(System.DateTimeOffset?)) { throw null; } public static Azure.Communication.JobRouter.Models.RouterJobOffer RouterJobOffer(string offerId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset? offeredAt = default(System.DateTimeOffset?), System.DateTimeOffset? expiresAt = default(System.DateTimeOffset?)) { throw null; } - public static Azure.Communication.JobRouter.Models.RouterQueueItem RouterQueueItem(Azure.Communication.JobRouter.Models.RouterQueue queue = null, string etag = null) { throw null; } public static Azure.Communication.JobRouter.Models.RouterQueueStatistics RouterQueueStatistics(string queueId = null, int length = 0, System.Collections.Generic.IReadOnlyDictionary estimatedWaitTimeMinutes = null, double? longestJobWaitTimeMinutes = default(double?)) { throw null; } public static Azure.Communication.JobRouter.Models.RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset assignedAt = default(System.DateTimeOffset)) { throw null; } public static Azure.Communication.JobRouter.Models.UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = 0) { throw null; } @@ -912,7 +911,7 @@ internal RouterQueue() { } public partial class RouterQueueItem { internal RouterQueueItem() { } - public string Etag { get { throw null; } } + public Azure.ETag ETag { get { throw null; } } public Azure.Communication.JobRouter.Models.RouterQueue Queue { get { throw null; } } } public partial class RouterQueueStatistics diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs index 31906d9af2f7a..fdde257d05637 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs @@ -64,15 +64,6 @@ public static AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = nu return new AcceptJobOfferResult(assignmentId, jobId, workerId); } - /// Initializes a new instance of RouterQueueItem. - /// A queue that can contain jobs to be routed. - /// (Optional) The Concurrency Token. - /// A new instance for mocking. - public static RouterQueueItem RouterQueueItem(RouterQueue queue = null, string etag = null) - { - return new RouterQueueItem(queue, etag); - } - /// Initializes a new instance of RouterQueueStatistics. /// Id of the queue these details are about. /// Length of the queue: total number of enqueued jobs. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs index 5d8b29a49114e..500f148cb4116 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs @@ -21,12 +21,10 @@ internal RouterQueueItem() internal RouterQueueItem(RouterQueue queue, string etag) { Queue = queue; - Etag = etag; + _etag = etag; } /// A queue that can contain jobs to be routed. public RouterQueue Queue { get; } - /// (Optional) The Concurrency Token. - public string Etag { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs index 24eb8cefeccd9..74e300c47ab1e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs @@ -8,5 +8,20 @@ namespace Azure.Communication.JobRouter.Models [CodeGenModel("RouterQueueItem")] public partial class RouterQueueItem { + [CodeGenMember("Etag")] + internal string _etag + { + get + { + return ETag.ToString(); + } + set + { + ETag = new ETag(value); + } + } + + /// (Optional) The Concurrency Token. + public ETag ETag { get; internal set; } } } From 363aee1ef90f45abab587c62cfb18382c29704fe Mon Sep 17 00:00:00 2001 From: Rajarshi Sarkar Date: Wed, 12 Jul 2023 16:25:42 -0700 Subject: [PATCH 2/3] remove empty classes --- .../Azure.Communication.JobRouter/README.md | 10 ++--- ....Communication.JobRouter.netstandard2.0.cs | 40 +++++-------------- .../samples/RouterJobCrud.md | 8 ++-- .../samples/RouterJobCrudAsync.md | 8 ++-- .../samples/Sample1_HelloWorld.md | 10 ++--- .../samples/Sample1_HelloWorldAsync.md | 10 ++--- .../src/JobRouterClient.cs | 40 +++++++++---------- .../src/Models/CancelJobResult.cs | 21 ---------- .../src/Models/CloseJobResult.cs | 22 ---------- .../src/Models/CompleteJobResult.cs | 22 ---------- .../src/Models/DeclineJobOfferResult.cs | 22 ---------- .../src/Models/ReclassifyJobResult.cs | 18 --------- .../tests/Samples/RouterJobCrudOps.cs | 8 ++-- .../tests/Samples/RouterJobCrudOpsAsync.cs | 8 ++-- .../tests/Samples/Sample1_KeyConcepts.cs | 10 ++--- .../tests/Samples/Sample1_KeyConceptsAsync.cs | 10 ++--- .../tests/Scenarios/AssignmentScenario.cs | 4 +- .../tests/Scenarios/SchedulingScenario.cs | 4 +- 18 files changed, 75 insertions(+), 200 deletions(-) delete mode 100644 sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobResult.cs delete mode 100644 sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobResult.cs delete mode 100644 sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobResult.cs delete mode 100644 sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferResult.cs delete mode 100644 sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobResult.cs diff --git a/sdk/communication/Azure.Communication.JobRouter/README.md b/sdk/communication/Azure.Communication.JobRouter/README.md index 3b3ea81c7fbca..781aa35921c7e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/README.md +++ b/sdk/communication/Azure.Communication.JobRouter/README.md @@ -203,7 +203,7 @@ Console.WriteLine($"Job assignment has been successful: {updatedJob.Value.Status ### Completing a job Once the worker is done with the job, the worker has to mark the job as `completed`. ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob_Async -Response completeJob = await routerClient.CompleteJobAsync( +Response completeJob = await routerClient.CompleteJobAsync( options: new CompleteJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) @@ -211,20 +211,20 @@ Response completeJob = await routerClient.CompleteJobAsync( Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); -Console.WriteLine($"Job has been successfully completed: {completeJob.GetRawResponse().Status == 200}"); +Console.WriteLine($"Job has been successfully completed: {completeJob.Status == 200}"); ``` ### Closing a job After a job has been completed, the worker can perform wrap up actions to the job before closing the job and finally releasing its capacity to accept more incoming jobs ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob_Async -Response closeJob = await routerClient.CloseJobAsync( +Response closeJob = await routerClient.CloseJobAsync( options: new CloseJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); -Console.WriteLine($"Job has been successfully closed: {closeJob.GetRawResponse().Status == 200}"); +Console.WriteLine($"Job has been successfully closed: {closeJob.Status == 200}"); updatedJob = await routerClient.GetJobAsync(job.Value.Id); Console.WriteLine($"Updated job status: {updatedJob.Value.Status == RouterJobStatus.Closed}"); @@ -238,7 +238,7 @@ var closeJobInFuture = await routerClient.CloseJobAsync( CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); -Console.WriteLine($"Job has been marked to close: {closeJob.GetRawResponse().Status == 202}"); // You'll received a 202 in that case +Console.WriteLine($"Job has been marked to close: {closeJob.Status == 202}"); // You'll received a 202 in that case await Task.Delay(TimeSpan.FromSeconds(2)); diff --git a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs index 5de9e988e71b5..d042a0e0ee9fb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs @@ -311,20 +311,20 @@ public JobRouterClient(System.Uri endpoint, Azure.AzureKeyCredential credential, public JobRouterClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Communication.JobRouter.JobRouterClientOptions options = null) { } public virtual Azure.Response AcceptJobOffer(string workerId, string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> AcceptJobOfferAsync(string workerId, string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CancelJob(Azure.Communication.JobRouter.CancelJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CancelJobAsync(Azure.Communication.JobRouter.CancelJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CloseJob(Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CloseJobAsync(Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CompleteJob(Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CompleteJobAsync(Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CancelJob(Azure.Communication.JobRouter.CancelJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelJobAsync(Azure.Communication.JobRouter.CancelJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CloseJob(Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CloseJobAsync(Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CompleteJob(Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CompleteJobAsync(Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateJob(Azure.Communication.JobRouter.CreateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateJobAsync(Azure.Communication.JobRouter.CreateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateJobWithClassificationPolicy(Azure.Communication.JobRouter.CreateJobWithClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateJobWithClassificationPolicyAsync(Azure.Communication.JobRouter.CreateJobWithClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CreateWorker(Azure.Communication.JobRouter.CreateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> CreateWorkerAsync(Azure.Communication.JobRouter.CreateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeclineJobOffer(Azure.Communication.JobRouter.DeclineJobOfferOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> DeclineJobOfferAsync(Azure.Communication.JobRouter.DeclineJobOfferOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeclineJobOffer(Azure.Communication.JobRouter.DeclineJobOfferOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeclineJobOfferAsync(Azure.Communication.JobRouter.DeclineJobOfferOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeleteJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteJobAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeleteWorker(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -341,8 +341,8 @@ public JobRouterClient(System.Uri endpoint, Azure.Core.TokenCredential credentia public virtual System.Threading.Tasks.Task> GetWorkerAsync(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetWorkers(Azure.Communication.JobRouter.GetWorkersOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetWorkersAsync(Azure.Communication.JobRouter.GetWorkersOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response ReclassifyJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ReclassifyJobAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ReclassifyJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task ReclassifyJobAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response UnassignJob(Azure.Communication.JobRouter.UnassignJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> UnassignJobAsync(Azure.Communication.JobRouter.UnassignJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response UpdateJob(Azure.Communication.JobRouter.UpdateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -739,10 +739,6 @@ internal AcceptJobOfferResult() { } public string JobId { get { throw null; } } public string WorkerId { get { throw null; } } } - public partial class CancelJobResult - { - internal CancelJobResult() { } - } public partial class ClassificationPolicy { internal ClassificationPolicy() { } @@ -759,10 +755,6 @@ internal ClassificationPolicyItem() { } public Azure.Communication.JobRouter.Models.ClassificationPolicy ClassificationPolicy { get { throw null; } } public Azure.ETag ETag { get { throw null; } } } - public partial class CloseJobResult - { - internal CloseJobResult() { } - } public static partial class CommunicationJobRouterModelFactory { public static Azure.Communication.JobRouter.Models.AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) { throw null; } @@ -772,14 +764,6 @@ public static partial class CommunicationJobRouterModelFactory public static Azure.Communication.JobRouter.Models.RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset assignedAt = default(System.DateTimeOffset)) { throw null; } public static Azure.Communication.JobRouter.Models.UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = 0) { throw null; } } - public partial class CompleteJobResult - { - internal CompleteJobResult() { } - } - public partial class DeclineJobOfferResult - { - internal DeclineJobOfferResult() { } - } public partial class DistributionPolicy { internal DistributionPolicy() { } @@ -807,10 +791,6 @@ internal ExceptionPolicyItem() { } public Azure.ETag ETag { get { throw null; } } public Azure.Communication.JobRouter.Models.ExceptionPolicy ExceptionPolicy { get { throw null; } } } - public partial class ReclassifyJobResult - { - internal ReclassifyJobResult() { } - } public partial class RouterJob { internal RouterJob() { } diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md index 13dae897de613..e68cd503bbcf7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md @@ -110,7 +110,7 @@ Console.WriteLine($"Job has been successfully updated. 'ChannelReference' has be ## Reclassify a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob -Response reclassifyJob = routerClient.ReclassifyJob(jobWithCpId); +Response reclassifyJob = routerClient.ReclassifyJob(jobWithCpId); ``` ## Accept a job offer @@ -156,7 +156,7 @@ Console.WriteLine($"Job has been successfully assigned with a worker with assign ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeclineJobOffer // A worker can also choose to decline an offer -Response declineOffer = routerClient.DeclineJobOffer(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); +Response declineOffer = routerClient.DeclineJobOffer(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); ``` ## Complete a job @@ -164,7 +164,7 @@ Response declineOffer = routerClient.DeclineJobOffer(new ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CompleteRouterJob // Once a worker completes the job, it needs to mark the job as completed -Response completedJobResult = routerClient.CompleteJob(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); +Response completedJobResult = routerClient.CompleteJob(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); queriedJob = routerClient.GetJob(jobId); Console.WriteLine($"Job has been successfully completed. Current status: {queriedJob.Value.Status}"); // "Completed" @@ -173,7 +173,7 @@ Console.WriteLine($"Job has been successfully completed. Current status: {querie ## Close a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CloseRouterJob -Response closeJobResult = routerClient.CloseJob(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); +Response closeJobResult = routerClient.CloseJob(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); queriedJob = routerClient.GetJob(jobId); Console.WriteLine($"Job has been successfully closed. Current status: {queriedJob.Value.Status}"); // "Closed" diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md index ae01f33e278b4..af8c6bcdd45f7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md @@ -111,7 +111,7 @@ Console.WriteLine($"Job has been successfully updated. 'ChannelReference' has be ## Reclassify a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob_Async -Response reclassifyJob = await routerClient.ReclassifyJobAsync(jobWithCpId); +Response reclassifyJob = await routerClient.ReclassifyJobAsync(jobWithCpId); ``` ## Accept a job offer @@ -157,7 +157,7 @@ Console.WriteLine($"Job has been successfully assigned with a worker with assign ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeclineJobOffer_Async // A worker can also choose to decline an offer -Response declineOffer = await routerClient.DeclineJobOfferAsync(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); +Response declineOffer = await routerClient.DeclineJobOfferAsync(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); ``` ## Complete a job @@ -165,7 +165,7 @@ Response declineOffer = await routerClient.DeclineJobOffe ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CompleteRouterJob_Async // Once a worker completes the job, it needs to mark the job as completed -Response completedJobResult = await routerClient.CompleteJobAsync(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); +Response completedJobResult = await routerClient.CompleteJobAsync(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); queriedJob = await routerClient.GetJobAsync(jobId); Console.WriteLine($"Job has been successfully completed. Current status: {queriedJob.Value.Status}"); // "Completed" @@ -174,7 +174,7 @@ Console.WriteLine($"Job has been successfully completed. Current status: {querie ## Close a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CloseRouterJob_Async -Response closeJobResult = await routerClient.CloseJobAsync(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); +Response closeJobResult = await routerClient.CloseJobAsync(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); queriedJob = await routerClient.GetJobAsync(jobId); Console.WriteLine($"Job has been successfully closed. Current status: {queriedJob.Value.Status}"); // "Closed" diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md index 5bb90a704f737..ffb619d910b24 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md @@ -153,7 +153,7 @@ Console.WriteLine($"Job assignment has been successful: {updatedJob.Value.Status Once the worker is done with the job, the worker has to mark the job as `completed`. ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob -Response completeJob = routerClient.CompleteJob( +Response completeJob = routerClient.CompleteJob( options: new CompleteJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) @@ -161,7 +161,7 @@ Response completeJob = routerClient.CompleteJob( Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); -Console.WriteLine($"Job has been successfully completed: {completeJob.GetRawResponse().Status == 200}"); +Console.WriteLine($"Job has been successfully completed: {completeJob.Status == 200}"); ``` ## Closing a job @@ -169,14 +169,14 @@ Console.WriteLine($"Job has been successfully completed: {completeJob.GetRawResp After a job has been completed, the worker can perform wrap up actions to the job before closing the job and finally releasing its capacity to accept more incoming jobs ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob -Response closeJob = routerClient.CloseJob( +Response closeJob = routerClient.CloseJob( options: new CloseJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); -Console.WriteLine($"Job has been successfully closed: {closeJob.GetRawResponse().Status == 200}"); +Console.WriteLine($"Job has been successfully closed: {closeJob.Status == 200}"); updatedJob = routerClient.GetJob(job.Value.Id); Console.WriteLine($"Updated job status: {updatedJob.Value.Status == RouterJobStatus.Closed}"); @@ -190,7 +190,7 @@ var closeJobInFuture = routerClient.CloseJob( CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); -Console.WriteLine($"Job has been marked to close: {closeJob.GetRawResponse().Status == 202}"); // You'll received a 202 in that case +Console.WriteLine($"Job has been marked to close: {closeJob.Status == 202}"); // You'll received a 202 in that case Thread.Sleep(TimeSpan.FromSeconds(2)); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md index 301390b87dbe0..b627df0702599 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md @@ -153,7 +153,7 @@ Console.WriteLine($"Job assignment has been successful: {updatedJob.Value.Status Once the worker is done with the job, the worker has to mark the job as `completed`. ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob_Async -Response completeJob = await routerClient.CompleteJobAsync( +Response completeJob = await routerClient.CompleteJobAsync( options: new CompleteJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) @@ -161,7 +161,7 @@ Response completeJob = await routerClient.CompleteJobAsync( Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); -Console.WriteLine($"Job has been successfully completed: {completeJob.GetRawResponse().Status == 200}"); +Console.WriteLine($"Job has been successfully completed: {completeJob.Status == 200}"); ``` ## Closing a job @@ -169,14 +169,14 @@ Console.WriteLine($"Job has been successfully completed: {completeJob.GetRawResp After a job has been completed, the worker can perform wrap up actions to the job before closing the job and finally releasing its capacity to accept more incoming jobs ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob_Async -Response closeJob = await routerClient.CloseJobAsync( +Response closeJob = await routerClient.CloseJobAsync( options: new CloseJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); -Console.WriteLine($"Job has been successfully closed: {closeJob.GetRawResponse().Status == 200}"); +Console.WriteLine($"Job has been successfully closed: {closeJob.Status == 200}"); updatedJob = await routerClient.GetJobAsync(job.Value.Id); Console.WriteLine($"Updated job status: {updatedJob.Value.Status == RouterJobStatus.Closed}"); @@ -190,7 +190,7 @@ var closeJobInFuture = await routerClient.CloseJobAsync( CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); -Console.WriteLine($"Job has been marked to close: {closeJob.GetRawResponse().Status == 202}"); // You'll received a 202 in that case +Console.WriteLine($"Job has been marked to close: {closeJob.Status == 202}"); // You'll received a 202 in that case await Task.Delay(TimeSpan.FromSeconds(2)); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClient.cs index 802113e62711d..a520b61baa5af 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClient.cs @@ -540,7 +540,7 @@ public virtual Response GetJob(string jobId, CancellationToken cancel /// (Optional) The cancellation token to use. /// ///The server returned an error. See for details returned from the server. - public virtual async Task> ReclassifyJobAsync( + public virtual async Task ReclassifyJobAsync( string jobId, CancellationToken cancellationToken = default) { @@ -553,7 +553,7 @@ public virtual async Task> ReclassifyJobAsync( var response = await RestClient.ReclassifyJobActionAsync( id: jobId, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ReclassifyJobResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { @@ -567,7 +567,7 @@ public virtual async Task> ReclassifyJobAsync( /// (Optional) The cancellation token to use. /// ///The server returned an error. See for details returned from the server. - public virtual Response ReclassifyJob( + public virtual Response ReclassifyJob( string jobId, CancellationToken cancellationToken = default) { @@ -580,7 +580,7 @@ public virtual Response ReclassifyJob( var response = RestClient.ReclassifyJobAction( id: jobId, cancellationToken: cancellationToken); - return Response.FromValue(new ReclassifyJobResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { @@ -593,7 +593,7 @@ public virtual Response ReclassifyJob( /// Options for cancelling a job. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual async Task> CancelJobAsync( + public virtual async Task CancelJobAsync( CancelJobOptions options, CancellationToken cancellationToken = default) { @@ -607,7 +607,7 @@ public virtual async Task> CancelJobAsync( dispositionCode: options.DispositionCode, cancellationToken: cancellationToken) .ConfigureAwait(false); - return Response.FromValue(new CancelJobResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { @@ -620,7 +620,7 @@ public virtual async Task> CancelJobAsync( /// Options for cancelling a job. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual Response CancelJob( + public virtual Response CancelJob( CancelJobOptions options, CancellationToken cancellationToken = default) { @@ -633,7 +633,7 @@ public virtual Response CancelJob( note: options.Note, dispositionCode: options.DispositionCode, cancellationToken: cancellationToken); - return Response.FromValue(new CancelJobResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { @@ -646,7 +646,7 @@ public virtual Response CancelJob( /// Options for completing a job. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual async Task> CompleteJobAsync( + public virtual async Task CompleteJobAsync( CompleteJobOptions options, CancellationToken cancellationToken = default) { @@ -661,7 +661,7 @@ public virtual async Task> CompleteJobAsync( cancellationToken: cancellationToken) .ConfigureAwait(false); - return Response.FromValue(new CompleteJobResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { @@ -674,7 +674,7 @@ public virtual async Task> CompleteJobAsync( /// Options for completing a job. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual Response CompleteJob( + public virtual Response CompleteJob( CompleteJobOptions options, CancellationToken cancellationToken = default) { @@ -688,7 +688,7 @@ public virtual Response CompleteJob( note: options.Note, cancellationToken: cancellationToken); - return Response.FromValue(new CompleteJobResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { @@ -701,7 +701,7 @@ public virtual Response CompleteJob( /// Options for closing a job. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual async Task> CloseJobAsync( + public virtual async Task CloseJobAsync( CloseJobOptions options, CancellationToken cancellationToken = default) { @@ -717,7 +717,7 @@ public virtual async Task> CloseJobAsync( note: options.Note, cancellationToken: cancellationToken) .ConfigureAwait(false); - return Response.FromValue(new CloseJobResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { @@ -730,7 +730,7 @@ public virtual async Task> CloseJobAsync( /// Options for closing a job. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual Response CloseJob( + public virtual Response CloseJob( CloseJobOptions options, CancellationToken cancellationToken = default) { @@ -745,7 +745,7 @@ public virtual Response CloseJob( closeAt: options.CloseAt, note: options.Note, cancellationToken: cancellationToken); - return Response.FromValue(new CloseJobResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { @@ -1045,7 +1045,7 @@ public virtual Response AcceptJobOffer( /// The options for declining a job offer. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual async Task> DeclineJobOfferAsync(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) + public virtual async Task DeclineJobOfferAsync(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeclineJobOffer)}"); scope.Start(); @@ -1058,7 +1058,7 @@ public virtual async Task> DeclineJobOfferAsync( cancellationToken: cancellationToken) .ConfigureAwait(false); - return Response.FromValue(new DeclineJobOfferResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { @@ -1071,7 +1071,7 @@ public virtual async Task> DeclineJobOfferAsync( /// The options for declining a job offer. /// (Optional) The cancellation token to use. /// The server returned an error. See for details returned from the server. - public virtual Response DeclineJobOffer(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) + public virtual Response DeclineJobOffer(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) { using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeclineJobOffer)}"); scope.Start(); @@ -1083,7 +1083,7 @@ public virtual Response DeclineJobOffer(DeclineJobOfferOp declineJobOfferRequest: new DeclineJobOfferRequest { RetryOfferAt = options.RetryOfferAt }, cancellationToken: cancellationToken); - return Response.FromValue(new DeclineJobOfferResult(), response.GetRawResponse()); + return response.GetRawResponse(); } catch (Exception ex) { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobResult.cs deleted file mode 100644 index f1d9360423c33..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobResult.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// - /// Response received after successful job cancellation. - /// - public class CancelJobResult - { - /// - /// Internal constructor. - /// - internal CancelJobResult() - { - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobResult.cs deleted file mode 100644 index 7551fbec10791..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobResult.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Azure.Communication.JobRouter.Models -{ - /// - /// Response received after successful job closure. - /// - public class CloseJobResult - { - /// - /// Internal constructor. - /// - internal CloseJobResult() - { - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobResult.cs deleted file mode 100644 index 4d597b9e96045..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobResult.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Azure.Communication.JobRouter.Models -{ - /// - /// Response received after successful job completion. - /// - public class CompleteJobResult - { - /// - /// Internal constructor. - /// - internal CompleteJobResult() - { - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferResult.cs deleted file mode 100644 index 94d2d2fd9ddc0..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferResult.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Text; - -namespace Azure.Communication.JobRouter.Models -{ - /// - /// Response received after declining job offer. - /// - public class DeclineJobOfferResult - { - /// - /// Public constructor. - /// - internal DeclineJobOfferResult() - { - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobResult.cs deleted file mode 100644 index 0b463dcbd99b1..0000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobResult.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Communication.JobRouter.Models -{ - /// - /// Placeholder response from job reclassification. - /// - public class ReclassifyJobResult - { - /// - /// Internal constructor. - /// - internal ReclassifyJobResult() - { - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs index 00643ad83f3a8..fc8559d82ee93 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs @@ -115,7 +115,7 @@ public void RouterCrudOps() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob - Response reclassifyJob = routerClient.ReclassifyJob(jobWithCpId); + Response reclassifyJob = routerClient.ReclassifyJob(jobWithCpId); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob @@ -161,7 +161,7 @@ public void RouterCrudOps() // A worker can also choose to decline an offer - Response declineOffer = routerClient.DeclineJobOffer(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); + Response declineOffer = routerClient.DeclineJobOffer(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeclineJobOffer @@ -169,7 +169,7 @@ public void RouterCrudOps() // Once a worker completes the job, it needs to mark the job as completed - Response completedJobResult = routerClient.CompleteJob(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); + Response completedJobResult = routerClient.CompleteJob(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); queriedJob = routerClient.GetJob(jobId); Console.WriteLine($"Job has been successfully completed. Current status: {queriedJob.Value.Status}"); // "Completed" @@ -178,7 +178,7 @@ public void RouterCrudOps() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CloseRouterJob - Response closeJobResult = routerClient.CloseJob(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); + Response closeJobResult = routerClient.CloseJob(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); queriedJob = routerClient.GetJob(jobId); Console.WriteLine($"Job has been successfully closed. Current status: {queriedJob.Value.Status}"); // "Closed" diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs index 1965814a75483..7f5dbac689aa9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs @@ -116,7 +116,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob_Async - Response reclassifyJob = await routerClient.ReclassifyJobAsync(jobWithCpId); + Response reclassifyJob = await routerClient.ReclassifyJobAsync(jobWithCpId); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob_Async @@ -162,7 +162,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib // A worker can also choose to decline an offer - Response declineOffer = await routerClient.DeclineJobOfferAsync(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); + Response declineOffer = await routerClient.DeclineJobOfferAsync(new DeclineJobOfferOptions(worker.Value.Id, issuedOffer.OfferId)); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_DeclineJobOffer_Async @@ -170,7 +170,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib // Once a worker completes the job, it needs to mark the job as completed - Response completedJobResult = await routerClient.CompleteJobAsync(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); + Response completedJobResult = await routerClient.CompleteJobAsync(new CompleteJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); queriedJob = await routerClient.GetJobAsync(jobId); Console.WriteLine($"Job has been successfully completed. Current status: {queriedJob.Value.Status}"); // "Completed" @@ -179,7 +179,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_CloseRouterJob_Async - Response closeJobResult = await routerClient.CloseJobAsync(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); + Response closeJobResult = await routerClient.CloseJobAsync(new CloseJobOptions(jobId, acceptedJobOffer.Value.AssignmentId)); queriedJob = await routerClient.GetJobAsync(jobId); Console.WriteLine($"Job has been successfully closed. Current status: {queriedJob.Value.Status}"); // "Closed" diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs index 576466c954507..86ee703af77f7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs @@ -105,7 +105,7 @@ public void BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob - Response completeJob = routerClient.CompleteJob( + Response completeJob = routerClient.CompleteJob( options: new CompleteJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) @@ -113,20 +113,20 @@ public void BasicScenario() Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); - Console.WriteLine($"Job has been successfully completed: {completeJob.GetRawResponse().Status == 200}"); + Console.WriteLine($"Job has been successfully completed: {completeJob.Status == 200}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob - Response closeJob = routerClient.CloseJob( + Response closeJob = routerClient.CloseJob( options: new CloseJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); - Console.WriteLine($"Job has been successfully closed: {closeJob.GetRawResponse().Status == 200}"); + Console.WriteLine($"Job has been successfully closed: {closeJob.Status == 200}"); updatedJob = routerClient.GetJob(job.Value.Id); Console.WriteLine($"Updated job status: {updatedJob.Value.Status == RouterJobStatus.Closed}"); @@ -142,7 +142,7 @@ public void BasicScenario() CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); - Console.WriteLine($"Job has been marked to close: {closeJob.GetRawResponse().Status == 202}"); // You'll received a 202 in that case + Console.WriteLine($"Job has been marked to close: {closeJob.Status == 202}"); // You'll received a 202 in that case Thread.Sleep(TimeSpan.FromSeconds(2)); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs index aa7bc8d7deb93..7569fa51c2225 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs @@ -104,7 +104,7 @@ public async Task BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob_Async - Response completeJob = await routerClient.CompleteJobAsync( + Response completeJob = await routerClient.CompleteJobAsync( options: new CompleteJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) @@ -112,20 +112,20 @@ public async Task BasicScenario() Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); - Console.WriteLine($"Job has been successfully completed: {completeJob.GetRawResponse().Status == 200}"); + Console.WriteLine($"Job has been successfully completed: {completeJob.Status == 200}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_CompleteJob_Async #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJob_Async - Response closeJob = await routerClient.CloseJobAsync( + Response closeJob = await routerClient.CloseJobAsync( options: new CloseJobOptions( jobId: job.Value.Id, assignmentId: acceptJobOfferResult.Value.AssignmentId) { Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); - Console.WriteLine($"Job has been successfully closed: {closeJob.GetRawResponse().Status == 200}"); + Console.WriteLine($"Job has been successfully closed: {closeJob.Status == 200}"); updatedJob = await routerClient.GetJobAsync(job.Value.Id); Console.WriteLine($"Updated job status: {updatedJob.Value.Status == RouterJobStatus.Closed}"); @@ -140,7 +140,7 @@ public async Task BasicScenario() CloseAt = DateTimeOffset.UtcNow.AddSeconds(2), // this will mark the job as closed after 2 seconds Note = $"Job has been marked to close in the future by {worker.Value.Id} at {DateTimeOffset.UtcNow}" }); - Console.WriteLine($"Job has been marked to close: {closeJob.GetRawResponse().Status == 202}"); // You'll received a 202 in that case + Console.WriteLine($"Job has been marked to close: {closeJob.Status == 202}"); // You'll received a 202 in that case await Task.Delay(TimeSpan.FromSeconds(2)); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs index 850b0a6aa648d..efc58db27eccd 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs @@ -81,13 +81,13 @@ public async Task Scenario() { Note = $"Job completed by {workerId1}" }); - Assert.AreEqual(200, complete.GetRawResponse().Status); + Assert.AreEqual(200, complete.Status); var close = await client.CloseJobAsync(new CloseJobOptions(createJob.Value.Id, accept.Value.AssignmentId) { Note = $"Job closed by {workerId1}" }); - Assert.AreEqual(200, complete.GetRawResponse().Status); + Assert.AreEqual(200, complete.Status); var finalJobState = await client.GetJobAsync(createJob.Value.Id); Assert.IsNotNull(finalJobState.Value.Assignments[accept.Value.AssignmentId].AssignedAt); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs index 8c9c12088c8a4..9eb8791fe76ea 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs @@ -102,13 +102,13 @@ await client.UpdateJobAsync(new UpdateJobOptions(jobId) { Note = $"Job completed by {workerId1}" }); - Assert.AreEqual(200, complete.GetRawResponse().Status); + Assert.AreEqual(200, complete.Status); var close = await client.CloseJobAsync(new CloseJobOptions(createJob.Value.Id, accept.Value.AssignmentId) { Note = $"Job closed by {workerId1}" }); - Assert.AreEqual(200, complete.GetRawResponse().Status); + Assert.AreEqual(200, complete.Status); var finalJobState = await client.GetJobAsync(createJob.Value.Id); Assert.IsNotNull(finalJobState.Value.Assignments[accept.Value.AssignmentId].AssignedAt); From c4ef39c496d38ec545d728fa689581857f196079 Mon Sep 17 00:00:00 2001 From: Rajarshi Sarkar Date: Wed, 12 Jul 2023 16:48:19 -0700 Subject: [PATCH 3/3] remove setter of ScheduleAndSuspendMode from JobMatchingMode --- .../api/Azure.Communication.JobRouter.netstandard2.0.cs | 2 +- .../src/Generated/Models/JobMatchingMode.Serialization.cs | 2 +- .../src/Generated/Models/JobMatchingMode.cs | 2 -- .../src/Models/JobMatchingMode.cs | 3 +++ 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs index d042a0e0ee9fb..9e7feca510799 100644 --- a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs @@ -224,7 +224,7 @@ public JobMatchingMode(Azure.Communication.JobRouter.ScheduleAndSuspendMode sche public JobMatchingMode(Azure.Communication.JobRouter.SuspendMode suspendMode) { } public Azure.Communication.JobRouter.JobMatchModeType? ModeType { get { throw null; } } public Azure.Communication.JobRouter.QueueAndMatchMode QueueAndMatchMode { get { throw null; } } - public Azure.Communication.JobRouter.ScheduleAndSuspendMode ScheduleAndSuspendMode { get { throw null; } set { } } + public Azure.Communication.JobRouter.ScheduleAndSuspendMode ScheduleAndSuspendMode { get { throw null; } } public Azure.Communication.JobRouter.SuspendMode SuspendMode { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs index 625c953cd5e56..0717ffcb5c16d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs @@ -48,7 +48,7 @@ internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element) { continue; } - scheduleAndSuspendMode = ScheduleAndSuspendMode.DeserializeScheduleAndSuspendMode(property.Value); + scheduleAndSuspendMode = JobRouter.ScheduleAndSuspendMode.DeserializeScheduleAndSuspendMode(property.Value); continue; } if (property.NameEquals("suspendMode"u8)) diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs index 661bad37254d2..84205d1b33a55 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs @@ -22,7 +22,5 @@ internal JobMatchingMode(JobMatchModeType? modeType, object queueAndMatchMode, S ScheduleAndSuspendMode = scheduleAndSuspendMode; _suspendMode = suspendMode; } - /// Gets or sets the schedule and suspend mode. - public ScheduleAndSuspendMode ScheduleAndSuspendMode { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs index 720116d620e18..5a97e01d5b52e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs @@ -75,6 +75,9 @@ internal object _suspendMode } } + /// Gets or sets the schedule and suspend mode. + public ScheduleAndSuspendMode ScheduleAndSuspendMode { get; internal set; } + void global::Azure.Core.IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject();