clean
This commit is contained in:
1 parent
6134c893ab
commit
545c09d502
3 files changed
+8
-8
No files matched your search
@@ -114,7 +114,7 @@ public final class GuildRoutes {
|
|||||||
.map(guild -> resolveMember(guild, userId)
|
.map(guild -> resolveMember(guild, userId)
|
||||||
.thenApply(member -> Optional.ofNullable(member)
|
.thenApply(member -> Optional.ofNullable(member)
|
||||||
.map(m -> userGuildEntry(guild, m, guildServices.get(guild.getId()))))
|
.map(m -> userGuildEntry(guild, m, guildServices.get(guild.getId()))))
|
||||||
.exceptionally(error -> Optional.<Map<String, Object>>empty()))
|
.exceptionally(_ -> Optional.empty()))
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
ctx.future(() -> CompletableFuture.allOf(lookups.toArray(new CompletableFuture[0])).thenApply(ignored -> {
|
ctx.future(() -> CompletableFuture.allOf(lookups.toArray(new CompletableFuture[0])).thenApply(ignored -> {
|
||||||
@@ -198,7 +198,7 @@ public final class GuildRoutes {
|
|||||||
private static void ownerOf(Supplier<JDA> jdaSupplier, Context ctx) {
|
private static void ownerOf(Supplier<JDA> jdaSupplier, Context ctx) {
|
||||||
Guild guild = guild(jdaSupplier, ctx);
|
Guild guild = guild(jdaSupplier, ctx);
|
||||||
|
|
||||||
CacheOrFetch.<Member>resolve(
|
CacheOrFetch.resolve(
|
||||||
ctx,
|
ctx,
|
||||||
guild::getOwner,
|
guild::getOwner,
|
||||||
guild::retrieveOwner,
|
guild::retrieveOwner,
|
||||||
@@ -263,7 +263,7 @@ public final class GuildRoutes {
|
|||||||
Guild guild = guild(jdaSupplier, ctx);
|
Guild guild = guild(jdaSupplier, ctx);
|
||||||
String userId = ctx.pathParam("userId");
|
String userId = ctx.pathParam("userId");
|
||||||
|
|
||||||
CacheOrFetch.<Member>resolve(
|
CacheOrFetch.resolve(
|
||||||
ctx,
|
ctx,
|
||||||
() -> guild.getMemberById(userId),
|
() -> guild.getMemberById(userId),
|
||||||
() -> guild.retrieveMemberById(userId),
|
() -> guild.retrieveMemberById(userId),
|
||||||
@@ -289,7 +289,7 @@ public final class GuildRoutes {
|
|||||||
Guild guild = guild(jdaSupplier, ctx);
|
Guild guild = guild(jdaSupplier, ctx);
|
||||||
String userId = ctx.pathParam("userId");
|
String userId = ctx.pathParam("userId");
|
||||||
|
|
||||||
CacheOrFetch.<Member>resolve(
|
CacheOrFetch.resolve(
|
||||||
ctx,
|
ctx,
|
||||||
() -> guild.getMemberById(userId),
|
() -> guild.getMemberById(userId),
|
||||||
() -> guild.retrieveMemberById(userId),
|
() -> guild.retrieveMemberById(userId),
|
||||||
@@ -315,7 +315,7 @@ public final class GuildRoutes {
|
|||||||
Guild guild = guild(jdaSupplier, ctx);
|
Guild guild = guild(jdaSupplier, ctx);
|
||||||
String userId = ctx.pathParam("userId");
|
String userId = ctx.pathParam("userId");
|
||||||
|
|
||||||
CacheOrFetch.<Member>resolve(
|
CacheOrFetch.resolve(
|
||||||
ctx,
|
ctx,
|
||||||
() -> guild.getMemberById(userId),
|
() -> guild.getMemberById(userId),
|
||||||
() -> guild.retrieveMemberById(userId),
|
() -> guild.retrieveMemberById(userId),
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ public final class MusicRoutes {
|
|||||||
MusicManager manager = musicService.get(guild);
|
MusicManager manager = musicService.get(guild);
|
||||||
String userId = ctx.pathParam("userId");
|
String userId = ctx.pathParam("userId");
|
||||||
|
|
||||||
CacheOrFetch.<Member>resolve(
|
CacheOrFetch.resolve(
|
||||||
ctx,
|
ctx,
|
||||||
() -> guild.getMemberById(userId),
|
() -> guild.getMemberById(userId),
|
||||||
() -> guild.retrieveMemberById(userId),
|
() -> guild.retrieveMemberById(userId),
|
||||||
@@ -506,7 +506,7 @@ public final class MusicRoutes {
|
|||||||
summary = "Clear the queue, or remove a single track from it when a position is provided",
|
summary = "Clear the queue, or remove a single track from it when a position is provided",
|
||||||
tags = {"Music"},
|
tags = {"Music"},
|
||||||
pathParams = @OpenApiParam(name = "guildId", description = "The Discord guild id"),
|
pathParams = @OpenApiParam(name = "guildId", description = "The Discord guild id"),
|
||||||
queryParams = @OpenApiParam(name = "position", description = "1-based position of the track to remove (position 1 is the currently playing track); omit to clear the whole queue", required = false),
|
queryParams = @OpenApiParam(name = "position", description = "1-based position of the track to remove (position 1 is the currently playing track); omit to clear the whole queue"),
|
||||||
responses = {
|
responses = {
|
||||||
@OpenApiResponse(status = "200", content = @OpenApiContent(from = DeleteQueueResponse.class)),
|
@OpenApiResponse(status = "200", content = @OpenApiContent(from = DeleteQueueResponse.class)),
|
||||||
@OpenApiResponse(status = "400", content = @OpenApiContent(from = ErrorResponse.class)),
|
@OpenApiResponse(status = "400", content = @OpenApiContent(from = ErrorResponse.class)),
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ public class WebApi implements Lifecycle {
|
|||||||
config.startup.showJavalinBanner = false;
|
config.startup.showJavalinBanner = false;
|
||||||
|
|
||||||
config.registerPlugin(new OpenApiPlugin(pluginConfig -> pluginConfig.withDefinitionConfiguration(
|
config.registerPlugin(new OpenApiPlugin(pluginConfig -> pluginConfig.withDefinitionConfiguration(
|
||||||
(version, definition) -> definition
|
(_, definition) -> definition
|
||||||
.info(info -> info.title("Net Neutrality API"))
|
.info(info -> info.title("Net Neutrality API"))
|
||||||
.withApiKeyAuth("ApiKeyAuth", "X-API-Key")
|
.withApiKeyAuth("ApiKeyAuth", "X-API-Key")
|
||||||
.withGlobalSecurity("ApiKeyAuth")
|
.withGlobalSecurity("ApiKeyAuth")
|
||||||
|
|||||||
Reference in new issue
Block a user