Skip to content

Fix "after" and "before" parameters in GroupApi#getAuditEvents() #1263

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

Merged
merged 1 commit into from
Jul 8, 2025
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
18 changes: 9 additions & 9 deletions gitlab4j-api/src/main/java/org/gitlab4j/api/AuditEventApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@ public AuditEventApi(GitLabApi gitLabApi) {
*
* <pre><code>GET /audit_events/</code></pre>
*
* @param created_after Return group audit events created on or after the given time.
* @param created_before Return group audit events created on or before the given time.
* @param createdAfter Return group audit events created on or after the given time.
* @param createdBefore Return group audit events created on or before the given time.
* @param entityType Return audit events for the given entity type. Valid values are: User, Group, or Project.
* @param entityId Return audit events for the given entity ID. Requires entityType attribute to be present.
* @return a List of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public List<AuditEvent> getAuditEvents(Date created_after, Date created_before, String entityType, Long entityId)
public List<AuditEvent> getAuditEvents(Date createdAfter, Date createdBefore, String entityType, Long entityId)
throws GitLabApiException {
return (getAuditEvents(created_after, created_before, entityType, entityId, getDefaultPerPage())
return (getAuditEvents(createdAfter, createdBefore, entityType, entityId, getDefaultPerPage())
.all());
}

Expand All @@ -43,20 +43,20 @@ public List<AuditEvent> getAuditEvents(Date created_after, Date created_before,
*
* <pre><code>GET /audit_events</code></pre>
*
* @param created_after Return group audit events created on or after the given time.
* @param created_before Return group audit events created on or before the given time.
* @param createdAfter Return group audit events created on or after the given time.
* @param createdBefore Return group audit events created on or before the given time.
* @param entityType Return audit events for the given entity type. Valid values are: User, Group, or Project.
* @param entityId Return audit events for the given entity ID. Requires entityType attribute to be present.
* @param itemsPerPage the number of Audit Event instances that will be fetched per page
* @return a Pager of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public Pager<AuditEvent> getAuditEvents(
Date created_after, Date created_before, String entityType, Long entityId, int itemsPerPage)
Date createdAfter, Date createdBefore, String entityType, Long entityId, int itemsPerPage)
throws GitLabApiException {
Form form = new GitLabApiForm()
.withParam("created_before", ISO8601.toString(created_before, false))
.withParam("created_after", ISO8601.toString(created_after, false))
.withParam("created_after", ISO8601.toString(createdAfter, false))
.withParam("created_before", ISO8601.toString(createdBefore, false))
.withParam("entity_type", entityType)
.withParam("entity_id", entityId);
return (new Pager<AuditEvent>(this, AuditEvent.class, itemsPerPage, form.asMap(), "audit_events"));
Expand Down
27 changes: 14 additions & 13 deletions gitlab4j-api/src/main/java/org/gitlab4j/api/GroupApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -1768,14 +1768,14 @@ public Project transferProject(Object groupIdOrPath, Object projectIdOrPath) thr
* <pre><code>GET /groups/:id/audit_events</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param created_after Group audit events created on or after the given time.
* @param created_before Group audit events created on or before the given time.
* @param createdAfter Group audit events created on or after the given time.
* @param createdBefore Group audit events created on or before the given time.
* @return a List of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public List<AuditEvent> getAuditEvents(Object groupIdOrPath, Date created_after, Date created_before)
public List<AuditEvent> getAuditEvents(Object groupIdOrPath, Date createdAfter, Date createdBefore)
throws GitLabApiException {
return (getAuditEvents(groupIdOrPath, created_after, created_before, getDefaultPerPage())
return (getAuditEvents(groupIdOrPath, createdAfter, createdBefore, getDefaultPerPage())
.all());
}

Expand All @@ -1785,17 +1785,18 @@ public List<AuditEvent> getAuditEvents(Object groupIdOrPath, Date created_after,
* <pre><code>GET /groups/:id/audit_events</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param created_after Group audit events created on or after the given time.
* @param created_before Group audit events created on or before the given time.
* @param createdAfter Group audit events created on or after the given time.
* @param createdBefore Group audit events created on or before the given time.
* @param itemsPerPage the number of Audit Event instances that will be fetched per page
* @return a Pager of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public Pager<AuditEvent> getAuditEvents(
Object groupIdOrPath, Date created_after, Date created_before, int itemsPerPage) throws GitLabApiException {
Object groupIdOrPath, Date createdAfter, Date createdBefore, int itemsPerPage) throws GitLabApiException {
Form form = new GitLabApiForm()
.withParam("created_before", ISO8601.toString(created_after, false))
.withParam("created_after", ISO8601.toString(created_before, false));
.withParam("created_after", ISO8601.toString(createdAfter, false))
.withParam("created_before", ISO8601.toString(createdBefore, false));

return (new Pager<AuditEvent>(
this,
AuditEvent.class,
Expand All @@ -1812,14 +1813,14 @@ public Pager<AuditEvent> getAuditEvents(
* <pre><code>GET /groups/:id/audit_events</code></pre>
*
* @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path
* @param created_after Group audit events created on or after the given time.
* @param created_before Group audit events created on or before the given time.
* @param createdAfter Group audit events created on or after the given time.
* @param createdBefore Group audit events created on or before the given time.
* @return a Stream of group Audit events
* @throws GitLabApiException if any exception occurs
*/
public Stream<AuditEvent> getAuditEventsStream(Object groupIdOrPath, Date created_after, Date created_before)
public Stream<AuditEvent> getAuditEventsStream(Object groupIdOrPath, Date createdAfter, Date createdBefore)
throws GitLabApiException {
return (getAuditEvents(groupIdOrPath, created_after, created_before, getDefaultPerPage()).stream());
return (getAuditEvents(groupIdOrPath, createdAfter, createdBefore, getDefaultPerPage()).stream());
}

/**
Expand Down
27 changes: 13 additions & 14 deletions gitlab4j-api/src/main/java/org/gitlab4j/api/ProjectApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -3424,14 +3424,14 @@ public Project setProjectAvatar(Object projectIdOrPath, File avatarFile) throws
* <pre><code>GET /projects/:id/audit_events</code></pre>
*
* @param projectIdOrPath the project ID, path of the project, or a project instance holding the project ID or path
* @param created_after Project audit events created on or after the given time.
* @param created_before Project audit events created on or before the given time.
* @param createdAfter Project audit events created on or after the given time.
* @param createdBefore Project audit events created on or before the given time.
* @return a List of project Audit events
* @throws GitLabApiException if any exception occurs
*/
public List<AuditEvent> getAuditEvents(Object projectIdOrPath, Date created_after, Date created_before)
public List<AuditEvent> getAuditEvents(Object projectIdOrPath, Date createdAfter, Date createdBefore)
throws GitLabApiException {
return (getAuditEvents(projectIdOrPath, created_after, created_before, getDefaultPerPage())
return (getAuditEvents(projectIdOrPath, createdAfter, createdBefore, getDefaultPerPage())
.all());
}

Expand All @@ -3441,18 +3441,17 @@ public List<AuditEvent> getAuditEvents(Object projectIdOrPath, Date created_afte
* <pre><code>GET /projects/:id/audit_events</code></pre>
*
* @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path
* @param created_after Project audit events created on or after the given time.
* @param created_before Project audit events created on or before the given time.
* @param createdAfter Project audit events created on or after the given time.
* @param createdBefore Project audit events created on or before the given time.
* @param itemsPerPage the number of Audit Event instances that will be fetched per page
* @return a Pager of project Audit events
* @throws GitLabApiException if any exception occurs
*/
public Pager<AuditEvent> getAuditEvents(
Object projectIdOrPath, Date created_after, Date created_before, int itemsPerPage)
throws GitLabApiException {
Object projectIdOrPath, Date createdAfter, Date createdBefore, int itemsPerPage) throws GitLabApiException {
Form form = new GitLabApiForm()
.withParam("created_before", ISO8601.toString(created_before, false))
.withParam("created_after", ISO8601.toString(created_after, false));
.withParam("created_after", ISO8601.toString(createdAfter, false))
.withParam("created_before", ISO8601.toString(createdBefore, false));
return (new Pager<AuditEvent>(
this,
AuditEvent.class,
Expand All @@ -3469,14 +3468,14 @@ public Pager<AuditEvent> getAuditEvents(
* <pre><code>GET /projects/:id/audit_events</code></pre>
*
* @param projectIdOrPath the project ID, path of the project, or a Project instance holding the project ID or path
* @param created_after Project audit events created on or after the given time.
* @param created_before Project audit events created on or before the given time.
* @param createdAfter Project audit events created on or after the given time.
* @param createdBefore Project audit events created on or before the given time.
* @return a Stream of project Audit events
* @throws GitLabApiException if any exception occurs
*/
public Stream<AuditEvent> getAuditEventsStream(Object projectIdOrPath, Date created_after, Date created_before)
public Stream<AuditEvent> getAuditEventsStream(Object projectIdOrPath, Date createdAfter, Date createdBefore)
throws GitLabApiException {
return (getAuditEvents(projectIdOrPath, created_after, created_before, getDefaultPerPage()).stream());
return (getAuditEvents(projectIdOrPath, createdAfter, createdBefore, getDefaultPerPage()).stream());
}

/**
Expand Down
Loading