Skip to content

Commit

Permalink
feat: add PollVote events data
Browse files Browse the repository at this point in the history
  • Loading branch information
Azn9 committed Jun 10, 2024
1 parent a04eabc commit 12f2425
Show file tree
Hide file tree
Showing 3 changed files with 111 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/main/java/discord4j/discordjson/json/gateway/PollVoteAdd.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of Discord4J.
*
* Discord4J is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Discord4J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Discord4J. If not, see <http://www.gnu.org/licenses/>.
*/
package discord4j.discordjson.json.gateway;

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

@Value.Immutable(builder = false)
@JsonSerialize(as = ImmutablePollVoteAdd.class)
@JsonDeserialize(as = ImmutablePollVoteAdd.class)
public interface PollVoteAdd extends Dispatch {

@JsonUnwrapped
PollVoteData data();

}
47 changes: 47 additions & 0 deletions src/main/java/discord4j/discordjson/json/gateway/PollVoteData.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* This file is part of Discord4J.
*
* Discord4J is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Discord4J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Discord4J. If not, see <http://www.gnu.org/licenses/>.
*/
package discord4j.discordjson.json.gateway;

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 org.immutables.value.Value;

import java.util.Optional;

@Value.Immutable(builder = false)
@JsonSerialize(as = ImmutablePollVoteAdd.class)
@JsonDeserialize(as = ImmutablePollVoteAdd.class)
public interface PollVoteData {

@JsonProperty("user_id")
Id userId();

@JsonProperty("channel_id")
Id channelId();

@JsonProperty("message_id")
Id messageId();

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

@JsonProperty("answer_id")
int answerId();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
* This file is part of Discord4J.
*
* Discord4J is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Discord4J is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Discord4J. If not, see <http://www.gnu.org/licenses/>.
*/
package discord4j.discordjson.json.gateway;

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

@Value.Immutable(builder = false)
@JsonSerialize(as = ImmutablePollVoteRemove.class)
@JsonDeserialize(as = ImmutablePollVoteRemove.class)
public interface PollVoteRemove extends Dispatch {

@JsonUnwrapped
PollVoteData data();

}

0 comments on commit 12f2425

Please sign in to comment.