Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JobRouter] SDK Review changes for GA #39533

Merged
merged 6 commits into from
Oct 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
164 changes: 164 additions & 0 deletions sdk/communication/Azure.Communication.JobRouter/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,169 @@
# Release History

## 1.0.0

### Features Added

#### RouterAdministrationClient
- Added `RequestContext` to all methods which can override default behaviors of the client pipeline on a per-call basis.
- Added `RequestConditions` to all `Update` methods which can specify HTTP options for conditional requests based on modification time.

#### RouterClient
- Added `RequestContext` to all methods which can override default behaviors of the client pipeline on a per-call basis.
- Added `RequestConditions` to all `Update` methods which can specify HTTP options for conditional requests based on modification time.

### Breaking Changes

#### RouterAdministrationClient
- `GetQueues` returns `AsyncPageable<RouterQueue>` rather than `Pageable<RouterQueueItem>`
- `GetDistributionPolicies` returns `AsyncPageable<DistributionPolicy>` rather than `Pageable<DistributionPolicyItem>`
- `GetClassificationPolicies` returns `AsyncPageable<ClassificationPolicy>` rather than `Pageable<ClassificationPolicyItem>`
- `GetExceptionPolicies` returns `AsyncPageable<ExceptionPolicy>` rather than `Pageable<ExceptionPolicyItem>`
- `UpdateQueue(UpdateQueueOptions options, CancellationToken cancellationToken)` changed to `UpdateQueue(RouterQueue queue, CancellationToken cancellationToken)`
- `UpdateDistributionPolicy(UpdateDistributionPolicyOptions options, CancellationToken cancellationToken)` changed to `UpdateDistributionPolicy(DistributionPolicy distributionPolicy, CancellationToken cancellationToken)`
- `UpdateClassificationPolicy(UpdateClassificationPolicyOptions options, CancellationToken cancellationToken)` changed to `UpdateClassificationPolicy(ClassificationPolicy classificationPolicy, CancellationToken cancellationToken)`
- `UpdateExceptionPolicy(UpdateExceptionPolicyOptions options, CancellationToken cancellationToken)` changed to `UpdateExceptionPolicy(ExceptionPolicy exceptionPolicy, CancellationToken cancellationToken)`

#### RouterClient
- `GetJobs` returns `AsyncPageable<RouterJob>` rather than `AsyncPageable<RouterJobItem>`
- `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>`
- Property `RequestedWorkerSelectors` - Changed from `List<RouterWorkerSelector>`to `IList<RouterWorkerSelector>`
- Property `Labels` - Changed from `Dictionary<string, LabelValue>` to `IDictionary<string, LabelValue>`
- Property `Tags` - Changed from `Dictionary<string, LabelValue>` to `IDictionary<string, LabelValue>`

##### RouterJobNote
- Changed constructor from `RouterJobNote()` to `RouterJobNote(string message)`
- Removed setter from `Message`

#### RouterWorker && CreateWorkerOptions
- Rename property `QueueAssignments` -> `Queues`
- `Queues` - Changed `Dictionary<string, RouterQueueAssignment>` -> `IList<string>`
- Rename property `TotalCapacity` -> `Capacity`
- Rename property `ChannelConfigurations` -> `Channels`
- `Channels` - Changed `Dictionary<string, ChannelConfiguration>` -> `IList<RouterChannel>`

#### ClassificationPolicy && CreateClassificationPolicyOptions
- Property `List<QueueSelectorAttachment> QueueSelectors` changed to `IList<QueueSelectorAttachment> QueueSelectorAttachments`
- Property `List<WorkerSelectorAttachment> WorkerSelectors` changed to `IList<WorkerSelectorAttachment> WorkerSelectorAttachments`

#### ExceptionPolicy && CreateExceptionPolicyOptions
- Property `ExceptionRules` - Changed from `Dictionary<string, ExceptionRule>` -> `IList<ExceptionRule>`

##### ExceptionRule
- `Actions` - Changed `Dictionary<string, ExceptionAction>` -> `IList<ExceptionAction>`

##### CancelExceptionAction
- Changed constructor from `CancelExceptionAction(string note = null, string dispositionCode = null)` to `CancelExceptionAction()`

##### ReclassifyExceptionAction
- Changed constructor from `ReclassifyExceptionAction(string classificationPolicyId, IDictionary<string, LabelValue> labelsToUpsert = null)` to `ReclassifyExceptionAction()`
- Removed setter from `LabelsToUpsert`

#### BestWorkerMode
- Removed constructor `BestWorkerMode(RouterRule scoringRule = null, IList<ScoringRuleParameterSelector> scoringParameterSelectors = null, bool allowScoringBatchOfWorkers = false, int? batchSize = null, bool descendingOrder = true, bool bypassSelectors = false)`

