package com.xfestudio.xfeservermanager.api.store;
import com.xfestudio.xfeservermanager.api.util.ApiChecks;
import java.time.Instant;
import java.util.Objects;
public record AuditQuery(
Instant fromInclusive,
Instant toExclusive,
String actorId,
String action,
String target,
String requestId,
int limit,
String cursor) {
public AuditQuery {
Objects.requireNonNull(fromInclusive, "fromInclusive");
Objects.requireNonNull(toExclusive, "toExclusive");
if (!fromInclusive.isBefore(toExclusive)) {
throw new IllegalArgumentException("fromInclusive must precede toExclusive");
}
actorId = actorId == null ? "" : actorId;
action = action == null ? "" : action;
target = target == null ? "" : target;
requestId = requestId == null ? "" : requestId;
if (limit < 1 || limit > 1_000) {
throw new IllegalArgumentException("limit must be between 1 and 1000");
}
cursor = cursor == null ? "" : cursor;
}
/** Source-compatible constructor for integrations that do not yet expose the new filters. */
public AuditQuery(
Instant fromInclusive,
Instant toExclusive,
String actorId,
String action,
int limit,
String cursor) {
this(fromInclusive, toExclusive, actorId, action, "", "", limit, cursor);
}
}
package com.xfestudio.xfeservermanager.api.store;
import com.xfestudio.xfeservermanager.api.util.ApiChecks;
import java.time.Instant;
import java.util.Objects;
public record AuditQuery(
Instant fromInclusive,
Instant toExclusive,
String actorId,
String action,
String target,
String requestId,
int limit,
String cursor) {
public AuditQuery {
Objects.requireNonNull(fromInclusive, "fromInclusive");
Objects.requireNonNull(toExclusive, "toExclusive");
if (!fromInclusive.isBefore(toExclusive)) {
throw new IllegalArgumentException("fromInclusive must precede toExclusive");
}
actorId = actorId == null ? "" : actorId;
action = action == null ? "" : action;
target = target == null ? "" : target;
requestId = requestId == null ? "" : requestId;
if (limit < 1 || limit > 1_000) {
throw new IllegalArgumentException("limit must be between 1 and 1000");
}
cursor = cursor == null ? "" : cursor;
}
/** Source-compatible constructor for integrations that do not yet expose the new filters. */
public AuditQuery(
Instant fromInclusive,
Instant toExclusive,
String actorId,
String action,
int limit,
String cursor) {
this(fromInclusive, toExclusive, actorId, action, "", "", limit, cursor);
}
}