Skip to content

Commit

Permalink
Merge pull request #43 from virtualq/zak_dev
Browse files Browse the repository at this point in the history
CON-62
  • Loading branch information
zeeshanalikhan15 authored May 3, 2021
2 parents 029f4af + b3b50da commit 4667f16
Show file tree
Hide file tree
Showing 15 changed files with 84 additions and 30 deletions.
4 changes: 2 additions & 2 deletions VirtualQNet.Tests/App.config
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="ApiUrl" value="http://api.virtualq.io" />
<add key="ApiKey" value="SrbiAWBMN9Bf4XKJrSAMDeFtCt6mwFQMi4TW3ZE6" />
<add key="ApiUrl" value="https://api.virtualq.io" />
<add key="ApiKey" value="TfjGWuF63ecAStv9GcnbafbrTc6JkW5fJm3cPgzy" />
<add key="Timeout" value="" />
</appSettings>
</configuration>
8 changes: 5 additions & 3 deletions VirtualQNet.Tests/CallCenterHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ public void UpdateCallCenter()
};
using (VirtualQ client = new VirtualQ(apiKey, configuration))
{
var attributes = new UpdateVersionNumberCallCenterParameters
var attributes = new UpdateCallCenterParameters
{
Id = 24,
ConnectorVersion = "version number update test via VirtualQ C# SDK is a success| Version Number: 1.5.0"
Id = 1,
//ConnectorVersion = "Testing Version zak 132",
ConnectorConnectionStatus = "Its down",
ConnectorLastRestartTime = DateTime.Now
};

Result result = client.CallCenter.UpdateCallCenter(attributes).Result;
Expand Down
6 changes: 3 additions & 3 deletions VirtualQNet.Tests/CallersHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ public void LineUpCaller_ValidLineId_ExpectSuccess()

var attributes = new LineUpCallerParameters
{
LineId = 3384,
LineId = 3534,
Phone = "+17343305027",
Channel = "CallIn",
Source = "Phone",
Channel = "callbackext",
Source = "Phone",
Language = "en",
Skills = new string[] { "Skill1", "Skill2", "Skill3" },
Properties = properties
Expand Down
8 changes: 4 additions & 4 deletions VirtualQNet.Tests/LinesHandlerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ public void ListLine_ValidFilters_ExpectResults()
{
var attributes = new ListLinesParameters
{
CallCenterId = 218
CallCenterId = -1
//LineGroupId = 468
};

Result<IEnumerable<LineResult>> result = client.Lines.ListLines(attributes).Result;
Result<bool> result = client.Lines.NewCallOffered(3128000).Result;

Trace.WriteLine("Lines Names: \n" + string.Join("\n", result.Value.Select(l => l.Name + "|" + l.VirtualQLineState + "|" + l.ForwardingPhoneNumber )));
//Trace.WriteLine("Lines Names: \n" + string.Join("\n", result.Value.Select(l => l.Name + "|" + l.VirtualQLineState + "|" + l.VirtualQLineState )));
Assert.IsTrue(result.RequestWasSuccessful);
Assert.IsTrue(result.Value.Any());
//Assert.IsTrue(result.Value.Any());
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion VirtualQNet/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@ public async Task<CallResult> Put<T>(string path, T model)
{
try
{
return await HandleResponse(await _Client.PutAsync(BuildApiPath(path), CreateContent(model)));
var content = CreateContent(model);
//var jsonContent = await content.ReadAsStringAsync();
return await HandleResponse(await _Client.PutAsync(BuildApiPath(path), content));
}
catch (Exception exception)
{
Expand Down
14 changes: 7 additions & 7 deletions VirtualQNet/CallCenter/CallCenterHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ internal class CallCenterHandler : EntityHandler, ICallCenterHandler

public CallCenterHandler(ApiClient apiClient) : base(apiClient) { }

public async Task<Result> UpdateCallCenter(UpdateVersionNumberCallCenterParameters updateVersionNumberCallCenterParameters)
public async Task<Result> UpdateCallCenter(UpdateCallCenterParameters updateCallCenterParameters)
{
if (string.IsNullOrWhiteSpace(updateVersionNumberCallCenterParameters.ConnectorVersion) || string.IsNullOrEmpty(updateVersionNumberCallCenterParameters.ConnectorVersion))
throw new ArgumentException(nameof(updateVersionNumberCallCenterParameters.ConnectorVersion));
var messageAttributes = new CallCenterCreateMessageAttributes
var messageAttributes = new CallCenterUpdateAttributes
{
Id = updateVersionNumberCallCenterParameters.Id,
ConnectorVersion = updateVersionNumberCallCenterParameters.ConnectorVersion
Id = updateCallCenterParameters.Id,
ConnectorVersion = updateCallCenterParameters.ConnectorVersion,
ConnectorConnectionStatus = updateCallCenterParameters.ConnectorConnectionStatus,
ConnectorLastRestartTime = updateCallCenterParameters.ConnectorLastRestartTime
};

SingleApiMessage<CallCenterMessage> message = CreateSingleMessage<CallCenterCreateMessageAttributes, CallCenterMessage>(MESSAGE_TYPE, messageAttributes);
SingleApiMessage<CallCenterMessage1> message = CreateSingleMessage<CallCenterUpdateAttributes, CallCenterMessage1>(MESSAGE_TYPE, messageAttributes);
var path = $"{CALL_CENTER_PATH}/{messageAttributes.Id}";
CallResult callResult = await _ApiClient.Put(path, message);

Expand Down
2 changes: 1 addition & 1 deletion VirtualQNet/CallCenter/ICallCenterHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace VirtualQNet.CallCenter
{
public interface ICallCenterHandler
{
Task<Result> UpdateCallCenter(UpdateVersionNumberCallCenterParameters updateVersionNumberCallCenterParameters);
Task<Result> UpdateCallCenter(UpdateCallCenterParameters updateCallCenterParameters);
Task<Result<IEnumerable<CallCenterResult>>> ListCallCenters(ListCallCenterParameters attributes);
Task<Result<CallCenterResult>> GetCallCenter(ListCallCenterParameters attributes);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,20 @@ internal class CallCenterCreateMessageAttributes
[JsonProperty("acd_type_version", NullValueHandling = NullValueHandling.Ignore)]
public string AcdTypeVersion { get; set; }

[JsonProperty("connector_version", NullValueHandling = NullValueHandling.Ignore)]
[JsonProperty("connector-version", NullValueHandling = NullValueHandling.Ignore)]
public string ConnectorVersion { get; set; }

[JsonProperty("notes", NullValueHandling = NullValueHandling.Ignore)]
public string Notes { get; set; }

[JsonProperty("connector-configuration", NullValueHandling = NullValueHandling.Ignore)]
public string ConnectorConfiguration { get; set; }

[JsonProperty("connector-last-restart-at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? ConnectorLastRestartTime { get; set; }

[JsonProperty("connector-connection-status", NullValueHandling = NullValueHandling.Ignore)]
public string ConnectorConnectionStatus { get; set; }

}
}
2 changes: 2 additions & 0 deletions VirtualQNet/CallCenter/Messages/CallCenterMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@
namespace VirtualQNet.CallCenter.Messages
{
internal class CallCenterMessage : ApiMessage<CallCenterCreateMessageAttributes> { }

internal class CallCenterMessage1 : ApiMessage<CallCenterUpdateAttributes> { }
}
27 changes: 27 additions & 0 deletions VirtualQNet/CallCenter/Messages/CallCenterUpdateAttributes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace VirtualQNet.CallCenter.Messages
{
internal class CallCenterUpdateAttributes
{
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
public long? Id { get; set; }

[JsonProperty("connector_version", NullValueHandling = NullValueHandling.Ignore)]
public string ConnectorVersion { get; set; }

[JsonProperty("connector_configuration", NullValueHandling = NullValueHandling.Ignore)]
public string ConnectorConfiguration { get; set; }

[JsonProperty("connector_last_restart_at", NullValueHandling = NullValueHandling.Ignore)]
public DateTime? ConnectorLastRestartTime { get; set; }

[JsonProperty("connector_connection_status", NullValueHandling = NullValueHandling.Ignore)]
public string ConnectorConnectionStatus { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@

namespace VirtualQNet.CallCenter.Parameters
{
public class UpdateVersionNumberCallCenterParameters
public class UpdateCallCenterParameters
{
public long Id { get; set; }
public string ConnectorVersion { get; set; }
public DateTime ConnectorLastRestartTime { get; set; }
public string ConnectorConnectionStatus { get; set; }
}
}
6 changes: 6 additions & 0 deletions VirtualQNet/CallCenter/Results/CallCenterResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ internal CallCenterResult(CallCenterMessage callCenterMessage)
AcdTypeVersion = callCenterMessage?.Attributes?.AcdTypeVersion;
ConnectorVersion = callCenterMessage?.Attributes?.ConnectorVersion;
Notes = callCenterMessage?.Attributes?.Notes;
ConnectorConfiguration = callCenterMessage?.Attributes?.ConnectorConfiguration;
ConnectorLastRestartTime = callCenterMessage?.Attributes?.ConnectorLastRestartTime;
ConnectorConnectionStatus = callCenterMessage?.Attributes?.ConnectorConnectionStatus;
}

public long? Id { get; }
Expand All @@ -37,5 +40,8 @@ internal CallCenterResult(CallCenterMessage callCenterMessage)
public string AcdTypeVersion { get; }
public string ConnectorVersion { get; }
public string Notes { get; }
public string ConnectorConfiguration { get; set; }
public DateTime? ConnectorLastRestartTime { get; set; }
public string ConnectorConnectionStatus { get; set; }
}
}
4 changes: 2 additions & 2 deletions VirtualQNet/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.1.1.0")]
[assembly: AssemblyFileVersion("1.1.1.0")]
[assembly: AssemblyVersion("1.2.0.0")]
[assembly: AssemblyFileVersion("1.2.0.0")]
3 changes: 2 additions & 1 deletion VirtualQNet/VirtualQNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@
<Compile Include="CallCenter\ICallCenterHandler.cs" />
<Compile Include="CallCenter\Messages\CallCenterCreateMessageAttributes.cs" />
<Compile Include="CallCenter\Messages\CallCenterMessage.cs" />
<Compile Include="CallCenter\Messages\CallCenterUpdateAttributes.cs" />
<Compile Include="CallCenter\Parameters\ListCallCenterParameters.cs" />
<Compile Include="CallCenter\Parameters\UpdateVersionNumberCallCenterParameters.cs" />
<Compile Include="CallCenter\Parameters\UpdateCallCenterParameters.cs" />
<Compile Include="CallCenter\Results\CallCenterResult.cs" />
<Compile Include="Caller\Messages\CallerCreateMessage.cs" />
<Compile Include="Caller\Messages\CallerCreateMessageAttributes.cs" />
Expand Down
10 changes: 6 additions & 4 deletions VirtualQNet/VirtualQNet.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@
<package >
<metadata>
<id>virtualQ.API.virtualQNetClient</id>
<version>1.1.1</version>
<version>1.2.0</version>
<title>virtualQ .NET client</title>
<authors>Niels Liebisch and Zeeshan Ali Khan</authors>
<owners>virtualQ</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>.NET client URL for virtualQ API</description>
<releaseNotes>Added support for TLS1.2</releaseNotes>
<copyright>Copyright 2017</copyright>
<description>- update connector status, connector last restart time, connector.
- get remote configuration from connector settings tab.
- get caller data on lineup request.</description>
<releaseNotes>Added support for connector settting page. https://github.com/virtualq/virtualQ.NET/wiki/6.-CallCenter</releaseNotes>
<copyright>Copyright 2021</copyright>
<tags>api client application</tags>
<dependencies>
<dependency id="Microsoft.AspNet.WebApi.Client" version="5.2.3" />
Expand Down

0 comments on commit 4667f16

Please sign in to comment.