Skip to content

Commit

Permalink
prepare for v3
Browse files Browse the repository at this point in the history
  • Loading branch information
kashike committed Apr 30, 2024
1 parent b57ea18 commit 90da4eb
Show file tree
Hide file tree
Showing 28 changed files with 890 additions and 366 deletions.
37 changes: 37 additions & 0 deletions src/main/java/io/papermc/bibliothek/api/model/Change.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* This file is part of bibliothek, licensed under the MIT License.
*
* Copyright (c) 2019-2024 PaperMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.papermc.bibliothek.api.model;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema
public record Change(
@Schema(name = "commit")
String commit,
@Schema(name = "summary")
String summary,
@Schema(name = "message")
String message
) {
}
29 changes: 29 additions & 0 deletions src/main/java/io/papermc/bibliothek/api/model/Channel.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* This file is part of bibliothek, licensed under the MIT License.
*
* Copyright (c) 2019-2024 PaperMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.papermc.bibliothek.api.model;

public enum Channel {
DEFAULT,
EXPERIMENTAL;
}
35 changes: 35 additions & 0 deletions src/main/java/io/papermc/bibliothek/api/model/Download.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* This file is part of bibliothek, licensed under the MIT License.
*
* Copyright (c) 2019-2024 PaperMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.papermc.bibliothek.api.model;

import io.swagger.v3.oas.annotations.media.Schema;

@Schema
public record Download(
@Schema(name = "name", pattern = "[a-z0-9._-]+", example = "paper-1.18-10.jar")
String name,
@Schema(name = "sha256", pattern = "[a-f0-9]{64}", example = "f065e2d345d9d772d5cf2a1ce5c495c4cc56eb2fcd6820e82856485fa19414c8")
String sha256
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* This file is part of bibliothek, licensed under the MIT License.
*
* Copyright (c) 2019-2024 PaperMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.papermc.bibliothek.api.response.v2;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.papermc.bibliothek.api.model.Change;
import io.papermc.bibliothek.api.model.Channel;
import io.papermc.bibliothek.api.model.Download;
import io.papermc.bibliothek.api.serialization.LegacyChannelSerializer;
import io.papermc.bibliothek.database.model.VersionEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.Instant;
import java.util.List;
import java.util.Map;

@Schema
public record BuildResponse(
@JsonProperty("project_id")
@Schema(name = "project_id", pattern = "[a-z]+", example = "paper")
String projectId,

@JsonProperty("project_name")
@Schema(name = "project_name", example = "Paper")
String projectName,

@JsonProperty("version")
@Schema(name = "version", pattern = VersionEntity.PATTERN, example = "1.18")
String version,

@JsonProperty("build")
@Schema(name = "build", pattern = "\\d+", example = "10")
int build,

@JsonProperty("time")
@Schema(name = "time")
Instant time,

@JsonProperty("channel")
@JsonSerialize(using = LegacyChannelSerializer.class)
@Schema(name = "channel")
Channel channel,

@JsonProperty("promoted")
@Schema(name = "promoted")
boolean promoted,

@JsonProperty("changes")
@Schema(name = "changes")
List<Change> changes,

@JsonProperty("downloads")
@Schema(name = "downloads")
Map<String, Download> downloads
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* This file is part of bibliothek, licensed under the MIT License.
*
* Copyright (c) 2019-2024 PaperMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.papermc.bibliothek.api.response.v2;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.papermc.bibliothek.api.model.Change;
import io.papermc.bibliothek.api.model.Channel;
import io.papermc.bibliothek.api.model.Download;
import io.papermc.bibliothek.database.model.VersionEntity;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.Instant;
import java.util.List;
import java.util.Map;

@Schema
public record BuildsResponse(
@JsonProperty("project_id")
@Schema(name = "project_id", pattern = "[a-z]+", example = "paper")
String projectId,

@JsonProperty("project_name")
@Schema(name = "project_name", example = "Paper")
String projectName,

@JsonProperty("version")
@Schema(name = "version", pattern = VersionEntity.PATTERN, example = "1.18")
String version,

@JsonProperty("builds")
@Schema(name = "builds")
List<VersionBuild> builds
) {
@Schema
public record VersionBuild(
@JsonProperty("build")
@Schema(name = "build", pattern = "\\d+", example = "10")
int build,

@JsonProperty("time")
@Schema(name = "time")
Instant time,

@JsonProperty("channel")
@Schema(name = "channel")
Channel channel,

@JsonProperty("promoted")
@Schema(name = "promoted")
boolean promoted,

@JsonProperty("changes")
@Schema(name = "changes")
List<Change> changes,

@JsonProperty("downloads")
@Schema(name = "downloads")
Map<String, Download> downloads
) {
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/*
* This file is part of bibliothek, licensed under the MIT License.
*
* Copyright (c) 2019-2024 PaperMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.papermc.bibliothek.api.response.v2;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;

@Schema
public record ProjectResponse(
@JsonProperty("project_id")
@Schema(name = "project_id", pattern = "[a-z]+", example = "paper")
String projectId,

@JsonProperty("project_name")
@Schema(name = "project_name", example = "Paper")
String projectName,

@JsonProperty("version_groups")
@Schema(name = "version_groups")
List<String> versionGroups,

@JsonProperty("versions")
@Schema(name = "versions")
List<String> versions
) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* This file is part of bibliothek, licensed under the MIT License.
*
* Copyright (c) 2019-2024 PaperMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package io.papermc.bibliothek.api.response.v2;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;

@Schema
public record ProjectsResponse(
@JsonProperty("projects")
@Schema(name = "projects")
List<String> projects
) {
}
Loading

0 comments on commit 90da4eb

Please sign in to comment.