##### ScoringRuleOptions
- Rename property `AllowScoringBatchOfWorkers` -> `IsBatchScoringEnabled`

#### FunctionRouterRuleCredential
- Removed properties `AppKey` and `FunctionKey`

#### OAuth2WebhookClientCredential
- Removed property `ClientSecret`

#### Renames
- `ChannelConfiguration` -> `RouterChannel`
- `Oauth2ClientCredential` -> `OAuth2WebhookClientCredential`

#### Deletions
- `ClassificationPolicyItem`
- `DistributionPolicyItem`
- `ExceptionPolicyItem`
- `RouterQueueItem`
- `RouterWorkerItem`
- `RouterJobItem`
- `RouterQueueAssignment`
- `UpdateClassificationPolicyOptions`
- `UpdateDistributionPolicyOptions`
- `UpdateExceptionPolicyOptions`
- `UpdateQueueOptions`
- `UpdateWorkerOptions`
- `UpdateJobOptions`

### Other Changes

#### ClassificationPolicy
- Add `Etag`
- Added constructor `ClassificationPolicy(string classificationPolicyId)`
- Added setters to `FallbackQueueId`, `Name`, and `PrioritizationRule`

#### DistributionPolicy
- Add `Etag`
- Added constructor `DistributionPolicy(string distributionPolicyId)`
- Added setters to `Mode` and `Name`

#### ExceptionPolicy
- Added `Etag`
- Added constructor `ExceptionPolicy(string exceptionPolicyId)`
- Added setter to `Name`

##### ExceptionRule
- Added `Id`

##### ExceptionAction
- Added `Id`. Property is read-only. If not provided, it will be generated by the service.

##### ReclassifyExceptionAction
- Added setter to `ClassificationPolicyId`

#### RouterChannel
- Added `ChannelId`

#### RouterJob
- Added `Etag`
- Added constructor `RouterJob(string jobId)`
- Added setters for `ChannelId`, `ChannelReference`, `ClassificationPolicyId`, `DispositionCode`, `MatchingMode`, `Priority`, `QueueId`

#### RouterQueue
- Added `Etag`
- Added constructor `RouterQueue(string queueId)`
- Added setters for `DistributionPolicyId`, `ExceptionPolicyId` and `Name`

#### RouterWorker
- Added `Etag`
- Added constructor `RouterWorker(string workerId)`

#### BestWorkerMode
- Added setters to `ScoringRule` and `ScoringRuleOptions`

#### OAuth2WebhookClientCredential
- Added constructor `OAuth2WebhookClientCredential(string clientId, string clientSecret)`

## 1.0.0-beta.4 (Unreleased)

### Features Added
Expand Down
16 changes: 6 additions & 10 deletions sdk/communication/Azure.Communication.JobRouter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@ Response<RouterJob> job = await routerClient.CreateJobAsync(
Now, we register a worker to receive work from that queue, with a label of `Some-Skill` equal to 11.
```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_RegisterWorker_Async
Response<RouterWorker> worker = await routerClient.CreateWorkerAsync(
new CreateWorkerOptions(workerId: "worker-1", totalCapacity: 1)
new CreateWorkerOptions(workerId: "worker-1", capacity: 1)
{
QueueAssignments = { [queue.Value.Id] = new RouterQueueAssignment() },
Queues = { queue.Value.Id },
Labels = { ["Some-Skill"] = new LabelValue(11) },
ChannelConfigurations = { ["my-channel"] = new ChannelConfiguration(1) },
Channels = { new RouterChannel("my-channel", 1) },
AvailableForOffers = true,
}
);
Expand Down Expand Up @@ -203,9 +203,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(
options: new CompleteJobOptions(
jobId: job.Value.Id,
assignmentId: acceptJobOfferResult.Value.AssignmentId)
jobId: job.Value.Id, new CompleteJobOptions(acceptJobOfferResult.Value.AssignmentId)
{
Note = $"Job has been completed by {worker.Value.Id} at {DateTimeOffset.UtcNow}"
});
Expand All @@ -217,9 +215,7 @@ Console.WriteLine($"Job has been successfully completed: {completeJob.Status ==
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(
options: new CloseJobOptions(
jobId: job.Value.Id,
assignmentId: acceptJobOfferResult.Value.AssignmentId)
jobId: job.Value.Id, new CloseJobOptions(acceptJobOfferResult.Value.AssignmentId)
{
Note = $"Job has been closed by {worker.Value.Id} at {DateTimeOffset.UtcNow}"
});
Expand All @@ -232,7 +228,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(
options: new CloseJobOptions(job.Value.Id, acceptJobOfferResult.Value.AssignmentId)
jobId: job.Value.Id, new CloseJobOptions(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
Loading