Skip to content

Commit

Permalink
feat: application emojis (#184)
Browse files Browse the repository at this point in the history
* feat: change EmojiCreateRequest and EmojiModifyRequest hierarchy to add Application-related classes

* feat: add new ApplicationEmojiDataList class
  • Loading branch information
Azn9 authored Jul 19, 2024
1 parent 8af98a3 commit 6f6dbd0
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package discord4j.discordjson.json;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.immutables.value.Value;

@Value.Immutable
@JsonSerialize(as = ImmutableApplicationEmojiCreateRequest.class)
@JsonDeserialize(as = ImmutableApplicationEmojiCreateRequest.class)
public interface ApplicationEmojiCreateRequest extends EmojiCreateRequest {

static ImmutableApplicationEmojiCreateRequest.Builder builder() {
return ImmutableApplicationEmojiCreateRequest.builder();
}

// Note: this class is empty to allow future modifications without having to create it
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package discord4j.discordjson.json;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.immutables.value.Value;

import java.util.List;

@Value.Immutable
@JsonSerialize(as = ImmutableApplicationEmojiDataList.class)
@JsonDeserialize(as = ImmutableApplicationEmojiDataList.class)
public interface ApplicationEmojiDataList {

static ImmutableApplicationEmojiDataList.Builder builder() {
return ImmutableApplicationEmojiDataList.builder();
}

List<EmojiData> items();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package discord4j.discordjson.json;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import discord4j.discordjson.possible.Possible;
import org.immutables.value.Value;

import java.util.List;

@Value.Immutable
@JsonSerialize(as = ImmutableApplicationEmojiModifyRequest.class)
@JsonDeserialize(as = ImmutableApplicationEmojiModifyRequest.class)
public interface ApplicationEmojiModifyRequest extends EmojiModifyRequest {

static ImmutableApplicationEmojiModifyRequest.Builder builder() {
return ImmutableApplicationEmojiModifyRequest.builder();
}

// Note: this class is empty to allow future modifications without having to create it
}
19 changes: 19 additions & 0 deletions src/main/java/discord4j/discordjson/json/EmojiCreateRequest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package discord4j.discordjson.json;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.immutables.value.Value;

@Value.Immutable
@JsonSerialize(as = ImmutableEmojiCreateRequest.class)
@JsonDeserialize(as = ImmutableEmojiCreateRequest.class)
public interface EmojiCreateRequest {

static ImmutableEmojiCreateRequest.Builder builder() {
return ImmutableEmojiCreateRequest.builder();
}

String name();
String image();

}
19 changes: 19 additions & 0 deletions src/main/java/discord4j/discordjson/json/EmojiModifyRequest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package discord4j.discordjson.json;

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import discord4j.discordjson.possible.Possible;
import org.immutables.value.Value;

@Value.Immutable
@JsonSerialize(as = ImmutableEmojiModifyRequest.class)
@JsonDeserialize(as = ImmutableEmojiModifyRequest.class)
public interface EmojiModifyRequest {

static ImmutableEmojiModifyRequest.Builder builder() {
return ImmutableEmojiModifyRequest.builder();
}

Possible<String> name();

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,11 @@
@Value.Immutable
@JsonSerialize(as = ImmutableGuildEmojiCreateRequest.class)
@JsonDeserialize(as = ImmutableGuildEmojiCreateRequest.class)
public interface GuildEmojiCreateRequest {
public interface GuildEmojiCreateRequest extends EmojiCreateRequest {

static ImmutableGuildEmojiCreateRequest.Builder builder() {
return ImmutableGuildEmojiCreateRequest.builder();
}

String name();
String image();
List<String> roles();
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
@Value.Immutable
@JsonSerialize(as = ImmutableGuildEmojiModifyRequest.class)
@JsonDeserialize(as = ImmutableGuildEmojiModifyRequest.class)
public interface GuildEmojiModifyRequest {
public interface GuildEmojiModifyRequest extends EmojiModifyRequest {

static ImmutableGuildEmojiModifyRequest.Builder builder() {
return ImmutableGuildEmojiModifyRequest.builder();
}

Possible<String> name();
Possible<List<String>> roles();
}

0 comments on commit 6f6dbd0

Please sign in to comment.