Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix get user last activity date method #19

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions Octokit/Clients/AuditOrganizationsClient.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

Expand All @@ -23,14 +24,19 @@ public AuditOrganizationsClient(IApiConnection apiConnection) : base(apiConnecti

var options = new ApiOptions()
{
PageCount = 1,
PageSize = 1
};
var auditLogs = await ApiConnection.GetAll<AuditLogEvent>(ApiUrls.AuditLog(organization, repository, user), options);

if (!auditLogs.Any()) return null;
IDictionary<string, string> parameters = new Dictionary<string, string>();
Pagination.Setup(parameters, options);
var auditLogs = await ApiConnection.Get<List<AuditLogEvent>>(ApiUrls.AuditLog(organization, repository, user), parameters);

if (!auditLogs.Any())
{
return null;
}

var auditLog = auditLogs.Single();
if (auditLog == null) return null;

var dateTimeOffSet = DateTimeOffset.FromUnixTimeMilliseconds(auditLog.CreatedAt);
var dateTime = dateTimeOffSet.DateTime;
Expand Down
2 changes: 1 addition & 1 deletion Octokit/Octokit.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>An async-based GitHub API client library for .NET and .NET Core</Description>
<AssemblyTitle>Octokit</AssemblyTitle>
<Authors>GitHub</Authors>
<Version>1.0.15</Version>
<Version>1.0.16</Version>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Octokit</AssemblyName>
<PackageId>Apiiro.Octokit</PackageId>
Expand Down