-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
51 changed files
with
1,415 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/main/java/io/papermc/bibliothek/api/model/Channel.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* 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 org.jspecify.annotations.NullMarked; | ||
|
||
@NullMarked | ||
public enum Channel { | ||
DEFAULT, | ||
EXPERIMENTAL; | ||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/io/papermc/bibliothek/api/model/Download.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* 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 org.jspecify.annotations.NullMarked; | ||
|
||
@NullMarked | ||
public record Download( | ||
String name, | ||
String sha256 | ||
) { | ||
} |
44 changes: 44 additions & 0 deletions
44
src/main/java/io/papermc/bibliothek/api/serialization/LegacyChannelSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* 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.serialization; | ||
|
||
import com.fasterxml.jackson.core.JsonGenerator; | ||
import com.fasterxml.jackson.databind.SerializerProvider; | ||
import com.fasterxml.jackson.databind.ser.std.StdSerializer; | ||
import io.papermc.bibliothek.api.model.Channel; | ||
import java.io.IOException; | ||
import java.util.Locale; | ||
import org.jspecify.annotations.NullMarked; | ||
|
||
@NullMarked | ||
public class LegacyChannelSerializer extends StdSerializer<Channel> { | ||
public LegacyChannelSerializer() { | ||
super(Channel.class); | ||
} | ||
|
||
@Override | ||
public void serialize(final Channel value, final JsonGenerator gen, final SerializerProvider provider) throws IOException { | ||
gen.writeString(value.name().toLowerCase(Locale.ROOT)); | ||
} | ||
} |
68 changes: 68 additions & 0 deletions
68
src/main/java/io/papermc/bibliothek/api/v2/Constants2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/* | ||
* 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.v2; | ||
|
||
import org.intellij.lang.annotations.Language; | ||
import org.jspecify.annotations.NullMarked; | ||
|
||
@NullMarked | ||
public final class Constants2 { | ||
public static final String FIELD_BUILD = "build"; | ||
public static final String FIELD_BUILDS = "builds"; | ||
public static final String FIELD_CHANGES = "changes"; | ||
public static final String FIELD_CHANNEL = "channel"; | ||
public static final String FIELD_COMMIT = "commit"; | ||
public static final String FIELD_DOWNLOADS = "downloads"; | ||
public static final String FIELD_MESSAGE = "message"; | ||
public static final String FIELD_NAME = "name"; | ||
public static final String FIELD_PROJECTS = "projects"; | ||
public static final String FIELD_PROJECT_ID = "project_id"; | ||
public static final String FIELD_PROJECT_NAME = "project_name"; | ||
public static final String FIELD_PROMOTED = "promoted"; | ||
public static final String FIELD_SHA256 = "sha256"; | ||
public static final String FIELD_SUMMARY = "summary"; | ||
public static final String FIELD_TIME = "time"; | ||
public static final String FIELD_VERSION = "version"; | ||
public static final String FIELD_VERSIONS = "versions"; | ||
public static final String FIELD_VERSION_GROUP = "version_group"; | ||
public static final String FIELD_VERSION_GROUPS = "version_groups"; | ||
|
||
@Language("RegExp") | ||
public static final String PATTERN_DOWNLOAD = "[a-z0-9._-]+"; | ||
@Language("RegExp") | ||
public static final String PATTERN_PROJECT_ID = "[a-z]+"; | ||
@Language("RegExp") | ||
public static final String PATTERN_SHA256 = "[a-f0-9]{64}"; | ||
@Language("RegExp") | ||
public static final String PATTERN_VERSION = "[0-9.]+-?(?:pre|SNAPSHOT)?(?:[0-9.]+)?"; | ||
|
||
public static final String EXAMPLE_DOWNLOAD = "paper-1.18-10.jar"; | ||
public static final String EXAMPLE_PROJECT_ID = "paper"; | ||
public static final String EXAMPLE_PROJECT_NAME = "Paper"; | ||
public static final String EXAMPLE_SHA256 = "f065e2d345d9d772d5cf2a1ce5c495c4cc56eb2fcd6820e82856485fa19414c8"; | ||
public static final String EXAMPLE_VERSION = "1.18"; | ||
|
||
private Constants2() { | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/main/java/io/papermc/bibliothek/api/v2/model/Change2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* 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.v2.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.papermc.bibliothek.api.model.Change; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.List; | ||
import org.jspecify.annotations.NullMarked; | ||
|
||
import static io.papermc.bibliothek.api.v2.Constants2.FIELD_COMMIT; | ||
import static io.papermc.bibliothek.api.v2.Constants2.FIELD_MESSAGE; | ||
import static io.papermc.bibliothek.api.v2.Constants2.FIELD_SUMMARY; | ||
|
||
@NullMarked | ||
@Schema | ||
public record Change2( | ||
@JsonProperty(FIELD_COMMIT) | ||
@Schema(name = FIELD_COMMIT) | ||
String commit, | ||
|
||
@JsonProperty(FIELD_SUMMARY) | ||
@Schema(name = FIELD_SUMMARY) | ||
String summary, | ||
|
||
@JsonProperty(FIELD_MESSAGE) | ||
@Schema(name = FIELD_MESSAGE) | ||
String message | ||
) { | ||
private Change2(final Change that) { | ||
this(that.commit(), that.summary(), that.message()); | ||
} | ||
|
||
public static List<Change2> map(final List<Change> list) { | ||
return list | ||
.stream() | ||
.map(Change2::new) | ||
.toList(); | ||
} | ||
} |
61 changes: 61 additions & 0 deletions
61
src/main/java/io/papermc/bibliothek/api/v2/model/Download2.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* 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.v2.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.papermc.bibliothek.api.model.Download; | ||
import io.swagger.v3.oas.annotations.media.Schema; | ||
import java.util.Map; | ||
import java.util.stream.Collectors; | ||
import org.jspecify.annotations.NullMarked; | ||
|
||
import static io.papermc.bibliothek.api.v2.Constants2.EXAMPLE_DOWNLOAD; | ||
import static io.papermc.bibliothek.api.v2.Constants2.EXAMPLE_SHA256; | ||
import static io.papermc.bibliothek.api.v2.Constants2.FIELD_NAME; | ||
import static io.papermc.bibliothek.api.v2.Constants2.FIELD_SHA256; | ||
import static io.papermc.bibliothek.api.v2.Constants2.PATTERN_DOWNLOAD; | ||
import static io.papermc.bibliothek.api.v2.Constants2.PATTERN_SHA256; | ||
|
||
@NullMarked | ||
@Schema | ||
public record Download2( | ||
@JsonProperty(FIELD_NAME) | ||
@Schema(name = FIELD_NAME, pattern = PATTERN_DOWNLOAD, example = EXAMPLE_DOWNLOAD) | ||
String name, | ||
|
||
@JsonProperty(FIELD_SHA256) | ||
@Schema(name = FIELD_SHA256, pattern = PATTERN_SHA256, example = EXAMPLE_SHA256) | ||
String sha256 | ||
) { | ||
private Download2(final Download that) { | ||
this(that.name(), that.sha256()); | ||
} | ||
|
||
public static Map<String, Download2> map(final Map<String, Download> map) { | ||
return map.entrySet() | ||
.stream() | ||
.map(e -> Map.entry(e.getKey(), new Download2(e.getValue()))) | ||
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); | ||
} | ||
} |
Oops, something went wrong.