158 lines
5.4 KiB
Java
158 lines
5.4 KiB
Java
package com.linkerbot.vibemake.bean;
|
|
|
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
|
import jakarta.validation.Valid;
|
|
import jakarta.validation.constraints.*;
|
|
|
|
import java.time.LocalDateTime;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public final class Contracts {
|
|
private Contracts() {}
|
|
|
|
public record LoginRequest(
|
|
@NotBlank @Email @Size(max = 254) String email,
|
|
@NotBlank String captchaCode,
|
|
@NotBlank String captchaAnswer) {}
|
|
|
|
public record UserView(String userCode, String nickname, String email) {}
|
|
|
|
public record PublicUser(String userCode, String nickname) {}
|
|
|
|
public record LoginView(String token, String tokenType, long expiresIn, UserView user) {}
|
|
|
|
public record CaptchaView(String captchaCode, String image, long expiresIn) {}
|
|
|
|
public record ProjectInput(
|
|
@NotBlank @Size(max = 100) String name,
|
|
@Size(max = 2000) String description,
|
|
@NotBlank @Size(max = 64) String projectType,
|
|
String coverUrl) {}
|
|
|
|
public record CoverUploadInput(
|
|
@NotBlank String contentType, @NotNull @Positive Long fileSize) {}
|
|
|
|
public record CoverUploadSignature(
|
|
String uploadUrl,
|
|
String objectKey,
|
|
String coverUrl,
|
|
LocalDateTime expiresAt,
|
|
Map<String, String> formFields) {}
|
|
|
|
public record PublicationInput(@NotBlank String commitSha) {}
|
|
|
|
public record UrdfFile(
|
|
@NotBlank String relativePath, @NotNull @PositiveOrZero Long sizeBytes) {}
|
|
|
|
public record UrdfUploadInput(@NotNull List<@NotNull @Valid UrdfFile> files) {}
|
|
|
|
public record UrdfConfirmInput(
|
|
@NotBlank @Pattern(regexp = "[a-f0-9]{32}") String batchCode,
|
|
@NotNull List<@NotNull @Valid UrdfFile> files) {}
|
|
|
|
public record UrdfFileSignature(
|
|
String relativePath, String objectKey, Map<String, String> formFields) {}
|
|
|
|
public record UrdfUploadSignature(
|
|
String batchCode,
|
|
String mainRelativePath,
|
|
String uploadUrl,
|
|
LocalDateTime expiresAt,
|
|
List<UrdfFileSignature> files) {}
|
|
|
|
public record ForkInput(
|
|
@NotBlank String publishedCommitSha, @NotBlank @Size(max = 100) String name) {}
|
|
|
|
public record CommentInput(@NotBlank @Size(max = 2000) String content) {}
|
|
|
|
public record TypeView(String code, String name) {}
|
|
|
|
public record ResourceFile(
|
|
@NotBlank String relativePath, @NotNull @PositiveOrZero Long sizeBytes) {}
|
|
|
|
public record ResourceUploadInput(@NotEmpty List<@NotNull @Valid ResourceFile> files) {}
|
|
|
|
public record ResourceConfirmInput(
|
|
@NotBlank @Pattern(regexp = "[a-f0-9]{32}") String batchCode,
|
|
@NotEmpty List<@NotNull @Valid ResourceFile> files) {}
|
|
|
|
public record ResourceFileSignature(
|
|
String relativePath, String objectKey, Map<String, String> formFields) {}
|
|
|
|
public record ResourceUploadSignature(
|
|
String batchCode,
|
|
String uploadUrl,
|
|
LocalDateTime expiresAt,
|
|
List<ResourceFileSignature> files) {}
|
|
|
|
public record ResourceFileView(String relativePath, long sizeBytes, String url) {}
|
|
|
|
public record ProjectView(
|
|
String projectCode,
|
|
String name,
|
|
String description,
|
|
String coverUrl,
|
|
String urdfMainUrl,
|
|
String urdfBaseUrl,
|
|
String stepMainUrl,
|
|
String stepFileName,
|
|
Long stepSizeBytes,
|
|
String modelGlbUrl,
|
|
String modelPartsBaseUrl,
|
|
@JsonInclude(JsonInclude.Include.NON_NULL) List<ResourceFileView> modelPartsFiles,
|
|
String assemblyJsonUrl,
|
|
String walkingResourcesBaseUrl,
|
|
@JsonInclude(JsonInclude.Include.NON_NULL) List<ResourceFileView> walkingResourcesFiles,
|
|
String projectType,
|
|
PublicUser owner,
|
|
String repoStatus,
|
|
String publishStatus,
|
|
String publishedCommitSha,
|
|
LocalDateTime publishedAt,
|
|
String sourceProjectCode,
|
|
String sourceCommitSha,
|
|
long likeCount,
|
|
long commentCount,
|
|
boolean liked,
|
|
String sourceRepositoryUrl,
|
|
String sourceLicense,
|
|
LocalDateTime createdAt,
|
|
LocalDateTime updatedAt) {}
|
|
|
|
public record CommentView(
|
|
String commentCode, PublicUser author, String content, LocalDateTime createdAt) {}
|
|
|
|
public enum ChangeAction {
|
|
CREATE_FILE,
|
|
UPDATE_FILE,
|
|
DELETE_FILE,
|
|
CREATE_DIRECTORY
|
|
}
|
|
|
|
public record FileChange(@NotNull ChangeAction action, @NotBlank String path, String content) {}
|
|
|
|
public record CommitInput(
|
|
@NotBlank String expectedCommitSha,
|
|
@NotBlank @Size(max = 1000) String message,
|
|
@NotEmpty @Size(max = 500) List<@Valid FileChange> changes) {}
|
|
|
|
public record CommitView(String commitSha, String message) {}
|
|
|
|
public record TreeEntry(String path, String name, String type, long size, String blobSha) {}
|
|
|
|
public record TreeView(String commitSha, String path, List<TreeEntry> entries) {}
|
|
|
|
public record FileView(
|
|
String commitSha,
|
|
String path,
|
|
String blobSha,
|
|
long size,
|
|
String encoding,
|
|
String content,
|
|
boolean editable) {}
|
|
|
|
public record HistoryEntry(
|
|
String commitSha, String message, String authorName, String authorDate) {}
|
|
}
|