-
-
Notifications
You must be signed in to change notification settings - Fork 171
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated version command and moved away from HttpClient
- Loading branch information
Showing
12 changed files
with
100 additions
and
277 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
17 changes: 17 additions & 0 deletions
17
core/src/main/java/org/geysermc/floodgate/core/http/api/GlobalApiClient.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,17 @@ | ||
package org.geysermc.floodgate.core.http.api; | ||
|
||
import io.micronaut.http.HttpHeaders; | ||
import io.micronaut.http.annotation.Get; | ||
import io.micronaut.http.annotation.Header; | ||
import io.micronaut.http.client.annotation.Client; | ||
import org.geysermc.floodgate.core.util.Constants; | ||
|
||
@Client("${http.baseUrl.api}") | ||
@Header(name = HttpHeaders.USER_AGENT, value = Constants.USER_AGENT) | ||
public interface GlobalApiClient { | ||
/** | ||
* Checks if it can connect to the Global Api, any other status code than 204 or 404 will throw | ||
*/ | ||
@Get("/healthy") | ||
void health(); | ||
} |
16 changes: 16 additions & 0 deletions
16
core/src/main/java/org/geysermc/floodgate/core/http/downloads/DownloadClient.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,16 @@ | ||
package org.geysermc.floodgate.core.http.downloads; | ||
|
||
import io.micronaut.http.HttpHeaders; | ||
import io.micronaut.http.annotation.Get; | ||
import io.micronaut.http.annotation.Header; | ||
import io.micronaut.http.client.annotation.Client; | ||
import jakarta.validation.constraints.NotBlank; | ||
import java.util.concurrent.CompletableFuture; | ||
import org.geysermc.floodgate.core.util.Constants; | ||
|
||
@Client("${http.baseUrl.download}") | ||
@Header(name = HttpHeaders.USER_AGENT, value = Constants.USER_AGENT) | ||
public interface DownloadClient { | ||
@Get("/v2/projects/{project}/versions/latest/builds/latest") | ||
CompletableFuture<LatestBuildResult> latestBuildFor(@NotBlank String project); | ||
} |
7 changes: 7 additions & 0 deletions
7
core/src/main/java/org/geysermc/floodgate/core/http/downloads/LatestBuildResult.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,7 @@ | ||
package org.geysermc.floodgate.core.http.downloads; | ||
|
||
import io.micronaut.serde.annotation.Serdeable; | ||
|
||
@Serdeable | ||
public record LatestBuildResult(int build) { | ||
} |
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
Oops, something went wrong.