269 lines
8.5 KiB
Java
269 lines
8.5 KiB
Java
package com.muse.dto;
|
||
|
||
import java.net.URI;
|
||
import java.util.Objects;
|
||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||
import com.fasterxml.jackson.annotation.JsonValue;
|
||
import java.util.ArrayList;
|
||
import java.util.Arrays;
|
||
import java.util.List;
|
||
import org.springframework.lang.Nullable;
|
||
import java.io.Serializable;
|
||
import java.time.OffsetDateTime;
|
||
import jakarta.validation.Valid;
|
||
import jakarta.validation.constraints.*;
|
||
import io.swagger.v3.oas.annotations.media.Schema;
|
||
|
||
|
||
import java.util.*;
|
||
import jakarta.annotation.Generated;
|
||
|
||
/**
|
||
* 创建调用归属 job 请求。归因事实必须由服务端根据 correlationId/callIds 对已记录 New-API 调用、 业务任务和授权记录进行校验后得出,禁止在请求体中任意指定 user/work/asset/license 归属。
|
||
*/
|
||
|
||
@Schema(name = "CallAttributionJobCreate", description = "创建调用归属 job 请求。归因事实必须由服务端根据 correlationId/callIds 对已记录 New-API 调用、 业务任务和授权记录进行校验后得出,禁止在请求体中任意指定 user/work/asset/license 归属。 ")
|
||
@Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2026-05-24T16:47:40.290595+08:00[Asia/Shanghai]", comments = "Generator version: 7.22.0")
|
||
public class CallAttributionJobCreate implements Serializable {
|
||
|
||
private static final long serialVersionUID = 1L;
|
||
|
||
private String commandId;
|
||
|
||
private String correlationId;
|
||
|
||
@Valid
|
||
private List<String> callIds = new ArrayList<>();
|
||
|
||
private @Nullable Integer expectedCallRevision;
|
||
|
||
/**
|
||
* 归因校验模式;strict 下必须校验调用、任务、作品、资产和授权关系一致
|
||
*/
|
||
public enum VerificationModeEnum {
|
||
STRICT("strict");
|
||
|
||
private final String value;
|
||
|
||
VerificationModeEnum(String value) {
|
||
this.value = value;
|
||
}
|
||
|
||
@JsonValue
|
||
public String getValue() {
|
||
return value;
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
return String.valueOf(value);
|
||
}
|
||
|
||
@JsonCreator
|
||
public static VerificationModeEnum fromValue(String value) {
|
||
for (VerificationModeEnum b : VerificationModeEnum.values()) {
|
||
if (b.value.equals(value)) {
|
||
return b;
|
||
}
|
||
}
|
||
throw new IllegalArgumentException("Unexpected value '" + value + "'");
|
||
}
|
||
}
|
||
|
||
private VerificationModeEnum verificationMode = VerificationModeEnum.STRICT;
|
||
|
||
private @Nullable String reason;
|
||
|
||
public CallAttributionJobCreate() {
|
||
super();
|
||
}
|
||
|
||
/**
|
||
* Constructor with only required parameters
|
||
*/
|
||
public CallAttributionJobCreate(String commandId, String correlationId) {
|
||
this.commandId = commandId;
|
||
this.correlationId = correlationId;
|
||
}
|
||
|
||
public CallAttributionJobCreate commandId(String commandId) {
|
||
this.commandId = commandId;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 幂等键
|
||
* @return commandId
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "commandId", description = "幂等键", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("commandId")
|
||
public String getCommandId() {
|
||
return commandId;
|
||
}
|
||
|
||
@JsonProperty("commandId")
|
||
public void setCommandId(String commandId) {
|
||
this.commandId = commandId;
|
||
}
|
||
|
||
public CallAttributionJobCreate correlationId(String correlationId) {
|
||
this.correlationId = correlationId;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* New-API 调用关联 ID,必须已存在于服务端调用审计记录
|
||
* @return correlationId
|
||
*/
|
||
@NotNull
|
||
@Schema(name = "correlationId", description = "New-API 调用关联 ID,必须已存在于服务端调用审计记录", requiredMode = Schema.RequiredMode.REQUIRED)
|
||
@JsonProperty("correlationId")
|
||
public String getCorrelationId() {
|
||
return correlationId;
|
||
}
|
||
|
||
@JsonProperty("correlationId")
|
||
public void setCorrelationId(String correlationId) {
|
||
this.correlationId = correlationId;
|
||
}
|
||
|
||
public CallAttributionJobCreate callIds(List<String> callIds) {
|
||
this.callIds = callIds;
|
||
return this;
|
||
}
|
||
|
||
public CallAttributionJobCreate addCallIdsItem(String callIdsItem) {
|
||
if (this.callIds == null) {
|
||
this.callIds = new ArrayList<>();
|
||
}
|
||
this.callIds.add(callIdsItem);
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 可选的 New-API callId 白名单;未传时归因该 correlationId 下所有未归因调用
|
||
* @return callIds
|
||
*/
|
||
|
||
@Schema(name = "callIds", description = "可选的 New-API callId 白名单;未传时归因该 correlationId 下所有未归因调用", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("callIds")
|
||
public List<String> getCallIds() {
|
||
return callIds;
|
||
}
|
||
|
||
@JsonProperty("callIds")
|
||
public void setCallIds(List<String> callIds) {
|
||
this.callIds = callIds;
|
||
}
|
||
|
||
public CallAttributionJobCreate expectedCallRevision(@Nullable Integer expectedCallRevision) {
|
||
this.expectedCallRevision = expectedCallRevision;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 调用审计记录 revision 乐观锁,避免对过期调用集归因
|
||
* @return expectedCallRevision
|
||
*/
|
||
|
||
@Schema(name = "expectedCallRevision", description = "调用审计记录 revision 乐观锁,避免对过期调用集归因", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("expectedCallRevision")
|
||
public @Nullable Integer getExpectedCallRevision() {
|
||
return expectedCallRevision;
|
||
}
|
||
|
||
@JsonProperty("expectedCallRevision")
|
||
public void setExpectedCallRevision(@Nullable Integer expectedCallRevision) {
|
||
this.expectedCallRevision = expectedCallRevision;
|
||
}
|
||
|
||
public CallAttributionJobCreate verificationMode(VerificationModeEnum verificationMode) {
|
||
this.verificationMode = verificationMode;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 归因校验模式;strict 下必须校验调用、任务、作品、资产和授权关系一致
|
||
* @return verificationMode
|
||
*/
|
||
|
||
@Schema(name = "verificationMode", description = "归因校验模式;strict 下必须校验调用、任务、作品、资产和授权关系一致", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("verificationMode")
|
||
public VerificationModeEnum getVerificationMode() {
|
||
return verificationMode;
|
||
}
|
||
|
||
@JsonProperty("verificationMode")
|
||
public void setVerificationMode(VerificationModeEnum verificationMode) {
|
||
this.verificationMode = verificationMode;
|
||
}
|
||
|
||
public CallAttributionJobCreate reason(@Nullable String reason) {
|
||
this.reason = reason;
|
||
return this;
|
||
}
|
||
|
||
/**
|
||
* 归属原因
|
||
* @return reason
|
||
*/
|
||
|
||
@Schema(name = "reason", description = "归属原因", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
||
@JsonProperty("reason")
|
||
public @Nullable String getReason() {
|
||
return reason;
|
||
}
|
||
|
||
@JsonProperty("reason")
|
||
public void setReason(@Nullable String reason) {
|
||
this.reason = reason;
|
||
}
|
||
|
||
@Override
|
||
public boolean equals(Object o) {
|
||
if (this == o) {
|
||
return true;
|
||
}
|
||
if (o == null || getClass() != o.getClass()) {
|
||
return false;
|
||
}
|
||
CallAttributionJobCreate callAttributionJobCreate = (CallAttributionJobCreate) o;
|
||
return Objects.equals(this.commandId, callAttributionJobCreate.commandId) &&
|
||
Objects.equals(this.correlationId, callAttributionJobCreate.correlationId) &&
|
||
Objects.equals(this.callIds, callAttributionJobCreate.callIds) &&
|
||
Objects.equals(this.expectedCallRevision, callAttributionJobCreate.expectedCallRevision) &&
|
||
Objects.equals(this.verificationMode, callAttributionJobCreate.verificationMode) &&
|
||
Objects.equals(this.reason, callAttributionJobCreate.reason);
|
||
}
|
||
|
||
@Override
|
||
public int hashCode() {
|
||
return Objects.hash(commandId, correlationId, callIds, expectedCallRevision, verificationMode, reason);
|
||
}
|
||
|
||
@Override
|
||
public String toString() {
|
||
StringBuilder sb = new StringBuilder();
|
||
sb.append("class CallAttributionJobCreate {\n");
|
||
sb.append(" commandId: ").append(toIndentedString(commandId)).append("\n");
|
||
sb.append(" correlationId: ").append(toIndentedString(correlationId)).append("\n");
|
||
sb.append(" callIds: ").append(toIndentedString(callIds)).append("\n");
|
||
sb.append(" expectedCallRevision: ").append(toIndentedString(expectedCallRevision)).append("\n");
|
||
sb.append(" verificationMode: ").append(toIndentedString(verificationMode)).append("\n");
|
||
sb.append(" reason: ").append(toIndentedString(reason)).append("\n");
|
||
sb.append("}");
|
||
return sb.toString();
|
||
}
|
||
|
||
/**
|
||
* Convert the given object to string with each line indented by 4 spaces
|
||
* (except the first line).
|
||
*/
|
||
private String toIndentedString(@Nullable Object o) {
|
||
return o == null ? "null" : o.toString().replace("\n", "\n ");
|
||
}
|
||
}
|
||
|