-
Notifications
You must be signed in to change notification settings - Fork 8
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
7 changed files
with
105 additions
and
12 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
src/main/java/com/javadiscord/jdi/internal/api/impl/emojis/CreateEmojiRequest.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,27 @@ | ||
package com.javadiscord.jdi.internal.api.impl.emojis; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public record CreateEmojiRequest( | ||
long guildId, | ||
String name, | ||
String image, // https://discord.com/developers/docs/reference#image-data | ||
List<Long> roles) | ||
implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
return new DiscordRequestBuilder() | ||
.post() | ||
.path("/guilds/%s/emojis".formatted(guildId)) | ||
.body( | ||
Map.of( | ||
"name", name, | ||
"image", image, | ||
"roles", roles)); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/javadiscord/jdi/internal/api/impl/emojis/DeleteEmojiRequest.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,14 @@ | ||
package com.javadiscord.jdi.internal.api.impl.emojis; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
public record DeleteEmojiRequest(long guildId, long emojiId) implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
return new DiscordRequestBuilder() | ||
.delete() | ||
.path("/guilds/%s/emojis/%s".formatted(guildId, emojiId)); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/com/javadiscord/jdi/internal/api/impl/emojis/GetEmojiRequest.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,14 @@ | ||
package com.javadiscord.jdi.internal.api.impl.emojis; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
public record GetEmojiRequest(long guildId, long emojiId) implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
return new DiscordRequestBuilder() | ||
.get() | ||
.path("/guilds/%s/emojis/%s".formatted(guildId, emojiId)); | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/main/java/com/javadiscord/jdi/internal/api/impl/emojis/GetEmojisRequest.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,12 @@ | ||
package com.javadiscord.jdi.internal.api.impl.emojis; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
public record GetEmojisRequest(long guildId) implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
return new DiscordRequestBuilder().get().path("/guilds/%s/emojis".formatted(guildId)); | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/javadiscord/jdi/internal/api/impl/emojis/ModifyEmojiRequest.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,26 @@ | ||
package com.javadiscord.jdi.internal.api.impl.emojis; | ||
|
||
import com.javadiscord.jdi.internal.api.DiscordRequest; | ||
import com.javadiscord.jdi.internal.api.DiscordRequestBuilder; | ||
|
||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Map; | ||
import java.util.Optional; | ||
|
||
public record ModifyEmojiRequest( | ||
long guildId, long emojiId, Optional<String> name, Optional<List<Long>> roles) | ||
implements DiscordRequest { | ||
|
||
@Override | ||
public DiscordRequestBuilder create() { | ||
Map<String, Object> body = new HashMap<>(); | ||
name.ifPresent(val -> body.put("name", val)); | ||
roles.ifPresent(val -> body.put("roles", val)); | ||
|
||
return new DiscordRequestBuilder() | ||
.patch() | ||
.path("/guilds/%s/emojis/%s".formatted(guildId, emojiId)) | ||
.body(body); | ||
} | ||
} |
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