Skip to content

Commit

Permalink
[JobRouter] SDK Review Updates part 2 (#39652)
Browse files Browse the repository at this point in the history
  • Loading branch information
williamzhao87 authored Nov 1, 2023
1 parent 921e6b5 commit 2ea411a
Show file tree
Hide file tree
Showing 138 changed files with 1,148 additions and 1,010 deletions.
20 changes: 14 additions & 6 deletions sdk/communication/Azure.Communication.JobRouter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,17 @@
#### OAuth2WebhookClientCredential
- Removed property `ClientSecret`

#### RouterQueueStatistics
- Changed `IReadOnlyDictionary<string, double> EstimatedWaitTimeMinutes` to `IDictionary<int, TimeSpan> EstimatedWaitTimes`

#### LabelOperator
- Renamed `GreaterThanEqual` to `GreaterThanOrEqual`
- Renamed `LessThanEqual` to `LessThanOrEqual`

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

#### Deletions
- `ClassificationPolicyItem`
Expand All @@ -118,17 +126,17 @@
### Other Changes

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

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

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

Expand All @@ -145,17 +153,17 @@
- Added `ChannelId`

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

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

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

#### BestWorkerMode
Expand Down
4 changes: 2 additions & 2 deletions sdk/communication/Azure.Communication.JobRouter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Response<RouterJob> job = await routerClient.CreateJobAsync(
Priority = 1,
RequestedWorkerSelectors =
{
new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new LabelValue(10))
new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new RouterValue(10))
}
});
```
Expand All @@ -129,7 +129,7 @@ Response<RouterWorker> worker = await routerClient.CreateWorkerAsync(
new CreateWorkerOptions(workerId: "worker-1", capacity: 1)
{
Queues = { queue.Value.Id },
Labels = { ["Some-Skill"] = new LabelValue(11) },
Labels = { ["Some-Skill"] = new RouterValue(11) },
Channels = { new RouterChannel("my-channel", 1) },
AvailableForOffers = true,
}
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "net",
"TagPrefix": "net/communication/Azure.Communication.JobRouter",
"Tag": "net/communication/Azure.Communication.JobRouter_83ab5cb025"
"Tag": "net/communication/Azure.Communication.JobRouter_508531d087"
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ Response<ClassificationPolicy> classificationPolicy = routerAdministrationClient
options: new CreateClassificationPolicyOptions(classificationPolicyId)
{
Name = "Sample classification policy",
PrioritizationRule = new StaticRouterRule(new LabelValue(10)),
PrioritizationRule = new StaticRouterRule(new RouterValue(10)),
QueueSelectorAttachments =
{
new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new LabelValue("NA"))),
new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new RouterValue("NA"))),
new ConditionalQueueSelectorAttachment(
condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"),
queueSelectors: new List<RouterQueueSelector>()
{
new RouterQueueSelector("Product", LabelOperator.Equal, new LabelValue("O365")),
new RouterQueueSelector("QGroup", LabelOperator.Equal, new LabelValue("NA_O365"))
new RouterQueueSelector("Product", LabelOperator.Equal, new RouterValue("O365")),
new RouterQueueSelector("QGroup", LabelOperator.Equal, new RouterValue("NA_O365"))
}),
},
WorkerSelectorAttachments =
Expand All @@ -42,14 +42,14 @@ Response<ClassificationPolicy> classificationPolicy = routerAdministrationClient
condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"),
workerSelectors: new List<RouterWorkerSelector>()
{
new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new LabelValue(true)),
new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(1))
new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new RouterValue(true)),
new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(1))
}),
new ConditionalWorkerSelectorAttachment(
condition: new ExpressionRouterRule("If(job.HighPriority = \"true\", true, false)"),
workerSelectors: new List<RouterWorkerSelector>()
{
new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(10))
new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(10))
})
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ Response<ClassificationPolicy> classificationPolicy = await routerAdministration
options: new CreateClassificationPolicyOptions(classificationPolicyId)
{
Name = "Sample classification policy",
PrioritizationRule = new StaticRouterRule(new LabelValue(10)),
PrioritizationRule = new StaticRouterRule(new RouterValue(10)),
QueueSelectorAttachments =
{
new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new LabelValue("NA"))),
new StaticQueueSelectorAttachment(new RouterQueueSelector("Region", LabelOperator.Equal, new RouterValue("NA"))),
new ConditionalQueueSelectorAttachment(
condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"),
queueSelectors: new List<RouterQueueSelector>()
{
new RouterQueueSelector("Product", LabelOperator.Equal, new LabelValue("O365")),
new RouterQueueSelector("QGroup", LabelOperator.Equal, new LabelValue("NA_O365"))
new RouterQueueSelector("Product", LabelOperator.Equal, new RouterValue("O365")),
new RouterQueueSelector("QGroup", LabelOperator.Equal, new RouterValue("NA_O365"))
}),
},
WorkerSelectorAttachments =
Expand All @@ -42,14 +42,14 @@ Response<ClassificationPolicy> classificationPolicy = await routerAdministration
condition: new ExpressionRouterRule("If(job.Product = \"O365\", true, false)"),
workerSelectors: new List<RouterWorkerSelector>()
{
new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new LabelValue(true)),
new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(1))
new RouterWorkerSelector("Skill_O365", LabelOperator.Equal, new RouterValue(true)),
new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(1))
}),
new ConditionalWorkerSelectorAttachment(
condition: new ExpressionRouterRule("If(job.HighPriority = \"true\", true, false)"),
workerSelectors: new List<RouterWorkerSelector>()
{
new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanEqual, new LabelValue(10))
new RouterWorkerSelector("Skill_O365_Lvl", LabelOperator.GreaterThanOrEqual, new RouterValue(10))
})
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ var escalateJobOnQueueOverFlow = new ReclassifyExceptionAction
ClassificationPolicyId = "escalation-on-q-over-flow",
LabelsToUpsert =
{
["EscalateJob"] = new LabelValue(true),
["EscalationReasonCode"] = new LabelValue("QueueOverFlow")
["EscalateJob"] = new RouterValue(true),
["EscalationReasonCode"] = new RouterValue("QueueOverFlow")
}
};

Expand All @@ -50,8 +50,8 @@ ReclassifyExceptionAction escalateJobOnWaitTimeExceeded = new()
ClassificationPolicyId = "escalation-on-wait-time-exceeded",
LabelsToUpsert =
{
["EscalateJob"] = new LabelValue(true),
["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded")
["EscalateJob"] = new RouterValue(true),
["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded")
}
};

Expand Down Expand Up @@ -105,8 +105,8 @@ var escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction
ClassificationPolicyId = "escalation-on-wait-time-exceeded",
LabelsToUpsert =
{
["EscalateJob"] = new LabelValue(true),
["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded2Min")
["EscalateJob"] = new RouterValue(true),
["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded2Min")
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ ReclassifyExceptionAction escalateJobOnQueueOverFlow = new ReclassifyExceptionAc
ClassificationPolicyId = "escalation-on-q-over-flow",
LabelsToUpsert =
{
["EscalateJob"] = new LabelValue(true),
["EscalationReasonCode"] = new LabelValue("QueueOverFlow")
["EscalateJob"] = new RouterValue(true),
["EscalationReasonCode"] = new RouterValue("QueueOverFlow")
}
};

Expand All @@ -50,8 +50,8 @@ var escalateJobOnWaitTimeExceeded = new ReclassifyExceptionAction
ClassificationPolicyId = "escalation-on-wait-time-exceeded",
LabelsToUpsert =
{
["EscalateJob"] = new LabelValue(true),
["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded")
["EscalateJob"] = new RouterValue(true),
["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded")
}
};

Expand Down Expand Up @@ -105,8 +105,8 @@ var escalateJobOnWaitTimeExceeded2 = new ReclassifyExceptionAction
ClassificationPolicyId = "escalation-on-wait-time-exceeded",
LabelsToUpsert =
{
["EscalateJob"] = new LabelValue(true),
["EscalationReasonCode"] = new LabelValue("WaitTimeExceeded2Min")
["EscalateJob"] = new RouterValue(true),
["EscalationReasonCode"] = new RouterValue("WaitTimeExceeded2Min")
}
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSeri
```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue
Response<RouterQueue> updatedJobQueue = routerAdministrationClient.UpdateQueue(new RouterQueue(jobQueueId)
{
Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") }
Labels = { ["Additional-Queue-Label"] = new RouterValue("ChatQueue") }
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSeri
Response<RouterQueue> updatedJobQueue = await routerAdministrationClient.UpdateQueueAsync(
new RouterQueue(jobQueueId)
{
Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") }
Labels = { ["Additional-Queue-Label"] = new RouterValue("ChatQueue") }
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ Response<ClassificationPolicy> classificationPolicy = routerAdministrationClient
QueueSelectorAttachments =
{
new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal,
new LabelValue(jobQueue.Value.Id))),
new RouterValue(jobQueue.Value.Id))),
},
PrioritizationRule = new StaticRouterRule(new LabelValue(10))
PrioritizationRule = new StaticRouterRule(new RouterValue(10))
});

