/// <summary>
        /// Return messaging statistics.
        /// </summary>
        /// <param name="groupBy">Group results by specified period: day, month, year or none. Default is none</param>
        /// <param name="start">(Optional) Start date in unix timestamp format. Default is 7 days ago</param>
        /// <param name="end">(Optional) End date in unix timestamp format. Default is now</param>
        /// <returns></returns>
        public MessagingStatsResult GetMessagingStats(MessagingStatsGroupBy groupBy, DateTime start, DateTime end)
        {
            var request = new RestRequest();

            request.Resource = "stats/messaging";

            string groupByString = "off";

            switch (groupBy)
            {
            case MessagingStatsGroupBy.Day:
                groupByString = "day";
                break;

            case MessagingStatsGroupBy.Month:
                groupByString = "month";
                break;

            case MessagingStatsGroupBy.Year:
                groupByString = "year";
                break;
            }
            request.AddQueryParameter("by", groupByString);
            request.AddQueryParameter("start", DateTimeToTimestamp(start).ToString());
            request.AddQueryParameter("end", DateTimeToTimestamp(start).ToString());

            return(Execute <MessagingStatsResult>(request));
        }
Beispiel #2
0
        /// <summary>
        /// Return messaging statistics.
        /// </summary>
        /// <param name="groupBy">Group results by specified period: day, month, year or none. Default is none</param>
        /// <param name="start">(Optional) Start date in unix timestamp format. Default is 7 days ago</param>
        /// <param name="end">(Optional) End date in unix timestamp format. Default is now</param>
        /// <returns></returns>
        public MessagingStatsResult GetMessagingStats(MessagingStatsGroupBy groupBy, DateTime start, DateTime end)
        {
            var request = new RestRequest();
            request.Resource = "stats/messaging";

            string groupByString = "off";
            switch (groupBy)
            {
                case MessagingStatsGroupBy.Day:
                    groupByString = "day";
                    break;
                case MessagingStatsGroupBy.Month:
                    groupByString = "month";
                    break;
                case MessagingStatsGroupBy.Year:
                    groupByString = "year";
                    break;
            }
            request.AddQueryParameter("by", groupByString);
            request.AddQueryParameter("start", DateTimeToTimestamp(start).ToString());
            request.AddQueryParameter("end", DateTimeToTimestamp(start).ToString());

            return Execute<MessagingStatsResult>(request);
        }