Example #1
0
        public async Task <DateTime[]> GetCallHistoryAsync(string method, string clientId, TimeSpan period)
        {
            var timeNow = DateTime.UtcNow;

            var result =
                await
                _tableStorage.WhereAsync(ApiCallHistoryRecord.GeneratePartitionKey(method, clientId),
                                         timeNow - period, timeNow, ToIntervalOption.IncludeTo, includeTime : true);

            return(result.Select(x => x.DateTime).ToArray());
        }
Example #2
0
        public async Task ClearCallsHistory(string method, string clientId)
        {
            var all = await _tableStorage.GetDataAsync(ApiCallHistoryRecord.GeneratePartitionKey(method, clientId));

            await _tableStorage.DeleteAsync(all);
        }
Example #3
0
        public async Task <int> GetCallsCount(string method, string clientId)
        {
            var all = await _tableStorage.GetDataAsync(ApiCallHistoryRecord.GeneratePartitionKey(method, clientId));

            return(all.Count());
        }