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

Zendesk Voice amendments #316

Merged
merged 14 commits into from
Mar 5, 2018
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
24 changes: 24 additions & 0 deletions src/ZendeskApi_v2/Models/Voice/CurrentQueueActivity.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using System.Collections.Generic;
using Newtonsoft.Json;
using System;

namespace ZendeskApi_v2.Models.Voice
{
public class CurrentQueueActivity
{
[JsonProperty("agents_online")]
public long AgentsOnline { get; set; }

[JsonProperty("calls_waiting")]
public long CallsWaiting { get; set; }

[JsonProperty("callbacks_waiting")]
public long CallbacksWaiting { get; set; }

[JsonProperty("average_wait_time")]
public long AverageWaitTime { get; set; }

[JsonProperty("longest_wait_time")]
public long LongestWaitTime { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ public class GroupAgentActivityResponse : GroupResponseBase
[JsonProperty("agents_activity")]
public IList<AgentActivity> AgentActivity { get; set; }
}
}
}
32 changes: 0 additions & 32 deletions src/ZendeskApi_v2/Models/Voice/HistoricalQueueActivity.cs

This file was deleted.

14 changes: 7 additions & 7 deletions src/ZendeskApi_v2/Requests/Voice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ public interface IVoice : ICore
bool OpenUserProfileInAgentBrowser(long agentId, long userId);
bool OpenTicketInAgentBrowser(long agentId, long ticketId);
GroupAgentActivityResponse GetVoiceAgentActivity();
HistoricalQueueActivityDetails GetHistoricalQueueActivity();
CurrentQueueActivity GetCurrentQueueActivity();

#endif

#if ASYNC
Task<bool> OpenUserProfileInAgentBrowserAsync(long agentId, long userId);
Task<bool> OpenTicketInAgentBrowserAsync(long agentId, long ticketId);
Task<GroupAgentActivityResponse> GetVoiceAgentActivityAsync();
Task<HistoricalQueueActivity> GetHistoricalQueueActivityAsync();
Task<CurrentQueueActivity> GetCurrentQueueActivityAsync();
#endif
}

Expand All @@ -32,7 +32,7 @@ class Voice : Core, IVoice
private const string tickets = "tickets";
private const string users = "users";
private const string agentsActivity = "channels/voice/stats/agents_activity";
private const string historicalQueueActivity = "channels/voice/stats/historical_queue_activity";
private const string currentQueueActivity = "channels/voice/stats/current_queue_activity";


public Voice(string yourZendeskUrl, string user, string password, string apiToken, string p_OAuthToken)
Expand All @@ -56,9 +56,9 @@ public GroupAgentActivityResponse GetVoiceAgentActivity()
return GenericGet<GroupAgentActivityResponse>(agentsActivity + ".json");
}

public HistoricalQueueActivityDetails GetHistoricalQueueActivity()
public CurrentQueueActivity GetCurrentQueueActivity()
{
return GenericGet<HistoricalQueueActivity>(historicalQueueActivity + ".json").Details;
return GenericGet<CurrentQueueActivity>(currentQueueActivity + ".json");
}

#endif
Expand All @@ -79,9 +79,9 @@ public async Task<GroupAgentActivityResponse> GetVoiceAgentActivityAsync()
return await GenericGetAsync<GroupAgentActivityResponse>(agentsActivity + ".json");
}

public async Task<HistoricalQueueActivity> GetHistoricalQueueActivityAsync()
public async Task<CurrentQueueActivity> GetCurrentQueueActivityAsync()
{
return await GenericGetAsync<HistoricalQueueActivity>(historicalQueueActivity + ".json");
return await GenericGetAsync<CurrentQueueActivity>(currentQueueActivity + ".json");
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/ZendeskApi_v2/ZendeskApi_v2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@
<Version>2.2.29</Version>
</PackageReference>
</ItemGroup>
</Project>
</Project>
16 changes: 16 additions & 0 deletions test/ZendeskApi_v2.Test/VoiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,22 @@ public void GetAllAgentAvailabilityAsync()
Assert.NotNull(agent);
Assert.AreEqual(2110053086, agent.AgentId);
}

[Test]
public void GetCurrentQueueActivity()
{
var res = api.Voice.GetCurrentQueueActivity();

Assert.NotNull(res);
}

[Test]
public void GetCurrentQueueActivityAsync()
{
var res = api.Voice.GetCurrentQueueActivityAsync();
Assert.NotNull(res);
}


}
}