string jobWithCpId = "job-with-cp-id";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ Response<ClassificationPolicy> classificationPolicy = await routerAdministration
QueueSelectorAttachments =
{
new StaticQueueSelectorAttachment(new RouterQueueSelector("Id", LabelOperator.Equal,
new LabelValue(jobQueue.Value.Id))),
new RouterValue(jobQueue.Value.Id))),
},
PrioritizationRule = new StaticRouterRule(new LabelValue(10))
PrioritizationRule = new StaticRouterRule(new RouterValue(10))
});

string jobWithCpId = "job-with-cp-id";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ Response<RouterWorker> worker = routerClient.CreateWorker(
},
Labels =
{
["Location"] = new LabelValue("NA"),
["English"] = new LabelValue(7),
["O365"] = new LabelValue(true),
["Xbox_Support"] = new LabelValue(false)
["Location"] = new RouterValue("NA"),
["English"] = new RouterValue(7),
["O365"] = new RouterValue(true),
["Xbox_Support"] = new RouterValue(false)
},
Tags =
{
["Name"] = new LabelValue("John Doe"),
["Department"] = new LabelValue("IT_HelpDesk")
["Name"] = new RouterValue("John Doe"),
["Department"] = new RouterValue("IT_HelpDesk")
}
}
);
Expand Down Expand Up @@ -74,9 +74,9 @@ Response<RouterWorker> updateWorker = routerClient.UpdateWorker(
Channels = { new RouterChannel("WebChatEscalated", 50), },
Labels =
{
["O365"] = new LabelValue("Supported"),
["Xbox_Support"] = new LabelValue(null),
["Xbox_Support_EN"] = new LabelValue(true),
["O365"] = new RouterValue("Supported"),
["Xbox_Support"] = new RouterValue(null),
["Xbox_Support_EN"] = new RouterValue(true),
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ Response<RouterWorker> worker = await routerClient.CreateWorkerAsync(
},
Labels =
{
["Location"] = new LabelValue("NA"),
["English"] = new LabelValue(7),
["O365"] = new LabelValue(true),
["Xbox_Support"] = new LabelValue(false)
["Location"] = new RouterValue("NA"),
["English"] = new RouterValue(7),
["O365"] = new RouterValue(true),
["Xbox_Support"] = new RouterValue(false)
},
Tags =
{
["Name"] = new LabelValue("John Doe"),
["Department"] = new LabelValue("IT_HelpDesk")
["Name"] = new RouterValue("John Doe"),
["Department"] = new RouterValue("IT_HelpDesk")
}
}
);
Expand Down Expand Up @@ -76,9 +76,9 @@ Response<RouterWorker> updateWorker = await routerClient.UpdateWorkerAsync(
Channels = { new RouterChannel("WebChatEscalated", 50), },
Labels =
{
["O365"] = new LabelValue("Supported"),
["Xbox_Support"] = new LabelValue(null),
["Xbox_Support_EN"] = new LabelValue(true),
["O365"] = new RouterValue("Supported"),
["Xbox_Support"] = new RouterValue(null),
["Xbox_Support_EN"] = new RouterValue(true),
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Response<RouterJob> job = routerClient.CreateJob(
Priority = 1,
RequestedWorkerSelectors =
{
new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new LabelValue(10))
new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new RouterValue(10))
},
});
```
Expand All @@ -71,7 +71,7 @@ Response<RouterWorker> worker = routerClient.CreateWorker(
new CreateWorkerOptions(workerId: "worker-1", capacity: 1)
{
Queues = { queue.Value.Id },
Labels = { ["Some-Skill"] = new LabelValue(11) },
Labels = { ["Some-Skill"] = new RouterValue(11) },
Channels = { new RouterChannel("my-channel", 1) },
AvailableForOffers = true,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Response<RouterJob> job = await routerClient.CreateJobAsync(
Priority = 1,
RequestedWorkerSelectors =
{
new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new LabelValue(10))
new RouterWorkerSelector("Some-Skill", LabelOperator.GreaterThan, new RouterValue(10))
}
});
```
Expand All @@ -71,7 +71,7 @@ Response<RouterWorker> worker = await routerClient.CreateWorkerAsync(
new CreateWorkerOptions(workerId: "worker-1", capacity: 1)
{
Queues = { queue.Value.Id },
Labels = { ["Some-Skill"] = new LabelValue(11) },
Labels = { ["Some-Skill"] = new RouterValue(11) },
Channels = { new RouterChannel("my-channel", 1) },
AvailableForOffers = true,
}
Expand Down
Loading

0 comments on commit 2ea411a

Please sign in to comment.