Skip to content

Complete Integration model definition #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
package com.javadiscord.jdi.core.models.guild;

import java.time.OffsetDateTime;
import java.util.List;

import com.javadiscord.jdi.core.models.user.User;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

// TODO: finish implementation
// https://discord.com/developers/docs/resources/guild#integration-object
@JsonIgnoreProperties(ignoreUnknown = true)
public record Integration(
@JsonProperty("id") long id,
@JsonProperty("name") String name,
@JsonProperty("type") String type,
@JsonProperty("type") IntegrationType type,
@JsonProperty("enabled") boolean enabled,
@JsonProperty("syncing") boolean syncing,
@JsonProperty("role_id") long roleId,
Expand All @@ -28,5 +27,6 @@ public record Integration(
) OffsetDateTime syncedAt,
@JsonProperty("subscriber_count") int subscriberCount,
@JsonProperty("revoked") boolean revoked,
@JsonProperty("application") IntegrationApplication application
@JsonProperty("application") IntegrationApplication application,
@JsonProperty("scopes") List<String> scopes
) {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.javadiscord.jdi.core.models.guild;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

public enum IntegrationType {
TWITCH,
YOUTUBE,
DISCORD,
GUILD_SUBSCRIPTION;

@JsonCreator
public static IntegrationType forValue(String value) {
return IntegrationType.valueOf(value.toUpperCase());
}

@JsonValue
public String toValue() {
return name().toLowerCase();
}
}
Loading