-
Notifications
You must be signed in to change notification settings - Fork 0
2. Examples
All methods in the handler interfaces are asynchronous. Here are some examples on how to use them.
ILinesHandler
interface defines functionality that affects Lines API end point.
Task<Result<bool>> IsVirtualQActive(long lineId);
Returns true if a line that matches the lineId
parameter is active, otherwise returns false.
bool isVirtualQActive;
long lineId = 3;
var result = await client.Lines.IsVirtualQActive(lineId);
if(result.RequestWasSuccessful)
{
// You can collect the value returned by the API
isVirtualQActive = result.Value;
}
else
{
// Something went wrong, verify the error object assigned to the Error property
YourCustomErrorHandling(result.Error);
}
Alternatively the result of the task can be obtained with the Result property:
var result = client.Lines.IsVirtualQActive(lineId).Result;
ILineGroupsHandler
interface defines functionality that affects Line Groups API end point.
Task<Result> UpdateLineGroup(long lineGroupId, UpdateLineGroupParameters attributes);
Updates a Line Group that matches lineGroupId
parameter with the information supplied in the attributes
parameter. This method doesn't return a value from the API.
long lineGroupIdToUpdate = 185;
UpdateLineGroupParameters attributes = new UpdateLineGroupParameters
{
ServiceEwt = 300,
ServiceCallersCount = 2,
ServiceAverageTalkTime = 35,
ServiceAgentsCount = 3,
ServiceAgentList = new string[] { "A", "B", "C" }
};
Result result = await client.LineGroups.UpdateLineGroup(lineGroupIdToUpdate, attributes);
if(!result.RequestWasSuccessful)
{
// Something went wrong, verify the error object assigned to the Error property
YourCustomErrorHandling(result.Error);
}
Alternatively the result of the task can be obtained with the Result property:
Result result = client.LineGroups.UpdateLineGroup(lineGroupIdToUpdate, attributes).Result;
For more information: Asynchronous Programming with async and await
virtualQ GmbH - All rights reserved | Website: http://virtualq.io | Dashboard: https://dashboard.virtualq.io