Skip to content

Commit

Permalink
Added support for obtaining aggregate graph statistics http://dev.mai…
Browse files Browse the repository at this point in the history
  • Loading branch information
JamieDunstan committed Jul 15, 2016
1 parent 5c8ff6b commit f4edd81
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 0 deletions.
1 change: 1 addition & 0 deletions MailJetClient/MailJet.Client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
<Compile Include="MailJetClient.cs" />
<Compile Include="Request\Contact.cs" />
<Compile Include="Request\TKEYVALUELIST.cs" />
<Compile Include="Response\Data\AggregateGraphStatistics.cs" />
<Compile Include="Response\Data\ContactData.cs" />
<Compile Include="Response\Data\ContactDataUpdate.cs" />
<Compile Include="Response\Data\ContactListData.cs" />
Expand Down
18 changes: 18 additions & 0 deletions MailJetClient/MailJetClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,24 @@ public Response<ListRecipient> GetListRecipient(
return ExecuteRequest<ListRecipient>(request);
}

/// <summary>
/// Get aggregate graph statistics available for this apikey.
/// </summary>
/// <param name="CampaignAggregateID">Only show statistics for this aggregation.</param>
/// <param name="Range">The period of the aggregates (24 hours or 7 days).</param>
/// <returns>Aggregated campaign statistics grouped over intervals.</returns>
public Response<AggregateGraphStatistics> GetAggregateGraphStatistics(int? CampaignAggregateID = null, string Range = null) {
var request = new RestRequest("REST/aggregategraphstatistics", Method.GET);

if (CampaignAggregateID.HasValue)
request.AddParameter("CampaignAggregateID", CampaignAggregateID.Value);

if (!String.IsNullOrWhiteSpace(Range))
request.AddParameter("Range", Range);

return ExecuteRequest<AggregateGraphStatistics>(request);
}

private Response<T> ExecuteRequest<T>(RestRequest request) where T : DataItem
{
request.RequestFormat = DataFormat.Json;
Expand Down
85 changes: 85 additions & 0 deletions MailJetClient/Response/Data/AggregateGraphStatistics.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
namespace MailJet.Client.Response.Data
{
public class AggregateGraphStatistics: DataItem
{
/// <summary>
/// Number of blocked messages.
/// </summary>
public double BlockedCount { get; set; }

/// <summary>
/// BlockedStdDev count.
/// </summary>
public double BlockedStdDev { get; set; }

/// <summary>
/// Number of bounced messages.
/// </summary>
public double BouncedCount { get; set; }

/// <summary>
/// BouncedStdDev count.
/// </summary>
public double BouncedStdDev { get; set; }

/// <summary>
/// The ID of campaign aggregate object that corresponds with the statistics.
/// </summary>
public long CampaignAggregateID { get; set; }

/// <summary>
/// Number of registered clicks.
/// </summary>
public double ClickedCount { get; set; }

/// <summary>
/// ClickedStdDev count.
/// </summary>
public double ClickedStdDev { get; set; }

/// <summary>
/// Number of open registrations.
/// </summary>
public double OpenedCount { get; set; }

/// <summary>
/// OpenedStdDev count.
/// </summary>
public double OpenedStdDev { get; set; }

/// <summary>
/// Reference time in textual form.
/// </summary>
public long RefTimestamp { get; set; }

/// <summary>
/// Number of sent messages.
/// </summary>
public double SentCount { get; set; }

/// <summary>
/// SentStdDev count.
/// </summary>
public double SentStdDev { get; set; }

/// <summary>
/// Number of spam complains.
/// </summary>
public double SpamComplaintCount { get; set; }

/// <summary>
/// SpamcomplaintStdDev count.
/// </summary>
public double SpamcomplaintStdDev { get; set; }

/// <summary>
/// Number of registered unsubscribe requests.
/// </summary>
public double UnsubscribedCount { get; set; }

/// <summary>
/// UnsubscribedStdDev count.
/// </summary>
public double UnsubscribedStdDev { get; set; }
}
}

0 comments on commit f4edd81

Please sign in to comment.