Skip to content

Commit

Permalink
Add SoundboardSound data
Browse files Browse the repository at this point in the history
  • Loading branch information
Doc94 committed Oct 20, 2024
1 parent cab812b commit 4785b98
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package discord4j.discordjson.json;

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

@Value.Immutable
@JsonSerialize(as = ImmutableSendSoundboardSoundRequest.class)
@JsonDeserialize(as = ImmutableSendSoundboardSoundRequest.class)
public interface SendSoundboardSoundRequest {

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

@JsonProperty("sound_id")
Id soundId();

@JsonProperty("source_guild_id")
Possible<Id> sourceGuildId();

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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import discord4j.discordjson.Id;
import discord4j.discordjson.possible.Possible;
import java.util.Optional;
import org.immutables.value.Value;

@Value.Immutable
@JsonSerialize(as = ImmutableSoundboardSoundCreateRequest.class)
@JsonDeserialize(as = ImmutableSoundboardSoundCreateRequest.class)
public interface SoundboardSoundCreateRequest {

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

String name();

String sound();

Possible<Optional<Double>> volume();

@JsonProperty("emoji_id")
Possible<Optional<Id>> emojiId();

@JsonProperty("emoji_name")
Possible<Optional<String>> emojiName();

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


import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import discord4j.discordjson.Id;
import discord4j.discordjson.possible.Possible;
import java.util.Optional;
import org.immutables.value.Value;

@Value.Immutable
@JsonSerialize(as = ImmutableSoundboardSoundData.class)
@JsonDeserialize(as = ImmutableSoundboardSoundData.class)
public interface SoundboardSoundData {

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

String name();

@JsonProperty("sound_id")
Id soundId();

double volume();

@JsonProperty("emoji_id")
Optional<Id> emojiId();

@JsonProperty("emoji_name")
Optional<String> emojiName();

@JsonProperty("guild_id")
Possible<Id> guildId();

boolean available();

Possible<UserData> user();

}
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 java.util.List;
import org.immutables.value.Value;

@Value.Immutable
@JsonSerialize(as = ImmutableSoundboardSoundDataLista.class)
@JsonDeserialize(as = ImmutableSoundboardSoundDataList.class)
public interface SoundboardSoundDataList {

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

List<SoundboardSoundData> items();

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

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import discord4j.discordjson.Id;
import discord4j.discordjson.possible.Possible;
import java.util.Optional;
import org.immutables.value.Value;

@Value.Immutable
@JsonSerialize(as = ImmutableSoundboardSoundModifyRequest.class)
@JsonDeserialize(as = ImmutableSoundboardSoundModifyRequest.class)
public interface SoundboardSoundModifyRequest {

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

Possible<String> name();

Possible<String> sound();

Possible<Optional<Double>> volume();

@JsonProperty("emoji_id")
Possible<Optional<Id>> emojiId();

@JsonProperty("emoji_name")
Possible<Optional<String>> emojiName();

}
Original file line number Diff line number Diff line change
Expand Up @@ -255,4 +255,10 @@ public void readGuildScheduledEvents() throws IOException {
GuildScheduledEventData[] data = read("/rest/GuildScheduledEventData.json", GuildScheduledEventData[].class);
log.info("{}", Arrays.asList(data));
}

@Test
public void readSoundboardSoundData() throws IOException {
SoundboardSoundData[] data = read("/rest/SoundboardSoundData.json", SoundboardSoundData[].class);
log.info("{}", Arrays.asList(data));
}
}
19 changes: 19 additions & 0 deletions src/test/resources/rest/SoundboardSoundData.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[
{
"name": "Yay",
"sound_id": "1106714396018884649",
"volume": 1,
"emoji_id": "989193655938064464",
"emoji_name": null,
"guild_id": "613425648685547541",
"available": true
},
{
"name": "quack",
"sound_id": "1",
"volume": 1.0,
"emoji_id": null,
"emoji_name": "🦆",
"available": true
}
]

0 comments on commit 4785b98

Please sign in to comment.