|
| 1 | +package so.trophy.src.main.java.types; |
| 2 | + |
| 3 | +/** |
| 4 | + * This file was auto-generated by Fern from our API Definition. |
| 5 | + */ |
| 6 | + |
| 7 | + |
| 8 | +import com.fasterxml.jackson.annotation.JsonAnyGetter; |
| 9 | +import com.fasterxml.jackson.annotation.JsonAnySetter; |
| 10 | +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; |
| 11 | +import com.fasterxml.jackson.annotation.JsonInclude; |
| 12 | +import com.fasterxml.jackson.annotation.JsonProperty; |
| 13 | +import com.fasterxml.jackson.annotation.JsonSetter; |
| 14 | +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; |
| 15 | +import so.trophy.core.ObjectMappers; |
| 16 | +import java.lang.Object; |
| 17 | +import java.lang.String; |
| 18 | +import java.time.OffsetDateTime; |
| 19 | +import java.util.HashMap; |
| 20 | +import java.util.Map; |
| 21 | +import java.util.Objects; |
| 22 | +import org.jetbrains.annotations.NotNull; |
| 23 | + |
| 24 | +@JsonInclude(JsonInclude.Include.NON_ABSENT) |
| 25 | +@JsonDeserialize( |
| 26 | + builder = WebhooksEmailsAchievementDuePayload.Builder.class |
| 27 | +) |
| 28 | +public final class WebhooksEmailsAchievementDuePayload { |
| 29 | + private final OffsetDateTime timestamp; |
| 30 | + |
| 31 | + private final User user; |
| 32 | + |
| 33 | + private final UserAchievementResponse achievement; |
| 34 | + |
| 35 | + private final Map<String, Object> additionalProperties; |
| 36 | + |
| 37 | + private WebhooksEmailsAchievementDuePayload(OffsetDateTime timestamp, User user, |
| 38 | + UserAchievementResponse achievement, Map<String, Object> additionalProperties) { |
| 39 | + this.timestamp = timestamp; |
| 40 | + this.user = user; |
| 41 | + this.achievement = achievement; |
| 42 | + this.additionalProperties = additionalProperties; |
| 43 | + } |
| 44 | + |
| 45 | + /** |
| 46 | + * @return The webhook event type. |
| 47 | + */ |
| 48 | + @JsonProperty("type") |
| 49 | + public String getType() { |
| 50 | + return "emails.achievement_due"; |
| 51 | + } |
| 52 | + |
| 53 | + /** |
| 54 | + * @return The time the webhook was sent. |
| 55 | + */ |
| 56 | + @JsonProperty("timestamp") |
| 57 | + public OffsetDateTime getTimestamp() { |
| 58 | + return timestamp; |
| 59 | + } |
| 60 | + |
| 61 | + /** |
| 62 | + * @return The user the achievement message is due for. |
| 63 | + */ |
| 64 | + @JsonProperty("user") |
| 65 | + public User getUser() { |
| 66 | + return user; |
| 67 | + } |
| 68 | + |
| 69 | + /** |
| 70 | + * @return The achievement that was completed. |
| 71 | + */ |
| 72 | + @JsonProperty("achievement") |
| 73 | + public UserAchievementResponse getAchievement() { |
| 74 | + return achievement; |
| 75 | + } |
| 76 | + |
| 77 | + @java.lang.Override |
| 78 | + public boolean equals(Object other) { |
| 79 | + if (this == other) return true; |
| 80 | + return other instanceof WebhooksEmailsAchievementDuePayload && equalTo((WebhooksEmailsAchievementDuePayload) other); |
| 81 | + } |
| 82 | + |
| 83 | + @JsonAnyGetter |
| 84 | + public Map<String, Object> getAdditionalProperties() { |
| 85 | + return this.additionalProperties; |
| 86 | + } |
| 87 | + |
| 88 | + private boolean equalTo(WebhooksEmailsAchievementDuePayload other) { |
| 89 | + return timestamp.equals(other.timestamp) && user.equals(other.user) && achievement.equals(other.achievement); |
| 90 | + } |
| 91 | + |
| 92 | + @java.lang.Override |
| 93 | + public int hashCode() { |
| 94 | + return Objects.hash(this.timestamp, this.user, this.achievement); |
| 95 | + } |
| 96 | + |
| 97 | + @java.lang.Override |
| 98 | + public String toString() { |
| 99 | + return ObjectMappers.stringify(this); |
| 100 | + } |
| 101 | + |
| 102 | + public static TimestampStage builder() { |
| 103 | + return new Builder(); |
| 104 | + } |
| 105 | + |
| 106 | + public interface TimestampStage { |
| 107 | + /** |
| 108 | + * <p>The time the webhook was sent.</p> |
| 109 | + */ |
| 110 | + UserStage timestamp(@NotNull OffsetDateTime timestamp); |
| 111 | + |
| 112 | + Builder from(WebhooksEmailsAchievementDuePayload other); |
| 113 | + } |
| 114 | + |
| 115 | + public interface UserStage { |
| 116 | + /** |
| 117 | + * <p>The user the achievement message is due for.</p> |
| 118 | + */ |
| 119 | + AchievementStage user(@NotNull User user); |
| 120 | + } |
| 121 | + |
| 122 | + public interface AchievementStage { |
| 123 | + /** |
| 124 | + * <p>The achievement that was completed.</p> |
| 125 | + */ |
| 126 | + _FinalStage achievement(@NotNull UserAchievementResponse achievement); |
| 127 | + } |
| 128 | + |
| 129 | + public interface _FinalStage { |
| 130 | + WebhooksEmailsAchievementDuePayload build(); |
| 131 | + |
| 132 | + _FinalStage additionalProperty(String key, Object value); |
| 133 | + |
| 134 | + _FinalStage additionalProperties(Map<String, Object> additionalProperties); |
| 135 | + } |
| 136 | + |
| 137 | + @JsonIgnoreProperties( |
| 138 | + ignoreUnknown = true |
| 139 | + ) |
| 140 | + public static final class Builder implements TimestampStage, UserStage, AchievementStage, _FinalStage { |
| 141 | + private OffsetDateTime timestamp; |
| 142 | + |
| 143 | + private User user; |
| 144 | + |
| 145 | + private UserAchievementResponse achievement; |
| 146 | + |
| 147 | + @JsonAnySetter |
| 148 | + private Map<String, Object> additionalProperties = new HashMap<>(); |
| 149 | + |
| 150 | + private Builder() { |
| 151 | + } |
| 152 | + |
| 153 | + @java.lang.Override |
| 154 | + public Builder from(WebhooksEmailsAchievementDuePayload other) { |
| 155 | + timestamp(other.getTimestamp()); |
| 156 | + user(other.getUser()); |
| 157 | + achievement(other.getAchievement()); |
| 158 | + return this; |
| 159 | + } |
| 160 | + |
| 161 | + /** |
| 162 | + * <p>The time the webhook was sent.</p> |
| 163 | + * @return Reference to {@code this} so that method calls can be chained together. |
| 164 | + */ |
| 165 | + @java.lang.Override |
| 166 | + @JsonSetter("timestamp") |
| 167 | + public UserStage timestamp(@NotNull OffsetDateTime timestamp) { |
| 168 | + this.timestamp = Objects.requireNonNull(timestamp, "timestamp must not be null"); |
| 169 | + return this; |
| 170 | + } |
| 171 | + |
| 172 | + /** |
| 173 | + * <p>The user the achievement message is due for.</p> |
| 174 | + * @return Reference to {@code this} so that method calls can be chained together. |
| 175 | + */ |
| 176 | + @java.lang.Override |
| 177 | + @JsonSetter("user") |
| 178 | + public AchievementStage user(@NotNull User user) { |
| 179 | + this.user = Objects.requireNonNull(user, "user must not be null"); |
| 180 | + return this; |
| 181 | + } |
| 182 | + |
| 183 | + /** |
| 184 | + * <p>The achievement that was completed.</p> |
| 185 | + * @return Reference to {@code this} so that method calls can be chained together. |
| 186 | + */ |
| 187 | + @java.lang.Override |
| 188 | + @JsonSetter("achievement") |
| 189 | + public _FinalStage achievement(@NotNull UserAchievementResponse achievement) { |
| 190 | + this.achievement = Objects.requireNonNull(achievement, "achievement must not be null"); |
| 191 | + return this; |
| 192 | + } |
| 193 | + |
| 194 | + @java.lang.Override |
| 195 | + public WebhooksEmailsAchievementDuePayload build() { |
| 196 | + return new WebhooksEmailsAchievementDuePayload(timestamp, user, achievement, additionalProperties); |
| 197 | + } |
| 198 | + |
| 199 | + @java.lang.Override |
| 200 | + public Builder additionalProperty(String key, Object value) { |
| 201 | + this.additionalProperties.put(key, value); |
| 202 | + return this; |
| 203 | + } |
| 204 | + |
| 205 | + @java.lang.Override |
| 206 | + public Builder additionalProperties(Map<String, Object> additionalProperties) { |
| 207 | + this.additionalProperties.putAll(additionalProperties); |
| 208 | + return this; |
| 209 | + } |
| 210 | + } |
| 211 | +} |
0 commit comments