Beispiel #1
0
        /// <summary>
        /// Retrieve every log event for a specific user.
        /// </summary>
        /// <param name="request">Specifies criteria to use when querying logs for a user.</param>
        /// <param name="pagination">Specifies pagination info to use when requesting paged results.</param>
        /// <returns>An <see cref="IPagedList{LogEntry}"/> containing the log entries for the user.</returns>
        public Task <IPagedList <LogEntry> > GetLogsAsync(GetUserLogsRequest request, PaginationInfo pagination)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }
            if (pagination == null)
            {
                throw new ArgumentNullException(nameof(pagination));
            }

            return(Connection.GetAsync <IPagedList <LogEntry> >(BuildUri($"users/{EncodePath(request.UserId)}/logs",
                                                                         new Dictionary <string, string>
            {
                { "sort", request.Sort },
                { "page", pagination.PageNo.ToString() },
                { "per_page", pagination.PerPage.ToString() },
                { "include_totals", pagination.IncludeTotals.ToString().ToLower() }
            }), DefaultHeaders, logsConverters));
        }
Beispiel #2
0
        /// <summary>
        /// Retrieve every log event for a specific user.
        /// </summary>
        /// <param name="request">Specifies criteria to use when querying logs for a user.</param>
        /// <param name="pagination">Specifies pagination info to use when requesting paged results.</param>
        /// <returns>An <see cref="IPagedList{LogEntry}"/> containing the log entries for the user.</returns>
        public Task <IPagedList <LogEntry> > GetLogsAsync(GetUserLogsRequest request, PaginationInfo pagination)
        {
            if (request == null)
            {
                throw new ArgumentNullException(nameof(request));
            }
            if (pagination == null)
            {
                throw new ArgumentNullException(nameof(pagination));
            }

            return(Connection.GetAsync <IPagedList <LogEntry> >("users/{id}/logs",
                                                                new Dictionary <string, string>
            {
                { "id", request.UserId }
            },
                                                                new Dictionary <string, string>
            {
                { "sort", request.Sort },
                { "page", pagination.PageNo.ToString() },
                { "per_page", pagination.PerPage.ToString() },
                { "include_totals", pagination.IncludeTotals.ToString().ToLower() }
            }, null, new PagedListConverter <LogEntry>("logs", true)));
        }