diff --git a/build.gradle b/build.gradle index e4b023b..e3196ec 100644 --- a/build.gradle +++ b/build.gradle @@ -29,7 +29,7 @@ publishing { maven(MavenPublication) { groupId = 'dev.ravenapp' artifactId = 'raven-java' - version = '0.0.33' + version = '0.034' from components.java } } diff --git a/src/main/java/com/raven/api/client/event/types/User.java b/src/main/java/com/raven/api/client/event/types/User.java index 945057f..8610f69 100644 --- a/src/main/java/com/raven/api/client/event/types/User.java +++ b/src/main/java/com/raven/api/client/event/types/User.java @@ -5,6 +5,9 @@ import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.raven.api.client.user.types.InAppProfile; +import com.raven.api.client.user.types.SlackProfile; +import com.raven.api.client.user.types.TelegramProfile; import java.lang.Object; import java.lang.Override; import java.lang.String; @@ -26,19 +29,43 @@ public final class User { private final Optional onesignalExternalId; + private final Optional> onesignalPlayerIds; + private final Optional> fcmTokens; + private final Optional> iosTokens; + + private final Optional slack; + + private final Optional telegram; + + private final Optional fcmTopic; + + private final Optional fcmDeviceGroup; + + private final Optional inApp; + private int _cachedHashCode; User(Optional userId, Optional email, Optional mobile, Optional whatsappMobile, Optional onesignalExternalId, - Optional> fcmTokens) { + Optional> onesignalPlayerIds, Optional> fcmTokens, + Optional> iosTokens, Optional slack, + Optional telegram, Optional fcmTopic, + Optional fcmDeviceGroup, Optional inApp) { this.userId = userId; this.email = email; this.mobile = mobile; this.whatsappMobile = whatsappMobile; this.onesignalExternalId = onesignalExternalId; + this.onesignalPlayerIds = onesignalPlayerIds; this.fcmTokens = fcmTokens; + this.iosTokens = iosTokens; + this.slack = slack; + this.telegram = telegram; + this.fcmTopic = fcmTopic; + this.fcmDeviceGroup = fcmDeviceGroup; + this.inApp = inApp; } @JsonProperty("user_id") @@ -66,11 +93,46 @@ public Optional getOnesignalExternalId() { return onesignalExternalId; } + @JsonProperty("onesignal_player_ids") + public Optional> getOnesignalPlayerIds() { + return onesignalPlayerIds; + } + @JsonProperty("fcm_tokens") public Optional> getFcmTokens() { return fcmTokens; } + @JsonProperty("ios_tokens") + public Optional> getIosTokens() { + return iosTokens; + } + + @JsonProperty("slack") + public Optional getSlack() { + return slack; + } + + @JsonProperty("telegram") + public Optional getTelegram() { + return telegram; + } + + @JsonProperty("fcm_topic") + public Optional getFcmTopic() { + return fcmTopic; + } + + @JsonProperty("fcm_device_group") + public Optional getFcmDeviceGroup() { + return fcmDeviceGroup; + } + + @JsonProperty("in_app") + public Optional getInApp() { + return inApp; + } + @Override public boolean equals(Object other) { if (this == other) return true; @@ -78,20 +140,20 @@ public boolean equals(Object other) { } private boolean equalTo(User other) { - return userId.equals(other.userId) && email.equals(other.email) && mobile.equals(other.mobile) && whatsappMobile.equals(other.whatsappMobile) && onesignalExternalId.equals(other.onesignalExternalId) && fcmTokens.equals(other.fcmTokens); + return userId.equals(other.userId) && email.equals(other.email) && mobile.equals(other.mobile) && whatsappMobile.equals(other.whatsappMobile) && onesignalExternalId.equals(other.onesignalExternalId) && onesignalPlayerIds.equals(other.onesignalPlayerIds) && fcmTokens.equals(other.fcmTokens) && iosTokens.equals(other.iosTokens) && slack.equals(other.slack) && telegram.equals(other.telegram) && fcmTopic.equals(other.fcmTopic) && fcmDeviceGroup.equals(other.fcmDeviceGroup) && inApp.equals(other.inApp); } @Override public int hashCode() { if (_cachedHashCode == 0) { - _cachedHashCode = Objects.hash(this.userId, this.email, this.mobile, this.whatsappMobile, this.onesignalExternalId, this.fcmTokens); + _cachedHashCode = Objects.hash(this.userId, this.email, this.mobile, this.whatsappMobile, this.onesignalExternalId, this.onesignalPlayerIds, this.fcmTokens, this.iosTokens, this.slack, this.telegram, this.fcmTopic, this.fcmDeviceGroup, this.inApp); } return _cachedHashCode; } @Override public String toString() { - return "User{" + "userId: " + userId + ", email: " + email + ", mobile: " + mobile + ", whatsappMobile: " + whatsappMobile + ", onesignalExternalId: " + onesignalExternalId + ", fcmTokens: " + fcmTokens + "}"; + return "User{" + "userId: " + userId + ", email: " + email + ", mobile: " + mobile + ", whatsappMobile: " + whatsappMobile + ", onesignalExternalId: " + onesignalExternalId + ", onesignalPlayerIds: " + onesignalPlayerIds + ", fcmTokens: " + fcmTokens + ", iosTokens: " + iosTokens + ", slack: " + slack + ", telegram: " + telegram + ", fcmTopic: " + fcmTopic + ", fcmDeviceGroup: " + fcmDeviceGroup + ", inApp: " + inApp + "}"; } public static Builder builder() { @@ -112,8 +174,22 @@ public static final class Builder { private Optional onesignalExternalId = Optional.empty(); + private Optional> onesignalPlayerIds = Optional.empty(); + private Optional> fcmTokens = Optional.empty(); + private Optional> iosTokens = Optional.empty(); + + private Optional slack = Optional.empty(); + + private Optional telegram = Optional.empty(); + + private Optional fcmTopic = Optional.empty(); + + private Optional fcmDeviceGroup = Optional.empty(); + + private Optional inApp = Optional.empty(); + private Builder() { } @@ -123,7 +199,14 @@ public Builder from(User other) { mobile(other.getMobile()); whatsappMobile(other.getWhatsappMobile()); onesignalExternalId(other.getOnesignalExternalId()); + onesignalPlayerIds(other.getOnesignalPlayerIds()); fcmTokens(other.getFcmTokens()); + iosTokens(other.getIosTokens()); + slack(other.getSlack()); + telegram(other.getTelegram()); + fcmTopic(other.getFcmTopic()); + fcmDeviceGroup(other.getFcmDeviceGroup()); + inApp(other.getInApp()); return this; } @@ -197,6 +280,20 @@ public Builder onesignalExternalId(String onesignalExternalId) { return this; } + @JsonSetter( + value = "onesignal_player_ids", + nulls = Nulls.SKIP + ) + public Builder onesignalPlayerIds(Optional> onesignalPlayerIds) { + this.onesignalPlayerIds = onesignalPlayerIds; + return this; + } + + public Builder onesignalPlayerIds(List onesignalPlayerIds) { + this.onesignalPlayerIds = Optional.of(onesignalPlayerIds); + return this; + } + @JsonSetter( value = "fcm_tokens", nulls = Nulls.SKIP @@ -211,8 +308,92 @@ public Builder fcmTokens(List fcmTokens) { return this; } + @JsonSetter( + value = "ios_tokens", + nulls = Nulls.SKIP + ) + public Builder iosTokens(Optional> iosTokens) { + this.iosTokens = iosTokens; + return this; + } + + public Builder iosTokens(List iosTokens) { + this.iosTokens = Optional.of(iosTokens); + return this; + } + + @JsonSetter( + value = "slack", + nulls = Nulls.SKIP + ) + public Builder slack(Optional slack) { + this.slack = slack; + return this; + } + + public Builder slack(SlackProfile slack) { + this.slack = Optional.of(slack); + return this; + } + + @JsonSetter( + value = "telegram", + nulls = Nulls.SKIP + ) + public Builder telegram(Optional telegram) { + this.telegram = telegram; + return this; + } + + public Builder telegram(TelegramProfile telegram) { + this.telegram = Optional.of(telegram); + return this; + } + + @JsonSetter( + value = "fcm_topic", + nulls = Nulls.SKIP + ) + public Builder fcmTopic(Optional fcmTopic) { + this.fcmTopic = fcmTopic; + return this; + } + + public Builder fcmTopic(String fcmTopic) { + this.fcmTopic = Optional.of(fcmTopic); + return this; + } + + @JsonSetter( + value = "fcm_device_group", + nulls = Nulls.SKIP + ) + public Builder fcmDeviceGroup(Optional fcmDeviceGroup) { + this.fcmDeviceGroup = fcmDeviceGroup; + return this; + } + + public Builder fcmDeviceGroup(String fcmDeviceGroup) { + this.fcmDeviceGroup = Optional.of(fcmDeviceGroup); + return this; + } + + @JsonSetter( + value = "in_app", + nulls = Nulls.SKIP + ) + public Builder inApp(Optional inApp) { + this.inApp = inApp; + return this; + } + + public Builder inApp(InAppProfile inApp) { + this.inApp = Optional.of(inApp); + return this; + } + public User build() { - return new User(userId, email, mobile, whatsappMobile, onesignalExternalId, fcmTokens); + return new User(userId, email, mobile, whatsappMobile, onesignalExternalId, onesignalPlayerIds, fcmTokens, iosTokens, slack, telegram, fcmTopic, fcmDeviceGroup, inApp); } } } diff --git a/src/main/java/com/raven/api/client/user/types/RavenUser.java b/src/main/java/com/raven/api/client/user/types/RavenUser.java index 2f65c0d..2ddb5db 100644 --- a/src/main/java/com/raven/api/client/user/types/RavenUser.java +++ b/src/main/java/com/raven/api/client/user/types/RavenUser.java @@ -5,12 +5,10 @@ import com.fasterxml.jackson.annotation.JsonSetter; import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.raven.api.client.device.types.Device; import java.lang.Long; import java.lang.Object; import java.lang.Override; import java.lang.String; -import java.util.ArrayList; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -31,10 +29,6 @@ public final class RavenUser { private final Optional whatsappMobile; - private final Optional> fcmTopic; - - private final Optional> fcmDeviceGroup; - private final Optional slack; private final Optional inApp; @@ -47,12 +41,6 @@ public final class RavenUser { private final Optional> iosTokens; - private final Optional> availableChannels; - - private final List devices; - - private final Optional userPreferences; - private final Optional createdAt; private final Optional updatedAt; @@ -61,30 +49,22 @@ public final class RavenUser { RavenUser(String userId, Optional userSid, Optional onesignalExternalId, Optional mobile, Optional email, Optional whatsappMobile, - Optional> fcmTopic, Optional> fcmDeviceGroup, Optional slack, Optional inApp, Optional telegram, Optional> fcmTokens, Optional> onesignalPlayerIds, Optional> iosTokens, - Optional> availableChannels, List devices, - Optional userPreferences, Optional createdAt, - Optional updatedAt) { + Optional createdAt, Optional updatedAt) { this.userId = userId; this.userSid = userSid; this.onesignalExternalId = onesignalExternalId; this.mobile = mobile; this.email = email; this.whatsappMobile = whatsappMobile; - this.fcmTopic = fcmTopic; - this.fcmDeviceGroup = fcmDeviceGroup; this.slack = slack; this.inApp = inApp; this.telegram = telegram; this.fcmTokens = fcmTokens; this.onesignalPlayerIds = onesignalPlayerIds; this.iosTokens = iosTokens; - this.availableChannels = availableChannels; - this.devices = devices; - this.userPreferences = userPreferences; this.createdAt = createdAt; this.updatedAt = updatedAt; } @@ -119,16 +99,6 @@ public Optional getWhatsappMobile() { return whatsappMobile; } - @JsonProperty("fcm_topic") - public Optional> getFcmTopic() { - return fcmTopic; - } - - @JsonProperty("fcm_device_group") - public Optional> getFcmDeviceGroup() { - return fcmDeviceGroup; - } - @JsonProperty("slack") public Optional getSlack() { return slack; @@ -159,21 +129,6 @@ public Optional> getIosTokens() { return iosTokens; } - @JsonProperty("available_channels") - public Optional> getAvailableChannels() { - return availableChannels; - } - - @JsonProperty("devices") - public List getDevices() { - return devices; - } - - @JsonProperty("user_preferences") - public Optional getUserPreferences() { - return userPreferences; - } - @JsonProperty("created_at") public Optional getCreatedAt() { return createdAt; @@ -191,20 +146,20 @@ public boolean equals(Object other) { } private boolean equalTo(RavenUser other) { - return userId.equals(other.userId) && userSid.equals(other.userSid) && onesignalExternalId.equals(other.onesignalExternalId) && mobile.equals(other.mobile) && email.equals(other.email) && whatsappMobile.equals(other.whatsappMobile) && fcmTopic.equals(other.fcmTopic) && fcmDeviceGroup.equals(other.fcmDeviceGroup) && slack.equals(other.slack) && inApp.equals(other.inApp) && telegram.equals(other.telegram) && fcmTokens.equals(other.fcmTokens) && onesignalPlayerIds.equals(other.onesignalPlayerIds) && iosTokens.equals(other.iosTokens) && availableChannels.equals(other.availableChannels) && devices.equals(other.devices) && userPreferences.equals(other.userPreferences) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt); + return userId.equals(other.userId) && userSid.equals(other.userSid) && onesignalExternalId.equals(other.onesignalExternalId) && mobile.equals(other.mobile) && email.equals(other.email) && whatsappMobile.equals(other.whatsappMobile) && slack.equals(other.slack) && inApp.equals(other.inApp) && telegram.equals(other.telegram) && fcmTokens.equals(other.fcmTokens) && onesignalPlayerIds.equals(other.onesignalPlayerIds) && iosTokens.equals(other.iosTokens) && createdAt.equals(other.createdAt) && updatedAt.equals(other.updatedAt); } @Override public int hashCode() { if (_cachedHashCode == 0) { - _cachedHashCode = Objects.hash(this.userId, this.userSid, this.onesignalExternalId, this.mobile, this.email, this.whatsappMobile, this.fcmTopic, this.fcmDeviceGroup, this.slack, this.inApp, this.telegram, this.fcmTokens, this.onesignalPlayerIds, this.iosTokens, this.availableChannels, this.devices, this.userPreferences, this.createdAt, this.updatedAt); + _cachedHashCode = Objects.hash(this.userId, this.userSid, this.onesignalExternalId, this.mobile, this.email, this.whatsappMobile, this.slack, this.inApp, this.telegram, this.fcmTokens, this.onesignalPlayerIds, this.iosTokens, this.createdAt, this.updatedAt); } return _cachedHashCode; } @Override public String toString() { - return "RavenUser{" + "userId: " + userId + ", userSid: " + userSid + ", onesignalExternalId: " + onesignalExternalId + ", mobile: " + mobile + ", email: " + email + ", whatsappMobile: " + whatsappMobile + ", fcmTopic: " + fcmTopic + ", fcmDeviceGroup: " + fcmDeviceGroup + ", slack: " + slack + ", inApp: " + inApp + ", telegram: " + telegram + ", fcmTokens: " + fcmTokens + ", onesignalPlayerIds: " + onesignalPlayerIds + ", iosTokens: " + iosTokens + ", availableChannels: " + availableChannels + ", devices: " + devices + ", userPreferences: " + userPreferences + ", createdAt: " + createdAt + ", updatedAt: " + updatedAt + "}"; + return "RavenUser{" + "userId: " + userId + ", userSid: " + userSid + ", onesignalExternalId: " + onesignalExternalId + ", mobile: " + mobile + ", email: " + email + ", whatsappMobile: " + whatsappMobile + ", slack: " + slack + ", inApp: " + inApp + ", telegram: " + telegram + ", fcmTokens: " + fcmTokens + ", onesignalPlayerIds: " + onesignalPlayerIds + ", iosTokens: " + iosTokens + ", createdAt: " + createdAt + ", updatedAt: " + updatedAt + "}"; } public static UserIdStage builder() { @@ -240,14 +195,6 @@ public interface _FinalStage { _FinalStage whatsappMobile(String whatsappMobile); - _FinalStage fcmTopic(Optional> fcmTopic); - - _FinalStage fcmTopic(List fcmTopic); - - _FinalStage fcmDeviceGroup(Optional> fcmDeviceGroup); - - _FinalStage fcmDeviceGroup(List fcmDeviceGroup); - _FinalStage slack(Optional slack); _FinalStage slack(SlackProfile slack); @@ -272,20 +219,6 @@ public interface _FinalStage { _FinalStage iosTokens(List iosTokens); - _FinalStage availableChannels(Optional> availableChannels); - - _FinalStage availableChannels(List availableChannels); - - _FinalStage devices(List devices); - - _FinalStage devices(Device devices); - - _FinalStage addAllDevices(List devices); - - _FinalStage userPreferences(Optional userPreferences); - - _FinalStage userPreferences(UserPreferences userPreferences); - _FinalStage createdAt(Optional createdAt); _FinalStage createdAt(Long createdAt); @@ -305,12 +238,6 @@ static final class Builder implements UserIdStage, _FinalStage { private Optional createdAt = Optional.empty(); - private Optional userPreferences = Optional.empty(); - - private List devices = new ArrayList<>(); - - private Optional> availableChannels = Optional.empty(); - private Optional> iosTokens = Optional.empty(); private Optional> onesignalPlayerIds = Optional.empty(); @@ -323,10 +250,6 @@ static final class Builder implements UserIdStage, _FinalStage { private Optional slack = Optional.empty(); - private Optional> fcmDeviceGroup = Optional.empty(); - - private Optional> fcmTopic = Optional.empty(); - private Optional whatsappMobile = Optional.empty(); private Optional email = Optional.empty(); @@ -348,17 +271,12 @@ public Builder from(RavenUser other) { mobile(other.getMobile()); email(other.getEmail()); whatsappMobile(other.getWhatsappMobile()); - fcmTopic(other.getFcmTopic()); - fcmDeviceGroup(other.getFcmDeviceGroup()); slack(other.getSlack()); inApp(other.getInApp()); telegram(other.getTelegram()); fcmTokens(other.getFcmTokens()); onesignalPlayerIds(other.getOnesignalPlayerIds()); iosTokens(other.getIosTokens()); - availableChannels(other.getAvailableChannels()); - devices(other.getDevices()); - userPreferences(other.getUserPreferences()); createdAt(other.getCreatedAt()); updatedAt(other.getUpdatedAt()); return this; @@ -403,61 +321,6 @@ public _FinalStage createdAt(Optional createdAt) { return this; } - @Override - public _FinalStage userPreferences(UserPreferences userPreferences) { - this.userPreferences = Optional.of(userPreferences); - return this; - } - - @Override - @JsonSetter( - value = "user_preferences", - nulls = Nulls.SKIP - ) - public _FinalStage userPreferences(Optional userPreferences) { - this.userPreferences = userPreferences; - return this; - } - - @Override - public _FinalStage addAllDevices(List devices) { - this.devices.addAll(devices); - return this; - } - - @Override - public _FinalStage devices(Device devices) { - this.devices.add(devices); - return this; - } - - @Override - @JsonSetter( - value = "devices", - nulls = Nulls.SKIP - ) - public _FinalStage devices(List devices) { - this.devices.clear(); - this.devices.addAll(devices); - return this; - } - - @Override - public _FinalStage availableChannels(List availableChannels) { - this.availableChannels = Optional.of(availableChannels); - return this; - } - - @Override - @JsonSetter( - value = "available_channels", - nulls = Nulls.SKIP - ) - public _FinalStage availableChannels(Optional> availableChannels) { - this.availableChannels = availableChannels; - return this; - } - @Override public _FinalStage iosTokens(List iosTokens) { this.iosTokens = Optional.of(iosTokens); @@ -554,38 +417,6 @@ public _FinalStage slack(Optional slack) { return this; } - @Override - public _FinalStage fcmDeviceGroup(List fcmDeviceGroup) { - this.fcmDeviceGroup = Optional.of(fcmDeviceGroup); - return this; - } - - @Override - @JsonSetter( - value = "fcm_device_group", - nulls = Nulls.SKIP - ) - public _FinalStage fcmDeviceGroup(Optional> fcmDeviceGroup) { - this.fcmDeviceGroup = fcmDeviceGroup; - return this; - } - - @Override - public _FinalStage fcmTopic(List fcmTopic) { - this.fcmTopic = Optional.of(fcmTopic); - return this; - } - - @Override - @JsonSetter( - value = "fcm_topic", - nulls = Nulls.SKIP - ) - public _FinalStage fcmTopic(Optional> fcmTopic) { - this.fcmTopic = fcmTopic; - return this; - } - @Override public _FinalStage whatsappMobile(String whatsappMobile) { this.whatsappMobile = Optional.of(whatsappMobile); @@ -668,7 +499,7 @@ public _FinalStage userSid(Optional userSid) { @Override public RavenUser build() { - return new RavenUser(userId, userSid, onesignalExternalId, mobile, email, whatsappMobile, fcmTopic, fcmDeviceGroup, slack, inApp, telegram, fcmTokens, onesignalPlayerIds, iosTokens, availableChannels, devices, userPreferences, createdAt, updatedAt); + return new RavenUser(userId, userSid, onesignalExternalId, mobile, email, whatsappMobile, slack, inApp, telegram, fcmTokens, onesignalPlayerIds, iosTokens, createdAt, updatedAt); } } }