Пример #1
0
        /// <summary>
        /// Gets audit logs asynchronously
        /// </summary>
        /// <returns>A page of audit logs</returns>
        /// <example>This example shows how to get the first page of audit logs:
        /// <code>
        /// using ProKnow;
        /// using System.Threading.Tasks;
        ///
        /// var pk = new ProKnowApi("https://example.proknow.com", "./credentials.json");
        /// FilterParameters filterParams = new FilterParameters();
        /// var page = await _proKnow.Audit.Query(filterParams);
        /// var nextPage = await page.Next();
        /// </code>
        /// </example>
        public async Task <AuditPage> Query(FilterParameters filter)
        {
            FilterParametersExtended filterParameters = new FilterParametersExtended();

            filterParameters.Copy(filter);

            filterParameters.PageNumber = null;
            if (filter == null)
            {
                filterParameters.PageSize = 25;
            }

            var bodyJson       = JsonSerializer.Serialize(filterParameters, _serializerOptions);
            var requestContent = new StringContent(bodyJson, Encoding.UTF8, "application/json");

            var json = await _proKnow.Requestor.PostAsync("/audit/events/search", null, requestContent);

            var page = JsonSerializer.Deserialize <AuditPage>(json);

            if (page.Items.Count > 0)
            {
                filterParameters.FirstId    = page.Items[0].Id;
                filterParameters.PageNumber = 0;
            }

            page.PostProcessDeserialization(_proKnow, filterParameters);
            return(page);
        }
 public void Copy(FilterParameters data)
 {
     this.PageSize       = data.PageSize;
     this.StartTime      = data.StartTime;
     this.EndTime        = data.EndTime;
     this.Types          = data.Types;
     this.UserName       = data.UserName;
     this.PatientName    = data.PatientName;
     this.Classification = data.Classification;
     this.Methods        = data.Methods;
     this.URI            = data.URI;
     this.UserAgent      = data.UserAgent;
     this.IpAddress      = data.IpAddress;
     this.StatusCodes    = data.StatusCodes;
     this.WorkspaceId    = data.WorkspaceId;
     this.ResourceId     = data.ResourceId;
 }