Skip to content

Commit

Permalink
[JobRouter] Regenerate from specs (Azure#39739)
Browse files Browse the repository at this point in the history
* [JobRouter] Regenerate from specs

* Add test records

* Regenerate with latest, update docs
  • Loading branch information
williamzhao87 authored Nov 8, 2023
1 parent bfaf0bc commit da1a85c
Show file tree
Hide file tree
Showing 104 changed files with 2,001 additions and 3,075 deletions.
20 changes: 0 additions & 20 deletions sdk/communication/Azure.Communication.JobRouter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,6 @@
- `GetWorkers` returns `AsyncPageable<RouterWorker>` rather than `AsyncPageable<RouterJobWorker>`
- `UpdateJob(UpdateJobOptions options, CancellationToken cancellationToken)` changed to `UpdateJob(RouterJob job, CancellationToken cancellationToken)`
- `UpdateWorker(UpdateWorkerOptions options, CancellationToken cancellationToken)` changed to `UpdateWorker(RouterWorker worker, CancellationToken cancellationToken)`
- `CancelJob(CancelJobOptions options, CancellationToken cancellationToken = default)` changed to `CancelJob(string jobId, CancelJobOptions cancelJobOptions = null, CancellationToken cancellationToken = default)`
- `CompleteJob(CompleteJobOptions options, CancellationToken cancellationToken = default)` changed to `CompleteJob(string jobId, CompleteJobOptions completeJobOptions = null, CancellationToken cancellationToken = default)`
- `CloseJob(CloseJobOptions options, CancellationToken cancellationToken = default)` changed to `CloseJob(string jobId, CloseJobOptions closeJobOptions = null, CancellationToken cancellationToken = default)`
- `DeclineJobOffer(DeclineJobOfferOptions options, CancellationToken cancellationToken = default)` changed to `DeclineJobOffer(string workerId, string offerId, DeclineJobOfferOptions declineJobOfferOptions = null, CancellationToken cancellationToken = default)`
- `UnassignJob(UnassignJobOptions options, CancellationToken cancellationToken = default)` changed to `UnassignJob(string jobId, string assignmentId, UnassignJobOptions unassignJobOptions = null, CancellationToken cancellationToken = default)`

#### CancelJobOptions
- Changed constructor from `CancelJobOptions(string jobId)` to `CancelJobOptions()`

#### CompleteJobOptions
- Changed constructor from `CompleteJobOptions(string jobId, string assignmentId)` to `CompleteJobOptions(string assignmentId)`

#### CloseJobOptions
- Changed constructor from `CloseJobOptions(string jobId, string assignmentId)` to `CloseJobOptions(string assignmentId)`

#### DeclineJobOfferOptions
- Changed constructor from `DeclineJobOfferOptions(string workerId, string offerId)` to `DeclineJobOfferOptions()`

#### UnassignJobOptions
- Changed constructor from `UnassignJobOptions(string jobId, string assignmentId)` to `UnassignJobOptions()`

#### RouterJob && CreateJobOptions && CreateJobWithClassificationOptions
- Property `Notes` - Changed from `List<RouterJobNote>` to `IList<RouterJobNote>`
Expand Down
9 changes: 3 additions & 6 deletions sdk/communication/Azure.Communication.JobRouter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,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(
jobId: job.Value.Id, new CompleteJobOptions(acceptJobOfferResult.Value.AssignmentId)
Response completeJob = await routerClient.CompleteJobAsync(new CompleteJobOptions(job.Value.Id, acceptJobOfferResult.Value.AssignmentId)
{
Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}"
});
Expand All @@ -214,8 +213,7 @@ Console.WriteLine($"Job has been successfully completed: {completeJob.Status ==
### 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(
jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId)
Response closeJob = await routerClient.CloseJobAsync(new CloseJobOptions(job.Value.Id, acceptJobOfferResult.Value.AssignmentId)
{
Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}"
});
Expand All @@ -227,8 +225,7 @@ Console.WriteLine($"Updated job status: {updatedJob.Value.Status == RouterJobSta

```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CloseJobInFuture_Async
// Optionally, a job can also be set up to be marked as closed in the future.
var closeJobInFuture = await routerClient.CloseJobAsync(
jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId)
var closeJobInFuture = await routerClient.CloseJobAsync(new CloseJobOptions(job.Value.Id, acceptJobOfferResult.Value.AssignmentId)
{
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}"
Expand Down
Loading

0 comments on commit da1a85c

Please sign in to comment.