From 12894b3a32a4d58875f3265b5c1f774a97d75823 Mon Sep 17 00:00:00 2001 From: ZeterTheDuck Date: Wed, 6 May 2026 14:19:19 -0600 Subject: [PATCH 1/9] refactor: remove repeated code in Attachment --- .../java/lol/pbu/z4j/model/Attachment.java | 120 +----------------- 1 file changed, 4 insertions(+), 116 deletions(-) diff --git a/src/main/java/lol/pbu/z4j/model/Attachment.java b/src/main/java/lol/pbu/z4j/model/Attachment.java index d3b3a3a..7b4e29d 100644 --- a/src/main/java/lol/pbu/z4j/model/Attachment.java +++ b/src/main/java/lol/pbu/z4j/model/Attachment.java @@ -23,6 +23,7 @@ import jakarta.validation.Valid; import lombok.AllArgsConstructor; import lombok.Data; +import lombok.EqualsAndHashCode; import lombok.NoArgsConstructor; import lombok.experimental.Accessors; @@ -38,6 +39,7 @@ @NoArgsConstructor @AllArgsConstructor @Data +@EqualsAndHashCode(callSuper = false) @JsonPropertyOrder({ Attachment.JSON_PROPERTY_CONTENT_TYPE, Attachment.JSON_PROPERTY_CONTENT_URL, @@ -55,124 +57,10 @@ Attachment.JSON_PROPERTY_THUMBNAILS, }) @Serdeable -public class Attachment { +public class Attachment extends AttachmentBase { - public static final String JSON_PROPERTY_CONTENT_TYPE = "content_type"; - public static final String JSON_PROPERTY_CONTENT_URL = "content_url"; - public static final String JSON_PROPERTY_DELETED = "deleted"; - public static final String JSON_PROPERTY_FILE_NAME = "file_name"; - public static final String JSON_PROPERTY_HEIGHT = "height"; - public static final String JSON_PROPERTY_ID = "id"; - public static final String JSON_PROPERTY_INLINE = "inline"; - public static final String JSON_PROPERTY_MALWARE_ACCESS_OVERRIDE = "malware_access_override"; - public static final String JSON_PROPERTY_MALWARE_SCAN_RESULT = "malware_scan_result"; - public static final String JSON_PROPERTY_MAPPED_CONTENT_URL = "mapped_content_url"; - public static final String JSON_PROPERTY_SIZE = "size"; - public static final String JSON_PROPERTY_URL = "url"; - public static final String JSON_PROPERTY_WIDTH = "width"; public static final String JSON_PROPERTY_THUMBNAILS = "thumbnails"; - /** - * The content type of the image. Example value: \"image/png\" - */ - @Nullable - @JsonProperty(JSON_PROPERTY_CONTENT_TYPE) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String contentType; - - /** - * A full URL where the attachment image file can be downloaded. The file may be hosted externally so take care not to inadvertently send Zendesk authentication credentials. See Working with url properties - */ - @Nullable - @JsonProperty(JSON_PROPERTY_CONTENT_URL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String contentUrl; - - /** - * If true, the attachment has been deleted - */ - @Nullable - @JsonProperty(JSON_PROPERTY_DELETED) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Boolean deleted; - - /** - * The name of the image file - */ - @Nullable - @JsonProperty(JSON_PROPERTY_FILE_NAME) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String fileName; - - /** - * The height of the image file in pixels. If height is unknown, returns null - */ - @Nullable - @JsonProperty(JSON_PROPERTY_HEIGHT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String height; - - /** - * Automatically assigned when created - */ - @Nullable - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Integer id; - - /** - * If true, the attachment is excluded from the attachment list and the attachment's URL can be referenced within the comment of a ticket. Default is false - */ - @Nullable - @JsonProperty(JSON_PROPERTY_INLINE) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Boolean inline; - - /** - * If true, you can download an attachment flagged as malware. If false, you can't download such an attachment. - */ - @Nullable - @JsonProperty(JSON_PROPERTY_MALWARE_ACCESS_OVERRIDE) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Boolean malwareAccessOverride; - - @Nullable - @JsonProperty(JSON_PROPERTY_MALWARE_SCAN_RESULT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private AttachmentBaseMalwareScanResult malwareScanResult; - - /** - * The URL the attachment image file has been mapped to - */ - @Nullable - @JsonProperty(JSON_PROPERTY_MAPPED_CONTENT_URL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String mappedContentUrl; - - /** - * The size of the image file in bytes - */ - @Nullable - @JsonProperty(JSON_PROPERTY_SIZE) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Integer size; - - /** - * A URL to access the attachment details - */ - @Nullable - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String url; - - /** - * The width of the image file in pixels. If width is unknown, returns null - */ - @Nullable - @JsonProperty(JSON_PROPERTY_WIDTH) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String width; - /** * An array of attachment objects. Note that photo thumbnails do not have thumbnails */ @@ -181,4 +69,4 @@ public class Attachment { @JsonInclude(JsonInclude.Include.USE_DEFAULTS) private List<@Valid AttachmentBase> thumbnails; -} +} \ No newline at end of file From fb69457a9c0229866cefe4894974363c6ca692ed Mon Sep 17 00:00:00 2001 From: ZeterTheDuck Date: Wed, 6 May 2026 14:23:08 -0600 Subject: [PATCH 2/9] refactor: remove TicketAuditVia, as its behavior is duplicated in TicketVia, which has more code. TicketComment references TicketVia instead of TicketAuditVia --- .../lol/pbu/z4j/model/TicketAuditVia.java | 66 ------------------- .../java/lol/pbu/z4j/model/TicketComment.java | 2 +- 2 files changed, 1 insertion(+), 67 deletions(-) delete mode 100644 src/main/java/lol/pbu/z4j/model/TicketAuditVia.java diff --git a/src/main/java/lol/pbu/z4j/model/TicketAuditVia.java b/src/main/java/lol/pbu/z4j/model/TicketAuditVia.java deleted file mode 100644 index ae9d644..0000000 --- a/src/main/java/lol/pbu/z4j/model/TicketAuditVia.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2026 Peanut Butter Unicorn, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package lol.pbu.z4j.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import io.micronaut.core.annotation.Nullable; -import io.micronaut.serde.annotation.Serdeable; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.Map; - -/** - * Describes how the object was created. See the Via object reference - * - * @author Jonathan-Zollinger - * @since 0.1.1 - */ -@Accessors(chain = true) -@NoArgsConstructor -@AllArgsConstructor -@Data -@JsonPropertyOrder({ - TicketAuditVia.JSON_PROPERTY_CHANNEL, - TicketAuditVia.JSON_PROPERTY_SOURCE, -}) -@Serdeable -public class TicketAuditVia { - - public static final String JSON_PROPERTY_CHANNEL = "channel"; - public static final String JSON_PROPERTY_SOURCE = "source"; - - /** - * This tells you how the ticket or event was created. Examples: \"web\", \"mobile\", \"rule\", \"system\" - */ - @Nullable - @JsonProperty(JSON_PROPERTY_CHANNEL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String channel; - - /** - * For some channels a source object gives more information about how or why the ticket or event was created - */ - @Nullable - @JsonProperty(JSON_PROPERTY_SOURCE) - @JsonInclude(content = JsonInclude.Include.ALWAYS, value = JsonInclude.Include.USE_DEFAULTS) - private Map source; - -} diff --git a/src/main/java/lol/pbu/z4j/model/TicketComment.java b/src/main/java/lol/pbu/z4j/model/TicketComment.java index e5797a5..413b597 100644 --- a/src/main/java/lol/pbu/z4j/model/TicketComment.java +++ b/src/main/java/lol/pbu/z4j/model/TicketComment.java @@ -174,7 +174,7 @@ public class TicketComment { @Valid @JsonProperty(JSON_PROPERTY_VIA) @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private TicketAuditVia via; + private TicketVia via; /** * Add an item to the uploads property in a chainable fashion. From 706cc52d0b7aaf6fc17efb60e3de518e83972fc3 Mon Sep 17 00:00:00 2001 From: ZeterTheDuck Date: Wed, 6 May 2026 14:24:24 -0600 Subject: [PATCH 3/9] refactor: remove repeated code in TicketCreateInput TicketCreateInput now extends TicketUpdateInput --- .../lol/pbu/z4j/model/TicketCreateInput.java | 323 +----------------- 1 file changed, 6 insertions(+), 317 deletions(-) diff --git a/src/main/java/lol/pbu/z4j/model/TicketCreateInput.java b/src/main/java/lol/pbu/z4j/model/TicketCreateInput.java index 47e5374..f083836 100644 --- a/src/main/java/lol/pbu/z4j/model/TicketCreateInput.java +++ b/src/main/java/lol/pbu/z4j/model/TicketCreateInput.java @@ -21,7 +21,6 @@ import io.micronaut.core.annotation.Nullable; import io.micronaut.serde.annotation.Serdeable; import jakarta.validation.Valid; -import jakarta.validation.constraints.Email; import jakarta.validation.constraints.NotNull; import lombok.EqualsAndHashCode; import lombok.Getter; @@ -29,7 +28,6 @@ import lombok.ToString; import lombok.experimental.Accessors; -import java.time.ZonedDateTime; import java.util.ArrayList; import java.util.List; @@ -40,7 +38,7 @@ * @since 0.1.1 */ @Accessors(chain = true) -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = false) @ToString @Getter @Setter @@ -82,32 +80,8 @@ TicketCreateInput.JSON_PROPERTY_VIA_FOLLOWUP_SOURCE_ID, }) @Serdeable -public class TicketCreateInput { +public class TicketCreateInput extends TicketUpdateInput { - public static final String JSON_PROPERTY_COMMENT = "comment"; - public static final String JSON_PROPERTY_ADDITIONAL_COLLABORATORS = "additional_collaborators"; - public static final String JSON_PROPERTY_ASSIGNEE_EMAIL = "assignee_email"; - public static final String JSON_PROPERTY_ASSIGNEE_ID = "assignee_id"; - public static final String JSON_PROPERTY_ATTRIBUTE_VALUE_IDS = "attribute_value_ids"; - public static final String JSON_PROPERTY_COLLABORATOR_IDS = "collaborator_ids"; - public static final String JSON_PROPERTY_CUSTOM_FIELDS = "custom_fields"; - public static final String JSON_PROPERTY_CUSTOM_STATUS_ID = "custom_status_id"; - public static final String JSON_PROPERTY_DUE_AT = "due_at"; - public static final String JSON_PROPERTY_EMAIL_CCS = "email_ccs"; - public static final String JSON_PROPERTY_EXTERNAL_ID = "external_id"; - public static final String JSON_PROPERTY_FOLLOWERS = "followers"; - public static final String JSON_PROPERTY_GROUP_ID = "group_id"; - public static final String JSON_PROPERTY_ORGANIZATION_ID = "organization_id"; - public static final String JSON_PROPERTY_PRIORITY = "priority"; - public static final String JSON_PROPERTY_PROBLEM_ID = "problem_id"; - public static final String JSON_PROPERTY_REQUESTER_ID = "requester_id"; - public static final String JSON_PROPERTY_SAFE_UPDATE = "safe_update"; - public static final String JSON_PROPERTY_SHARING_AGREEMENT_IDS = "sharing_agreement_ids"; - public static final String JSON_PROPERTY_STATUS = "status"; - public static final String JSON_PROPERTY_SUBJECT = "subject"; - public static final String JSON_PROPERTY_TAGS = "tags"; - public static final String JSON_PROPERTY_TYPE = "type"; - public static final String JSON_PROPERTY_UPDATED_STAMP = "updated_stamp"; public static final String JSON_PROPERTY_BRAND_ID = "brand_id"; public static final String JSON_PROPERTY_COLLABORATORS = "collaborators"; public static final String JSON_PROPERTY_EMAIL_CC_IDS = "email_cc_ids"; @@ -120,187 +94,6 @@ public class TicketCreateInput { public static final String JSON_PROPERTY_VIA = "via"; public static final String JSON_PROPERTY_VIA_FOLLOWUP_SOURCE_ID = "via_followup_source_id"; - @NotNull - @Valid - @JsonProperty(JSON_PROPERTY_COMMENT) - private TicketComment comment; - - /** - * An array of numeric IDs, emails, or objects containing name and email properties. See Setting Collaborators. An email notification is sent to them when the ticket is updated - */ - @Nullable - @JsonProperty(JSON_PROPERTY_ADDITIONAL_COLLABORATORS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private List<@Valid Collaborator> additionalCollaborators; - - /** - * The email address of the agent to assign the ticket to - */ - @Nullable - @Email - @JsonProperty(JSON_PROPERTY_ASSIGNEE_EMAIL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String assigneeEmail; - - /** - * The agent currently assigned to the ticket - */ - @Nullable - @JsonProperty(JSON_PROPERTY_ASSIGNEE_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Integer assigneeId; - - /** - * An array of the IDs of attribute values to be associated with the ticket - */ - @Nullable - @JsonProperty(JSON_PROPERTY_ATTRIBUTE_VALUE_IDS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private List<@NotNull Integer> attributeValueIds; - - /** - * The ids of users currently CC'ed on the ticket - */ - @Nullable - @JsonProperty(JSON_PROPERTY_COLLABORATOR_IDS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private List<@NotNull Integer> collaboratorIds; - - /** - * Custom fields for the ticket. See Setting custom field values - */ - @Nullable - @JsonProperty(JSON_PROPERTY_CUSTOM_FIELDS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private List<@Valid CustomField> customFields; - - /** - * The custom ticket status id of the ticket. See custom ticket statuses - */ - @Nullable - @JsonProperty(JSON_PROPERTY_CUSTOM_STATUS_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Integer customStatusId; - - /** - * If this is a ticket of type \"task\" it has a due date. Due date format uses ISO 8601 format. - */ - @Nullable - @JsonProperty(JSON_PROPERTY_DUE_AT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private ZonedDateTime dueAt; - - /** - * An array of objects that represent agent or end users email CCs to add or delete from the ticket. See Setting email CCs - */ - @Nullable - @JsonProperty(JSON_PROPERTY_EMAIL_CCS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private List<@Valid EmailCC> emailCcs; - - /** - * An id you can use to link Zendesk Support tickets to local records - */ - @Nullable - @JsonProperty(JSON_PROPERTY_EXTERNAL_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String externalId; - - /** - * An array of objects that represent agent followers to add or delete from the ticket. See Setting followers - */ - @Nullable - @JsonProperty(JSON_PROPERTY_FOLLOWERS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private List<@Valid Follower> followers; - - /** - * The group this ticket is assigned to - */ - @Nullable - @JsonProperty(JSON_PROPERTY_GROUP_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Integer groupId; - - /** - * The organization of the requester. You can only specify the ID of an organization associated with the requester. See Organization Memberships - */ - @Nullable - @JsonProperty(JSON_PROPERTY_ORGANIZATION_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Integer organizationId; - - @Nullable - @JsonProperty(JSON_PROPERTY_PRIORITY) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private TicketUpdateInputPriority priority; - - /** - * For tickets of type \"incident\", the ID of the problem the incident is linked to - */ - @Nullable - @JsonProperty(JSON_PROPERTY_PROBLEM_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Integer problemId; - - /** - * The user who requested this ticket - */ - @Nullable - @JsonProperty(JSON_PROPERTY_REQUESTER_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Integer requesterId; - - /** - * Optional boolean. Prevents updates with outdated ticket data (`updated_stamp` property required when true) - */ - @Nullable - @JsonProperty(JSON_PROPERTY_SAFE_UPDATE) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Boolean safeUpdate; - - /** - * An array of the numeric IDs of sharing agreements. Note that this replaces any existing agreements - */ - @Nullable - @JsonProperty(JSON_PROPERTY_SHARING_AGREEMENT_IDS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private List<@NotNull Integer> sharingAgreementIds; - - @Nullable - @JsonProperty(JSON_PROPERTY_STATUS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private TicketUpdateInputStatus status; - - /** - * The value of the subject field for this ticket - */ - @Nullable - @JsonProperty(JSON_PROPERTY_SUBJECT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String subject; - - /** - * The array of tags applied to this ticket - */ - @Nullable - @JsonProperty(JSON_PROPERTY_TAGS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private List<@NotNull String> tags; - - @Nullable - @JsonProperty(JSON_PROPERTY_TYPE) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private TicketUpdateInputType type; - - /** - * Datetime of last update received from API. See the safe_update property - */ - @Nullable - @JsonProperty(JSON_PROPERTY_UPDATED_STAMP) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private ZonedDateTime updatedStamp; - /** * Enterprise only. The id of the brand this ticket is associated with */ @@ -318,7 +111,7 @@ public class TicketCreateInput { private List<@Valid Collaborator> collaborators; /** - * The ids of agents or end users currently CC'ed on the ticket. See CCs and followers resources in the Support Help Center + * The ids of agents or end users currently CC'ed on the ticket. See CCs and followers resources in the Support Help Center */ @Nullable @JsonProperty(JSON_PROPERTY_EMAIL_CC_IDS) @@ -326,7 +119,7 @@ public class TicketCreateInput { private List<@NotNull Long> emailCcIds; /** - * The ids of agents currently following the ticket. See CCs and followers resources + * The ids of agents currently following the ticket. See CCs and followers resources */ @Nullable @JsonProperty(JSON_PROPERTY_FOLLOWER_IDS) @@ -388,111 +181,7 @@ public class TicketCreateInput { private Long viaFollowupSourceId; public TicketCreateInput(TicketComment comment) { - this.comment = comment; - } - - /** - * Add an item to the additionalCollaborators property in a chainable fashion. - * - * @return The same instance of TicketCreateInput for chaining. - */ - public TicketCreateInput addAdditionalCollaboratorsItem(Collaborator additionalCollaboratorsItem) { - if (additionalCollaborators == null) { - additionalCollaborators = new ArrayList<>(); - } - additionalCollaborators.add(additionalCollaboratorsItem); - return this; - } - - /** - * Add an item to the attributeValueIds property in a chainable fashion. - * - * @return The same instance of TicketCreateInput for chaining. - */ - public TicketCreateInput addAttributeValueIdsItem(Integer attributeValueIdsItem) { - if (attributeValueIds == null) { - attributeValueIds = new ArrayList<>(); - } - attributeValueIds.add(attributeValueIdsItem); - return this; - } - - /** - * Add an item to the collaboratorIds property in a chainable fashion. - * - * @return The same instance of TicketCreateInput for chaining. - */ - public TicketCreateInput addCollaboratorIdsItem(Integer collaboratorIdsItem) { - if (collaboratorIds == null) { - collaboratorIds = new ArrayList<>(); - } - collaboratorIds.add(collaboratorIdsItem); - return this; - } - - /** - * Add an item to the customFields property in a chainable fashion. - * - * @return The same instance of TicketCreateInput for chaining. - */ - public TicketCreateInput addCustomFieldsItem(CustomField customFieldsItem) { - if (customFields == null) { - customFields = new ArrayList<>(); - } - customFields.add(customFieldsItem); - return this; - } - - /** - * Add an item to the emailCcs property in a chainable fashion. - * - * @return The same instance of TicketCreateInput for chaining. - */ - public TicketCreateInput addEmailCcsItem(EmailCC emailCcsItem) { - if (emailCcs == null) { - emailCcs = new ArrayList<>(); - } - emailCcs.add(emailCcsItem); - return this; - } - - /** - * Add an item to the followers property in a chainable fashion. - * - * @return The same instance of TicketCreateInput for chaining. - */ - public TicketCreateInput addFollowersItem(Follower followersItem) { - if (followers == null) { - followers = new ArrayList<>(); - } - followers.add(followersItem); - return this; - } - - /** - * Add an item to the sharingAgreementIds property in a chainable fashion. - * - * @return The same instance of TicketCreateInput for chaining. - */ - public TicketCreateInput addSharingAgreementIdsItem(Integer sharingAgreementIdsItem) { - if (sharingAgreementIds == null) { - sharingAgreementIds = new ArrayList<>(); - } - sharingAgreementIds.add(sharingAgreementIdsItem); - return this; - } - - /** - * Add an item to the tags property in a chainable fashion. - * - * @return The same instance of TicketCreateInput for chaining. - */ - public TicketCreateInput addTagsItem(String tagsItem) { - if (tags == null) { - tags = new ArrayList<>(); - } - tags.add(tagsItem); - return this; + setComment(comment); } /** @@ -547,4 +236,4 @@ public TicketCreateInput addMacroIdsItem(Long macroIdsItem) { return this; } -} +} \ No newline at end of file From fb5bd5e2fcabd2b9711c3dc22e7b4c3ef57a84cc Mon Sep 17 00:00:00 2001 From: ZeterTheDuck Date: Wed, 6 May 2026 15:12:32 -0600 Subject: [PATCH 4/9] docs: add @see annotations for parent classes pertaining to previous changes --- src/main/java/lol/pbu/z4j/model/AttachmentBase.java | 1 + src/main/java/lol/pbu/z4j/model/TicketUpdateInput.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/lol/pbu/z4j/model/AttachmentBase.java b/src/main/java/lol/pbu/z4j/model/AttachmentBase.java index 7136052..8e9af01 100644 --- a/src/main/java/lol/pbu/z4j/model/AttachmentBase.java +++ b/src/main/java/lol/pbu/z4j/model/AttachmentBase.java @@ -30,6 +30,7 @@ * * @author Jonathan-Zollinger * @since 0.1.1 + * @see Attachment */ @Accessors(chain = true) @NoArgsConstructor diff --git a/src/main/java/lol/pbu/z4j/model/TicketUpdateInput.java b/src/main/java/lol/pbu/z4j/model/TicketUpdateInput.java index 19c2e97..2136c79 100644 --- a/src/main/java/lol/pbu/z4j/model/TicketUpdateInput.java +++ b/src/main/java/lol/pbu/z4j/model/TicketUpdateInput.java @@ -37,6 +37,7 @@ * * @author Jonathan-Zollinger * @since 0.1.1 + * @see TicketCreateRequest */ @Accessors(chain = true) @NoArgsConstructor From 196c0e8112eb00f7d4ee81e42c12136397c41c07 Mon Sep 17 00:00:00 2001 From: ZeterTheDuck Date: Wed, 6 May 2026 15:14:45 -0600 Subject: [PATCH 5/9] refactor: rewrite Section to be a subclass of Category --- src/main/java/lol/pbu/z4j/model/Category.java | 1 + src/main/java/lol/pbu/z4j/model/Section.java | 104 +----------------- 2 files changed, 4 insertions(+), 101 deletions(-) diff --git a/src/main/java/lol/pbu/z4j/model/Category.java b/src/main/java/lol/pbu/z4j/model/Category.java index fcfdbcc..83de410 100644 --- a/src/main/java/lol/pbu/z4j/model/Category.java +++ b/src/main/java/lol/pbu/z4j/model/Category.java @@ -34,6 +34,7 @@ * * @author Jonathan-Zollinger * @since 0.1.1 + * @see Section */ @Accessors(chain = true) @EqualsAndHashCode diff --git a/src/main/java/lol/pbu/z4j/model/Section.java b/src/main/java/lol/pbu/z4j/model/Section.java index 439f6a8..be151d6 100644 --- a/src/main/java/lol/pbu/z4j/model/Section.java +++ b/src/main/java/lol/pbu/z4j/model/Section.java @@ -20,7 +20,6 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.micronaut.core.annotation.Nullable; import io.micronaut.serde.annotation.Serdeable; -import jakarta.validation.constraints.NotNull; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; @@ -55,36 +54,11 @@ Section.JSON_PROPERTY_URL, }) @Serdeable -public class Section { +public class Section extends Category { - public static final String JSON_PROPERTY_LOCALE = "locale"; - public static final String JSON_PROPERTY_NAME = "name"; public static final String JSON_PROPERTY_CATEGORY_ID = "category_id"; - public static final String JSON_PROPERTY_CREATED_AT = "created_at"; - public static final String JSON_PROPERTY_DESCRIPTION = "description"; - public static final String JSON_PROPERTY_HTML_URL = "html_url"; - public static final String JSON_PROPERTY_ID = "id"; - public static final String JSON_PROPERTY_OUTDATED = "outdated"; public static final String JSON_PROPERTY_PARENT_SECTION_ID = "parent_section_id"; - public static final String JSON_PROPERTY_POSITION = "position"; - public static final String JSON_PROPERTY_SOURCE_LOCALE = "source_locale"; public static final String JSON_PROPERTY_THEME_TEMPLATE = "theme_template"; - public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; - public static final String JSON_PROPERTY_URL = "url"; - - /** - * The locale in which the section is displayed - */ - @NotNull - @JsonProperty(JSON_PROPERTY_LOCALE) - private LocaleAbbreviation localeAbbreviation; - - /** - * The name of the section - */ - @NotNull - @JsonProperty(JSON_PROPERTY_NAME) - private String name; /** * The id of the category to which this section belongs @@ -94,46 +68,6 @@ public class Section { @JsonInclude(JsonInclude.Include.USE_DEFAULTS) private Long categoryId; - /** - * The time at which the section was created - */ - @Nullable - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String createdAt; - - /** - * The description of the section - */ - @Nullable - @JsonProperty(JSON_PROPERTY_DESCRIPTION) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String description; - - /** - * The url of this section in HC - */ - @Nullable - @JsonProperty(JSON_PROPERTY_HTML_URL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String htmlUrl; - - /** - * Automatically assigned when creating subscriptions - */ - @Nullable - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long id; - - /** - * Whether the section is out of date - */ - @Nullable - @JsonProperty(JSON_PROPERTY_OUTDATED) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Boolean outdated; - /** * The id of the section to which this section belongs. Only writable for Guide Enterprise customers */ @@ -142,22 +76,6 @@ public class Section { @JsonInclude(JsonInclude.Include.USE_DEFAULTS) private Long parentSectionId; - /** - * The position of this section in the section list. Used when sorting is set to ´manual´. By default the section is added to the end of the list - */ - @Nullable - @JsonProperty(JSON_PROPERTY_POSITION) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long position; - - /** - * The source (default) locale of the section - */ - @Nullable - @JsonProperty(JSON_PROPERTY_SOURCE_LOCALE) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String sourceLocale; - /** * The theme template name used to display this section in Help Center. */ @@ -166,25 +84,9 @@ public class Section { @JsonInclude(JsonInclude.Include.USE_DEFAULTS) private String themeTemplate; - /** - * The time at which the section was last updated - */ - @Nullable - @JsonProperty(JSON_PROPERTY_UPDATED_AT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String updatedAt; - - /** - * The API url of this section - */ - @Nullable - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String url; - public Section(LocaleAbbreviation localeAbbreviation, String name) { - this.localeAbbreviation = localeAbbreviation; - this.name = name; + super(name); + setLocaleAbbreviation(localeAbbreviation); } } From b71e5711d139056e4c042132c61f6c456ed103cd Mon Sep 17 00:00:00 2001 From: ZeterTheDuck Date: Wed, 6 May 2026 15:28:10 -0600 Subject: [PATCH 6/9] fix: ensure section calls its own method for equals() and hashCode() --- src/main/java/lol/pbu/z4j/model/Section.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/lol/pbu/z4j/model/Section.java b/src/main/java/lol/pbu/z4j/model/Section.java index be151d6..b80c79f 100644 --- a/src/main/java/lol/pbu/z4j/model/Section.java +++ b/src/main/java/lol/pbu/z4j/model/Section.java @@ -33,7 +33,7 @@ * @since 0.1.1 */ @Accessors(chain = true) -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = false) @ToString @Getter @Setter From ce4008e00e18e2f3200cc99cff12299f46134163 Mon Sep 17 00:00:00 2001 From: ZeterTheDuck Date: Wed, 6 May 2026 15:38:42 -0600 Subject: [PATCH 7/9] refactor: delete AttachmentThumbnails --- .../pbu/z4j/model/AttachmentThumbnails.java | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 src/main/java/lol/pbu/z4j/model/AttachmentThumbnails.java diff --git a/src/main/java/lol/pbu/z4j/model/AttachmentThumbnails.java b/src/main/java/lol/pbu/z4j/model/AttachmentThumbnails.java deleted file mode 100644 index 9b0d334..0000000 --- a/src/main/java/lol/pbu/z4j/model/AttachmentThumbnails.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2026 Peanut Butter Unicorn, LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package lol.pbu.z4j.model; - -import com.fasterxml.jackson.annotation.JsonInclude; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.annotation.JsonPropertyOrder; -import io.micronaut.core.annotation.Nullable; -import io.micronaut.serde.annotation.Serdeable; -import jakarta.validation.Valid; -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -import java.util.List; - -/** - * AttachmentThumbnails - * - * @author Jonathan-Zollinger - * @since 0.1.1 - */ -@Accessors(chain = true) -@NoArgsConstructor -@AllArgsConstructor -@Data -@JsonPropertyOrder(AttachmentThumbnails.JSON_PROPERTY_THUMBNAILS) -@Serdeable -public class AttachmentThumbnails { - - public static final String JSON_PROPERTY_THUMBNAILS = "thumbnails"; - - /** - * An array of attachment objects. Note that photo thumbnails do not have thumbnails - */ - @Nullable - @JsonProperty(JSON_PROPERTY_THUMBNAILS) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private List<@Valid AttachmentBase> thumbnails; - -} From 4ea2c13329a303c82eb725c51935be2dad0f5814 Mon Sep 17 00:00:00 2001 From: ZeterTheDuck Date: Fri, 8 May 2026 10:56:14 -0600 Subject: [PATCH 8/9] refactor: create AbstractComment, which both Comment and PostComment extend --- .../lol/pbu/z4j/model/AbstractComment.java | 149 ++++++++++++++++++ src/main/java/lol/pbu/z4j/model/Comment.java | 107 +------------ .../java/lol/pbu/z4j/model/PostComment.java | 107 +------------ 3 files changed, 154 insertions(+), 209 deletions(-) create mode 100644 src/main/java/lol/pbu/z4j/model/AbstractComment.java diff --git a/src/main/java/lol/pbu/z4j/model/AbstractComment.java b/src/main/java/lol/pbu/z4j/model/AbstractComment.java new file mode 100644 index 0000000..1dd2220 --- /dev/null +++ b/src/main/java/lol/pbu/z4j/model/AbstractComment.java @@ -0,0 +1,149 @@ +/* + * Copyright 2026 Peanut Butter Unicorn, LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package lol.pbu.z4j.model; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import io.micronaut.core.annotation.Nullable; +import io.micronaut.serde.annotation.Serdeable; +import jakarta.validation.constraints.NotNull; +import lombok.EqualsAndHashCode; +import lombok.Getter; +import lombok.Setter; +import lombok.ToString; +import lombok.experimental.Accessors; + +import java.time.ZonedDateTime; + +/** + * Abstraction of a Comment + * + * @author Jonathan-Zollinger + * @since 0.1.2 + * @see Comment + * @see PostComment + */ +@Accessors(chain = true) +@EqualsAndHashCode +@ToString +@Getter +@Setter +@Serdeable +public abstract class AbstractComment { + + public static final String JSON_PROPERTY_BODY = "body"; + public static final String JSON_PROPERTY_AUTHOR_ID = "author_id"; + public static final String JSON_PROPERTY_CREATED_AT = "created_at"; + public static final String JSON_PROPERTY_HTML_URL = "html_url"; + public static final String JSON_PROPERTY_ID = "id"; + public static final String JSON_PROPERTY_NON_AUTHOR_EDITOR_ID = "non_author_editor_id"; + public static final String JSON_PROPERTY_NON_AUTHOR_UPDATED_AT = "non_author_updated_at"; + public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; + public static final String JSON_PROPERTY_URL = "url"; + public static final String JSON_PROPERTY_VOTE_COUNT = "vote_count"; + public static final String JSON_PROPERTY_VOTE_SUM = "vote_sum"; + + /** + * The comment made by the author. See User content + */ + @NotNull + @JsonProperty(JSON_PROPERTY_BODY) + private String body; + + /** + * The id of the author of this comment. Writable on create by Help Center managers. See Create Comment + */ + @Nullable + @JsonProperty(JSON_PROPERTY_AUTHOR_ID) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private Long authorId; + + /** + * The time the comment was created. Writable on create by Help Center managers. See Create Comment + */ + @Nullable + @JsonProperty(JSON_PROPERTY_CREATED_AT) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private String createdAt; + + /** + * The url of the comment + */ + @Nullable + @JsonProperty(JSON_PROPERTY_HTML_URL) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private String htmlUrl; + + /** + * Automatically assigned when the comment is created + */ + @Nullable + @JsonProperty(JSON_PROPERTY_ID) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private Long id; + + /** + *

The user id of whoever performed the most recent (if any) non-author edit.

A non-author edit consists of + * an edit make by a user other than the author that creates or updates the body or + * author_id. Note that only edits made after May 17, 2021, will be reflected in this field. + * If no non-author edits have occurred since May 17, 2021, then this field will benull. + */ + @Nullable + @JsonProperty(JSON_PROPERTY_NON_AUTHOR_EDITOR_ID) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private Long nonAuthorEditorId; + + /** + * When the comment was last edited by a non-author user + */ + @Nullable + @JsonProperty(JSON_PROPERTY_NON_AUTHOR_UPDATED_AT) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private ZonedDateTime nonAuthorUpdatedAt; + + /** + * The time at which the comment was last updated + */ + @Nullable + @JsonProperty(JSON_PROPERTY_UPDATED_AT) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private String updatedAt; + + /** + * The API url of this comment + */ + @Nullable + @JsonProperty(JSON_PROPERTY_URL) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private String url; + + /** + * The total number of upvotes and downvotes + */ + @Nullable + @JsonProperty(JSON_PROPERTY_VOTE_COUNT) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private Long voteCount; + + /** + * The sum of upvotes (+1) and downvotes (-1), which may be positive or negative + */ + @Nullable + @JsonProperty(JSON_PROPERTY_VOTE_SUM) + @JsonInclude(JsonInclude.Include.USE_DEFAULTS) + private Long voteSum; + +} \ No newline at end of file diff --git a/src/main/java/lol/pbu/z4j/model/Comment.java b/src/main/java/lol/pbu/z4j/model/Comment.java index 5d017dc..5feecbb 100644 --- a/src/main/java/lol/pbu/z4j/model/Comment.java +++ b/src/main/java/lol/pbu/z4j/model/Comment.java @@ -27,8 +27,6 @@ import lombok.ToString; import lombok.experimental.Accessors; -import java.time.ZonedDateTime; - /** * Comment * @@ -36,7 +34,7 @@ * @since 0.1.1 */ @Accessors(chain = true) -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = false) @ToString @Getter @Setter @@ -57,29 +55,11 @@ Comment.JSON_PROPERTY_VOTE_SUM, }) @Serdeable -public class Comment { +public class Comment extends AbstractComment { - public static final String JSON_PROPERTY_BODY = "body"; public static final String JSON_PROPERTY_LOCALE = "locale"; - public static final String JSON_PROPERTY_AUTHOR_ID = "author_id"; - public static final String JSON_PROPERTY_CREATED_AT = "created_at"; - public static final String JSON_PROPERTY_HTML_URL = "html_url"; - public static final String JSON_PROPERTY_ID = "id"; - public static final String JSON_PROPERTY_NON_AUTHOR_EDITOR_ID = "non_author_editor_id"; - public static final String JSON_PROPERTY_NON_AUTHOR_UPDATED_AT = "non_author_updated_at"; public static final String JSON_PROPERTY_SOURCE_ID = "source_id"; public static final String JSON_PROPERTY_SOURCE_TYPE = "source_type"; - public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; - public static final String JSON_PROPERTY_URL = "url"; - public static final String JSON_PROPERTY_VOTE_COUNT = "vote_count"; - public static final String JSON_PROPERTY_VOTE_SUM = "vote_sum"; - - /** - * The comment made by the author. See User content - */ - @NotNull - @JsonProperty(JSON_PROPERTY_BODY) - private String body; /** * The locale in which this comment was made @@ -88,57 +68,6 @@ public class Comment { @JsonProperty(JSON_PROPERTY_LOCALE) private LocaleAbbreviation localeAbbreviation; - /** - * The id of the author of this comment. Writable on create by Help Center managers. See Create Comment - */ - @Nullable - @JsonProperty(JSON_PROPERTY_AUTHOR_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long authorId; - - /** - * The time the comment was created. Writable on create by Help Center managers. See Create Comment - */ - @Nullable - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String createdAt; - - /** - * The url at which the comment is presented in Help Center - */ - @Nullable - @JsonProperty(JSON_PROPERTY_HTML_URL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String htmlUrl; - - /** - * Automatically assigned when the comment is created - */ - @Nullable - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long id; - - /** - *

The user id of whoever performed the most recent (if any) non-author edit.

A non-author edit consists of - * an edit make by a user other than the author that creates or updates the body or - * author_id. Note that only edits made after May 17, 2021, will be reflected in this field. - * If no non-author edits have occurred since May 17, 2021, then this field will benull. - */ - @Nullable - @JsonProperty(JSON_PROPERTY_NON_AUTHOR_EDITOR_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long nonAuthorEditorId; - - /** - * When the comment was last edited by a non-author user - */ - @Nullable - @JsonProperty(JSON_PROPERTY_NON_AUTHOR_UPDATED_AT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private ZonedDateTime nonAuthorUpdatedAt; - /** * The id of the item on which this comment was made */ @@ -155,36 +84,4 @@ public class Comment { @JsonInclude(JsonInclude.Include.USE_DEFAULTS) private String sourceType; - /** - * The time at which the comment was last updated - */ - @Nullable - @JsonProperty(JSON_PROPERTY_UPDATED_AT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String updatedAt; - - /** - * The API url of this comment - */ - @Nullable - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String url; - - /** - * The total number of upvotes and downvotes - */ - @Nullable - @JsonProperty(JSON_PROPERTY_VOTE_COUNT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long voteCount; - - /** - * The sum of upvotes (+1) and downvotes (-1), which may be positive or negative - */ - @Nullable - @JsonProperty(JSON_PROPERTY_VOTE_SUM) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long voteSum; - } diff --git a/src/main/java/lol/pbu/z4j/model/PostComment.java b/src/main/java/lol/pbu/z4j/model/PostComment.java index 7843a38..7a47ef5 100644 --- a/src/main/java/lol/pbu/z4j/model/PostComment.java +++ b/src/main/java/lol/pbu/z4j/model/PostComment.java @@ -20,15 +20,12 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder; import io.micronaut.core.annotation.Nullable; import io.micronaut.serde.annotation.Serdeable; -import jakarta.validation.constraints.NotNull; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; import lombok.experimental.Accessors; -import java.time.ZonedDateTime; - /** * PostComment * @@ -36,7 +33,7 @@ * @since 0.1.1 */ @Accessors(chain = true) -@EqualsAndHashCode +@EqualsAndHashCode(callSuper = false) @ToString @Getter @Setter @@ -56,76 +53,10 @@ PostComment.JSON_PROPERTY_VOTE_SUM, }) @Serdeable -public class PostComment implements SearchResultsInner { +public class PostComment extends AbstractComment implements SearchResultsInner { - public static final String JSON_PROPERTY_BODY = "body"; - public static final String JSON_PROPERTY_AUTHOR_ID = "author_id"; - public static final String JSON_PROPERTY_CREATED_AT = "created_at"; - public static final String JSON_PROPERTY_HTML_URL = "html_url"; - public static final String JSON_PROPERTY_ID = "id"; - public static final String JSON_PROPERTY_NON_AUTHOR_EDITOR_ID = "non_author_editor_id"; - public static final String JSON_PROPERTY_NON_AUTHOR_UPDATED_AT = "non_author_updated_at"; public static final String JSON_PROPERTY_OFFICIAL = "official"; public static final String JSON_PROPERTY_POST_ID = "post_id"; - public static final String JSON_PROPERTY_UPDATED_AT = "updated_at"; - public static final String JSON_PROPERTY_URL = "url"; - public static final String JSON_PROPERTY_VOTE_COUNT = "vote_count"; - public static final String JSON_PROPERTY_VOTE_SUM = "vote_sum"; - - /** - * The comment made by the author. See User content - */ - @NotNull - @JsonProperty(JSON_PROPERTY_BODY) - private String body; - - /** - * The id of the author of the comment. Writable on create by Help Center managers. See Create Post Comment - */ - @Nullable - @JsonProperty(JSON_PROPERTY_AUTHOR_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long authorId; - - /** - * When the comment was created. Writable on create by Help Center managers. See Create Post Comment - */ - @Nullable - @JsonProperty(JSON_PROPERTY_CREATED_AT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String createdAt; - - /** - * The community url of the comment - */ - @Nullable - @JsonProperty(JSON_PROPERTY_HTML_URL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String htmlUrl; - - /** - * Automatically assigned when the comment is created - */ - @Nullable - @JsonProperty(JSON_PROPERTY_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long id; - - /** - * The user id of whoever performed the most recent (if any) non-author edit. A non-author edit consists of an edit make by a user other than the author that creates or updates the body. Note that only edits made after May 17, 2021 will be reflected in this field. If no non-author edits have occured since May 17, 2021, then this field will be null. - */ - @Nullable - @JsonProperty(JSON_PROPERTY_NON_AUTHOR_EDITOR_ID) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long nonAuthorEditorId; - - /** - * When the comment was last edited by a non-author user - */ - @Nullable - @JsonProperty(JSON_PROPERTY_NON_AUTHOR_UPDATED_AT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private ZonedDateTime nonAuthorUpdatedAt; /** * Whether the comment is marked as official @@ -143,40 +74,8 @@ public class PostComment implements SearchResultsInner { @JsonInclude(JsonInclude.Include.USE_DEFAULTS) private Long postId; - /** - * When the comment was last updated - */ - @Nullable - @JsonProperty(JSON_PROPERTY_UPDATED_AT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String updatedAt; - - /** - * The API url of the comment - */ - @Nullable - @JsonProperty(JSON_PROPERTY_URL) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private String url; - - /** - * The total number of upvotes and downvotes - */ - @Nullable - @JsonProperty(JSON_PROPERTY_VOTE_COUNT) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long voteCount; - - /** - * The sum of upvotes (+1) and downvotes (-1), which may be positive or negative - */ - @Nullable - @JsonProperty(JSON_PROPERTY_VOTE_SUM) - @JsonInclude(JsonInclude.Include.USE_DEFAULTS) - private Long voteSum; - public PostComment(String body) { - this.body = body; + setBody(body); } } From c98629768bac93236b52b24fe383df5a76b9c5c4 Mon Sep 17 00:00:00 2001 From: ZeterTheDuck Date: Fri, 8 May 2026 11:00:09 -0600 Subject: [PATCH 9/9] refactor: remove Lombok @EqualAndHashCode annotation from AbstractComment An abstract class shouldn't be instantiated, and the subclasses call their own methods. --- src/main/java/lol/pbu/z4j/model/AbstractComment.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/lol/pbu/z4j/model/AbstractComment.java b/src/main/java/lol/pbu/z4j/model/AbstractComment.java index 1dd2220..d39b332 100644 --- a/src/main/java/lol/pbu/z4j/model/AbstractComment.java +++ b/src/main/java/lol/pbu/z4j/model/AbstractComment.java @@ -20,7 +20,6 @@ import io.micronaut.core.annotation.Nullable; import io.micronaut.serde.annotation.Serdeable; import jakarta.validation.constraints.NotNull; -import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.Setter; import lombok.ToString; @@ -37,7 +36,6 @@ * @see PostComment */ @Accessors(chain = true) -@EqualsAndHashCode @ToString @Getter @Setter