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

fix: Added missing model definitions for statistics #625

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public static WorkerStatisticsResource FromJson(string json)
/// An object that contains the cumulative statistics for the Worker
/// </summary>
[JsonProperty("cumulative")]
public object Cumulative { get; private set; }
public CumulativeStatistics Cumulative { get; private set; }
/// <summary>
/// The SID of the Worker that contains the WorkerChannel
/// </summary>
Expand All @@ -152,6 +152,50 @@ public static WorkerStatisticsResource FromJson(string json)
[JsonProperty("url")]
public Uri Url { get; private set; }

public class CumulativeStatistics
{
[JsonProperty("reservations_timed_out")]
public int ReservationsTimedOut { get; set; }
[JsonProperty("reservations_rejected")]
public int ReservationsRejected { get; set; }
[JsonProperty("reservations_created")]
public int ReservationsCreated { get; set; }
[JsonProperty("reservations_rescinded")]
public int ReservationsRescinded { get; set; }
[JsonProperty("tasks_assigned")]
public int TasksAssigned { get; set; }
[JsonProperty("start_time")]
public DateTime StartTime { get; set; }
[JsonProperty("reservations_wrapup ")]
public int ReservationsWrapup { get; set; }
[JsonProperty("end_time")]
public DateTime EndTime { get; set; }
[JsonProperty("reservations_accepted")]
public int ReservationsAccepted { get; set; }
[JsonProperty("activity_durations")]
public List<ActivityDuration> ActivityDurations { get; set; }
[JsonProperty("reservations_canceled")]
public int ReservationsCanceled { get; set; }
[JsonProperty("reservations_completed")]
public int ReservationsCompleted { get; set; }
}

public class ActivityDuration
{
[JsonProperty("avg")]
public int Avg { get; set; }
[JsonProperty("min")]
public int Min { get; set; }
[JsonProperty("max")]
public int Max { get; set; }
[JsonProperty("friendly_name")]
public string FriendlyName { get; set; }
[JsonProperty("sid")]
public string Sid { get; set; }
[JsonProperty("total")]
public int Total { get; set; }
}

private WorkerStatisticsResource()
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public static WorkersCumulativeStatisticsResource FromJson(string json)
/// The minimum, average, maximum, and total time that Workers spent in each Activity
/// </summary>
[JsonProperty("activity_durations")]
public List<object> ActivityDurations { get; private set; }
public List<ActivityDuration> ActivityDurations { get; private set; }
/// <summary>
/// The total number of Reservations that were created
/// </summary>
Expand Down Expand Up @@ -184,6 +184,23 @@ public static WorkersCumulativeStatisticsResource FromJson(string json)
[JsonProperty("url")]
public Uri Url { get; private set; }


public class ActivityDuration
{
[JsonProperty("avg")]
public int Avg { get; set; }
[JsonProperty("min")]
public int Min { get; set; }
[JsonProperty("max")]
public int Max { get; set; }
[JsonProperty("friendly_name")]
public string FriendlyName { get; set; }
[JsonProperty("sid")]
public string Sid { get; set; }
[JsonProperty("total")]
public int Total { get; set; }
}

private WorkersCumulativeStatisticsResource()
{

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,30 +112,56 @@ public static WorkersRealTimeStatisticsResource FromJson(string json)
}

/// <summary>
/// The SID of the Account that created the resource
/// </summary>
[JsonProperty("account_sid")]
public string AccountSid { get; private set; }
/// <summary>
/// The number of current Workers by Activity
/// </summary>
[JsonProperty("activity_statistics")]
public List<object> ActivityStatistics { get; private set; }
/// <summary>
/// The total number of Workers
/// </summary>
[JsonProperty("total_workers")]
public int? TotalWorkers { get; private set; }
/// <summary>
/// The SID of the Workspace that contains the Workers
/// </summary>
[JsonProperty("workspace_sid")]
public string WorkspaceSid { get; private set; }
/// <summary>
/// The absolute URL of the Workers statistics resource
/// </summary>
[JsonProperty("url")]
public Uri Url { get; private set; }
/// The SID of the Account that created the resource
/// </summary>
[JsonProperty("account_sid")]
public string AccountSid { get; private set; }
/// <summary>
/// The number of current Workers by Activity
/// </summary>
[JsonProperty("activity_statistics")]
public List<ActivityStatistic> ActivityStatistics { get; private set; }
/// <summary>
/// The total number of Workers
/// </summary>
[JsonProperty("total_workers")]
public int? TotalWorkers { get; private set; }
/// <summary>
/// The SID of the Workspace that contains the Workers
/// </summary>
[JsonProperty("workspace_sid")]
public string WorkspaceSid { get; private set; }
/// <summary>
/// The absolute URL of the Workers statistics resource
/// </summary>
[JsonProperty("url")]
public Uri Url { get; private set; }

public class ActivityStatistic
{
[JsonProperty("workers")]
public int Workers { get; set; }
[JsonProperty("friendly_name")]
public string Friendlyname { get; set; }
[JsonProperty("sid")]
public string Sid { get; set; }
}

public class TasksByStatusType
{
[JsonProperty("reserved")]
public int Reserved { get; set; }
[JsonProperty("completed")]
public int Completed { get; set; }
[JsonProperty("wrapping")]
public int Wrapping { get; set; }
[JsonProperty("assigned")]
public int Assigned { get; set; }
[JsonProperty("canceled")]
public int Canceled { get; set; }
[JsonProperty("pending")]
public int Pending { get; set; }
}

private WorkersRealTimeStatisticsResource()
{
Expand Down