XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEServerManager

【Java】我的世界XFE服务器管理器

公开
关注 0 Fork 0 Star 0
UTF-8
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);
    }
}