From 0648c91f4acf758c91b18580b77ebaeeb277ce50 Mon Sep 17 00:00:00 2001 From: "fern-api[bot]" <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 01:31:22 +0000 Subject: [PATCH 1/2] SDK regeneration --- README.md | 2 +- build.gradle | 4 +- .../com/intercom/api/core/ClientOptions.java | 4 +- .../helpcenter/types/HelpCenter.java | 265 ++++++---- .../api/resources/news/types/NewsItem.java | 409 +++++++++------ .../api/resources/news/types/Newsfeed.java | 160 +++--- .../news/types/NewsfeedAssignment.java | 60 ++- .../api/resources/segments/types/Segment.java | 210 ++++---- .../api/resources/teams/types/Team.java | 217 +++++--- .../resources/tickets/types/TicketPart.java | 438 +++++++++++----- .../intercom/api/types/ConversationPart.java | 495 ++++++++++++------ .../api/types/ConversationPartAuthor.java | 177 +++++-- .../api/types/ConversationRating.java | 168 ++++-- .../api/types/ConversationSource.java | 258 +++++---- .../com/intercom/api/types/LinkedObject.java | 92 ++-- .../intercom/api/types/PartAttachment.java | 206 +++++--- .../intercom/api/types/TicketPartAuthor.java | 123 +++-- 17 files changed, 2149 insertions(+), 1139 deletions(-) diff --git a/README.md b/README.md index 77058a14..4112a905 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ Add the dependency in your `pom.xml` file: io.intercom intercom-java - 4.0.3 + 4.0.4 ``` diff --git a/build.gradle b/build.gradle index d637172e..2c41feb7 100644 --- a/build.gradle +++ b/build.gradle @@ -47,7 +47,7 @@ java { group = 'io.intercom' -version = '4.0.3' +version = '4.0.4' jar { dependsOn(":generatePomFileForMavenPublication") @@ -78,7 +78,7 @@ publishing { maven(MavenPublication) { groupId = 'io.intercom' artifactId = 'intercom-java' - version = '4.0.3' + version = '4.0.4' from components.java pom { name = 'intercom' diff --git a/src/main/java/com/intercom/api/core/ClientOptions.java b/src/main/java/com/intercom/api/core/ClientOptions.java index 41a520f7..4d14fa85 100644 --- a/src/main/java/com/intercom/api/core/ClientOptions.java +++ b/src/main/java/com/intercom/api/core/ClientOptions.java @@ -44,10 +44,10 @@ private ClientOptions( this.headers.putAll(headers); this.headers.putAll(new HashMap() { { - put("User-Agent", "io.intercom:intercom-java/4.0.3"); + put("User-Agent", "io.intercom:intercom-java/4.0.4"); put("X-Fern-Language", "JAVA"); put("X-Fern-SDK-Name", "com.intercom.fern:api-sdk"); - put("X-Fern-SDK-Version", "4.0.3"); + put("X-Fern-SDK-Version", "4.0.4"); } }); this.headerSuppliers = headerSuppliers; diff --git a/src/main/java/com/intercom/api/resources/helpcenter/types/HelpCenter.java b/src/main/java/com/intercom/api/resources/helpcenter/types/HelpCenter.java index 81b0dd58..71281c3e 100644 --- a/src/main/java/com/intercom/api/resources/helpcenter/types/HelpCenter.java +++ b/src/main/java/com/intercom/api/resources/helpcenter/types/HelpCenter.java @@ -16,19 +16,20 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = HelpCenter.Builder.class) public final class HelpCenter { - private final Optional id; + private final String id; - private final Optional workspaceId; + private final String workspaceId; - private final Optional createdAt; + private final int createdAt; - private final Optional updatedAt; + private final int updatedAt; - private final Optional identifier; + private final String identifier; private final Optional websiteTurnedOn; @@ -41,11 +42,11 @@ public final class HelpCenter { private final Map additionalProperties; private HelpCenter( - Optional id, - Optional workspaceId, - Optional createdAt, - Optional updatedAt, - Optional identifier, + String id, + String workspaceId, + int createdAt, + int updatedAt, + String identifier, Optional websiteTurnedOn, Optional displayName, Optional url, @@ -67,7 +68,7 @@ private HelpCenter( * @return The unique identifier for the Help Center which is given by Intercom. */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -75,7 +76,7 @@ public Optional getId() { * @return The id of the workspace which the Help Center belongs to. */ @JsonProperty("workspace_id") - public Optional getWorkspaceId() { + public String getWorkspaceId() { return workspaceId; } @@ -83,7 +84,7 @@ public Optional getWorkspaceId() { * @return The time when the Help Center was created. */ @JsonProperty("created_at") - public Optional getCreatedAt() { + public int getCreatedAt() { return createdAt; } @@ -91,7 +92,7 @@ public Optional getCreatedAt() { * @return The time when the Help Center was last updated. */ @JsonProperty("updated_at") - public Optional getUpdatedAt() { + public int getUpdatedAt() { return updatedAt; } @@ -99,7 +100,7 @@ public Optional getUpdatedAt() { * @return The identifier of the Help Center. This is used in the URL of the Help Center. */ @JsonProperty("identifier") - public Optional getIdentifier() { + public String getIdentifier() { return identifier; } @@ -149,8 +150,8 @@ public Map getAdditionalProperties() { private boolean equalTo(HelpCenter other) { return id.equals(other.id) && workspaceId.equals(other.workspaceId) - && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt) + && createdAt == other.createdAt + && updatedAt == other.updatedAt && identifier.equals(other.identifier) && websiteTurnedOn.equals(other.websiteTurnedOn) && displayName.equals(other.displayName) @@ -177,35 +178,106 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static IdStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional id = Optional.empty(); + public interface IdStage { + /** + *

The unique identifier for the Help Center which is given by Intercom.

+ */ + WorkspaceIdStage id(@NotNull String id); - private Optional workspaceId = Optional.empty(); + Builder from(HelpCenter other); + } - private Optional createdAt = Optional.empty(); + public interface WorkspaceIdStage { + /** + *

The id of the workspace which the Help Center belongs to.

+ */ + CreatedAtStage workspaceId(@NotNull String workspaceId); + } - private Optional updatedAt = Optional.empty(); + public interface CreatedAtStage { + /** + *

The time when the Help Center was created.

+ */ + UpdatedAtStage createdAt(int createdAt); + } + + public interface UpdatedAtStage { + /** + *

The time when the Help Center was last updated.

+ */ + IdentifierStage updatedAt(int updatedAt); + } - private Optional identifier = Optional.empty(); + public interface IdentifierStage { + /** + *

The identifier of the Help Center. This is used in the URL of the Help Center.

+ */ + _FinalStage identifier(@NotNull String identifier); + } - private Optional websiteTurnedOn = Optional.empty(); + public interface _FinalStage { + HelpCenter build(); - private Optional displayName = Optional.empty(); + /** + *

Whether the Help Center is turned on or not. This is controlled in your Help Center settings.

+ */ + _FinalStage websiteTurnedOn(Optional websiteTurnedOn); - private Optional url = Optional.empty(); + _FinalStage websiteTurnedOn(Boolean websiteTurnedOn); + + /** + *

The display name of the Help Center only seen by teammates.

+ */ + _FinalStage displayName(Optional displayName); + + _FinalStage displayName(String displayName); + + /** + *

The URL for the help center, if you have a custom domain then this will show the URL using the custom domain.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + + /** + *

Custom domain configured for the help center

+ */ + _FinalStage customDomain(Optional customDomain); + + _FinalStage customDomain(String customDomain); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, WorkspaceIdStage, CreatedAtStage, UpdatedAtStage, IdentifierStage, _FinalStage { + private String id; + + private String workspaceId; + + private int createdAt; + + private int updatedAt; + + private String identifier; private Optional customDomain = Optional.empty(); + private Optional url = Optional.empty(); + + private Optional displayName = Optional.empty(); + + private Optional websiteTurnedOn = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(HelpCenter other) { id(other.getId()); workspaceId(other.getWorkspaceId()); @@ -221,130 +293,145 @@ public Builder from(HelpCenter other) { /** *

The unique identifier for the Help Center which is given by Intercom.

+ *

The unique identifier for the Help Center which is given by Intercom.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); + @java.lang.Override + @JsonSetter("id") + public WorkspaceIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } /** *

The id of the workspace which the Help Center belongs to.

+ *

The id of the workspace which the Help Center belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "workspace_id", nulls = Nulls.SKIP) - public Builder workspaceId(Optional workspaceId) { - this.workspaceId = workspaceId; - return this; - } - - public Builder workspaceId(String workspaceId) { - this.workspaceId = Optional.ofNullable(workspaceId); + @java.lang.Override + @JsonSetter("workspace_id") + public CreatedAtStage workspaceId(@NotNull String workspaceId) { + this.workspaceId = Objects.requireNonNull(workspaceId, "workspaceId must not be null"); return this; } /** *

The time when the Help Center was created.

+ *

The time when the Help Center was created.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "created_at", nulls = Nulls.SKIP) - public Builder createdAt(Optional createdAt) { + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { this.createdAt = createdAt; return this; } - public Builder createdAt(Integer createdAt) { - this.createdAt = Optional.ofNullable(createdAt); - return this; - } - /** *

The time when the Help Center was last updated.

+ *

The time when the Help Center was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) - public Builder updatedAt(Optional updatedAt) { + @java.lang.Override + @JsonSetter("updated_at") + public IdentifierStage updatedAt(int updatedAt) { this.updatedAt = updatedAt; return this; } - public Builder updatedAt(Integer updatedAt) { - this.updatedAt = Optional.ofNullable(updatedAt); - return this; - } - /** *

The identifier of the Help Center. This is used in the URL of the Help Center.

+ *

The identifier of the Help Center. This is used in the URL of the Help Center.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "identifier", nulls = Nulls.SKIP) - public Builder identifier(Optional identifier) { - this.identifier = identifier; + @java.lang.Override + @JsonSetter("identifier") + public _FinalStage identifier(@NotNull String identifier) { + this.identifier = Objects.requireNonNull(identifier, "identifier must not be null"); return this; } - public Builder identifier(String identifier) { - this.identifier = Optional.ofNullable(identifier); + /** + *

Custom domain configured for the help center

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage customDomain(String customDomain) { + this.customDomain = Optional.ofNullable(customDomain); return this; } /** - *

Whether the Help Center is turned on or not. This is controlled in your Help Center settings.

+ *

Custom domain configured for the help center

*/ - @JsonSetter(value = "website_turned_on", nulls = Nulls.SKIP) - public Builder websiteTurnedOn(Optional websiteTurnedOn) { - this.websiteTurnedOn = websiteTurnedOn; + @java.lang.Override + @JsonSetter(value = "custom_domain", nulls = Nulls.SKIP) + public _FinalStage customDomain(Optional customDomain) { + this.customDomain = customDomain; return this; } - public Builder websiteTurnedOn(Boolean websiteTurnedOn) { - this.websiteTurnedOn = Optional.ofNullable(websiteTurnedOn); + /** + *

The URL for the help center, if you have a custom domain then this will show the URL using the custom domain.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); return this; } /** - *

The display name of the Help Center only seen by teammates.

+ *

The URL for the help center, if you have a custom domain then this will show the URL using the custom domain.

*/ - @JsonSetter(value = "display_name", nulls = Nulls.SKIP) - public Builder displayName(Optional displayName) { - this.displayName = displayName; + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; return this; } - public Builder displayName(String displayName) { + /** + *

The display name of the Help Center only seen by teammates.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage displayName(String displayName) { this.displayName = Optional.ofNullable(displayName); return this; } /** - *

The URL for the help center, if you have a custom domain then this will show the URL using the custom domain.

+ *

The display name of the Help Center only seen by teammates.

*/ - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public Builder url(Optional url) { - this.url = url; - return this; - } - - public Builder url(String url) { - this.url = Optional.ofNullable(url); + @java.lang.Override + @JsonSetter(value = "display_name", nulls = Nulls.SKIP) + public _FinalStage displayName(Optional displayName) { + this.displayName = displayName; return this; } /** - *

Custom domain configured for the help center

+ *

Whether the Help Center is turned on or not. This is controlled in your Help Center settings.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "custom_domain", nulls = Nulls.SKIP) - public Builder customDomain(Optional customDomain) { - this.customDomain = customDomain; + @java.lang.Override + public _FinalStage websiteTurnedOn(Boolean websiteTurnedOn) { + this.websiteTurnedOn = Optional.ofNullable(websiteTurnedOn); return this; } - public Builder customDomain(String customDomain) { - this.customDomain = Optional.ofNullable(customDomain); + /** + *

Whether the Help Center is turned on or not. This is controlled in your Help Center settings.

+ */ + @java.lang.Override + @JsonSetter(value = "website_turned_on", nulls = Nulls.SKIP) + public _FinalStage websiteTurnedOn(Optional websiteTurnedOn) { + this.websiteTurnedOn = websiteTurnedOn; return this; } + @java.lang.Override public HelpCenter build() { return new HelpCenter( id, diff --git a/src/main/java/com/intercom/api/resources/news/types/NewsItem.java b/src/main/java/com/intercom/api/resources/news/types/NewsItem.java index cecb7932..73c55556 100644 --- a/src/main/java/com/intercom/api/resources/news/types/NewsItem.java +++ b/src/main/java/com/intercom/api/resources/news/types/NewsItem.java @@ -19,23 +19,22 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = NewsItem.Builder.class) public final class NewsItem { - private final Optional type; + private final String id; - private final Optional id; + private final String workspaceId; - private final Optional workspaceId; - - private final Optional title; + private final String title; private final Optional body; private final Optional senderId; - private final Optional state; + private final State state; private final Optional> newsfeedAssignments; @@ -47,29 +46,27 @@ public final class NewsItem { private final Optional deliverSilently; - private final Optional createdAt; + private final int createdAt; - private final Optional updatedAt; + private final int updatedAt; private final Map additionalProperties; private NewsItem( - Optional type, - Optional id, - Optional workspaceId, - Optional title, + String id, + String workspaceId, + String title, Optional body, Optional senderId, - Optional state, + State state, Optional> newsfeedAssignments, Optional>> labels, Optional coverImageUrl, Optional>> reactions, Optional deliverSilently, - Optional createdAt, - Optional updatedAt, + int createdAt, + int updatedAt, Map additionalProperties) { - this.type = type; this.id = id; this.workspaceId = workspaceId; this.title = title; @@ -90,15 +87,15 @@ private NewsItem( * @return The type of object. */ @JsonProperty("type") - public Optional getType() { - return type; + public String getType() { + return "news-item"; } /** * @return The unique identifier for the news item which is given by Intercom. */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -106,7 +103,7 @@ public Optional getId() { * @return The id of the workspace which the news item belongs to. */ @JsonProperty("workspace_id") - public Optional getWorkspaceId() { + public String getWorkspaceId() { return workspaceId; } @@ -114,7 +111,7 @@ public Optional getWorkspaceId() { * @return The title of the news item. */ @JsonProperty("title") - public Optional getTitle() { + public String getTitle() { return title; } @@ -138,7 +135,7 @@ public Optional getSenderId() { * @return News items will not be visible to your users in the assigned newsfeeds until they are set live. */ @JsonProperty("state") - public Optional getState() { + public State getState() { return state; } @@ -186,7 +183,7 @@ public Optional getDeliverSilently() { * @return Timestamp for when the news item was created. */ @JsonProperty("created_at") - public Optional getCreatedAt() { + public int getCreatedAt() { return createdAt; } @@ -194,7 +191,7 @@ public Optional getCreatedAt() { * @return Timestamp for when the news item was last updated. */ @JsonProperty("updated_at") - public Optional getUpdatedAt() { + public int getUpdatedAt() { return updatedAt; } @@ -210,8 +207,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(NewsItem other) { - return type.equals(other.type) - && id.equals(other.id) + return id.equals(other.id) && workspaceId.equals(other.workspaceId) && title.equals(other.title) && body.equals(other.body) @@ -222,14 +218,13 @@ private boolean equalTo(NewsItem other) { && coverImageUrl.equals(other.coverImageUrl) && reactions.equals(other.reactions) && deliverSilently.equals(other.deliverSilently) - && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt); + && createdAt == other.createdAt + && updatedAt == other.updatedAt; } @java.lang.Override public int hashCode() { return Objects.hash( - this.type, this.id, this.workspaceId, this.title, @@ -250,47 +245,143 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static IdStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public interface IdStage { + /** + *

The unique identifier for the news item which is given by Intercom.

+ */ + WorkspaceIdStage id(@NotNull String id); - private Optional id = Optional.empty(); + Builder from(NewsItem other); + } - private Optional workspaceId = Optional.empty(); + public interface WorkspaceIdStage { + /** + *

The id of the workspace which the news item belongs to.

+ */ + TitleStage workspaceId(@NotNull String workspaceId); + } - private Optional title = Optional.empty(); + public interface TitleStage { + /** + *

The title of the news item.

+ */ + StateStage title(@NotNull String title); + } - private Optional body = Optional.empty(); + public interface StateStage { + /** + *

News items will not be visible to your users in the assigned newsfeeds until they are set live.

+ */ + CreatedAtStage state(@NotNull State state); + } - private Optional senderId = Optional.empty(); + public interface CreatedAtStage { + /** + *

Timestamp for when the news item was created.

+ */ + UpdatedAtStage createdAt(int createdAt); + } - private Optional state = Optional.empty(); + public interface UpdatedAtStage { + /** + *

Timestamp for when the news item was last updated.

+ */ + _FinalStage updatedAt(int updatedAt); + } - private Optional> newsfeedAssignments = Optional.empty(); + public interface _FinalStage { + NewsItem build(); - private Optional>> labels = Optional.empty(); + /** + *

The news item body, which may contain HTML.

+ */ + _FinalStage body(Optional body); - private Optional coverImageUrl = Optional.empty(); + _FinalStage body(String body); - private Optional>> reactions = Optional.empty(); + /** + *

The id of the sender of the news item. Must be a teammate on the workspace.

+ */ + _FinalStage senderId(Optional senderId); + + _FinalStage senderId(Integer senderId); + + /** + *

A list of newsfeed_assignments to assign to the specified newsfeed.

+ */ + _FinalStage newsfeedAssignments(Optional> newsfeedAssignments); + + _FinalStage newsfeedAssignments(List newsfeedAssignments); + + /** + *

Label names displayed to users to categorize the news item.

+ */ + _FinalStage labels(Optional>> labels); + + _FinalStage labels(List> labels); + + /** + *

URL of the image used as cover. Must have .jpg or .png extension.

+ */ + _FinalStage coverImageUrl(Optional coverImageUrl); + + _FinalStage coverImageUrl(String coverImageUrl); + + /** + *

Ordered list of emoji reactions to the news item. When empty, reactions are disabled.

+ */ + _FinalStage reactions(Optional>> reactions); + + _FinalStage reactions(List> reactions); + + /** + *

When set to true, the news item will appear in the messenger newsfeed without showing a notification badge.

+ */ + _FinalStage deliverSilently(Optional deliverSilently); + + _FinalStage deliverSilently(Boolean deliverSilently); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, WorkspaceIdStage, TitleStage, StateStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; + + private String workspaceId; + + private String title; + + private State state; + + private int createdAt; + + private int updatedAt; private Optional deliverSilently = Optional.empty(); - private Optional createdAt = Optional.empty(); + private Optional>> reactions = Optional.empty(); - private Optional updatedAt = Optional.empty(); + private Optional coverImageUrl = Optional.empty(); + + private Optional>> labels = Optional.empty(); + + private Optional> newsfeedAssignments = Optional.empty(); + + private Optional senderId = Optional.empty(); + + private Optional body = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(NewsItem other) { - type(other.getType()); id(other.getId()); workspaceId(other.getWorkspaceId()); title(other.getTitle()); @@ -307,205 +398,221 @@ public Builder from(NewsItem other) { return this; } - /** - *

The type of object.

- */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(String type) { - this.type = Optional.ofNullable(type); - return this; - } - /** *

The unique identifier for the news item which is given by Intercom.

+ *

The unique identifier for the news item which is given by Intercom.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); + @java.lang.Override + @JsonSetter("id") + public WorkspaceIdStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } /** *

The id of the workspace which the news item belongs to.

+ *

The id of the workspace which the news item belongs to.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "workspace_id", nulls = Nulls.SKIP) - public Builder workspaceId(Optional workspaceId) { - this.workspaceId = workspaceId; - return this; - } - - public Builder workspaceId(String workspaceId) { - this.workspaceId = Optional.ofNullable(workspaceId); + @java.lang.Override + @JsonSetter("workspace_id") + public TitleStage workspaceId(@NotNull String workspaceId) { + this.workspaceId = Objects.requireNonNull(workspaceId, "workspaceId must not be null"); return this; } /** *

The title of the news item.

+ *

The title of the news item.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "title", nulls = Nulls.SKIP) - public Builder title(Optional title) { - this.title = title; - return this; - } - - public Builder title(String title) { - this.title = Optional.ofNullable(title); + @java.lang.Override + @JsonSetter("title") + public StateStage title(@NotNull String title) { + this.title = Objects.requireNonNull(title, "title must not be null"); return this; } /** - *

The news item body, which may contain HTML.

+ *

News items will not be visible to your users in the assigned newsfeeds until they are set live.

+ *

News items will not be visible to your users in the assigned newsfeeds until they are set live.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Optional body) { - this.body = body; - return this; - } - - public Builder body(String body) { - this.body = Optional.ofNullable(body); + @java.lang.Override + @JsonSetter("state") + public CreatedAtStage state(@NotNull State state) { + this.state = Objects.requireNonNull(state, "state must not be null"); return this; } /** - *

The id of the sender of the news item. Must be a teammate on the workspace.

+ *

Timestamp for when the news item was created.

+ *

Timestamp for when the news item was created.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "sender_id", nulls = Nulls.SKIP) - public Builder senderId(Optional senderId) { - this.senderId = senderId; - return this; - } - - public Builder senderId(Integer senderId) { - this.senderId = Optional.ofNullable(senderId); + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { + this.createdAt = createdAt; return this; } /** - *

News items will not be visible to your users in the assigned newsfeeds until they are set live.

+ *

Timestamp for when the news item was last updated.

+ *

Timestamp for when the news item was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "state", nulls = Nulls.SKIP) - public Builder state(Optional state) { - this.state = state; + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(int updatedAt) { + this.updatedAt = updatedAt; return this; } - public Builder state(State state) { - this.state = Optional.ofNullable(state); + /** + *

When set to true, the news item will appear in the messenger newsfeed without showing a notification badge.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage deliverSilently(Boolean deliverSilently) { + this.deliverSilently = Optional.ofNullable(deliverSilently); return this; } /** - *

A list of newsfeed_assignments to assign to the specified newsfeed.

+ *

When set to true, the news item will appear in the messenger newsfeed without showing a notification badge.

*/ - @JsonSetter(value = "newsfeed_assignments", nulls = Nulls.SKIP) - public Builder newsfeedAssignments(Optional> newsfeedAssignments) { - this.newsfeedAssignments = newsfeedAssignments; + @java.lang.Override + @JsonSetter(value = "deliver_silently", nulls = Nulls.SKIP) + public _FinalStage deliverSilently(Optional deliverSilently) { + this.deliverSilently = deliverSilently; return this; } - public Builder newsfeedAssignments(List newsfeedAssignments) { - this.newsfeedAssignments = Optional.ofNullable(newsfeedAssignments); + /** + *

Ordered list of emoji reactions to the news item. When empty, reactions are disabled.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage reactions(List> reactions) { + this.reactions = Optional.ofNullable(reactions); return this; } /** - *

Label names displayed to users to categorize the news item.

+ *

Ordered list of emoji reactions to the news item. When empty, reactions are disabled.

*/ - @JsonSetter(value = "labels", nulls = Nulls.SKIP) - public Builder labels(Optional>> labels) { - this.labels = labels; + @java.lang.Override + @JsonSetter(value = "reactions", nulls = Nulls.SKIP) + public _FinalStage reactions(Optional>> reactions) { + this.reactions = reactions; return this; } - public Builder labels(List> labels) { - this.labels = Optional.ofNullable(labels); + /** + *

URL of the image used as cover. Must have .jpg or .png extension.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage coverImageUrl(String coverImageUrl) { + this.coverImageUrl = Optional.ofNullable(coverImageUrl); return this; } /** *

URL of the image used as cover. Must have .jpg or .png extension.

*/ + @java.lang.Override @JsonSetter(value = "cover_image_url", nulls = Nulls.SKIP) - public Builder coverImageUrl(Optional coverImageUrl) { + public _FinalStage coverImageUrl(Optional coverImageUrl) { this.coverImageUrl = coverImageUrl; return this; } - public Builder coverImageUrl(String coverImageUrl) { - this.coverImageUrl = Optional.ofNullable(coverImageUrl); - return this; - } - /** - *

Ordered list of emoji reactions to the news item. When empty, reactions are disabled.

+ *

Label names displayed to users to categorize the news item.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "reactions", nulls = Nulls.SKIP) - public Builder reactions(Optional>> reactions) { - this.reactions = reactions; + @java.lang.Override + public _FinalStage labels(List> labels) { + this.labels = Optional.ofNullable(labels); return this; } - public Builder reactions(List> reactions) { - this.reactions = Optional.ofNullable(reactions); + /** + *

Label names displayed to users to categorize the news item.

+ */ + @java.lang.Override + @JsonSetter(value = "labels", nulls = Nulls.SKIP) + public _FinalStage labels(Optional>> labels) { + this.labels = labels; return this; } /** - *

When set to true, the news item will appear in the messenger newsfeed without showing a notification badge.

+ *

A list of newsfeed_assignments to assign to the specified newsfeed.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "deliver_silently", nulls = Nulls.SKIP) - public Builder deliverSilently(Optional deliverSilently) { - this.deliverSilently = deliverSilently; + @java.lang.Override + public _FinalStage newsfeedAssignments(List newsfeedAssignments) { + this.newsfeedAssignments = Optional.ofNullable(newsfeedAssignments); return this; } - public Builder deliverSilently(Boolean deliverSilently) { - this.deliverSilently = Optional.ofNullable(deliverSilently); + /** + *

A list of newsfeed_assignments to assign to the specified newsfeed.

+ */ + @java.lang.Override + @JsonSetter(value = "newsfeed_assignments", nulls = Nulls.SKIP) + public _FinalStage newsfeedAssignments(Optional> newsfeedAssignments) { + this.newsfeedAssignments = newsfeedAssignments; return this; } /** - *

Timestamp for when the news item was created.

+ *

The id of the sender of the news item. Must be a teammate on the workspace.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "created_at", nulls = Nulls.SKIP) - public Builder createdAt(Optional createdAt) { - this.createdAt = createdAt; + @java.lang.Override + public _FinalStage senderId(Integer senderId) { + this.senderId = Optional.ofNullable(senderId); return this; } - public Builder createdAt(Integer createdAt) { - this.createdAt = Optional.ofNullable(createdAt); + /** + *

The id of the sender of the news item. Must be a teammate on the workspace.

+ */ + @java.lang.Override + @JsonSetter(value = "sender_id", nulls = Nulls.SKIP) + public _FinalStage senderId(Optional senderId) { + this.senderId = senderId; return this; } /** - *

Timestamp for when the news item was last updated.

+ *

The news item body, which may contain HTML.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) - public Builder updatedAt(Optional updatedAt) { - this.updatedAt = updatedAt; + @java.lang.Override + public _FinalStage body(String body) { + this.body = Optional.ofNullable(body); return this; } - public Builder updatedAt(Integer updatedAt) { - this.updatedAt = Optional.ofNullable(updatedAt); + /** + *

The news item body, which may contain HTML.

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Optional body) { + this.body = body; return this; } + @java.lang.Override public NewsItem build() { return new NewsItem( - type, id, workspaceId, title, diff --git a/src/main/java/com/intercom/api/resources/news/types/Newsfeed.java b/src/main/java/com/intercom/api/resources/news/types/Newsfeed.java index 8d7e1126..96664ab5 100644 --- a/src/main/java/com/intercom/api/resources/news/types/Newsfeed.java +++ b/src/main/java/com/intercom/api/resources/news/types/Newsfeed.java @@ -9,38 +9,28 @@ import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonSetter; -import com.fasterxml.jackson.annotation.Nulls; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.intercom.api.core.ObjectMappers; import java.util.HashMap; import java.util.Map; import java.util.Objects; -import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = Newsfeed.Builder.class) public final class Newsfeed { - private final Optional id; + private final String id; - private final Optional type; + private final String name; - private final Optional name; + private final int createdAt; - private final Optional createdAt; - - private final Optional updatedAt; + private final int updatedAt; private final Map additionalProperties; - private Newsfeed( - Optional id, - Optional type, - Optional name, - Optional createdAt, - Optional updatedAt, - Map additionalProperties) { + private Newsfeed(String id, String name, int createdAt, int updatedAt, Map additionalProperties) { this.id = id; - this.type = type; this.name = name; this.createdAt = createdAt; this.updatedAt = updatedAt; @@ -51,7 +41,7 @@ private Newsfeed( * @return The unique identifier for the newsfeed which is given by Intercom. */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -59,15 +49,15 @@ public Optional getId() { * @return The type of object. */ @JsonProperty("type") - public Optional getType() { - return type; + public String getType() { + return "newsfeed"; } /** * @return The name of the newsfeed. This name will never be visible to your users. */ @JsonProperty("name") - public Optional getName() { + public String getName() { return name; } @@ -75,7 +65,7 @@ public Optional getName() { * @return Timestamp for when the newsfeed was created. */ @JsonProperty("created_at") - public Optional getCreatedAt() { + public int getCreatedAt() { return createdAt; } @@ -83,7 +73,7 @@ public Optional getCreatedAt() { * @return Timestamp for when the newsfeed was last updated. */ @JsonProperty("updated_at") - public Optional getUpdatedAt() { + public int getUpdatedAt() { return updatedAt; } @@ -100,15 +90,14 @@ public Map getAdditionalProperties() { private boolean equalTo(Newsfeed other) { return id.equals(other.id) - && type.equals(other.type) && name.equals(other.name) - && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt); + && createdAt == other.createdAt + && updatedAt == other.updatedAt; } @java.lang.Override public int hashCode() { - return Objects.hash(this.id, this.type, this.name, this.createdAt, this.updatedAt); + return Objects.hash(this.id, this.name, this.createdAt, this.updatedAt); } @java.lang.Override @@ -116,30 +105,62 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static IdStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional id = Optional.empty(); + public interface IdStage { + /** + *

The unique identifier for the newsfeed which is given by Intercom.

+ */ + NameStage id(@NotNull String id); + + Builder from(Newsfeed other); + } - private Optional type = Optional.empty(); + public interface NameStage { + /** + *

The name of the newsfeed. This name will never be visible to your users.

+ */ + CreatedAtStage name(@NotNull String name); + } + + public interface CreatedAtStage { + /** + *

Timestamp for when the newsfeed was created.

+ */ + UpdatedAtStage createdAt(int createdAt); + } + + public interface UpdatedAtStage { + /** + *

Timestamp for when the newsfeed was last updated.

+ */ + _FinalStage updatedAt(int updatedAt); + } + + public interface _FinalStage { + Newsfeed build(); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements IdStage, NameStage, CreatedAtStage, UpdatedAtStage, _FinalStage { + private String id; - private Optional name = Optional.empty(); + private String name; - private Optional createdAt = Optional.empty(); + private int createdAt; - private Optional updatedAt = Optional.empty(); + private int updatedAt; @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(Newsfeed other) { id(other.getId()); - type(other.getType()); name(other.getName()); createdAt(other.getCreatedAt()); updatedAt(other.getUpdatedAt()); @@ -148,76 +169,55 @@ public Builder from(Newsfeed other) { /** *

The unique identifier for the newsfeed which is given by Intercom.

+ *

The unique identifier for the newsfeed which is given by Intercom.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); - return this; - } - - /** - *

The type of object.

- */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(String type) { - this.type = Optional.ofNullable(type); + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } /** *

The name of the newsfeed. This name will never be visible to your users.

+ *

The name of the newsfeed. This name will never be visible to your users.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); + @java.lang.Override + @JsonSetter("name") + public CreatedAtStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } /** *

Timestamp for when the newsfeed was created.

+ *

Timestamp for when the newsfeed was created.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "created_at", nulls = Nulls.SKIP) - public Builder createdAt(Optional createdAt) { + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { this.createdAt = createdAt; return this; } - public Builder createdAt(Integer createdAt) { - this.createdAt = Optional.ofNullable(createdAt); - return this; - } - /** *

Timestamp for when the newsfeed was last updated.

+ *

Timestamp for when the newsfeed was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) - public Builder updatedAt(Optional updatedAt) { + @java.lang.Override + @JsonSetter("updated_at") + public _FinalStage updatedAt(int updatedAt) { this.updatedAt = updatedAt; return this; } - public Builder updatedAt(Integer updatedAt) { - this.updatedAt = Optional.ofNullable(updatedAt); - return this; - } - + @java.lang.Override public Newsfeed build() { - return new Newsfeed(id, type, name, createdAt, updatedAt, additionalProperties); + return new Newsfeed(id, name, createdAt, updatedAt, additionalProperties); } } } diff --git a/src/main/java/com/intercom/api/resources/news/types/NewsfeedAssignment.java b/src/main/java/com/intercom/api/resources/news/types/NewsfeedAssignment.java index 6781737c..60c3b067 100644 --- a/src/main/java/com/intercom/api/resources/news/types/NewsfeedAssignment.java +++ b/src/main/java/com/intercom/api/resources/news/types/NewsfeedAssignment.java @@ -20,14 +20,14 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = NewsfeedAssignment.Builder.class) public final class NewsfeedAssignment { - private final Optional newsfeedId; + private final int newsfeedId; private final Optional publishedAt; private final Map additionalProperties; private NewsfeedAssignment( - Optional newsfeedId, Optional publishedAt, Map additionalProperties) { + int newsfeedId, Optional publishedAt, Map additionalProperties) { this.newsfeedId = newsfeedId; this.publishedAt = publishedAt; this.additionalProperties = additionalProperties; @@ -37,7 +37,7 @@ private NewsfeedAssignment( * @return The unique identifier for the newsfeed which is given by Intercom. Publish dates cannot be in the future, to schedule news items use the dedicated feature in app (see this article). */ @JsonProperty("newsfeed_id") - public Optional getNewsfeedId() { + public int getNewsfeedId() { return newsfeedId; } @@ -61,7 +61,7 @@ public Map getAdditionalProperties() { } private boolean equalTo(NewsfeedAssignment other) { - return newsfeedId.equals(other.newsfeedId) && publishedAt.equals(other.publishedAt); + return newsfeedId == other.newsfeedId && publishedAt.equals(other.publishedAt); } @java.lang.Override @@ -74,13 +74,33 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static NewsfeedIdStage builder() { return new Builder(); } + public interface NewsfeedIdStage { + /** + *

The unique identifier for the newsfeed which is given by Intercom. Publish dates cannot be in the future, to schedule news items use the dedicated feature in app (see this article).

+ */ + _FinalStage newsfeedId(int newsfeedId); + + Builder from(NewsfeedAssignment other); + } + + public interface _FinalStage { + NewsfeedAssignment build(); + + /** + *

Publish date of the news item on the newsfeed, use this field if you want to set a publish date in the past (e.g. when importing existing news items). On write, this field will be ignored if the news item state is "draft".

+ */ + _FinalStage publishedAt(Optional publishedAt); + + _FinalStage publishedAt(Integer publishedAt); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional newsfeedId = Optional.empty(); + public static final class Builder implements NewsfeedIdStage, _FinalStage { + private int newsfeedId; private Optional publishedAt = Optional.empty(); @@ -89,6 +109,7 @@ public static final class Builder { private Builder() {} + @java.lang.Override public Builder from(NewsfeedAssignment other) { newsfeedId(other.getNewsfeedId()); publishedAt(other.getPublishedAt()); @@ -97,32 +118,37 @@ public Builder from(NewsfeedAssignment other) { /** *

The unique identifier for the newsfeed which is given by Intercom. Publish dates cannot be in the future, to schedule news items use the dedicated feature in app (see this article).

+ *

The unique identifier for the newsfeed which is given by Intercom. Publish dates cannot be in the future, to schedule news items use the dedicated feature in app (see this article).

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "newsfeed_id", nulls = Nulls.SKIP) - public Builder newsfeedId(Optional newsfeedId) { + @java.lang.Override + @JsonSetter("newsfeed_id") + public _FinalStage newsfeedId(int newsfeedId) { this.newsfeedId = newsfeedId; return this; } - public Builder newsfeedId(Integer newsfeedId) { - this.newsfeedId = Optional.ofNullable(newsfeedId); + /** + *

Publish date of the news item on the newsfeed, use this field if you want to set a publish date in the past (e.g. when importing existing news items). On write, this field will be ignored if the news item state is "draft".

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage publishedAt(Integer publishedAt) { + this.publishedAt = Optional.ofNullable(publishedAt); return this; } /** *

Publish date of the news item on the newsfeed, use this field if you want to set a publish date in the past (e.g. when importing existing news items). On write, this field will be ignored if the news item state is "draft".

*/ + @java.lang.Override @JsonSetter(value = "published_at", nulls = Nulls.SKIP) - public Builder publishedAt(Optional publishedAt) { + public _FinalStage publishedAt(Optional publishedAt) { this.publishedAt = publishedAt; return this; } - public Builder publishedAt(Integer publishedAt) { - this.publishedAt = Optional.ofNullable(publishedAt); - return this; - } - + @java.lang.Override public NewsfeedAssignment build() { return new NewsfeedAssignment(newsfeedId, publishedAt, additionalProperties); } diff --git a/src/main/java/com/intercom/api/resources/segments/types/Segment.java b/src/main/java/com/intercom/api/resources/segments/types/Segment.java index a3db029e..9be4c797 100644 --- a/src/main/java/com/intercom/api/resources/segments/types/Segment.java +++ b/src/main/java/com/intercom/api/resources/segments/types/Segment.java @@ -18,36 +18,33 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = Segment.Builder.class) public final class Segment { - private final Optional type; + private final String id; - private final Optional id; + private final String name; - private final Optional name; + private final int createdAt; - private final Optional createdAt; + private final int updatedAt; - private final Optional updatedAt; - - private final Optional personType; + private final PersonType personType; private final Optional count; private final Map additionalProperties; private Segment( - Optional type, - Optional id, - Optional name, - Optional createdAt, - Optional updatedAt, - Optional personType, + String id, + String name, + int createdAt, + int updatedAt, + PersonType personType, Optional count, Map additionalProperties) { - this.type = type; this.id = id; this.name = name; this.createdAt = createdAt; @@ -61,15 +58,15 @@ private Segment( * @return The type of object. */ @JsonProperty("type") - public Optional getType() { - return type; + public String getType() { + return "segment"; } /** * @return The unique identifier representing the segment. */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -77,7 +74,7 @@ public Optional getId() { * @return The name of the segment. */ @JsonProperty("name") - public Optional getName() { + public String getName() { return name; } @@ -85,7 +82,7 @@ public Optional getName() { * @return The time the segment was created. */ @JsonProperty("created_at") - public Optional getCreatedAt() { + public int getCreatedAt() { return createdAt; } @@ -93,7 +90,7 @@ public Optional getCreatedAt() { * @return The time the segment was updated. */ @JsonProperty("updated_at") - public Optional getUpdatedAt() { + public int getUpdatedAt() { return updatedAt; } @@ -101,7 +98,7 @@ public Optional getUpdatedAt() { * @return Type of the contact: contact (lead) or user. */ @JsonProperty("person_type") - public Optional getPersonType() { + public PersonType getPersonType() { return personType; } @@ -125,18 +122,17 @@ public Map getAdditionalProperties() { } private boolean equalTo(Segment other) { - return type.equals(other.type) - && id.equals(other.id) + return id.equals(other.id) && name.equals(other.name) - && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt) + && createdAt == other.createdAt + && updatedAt == other.updatedAt && personType.equals(other.personType) && count.equals(other.count); } @java.lang.Override public int hashCode() { - return Objects.hash(this.type, this.id, this.name, this.createdAt, this.updatedAt, this.personType, this.count); + return Objects.hash(this.id, this.name, this.createdAt, this.updatedAt, this.personType, this.count); } @java.lang.Override @@ -144,23 +140,70 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static IdStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public interface IdStage { + /** + *

The unique identifier representing the segment.

+ */ + NameStage id(@NotNull String id); - private Optional id = Optional.empty(); + Builder from(Segment other); + } - private Optional name = Optional.empty(); + public interface NameStage { + /** + *

The name of the segment.

+ */ + CreatedAtStage name(@NotNull String name); + } - private Optional createdAt = Optional.empty(); + public interface CreatedAtStage { + /** + *

The time the segment was created.

+ */ + UpdatedAtStage createdAt(int createdAt); + } - private Optional updatedAt = Optional.empty(); + public interface UpdatedAtStage { + /** + *

The time the segment was updated.

+ */ + PersonTypeStage updatedAt(int updatedAt); + } - private Optional personType = Optional.empty(); + public interface PersonTypeStage { + /** + *

Type of the contact: contact (lead) or user.

+ */ + _FinalStage personType(@NotNull PersonType personType); + } + + public interface _FinalStage { + Segment build(); + + /** + *

The number of items in the user segment. It's returned when include_count=true is included in the request.

+ */ + _FinalStage count(Optional count); + + _FinalStage count(Integer count); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder + implements IdStage, NameStage, CreatedAtStage, UpdatedAtStage, PersonTypeStage, _FinalStage { + private String id; + + private String name; + + private int createdAt; + + private int updatedAt; + + private PersonType personType; private Optional count = Optional.empty(); @@ -169,8 +212,8 @@ public static final class Builder { private Builder() {} + @java.lang.Override public Builder from(Segment other) { - type(other.getType()); id(other.getId()); name(other.getName()); createdAt(other.getCreatedAt()); @@ -180,106 +223,89 @@ public Builder from(Segment other) { return this; } - /** - *

The type of object.

- */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(String type) { - this.type = Optional.ofNullable(type); - return this; - } - /** *

The unique identifier representing the segment.

+ *

The unique identifier representing the segment.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } /** *

The name of the segment.

+ *

The name of the segment.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); + @java.lang.Override + @JsonSetter("name") + public CreatedAtStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } /** *

The time the segment was created.

+ *

The time the segment was created.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "created_at", nulls = Nulls.SKIP) - public Builder createdAt(Optional createdAt) { + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { this.createdAt = createdAt; return this; } - public Builder createdAt(Integer createdAt) { - this.createdAt = Optional.ofNullable(createdAt); - return this; - } - /** *

The time the segment was updated.

+ *

The time the segment was updated.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) - public Builder updatedAt(Optional updatedAt) { + @java.lang.Override + @JsonSetter("updated_at") + public PersonTypeStage updatedAt(int updatedAt) { this.updatedAt = updatedAt; return this; } - public Builder updatedAt(Integer updatedAt) { - this.updatedAt = Optional.ofNullable(updatedAt); - return this; - } - /** *

Type of the contact: contact (lead) or user.

+ *

Type of the contact: contact (lead) or user.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "person_type", nulls = Nulls.SKIP) - public Builder personType(Optional personType) { - this.personType = personType; + @java.lang.Override + @JsonSetter("person_type") + public _FinalStage personType(@NotNull PersonType personType) { + this.personType = Objects.requireNonNull(personType, "personType must not be null"); return this; } - public Builder personType(PersonType personType) { - this.personType = Optional.ofNullable(personType); + /** + *

The number of items in the user segment. It's returned when include_count=true is included in the request.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage count(Integer count) { + this.count = Optional.ofNullable(count); return this; } /** *

The number of items in the user segment. It's returned when include_count=true is included in the request.

*/ + @java.lang.Override @JsonSetter(value = "count", nulls = Nulls.SKIP) - public Builder count(Optional count) { + public _FinalStage count(Optional count) { this.count = count; return this; } - public Builder count(Integer count) { - this.count = Optional.ofNullable(count); - return this; - } - + @java.lang.Override public Segment build() { - return new Segment(type, id, name, createdAt, updatedAt, personType, count, additionalProperties); + return new Segment(id, name, createdAt, updatedAt, personType, count, additionalProperties); } } diff --git a/src/main/java/com/intercom/api/resources/teams/types/Team.java b/src/main/java/com/intercom/api/resources/teams/types/Team.java index 1de053c9..5a4b8c82 100644 --- a/src/main/java/com/intercom/api/resources/teams/types/Team.java +++ b/src/main/java/com/intercom/api/resources/teams/types/Team.java @@ -13,22 +13,24 @@ import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.intercom.api.core.ObjectMappers; import com.intercom.api.types.AdminPriorityLevel; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = Team.Builder.class) public final class Team { - private final Optional type; + private final String type; - private final Optional id; + private final String id; - private final Optional name; + private final String name; - private final Optional> adminIds; + private final List adminIds; private final Optional adminPriorityLevel; @@ -39,10 +41,10 @@ public final class Team { private final Map additionalProperties; private Team( - Optional type, - Optional id, - Optional name, - Optional> adminIds, + String type, + String id, + String name, + List adminIds, Optional adminPriorityLevel, Optional assignmentLimit, Optional distributionMethod, @@ -61,7 +63,7 @@ private Team( * @return Value is always "team" */ @JsonProperty("type") - public Optional getType() { + public String getType() { return type; } @@ -69,7 +71,7 @@ public Optional getType() { * @return The id of the team */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -77,7 +79,7 @@ public Optional getId() { * @return The name of the team */ @JsonProperty("name") - public Optional getName() { + public String getName() { return name; } @@ -85,7 +87,7 @@ public Optional getName() { * @return The list of admin IDs that are a part of the team. */ @JsonProperty("admin_ids") - public Optional> getAdminIds() { + public List getAdminIds() { return adminIds; } @@ -148,31 +150,86 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static TypeStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public interface TypeStage { + /** + *

Value is always "team"

+ */ + IdStage type(@NotNull String type); - private Optional id = Optional.empty(); + Builder from(Team other); + } - private Optional name = Optional.empty(); + public interface IdStage { + /** + *

The id of the team

+ */ + NameStage id(@NotNull String id); + } - private Optional> adminIds = Optional.empty(); + public interface NameStage { + /** + *

The name of the team

+ */ + _FinalStage name(@NotNull String name); + } - private Optional adminPriorityLevel = Optional.empty(); + public interface _FinalStage { + Team build(); - private Optional assignmentLimit = Optional.empty(); + /** + *

The list of admin IDs that are a part of the team.

+ */ + _FinalStage adminIds(List adminIds); + + _FinalStage addAdminIds(Integer adminIds); + + _FinalStage addAllAdminIds(List adminIds); + + _FinalStage adminPriorityLevel(Optional adminPriorityLevel); + + _FinalStage adminPriorityLevel(AdminPriorityLevel adminPriorityLevel); + + /** + *

The assignment limit for the team. This field is only present when the team's distribution type is load balanced.

+ */ + _FinalStage assignmentLimit(Optional assignmentLimit); + + _FinalStage assignmentLimit(Integer assignmentLimit); + + /** + *

Describes how assignments are distributed among the team members

+ */ + _FinalStage distributionMethod(Optional distributionMethod); + + _FinalStage distributionMethod(String distributionMethod); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, IdStage, NameStage, _FinalStage { + private String type; + + private String id; + + private String name; private Optional distributionMethod = Optional.empty(); + private Optional assignmentLimit = Optional.empty(); + + private Optional adminPriorityLevel = Optional.empty(); + + private List adminIds = new ArrayList<>(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(Team other) { type(other.getType()); id(other.getId()); @@ -186,99 +243,129 @@ public Builder from(Team other) { /** *

Value is always "team"

+ *

Value is always "team"

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; + @java.lang.Override + @JsonSetter("type") + public IdStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); return this; } - public Builder type(String type) { - this.type = Optional.ofNullable(type); + /** + *

The id of the team

+ *

The id of the team

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("id") + public NameStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } /** - *

The id of the team

+ *

The name of the team

+ *

The name of the team

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; + @java.lang.Override + @JsonSetter("name") + public _FinalStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } - public Builder id(String id) { - this.id = Optional.ofNullable(id); + /** + *

Describes how assignments are distributed among the team members

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage distributionMethod(String distributionMethod) { + this.distributionMethod = Optional.ofNullable(distributionMethod); return this; } /** - *

The name of the team

+ *

Describes how assignments are distributed among the team members

*/ - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; + @java.lang.Override + @JsonSetter(value = "distribution_method", nulls = Nulls.SKIP) + public _FinalStage distributionMethod(Optional distributionMethod) { + this.distributionMethod = distributionMethod; return this; } - public Builder name(String name) { - this.name = Optional.ofNullable(name); + /** + *

The assignment limit for the team. This field is only present when the team's distribution type is load balanced.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage assignmentLimit(Integer assignmentLimit) { + this.assignmentLimit = Optional.ofNullable(assignmentLimit); return this; } /** - *

The list of admin IDs that are a part of the team.

+ *

The assignment limit for the team. This field is only present when the team's distribution type is load balanced.

*/ - @JsonSetter(value = "admin_ids", nulls = Nulls.SKIP) - public Builder adminIds(Optional> adminIds) { - this.adminIds = adminIds; + @java.lang.Override + @JsonSetter(value = "assignment_limit", nulls = Nulls.SKIP) + public _FinalStage assignmentLimit(Optional assignmentLimit) { + this.assignmentLimit = assignmentLimit; return this; } - public Builder adminIds(List adminIds) { - this.adminIds = Optional.ofNullable(adminIds); + @java.lang.Override + public _FinalStage adminPriorityLevel(AdminPriorityLevel adminPriorityLevel) { + this.adminPriorityLevel = Optional.ofNullable(adminPriorityLevel); return this; } + @java.lang.Override @JsonSetter(value = "admin_priority_level", nulls = Nulls.SKIP) - public Builder adminPriorityLevel(Optional adminPriorityLevel) { + public _FinalStage adminPriorityLevel(Optional adminPriorityLevel) { this.adminPriorityLevel = adminPriorityLevel; return this; } - public Builder adminPriorityLevel(AdminPriorityLevel adminPriorityLevel) { - this.adminPriorityLevel = Optional.ofNullable(adminPriorityLevel); - return this; - } - /** - *

The assignment limit for the team. This field is only present when the team's distribution type is load balanced.

+ *

The list of admin IDs that are a part of the team.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "assignment_limit", nulls = Nulls.SKIP) - public Builder assignmentLimit(Optional assignmentLimit) { - this.assignmentLimit = assignmentLimit; - return this; - } - - public Builder assignmentLimit(Integer assignmentLimit) { - this.assignmentLimit = Optional.ofNullable(assignmentLimit); + @java.lang.Override + public _FinalStage addAllAdminIds(List adminIds) { + if (adminIds != null) { + this.adminIds.addAll(adminIds); + } return this; } /** - *

Describes how assignments are distributed among the team members

+ *

The list of admin IDs that are a part of the team.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "distribution_method", nulls = Nulls.SKIP) - public Builder distributionMethod(Optional distributionMethod) { - this.distributionMethod = distributionMethod; + @java.lang.Override + public _FinalStage addAdminIds(Integer adminIds) { + this.adminIds.add(adminIds); return this; } - public Builder distributionMethod(String distributionMethod) { - this.distributionMethod = Optional.ofNullable(distributionMethod); + /** + *

The list of admin IDs that are a part of the team.

+ */ + @java.lang.Override + @JsonSetter(value = "admin_ids", nulls = Nulls.SKIP) + public _FinalStage adminIds(List adminIds) { + this.adminIds.clear(); + if (adminIds != null) { + this.adminIds.addAll(adminIds); + } return this; } + @java.lang.Override public Team build() { return new Team( type, diff --git a/src/main/java/com/intercom/api/resources/tickets/types/TicketPart.java b/src/main/java/com/intercom/api/resources/tickets/types/TicketPart.java index 89d17ee0..cfd1ac99 100644 --- a/src/main/java/com/intercom/api/resources/tickets/types/TicketPart.java +++ b/src/main/java/com/intercom/api/resources/tickets/types/TicketPart.java @@ -33,11 +33,11 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = TicketPart.Builder.class) public final class TicketPart { - private final Optional type; + private final String type; - private final Optional id; + private final String id; - private final Optional partType; + private final String partType; private final Optional body; @@ -45,19 +45,19 @@ public final class TicketPart { private final Optional ticketState; - private final Optional createdAt; + private final int createdAt; - private final Optional updatedAt; + private final int updatedAt; private final Optional assignedTo; - private final Optional author; + private final TicketPartAuthor author; private final Optional> attachments; private final Optional externalId; - private final Optional redacted; + private final boolean redacted; private final Optional appPackageCode; @@ -66,19 +66,19 @@ public final class TicketPart { private final Map additionalProperties; private TicketPart( - Optional type, - Optional id, - Optional partType, + String type, + String id, + String partType, Optional body, Optional previousTicketState, Optional ticketState, - Optional createdAt, - Optional updatedAt, + int createdAt, + int updatedAt, Optional assignedTo, - Optional author, + TicketPartAuthor author, Optional> attachments, Optional externalId, - Optional redacted, + boolean redacted, Optional appPackageCode, Optional updatedAttributeData, Map additionalProperties) { @@ -104,7 +104,7 @@ private TicketPart( * @return Always ticket_part */ @JsonProperty("type") - public Optional getType() { + public String getType() { return type; } @@ -112,7 +112,7 @@ public Optional getType() { * @return The id representing the ticket part. */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -120,7 +120,7 @@ public Optional getId() { * @return The type of ticket part. */ @JsonProperty("part_type") - public Optional getPartType() { + public String getPartType() { return partType; } @@ -152,7 +152,7 @@ public Optional getTicketState() { * @return The time the ticket part was created. */ @JsonProperty("created_at") - public Optional getCreatedAt() { + public int getCreatedAt() { return createdAt; } @@ -160,7 +160,7 @@ public Optional getCreatedAt() { * @return The last time the ticket part was updated. */ @JsonProperty("updated_at") - public Optional getUpdatedAt() { + public int getUpdatedAt() { return updatedAt; } @@ -173,7 +173,7 @@ public Optional getAssignedTo() { } @JsonProperty("author") - public Optional getAuthor() { + public TicketPartAuthor getAuthor() { return author; } @@ -197,7 +197,7 @@ public Optional getExternalId() { * @return Whether or not the ticket part has been redacted. */ @JsonProperty("redacted") - public Optional getRedacted() { + public boolean getRedacted() { return redacted; } @@ -235,13 +235,13 @@ private boolean equalTo(TicketPart other) { && body.equals(other.body) && previousTicketState.equals(other.previousTicketState) && ticketState.equals(other.ticketState) - && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt) + && createdAt == other.createdAt + && updatedAt == other.updatedAt && assignedTo.equals(other.assignedTo) && author.equals(other.author) && attachments.equals(other.attachments) && externalId.equals(other.externalId) - && redacted.equals(other.redacted) + && redacted == other.redacted && appPackageCode.equals(other.appPackageCode) && updatedAttributeData.equals(other.updatedAttributeData); } @@ -271,47 +271,164 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static TypeStage builder() { return new Builder(); } + public interface TypeStage { + /** + *

Always ticket_part

+ */ + IdStage type(@NotNull String type); + + Builder from(TicketPart other); + } + + public interface IdStage { + /** + *

The id representing the ticket part.

+ */ + PartTypeStage id(@NotNull String id); + } + + public interface PartTypeStage { + /** + *

The type of ticket part.

+ */ + CreatedAtStage partType(@NotNull String partType); + } + + public interface CreatedAtStage { + /** + *

The time the ticket part was created.

+ */ + UpdatedAtStage createdAt(int createdAt); + } + + public interface UpdatedAtStage { + /** + *

The last time the ticket part was updated.

+ */ + AuthorStage updatedAt(int updatedAt); + } + + public interface AuthorStage { + RedactedStage author(@NotNull TicketPartAuthor author); + } + + public interface RedactedStage { + /** + *

Whether or not the ticket part has been redacted.

+ */ + _FinalStage redacted(boolean redacted); + } + + public interface _FinalStage { + TicketPart build(); + + /** + *

The message body, which may contain HTML.

+ */ + _FinalStage body(Optional body); + + _FinalStage body(String body); + + /** + *

The previous state of the ticket.

+ */ + _FinalStage previousTicketState(Optional previousTicketState); + + _FinalStage previousTicketState(PreviousTicketState previousTicketState); + + /** + *

The state of the ticket.

+ */ + _FinalStage ticketState(Optional ticketState); + + _FinalStage ticketState(TicketState ticketState); + + /** + *

The id of the admin that was assigned the ticket by this ticket_part (null if there has been no change in assignment.)

+ */ + _FinalStage assignedTo(Optional assignedTo); + + _FinalStage assignedTo(Reference assignedTo); + + /** + *

A list of attachments for the part.

+ */ + _FinalStage attachments(Optional> attachments); + + _FinalStage attachments(List attachments); + + /** + *

The external id of the ticket part

+ */ + _FinalStage externalId(Optional externalId); + + _FinalStage externalId(String externalId); + + /** + *

The app package code if this part was created via API. Note this field won't show if the part was not created via API.

+ */ + _FinalStage appPackageCode(Optional appPackageCode); + + _FinalStage appPackageCode(String appPackageCode); + + /** + *

The updated attribute data of the ticket part. Only present for attribute update parts.

+ */ + _FinalStage updatedAttributeData(Optional updatedAttributeData); + + _FinalStage updatedAttributeData(UpdatedAttributeData updatedAttributeData); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public static final class Builder + implements TypeStage, + IdStage, + PartTypeStage, + CreatedAtStage, + UpdatedAtStage, + AuthorStage, + RedactedStage, + _FinalStage { + private String type; - private Optional id = Optional.empty(); + private String id; - private Optional partType = Optional.empty(); + private String partType; - private Optional body = Optional.empty(); + private int createdAt; - private Optional previousTicketState = Optional.empty(); + private int updatedAt; - private Optional ticketState = Optional.empty(); + private TicketPartAuthor author; - private Optional createdAt = Optional.empty(); + private boolean redacted; - private Optional updatedAt = Optional.empty(); + private Optional updatedAttributeData = Optional.empty(); - private Optional assignedTo = Optional.empty(); + private Optional appPackageCode = Optional.empty(); - private Optional author = Optional.empty(); + private Optional externalId = Optional.empty(); private Optional> attachments = Optional.empty(); - private Optional externalId = Optional.empty(); + private Optional assignedTo = Optional.empty(); - private Optional redacted = Optional.empty(); + private Optional ticketState = Optional.empty(); - private Optional appPackageCode = Optional.empty(); + private Optional previousTicketState = Optional.empty(); - private Optional updatedAttributeData = Optional.empty(); + private Optional body = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(TicketPart other) { type(other.getType()); id(other.getId()); @@ -333,211 +450,244 @@ public Builder from(TicketPart other) { /** *

Always ticket_part

+ *

Always ticket_part

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(String type) { - this.type = Optional.ofNullable(type); + @java.lang.Override + @JsonSetter("type") + public IdStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); return this; } /** *

The id representing the ticket part.

+ *

The id representing the ticket part.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); + @java.lang.Override + @JsonSetter("id") + public PartTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } /** *

The type of ticket part.

+ *

The type of ticket part.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "part_type", nulls = Nulls.SKIP) - public Builder partType(Optional partType) { - this.partType = partType; - return this; - } - - public Builder partType(String partType) { - this.partType = Optional.ofNullable(partType); + @java.lang.Override + @JsonSetter("part_type") + public CreatedAtStage partType(@NotNull String partType) { + this.partType = Objects.requireNonNull(partType, "partType must not be null"); return this; } /** - *

The message body, which may contain HTML.

+ *

The time the ticket part was created.

+ *

The time the ticket part was created.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Optional body) { - this.body = body; - return this; - } - - public Builder body(String body) { - this.body = Optional.ofNullable(body); + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { + this.createdAt = createdAt; return this; } /** - *

The previous state of the ticket.

+ *

The last time the ticket part was updated.

+ *

The last time the ticket part was updated.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "previous_ticket_state", nulls = Nulls.SKIP) - public Builder previousTicketState(Optional previousTicketState) { - this.previousTicketState = previousTicketState; + @java.lang.Override + @JsonSetter("updated_at") + public AuthorStage updatedAt(int updatedAt) { + this.updatedAt = updatedAt; return this; } - public Builder previousTicketState(PreviousTicketState previousTicketState) { - this.previousTicketState = Optional.ofNullable(previousTicketState); + @java.lang.Override + @JsonSetter("author") + public RedactedStage author(@NotNull TicketPartAuthor author) { + this.author = Objects.requireNonNull(author, "author must not be null"); return this; } /** - *

The state of the ticket.

+ *

Whether or not the ticket part has been redacted.

+ *

Whether or not the ticket part has been redacted.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "ticket_state", nulls = Nulls.SKIP) - public Builder ticketState(Optional ticketState) { - this.ticketState = ticketState; - return this; - } - - public Builder ticketState(TicketState ticketState) { - this.ticketState = Optional.ofNullable(ticketState); + @java.lang.Override + @JsonSetter("redacted") + public _FinalStage redacted(boolean redacted) { + this.redacted = redacted; return this; } /** - *

The time the ticket part was created.

+ *

The updated attribute data of the ticket part. Only present for attribute update parts.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "created_at", nulls = Nulls.SKIP) - public Builder createdAt(Optional createdAt) { - this.createdAt = createdAt; - return this; - } - - public Builder createdAt(Integer createdAt) { - this.createdAt = Optional.ofNullable(createdAt); + @java.lang.Override + public _FinalStage updatedAttributeData(UpdatedAttributeData updatedAttributeData) { + this.updatedAttributeData = Optional.ofNullable(updatedAttributeData); return this; } /** - *

The last time the ticket part was updated.

+ *

The updated attribute data of the ticket part. Only present for attribute update parts.

*/ - @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) - public Builder updatedAt(Optional updatedAt) { - this.updatedAt = updatedAt; + @java.lang.Override + @JsonSetter(value = "updated_attribute_data", nulls = Nulls.SKIP) + public _FinalStage updatedAttributeData(Optional updatedAttributeData) { + this.updatedAttributeData = updatedAttributeData; return this; } - public Builder updatedAt(Integer updatedAt) { - this.updatedAt = Optional.ofNullable(updatedAt); + /** + *

The app package code if this part was created via API. Note this field won't show if the part was not created via API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appPackageCode(String appPackageCode) { + this.appPackageCode = Optional.ofNullable(appPackageCode); return this; } /** - *

The id of the admin that was assigned the ticket by this ticket_part (null if there has been no change in assignment.)

+ *

The app package code if this part was created via API. Note this field won't show if the part was not created via API.

*/ - @JsonSetter(value = "assigned_to", nulls = Nulls.SKIP) - public Builder assignedTo(Optional assignedTo) { - this.assignedTo = assignedTo; + @java.lang.Override + @JsonSetter(value = "app_package_code", nulls = Nulls.SKIP) + public _FinalStage appPackageCode(Optional appPackageCode) { + this.appPackageCode = appPackageCode; return this; } - public Builder assignedTo(Reference assignedTo) { - this.assignedTo = Optional.ofNullable(assignedTo); + /** + *

The external id of the ticket part

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); return this; } - @JsonSetter(value = "author", nulls = Nulls.SKIP) - public Builder author(Optional author) { - this.author = author; + /** + *

The external id of the ticket part

+ */ + @java.lang.Override + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public _FinalStage externalId(Optional externalId) { + this.externalId = externalId; return this; } - public Builder author(TicketPartAuthor author) { - this.author = Optional.ofNullable(author); + /** + *

A list of attachments for the part.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); return this; } /** *

A list of attachments for the part.

*/ + @java.lang.Override @JsonSetter(value = "attachments", nulls = Nulls.SKIP) - public Builder attachments(Optional> attachments) { + public _FinalStage attachments(Optional> attachments) { this.attachments = attachments; return this; } - public Builder attachments(List attachments) { - this.attachments = Optional.ofNullable(attachments); - return this; - } - /** - *

The external id of the ticket part

+ *

The id of the admin that was assigned the ticket by this ticket_part (null if there has been no change in assignment.)

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "external_id", nulls = Nulls.SKIP) - public Builder externalId(Optional externalId) { - this.externalId = externalId; + @java.lang.Override + public _FinalStage assignedTo(Reference assignedTo) { + this.assignedTo = Optional.ofNullable(assignedTo); return this; } - public Builder externalId(String externalId) { - this.externalId = Optional.ofNullable(externalId); + /** + *

The id of the admin that was assigned the ticket by this ticket_part (null if there has been no change in assignment.)

+ */ + @java.lang.Override + @JsonSetter(value = "assigned_to", nulls = Nulls.SKIP) + public _FinalStage assignedTo(Optional assignedTo) { + this.assignedTo = assignedTo; return this; } /** - *

Whether or not the ticket part has been redacted.

+ *

The state of the ticket.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "redacted", nulls = Nulls.SKIP) - public Builder redacted(Optional redacted) { - this.redacted = redacted; + @java.lang.Override + public _FinalStage ticketState(TicketState ticketState) { + this.ticketState = Optional.ofNullable(ticketState); return this; } - public Builder redacted(Boolean redacted) { - this.redacted = Optional.ofNullable(redacted); + /** + *

The state of the ticket.

+ */ + @java.lang.Override + @JsonSetter(value = "ticket_state", nulls = Nulls.SKIP) + public _FinalStage ticketState(Optional ticketState) { + this.ticketState = ticketState; return this; } /** - *

The app package code if this part was created via API. Note this field won't show if the part was not created via API.

+ *

The previous state of the ticket.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "app_package_code", nulls = Nulls.SKIP) - public Builder appPackageCode(Optional appPackageCode) { - this.appPackageCode = appPackageCode; + @java.lang.Override + public _FinalStage previousTicketState(PreviousTicketState previousTicketState) { + this.previousTicketState = Optional.ofNullable(previousTicketState); return this; } - public Builder appPackageCode(String appPackageCode) { - this.appPackageCode = Optional.ofNullable(appPackageCode); + /** + *

The previous state of the ticket.

+ */ + @java.lang.Override + @JsonSetter(value = "previous_ticket_state", nulls = Nulls.SKIP) + public _FinalStage previousTicketState(Optional previousTicketState) { + this.previousTicketState = previousTicketState; return this; } /** - *

The updated attribute data of the ticket part. Only present for attribute update parts.

+ *

The message body, which may contain HTML.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "updated_attribute_data", nulls = Nulls.SKIP) - public Builder updatedAttributeData(Optional updatedAttributeData) { - this.updatedAttributeData = updatedAttributeData; + @java.lang.Override + public _FinalStage body(String body) { + this.body = Optional.ofNullable(body); return this; } - public Builder updatedAttributeData(UpdatedAttributeData updatedAttributeData) { - this.updatedAttributeData = Optional.ofNullable(updatedAttributeData); + /** + *

The message body, which may contain HTML.

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Optional body) { + this.body = body; return this; } + @java.lang.Override public TicketPart build() { return new TicketPart( type, diff --git a/src/main/java/com/intercom/api/types/ConversationPart.java b/src/main/java/com/intercom/api/types/ConversationPart.java index 9360990e..1d6a48de 100644 --- a/src/main/java/com/intercom/api/types/ConversationPart.java +++ b/src/main/java/com/intercom/api/types/ConversationPart.java @@ -20,33 +20,34 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConversationPart.Builder.class) public final class ConversationPart { - private final Optional type; + private final String type; - private final Optional id; + private final String id; - private final Optional partType; + private final String partType; private final Optional body; - private final Optional createdAt; + private final int createdAt; - private final Optional updatedAt; + private final int updatedAt; private final Optional notifiedAt; private final Optional assignedTo; - private final Optional author; + private final ConversationPartAuthor author; private final Optional> attachments; private final Optional externalId; - private final Optional redacted; + private final boolean redacted; private final Optional emailMessageMetadata; @@ -63,18 +64,18 @@ public final class ConversationPart { private final Map additionalProperties; private ConversationPart( - Optional type, - Optional id, - Optional partType, + String type, + String id, + String partType, Optional body, - Optional createdAt, - Optional updatedAt, + int createdAt, + int updatedAt, Optional notifiedAt, Optional assignedTo, - Optional author, + ConversationPartAuthor author, Optional> attachments, Optional externalId, - Optional redacted, + boolean redacted, Optional emailMessageMetadata, Optional metadata, Optional state, @@ -107,7 +108,7 @@ private ConversationPart( * @return Always conversation_part */ @JsonProperty("type") - public Optional getType() { + public String getType() { return type; } @@ -115,7 +116,7 @@ public Optional getType() { * @return The id representing the conversation part. */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -123,7 +124,7 @@ public Optional getId() { * @return The type of conversation part. */ @JsonProperty("part_type") - public Optional getPartType() { + public String getPartType() { return partType; } @@ -139,7 +140,7 @@ public Optional getBody() { * @return The time the conversation part was created. */ @JsonProperty("created_at") - public Optional getCreatedAt() { + public int getCreatedAt() { return createdAt; } @@ -147,7 +148,7 @@ public Optional getCreatedAt() { * @return The last time the conversation part was updated. */ @JsonProperty("updated_at") - public Optional getUpdatedAt() { + public int getUpdatedAt() { return updatedAt; } @@ -168,7 +169,7 @@ public Optional getAssignedTo() { } @JsonProperty("author") - public Optional getAuthor() { + public ConversationPartAuthor getAuthor() { return author; } @@ -192,7 +193,7 @@ public Optional getExternalId() { * @return Whether or not the conversation part has been redacted. */ @JsonProperty("redacted") - public Optional getRedacted() { + public boolean getRedacted() { return redacted; } @@ -251,14 +252,14 @@ private boolean equalTo(ConversationPart other) { && id.equals(other.id) && partType.equals(other.partType) && body.equals(other.body) - && createdAt.equals(other.createdAt) - && updatedAt.equals(other.updatedAt) + && createdAt == other.createdAt + && updatedAt == other.updatedAt && notifiedAt.equals(other.notifiedAt) && assignedTo.equals(other.assignedTo) && author.equals(other.author) && attachments.equals(other.attachments) && externalId.equals(other.externalId) - && redacted.equals(other.redacted) + && redacted == other.redacted && emailMessageMetadata.equals(other.emailMessageMetadata) && metadata.equals(other.metadata) && state.equals(other.state) @@ -295,53 +296,182 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static TypeStage builder() { return new Builder(); } + public interface TypeStage { + /** + *

Always conversation_part

+ */ + IdStage type(@NotNull String type); + + Builder from(ConversationPart other); + } + + public interface IdStage { + /** + *

The id representing the conversation part.

+ */ + PartTypeStage id(@NotNull String id); + } + + public interface PartTypeStage { + /** + *

The type of conversation part.

+ */ + CreatedAtStage partType(@NotNull String partType); + } + + public interface CreatedAtStage { + /** + *

The time the conversation part was created.

+ */ + UpdatedAtStage createdAt(int createdAt); + } + + public interface UpdatedAtStage { + /** + *

The last time the conversation part was updated.

+ */ + AuthorStage updatedAt(int updatedAt); + } + + public interface AuthorStage { + RedactedStage author(@NotNull ConversationPartAuthor author); + } + + public interface RedactedStage { + /** + *

Whether or not the conversation part has been redacted.

+ */ + _FinalStage redacted(boolean redacted); + } + + public interface _FinalStage { + ConversationPart build(); + + /** + *

The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.

+ */ + _FinalStage body(Optional body); + + _FinalStage body(String body); + + /** + *

The time the user was notified with the conversation part.

+ */ + _FinalStage notifiedAt(Optional notifiedAt); + + _FinalStage notifiedAt(Integer notifiedAt); + + /** + *

The id of the admin that was assigned the conversation by this conversation_part (null if there has been no change in assignment.)

+ */ + _FinalStage assignedTo(Optional assignedTo); + + _FinalStage assignedTo(Reference assignedTo); + + /** + *

A list of attachments for the part.

+ */ + _FinalStage attachments(Optional> attachments); + + _FinalStage attachments(List attachments); + + /** + *

The external id of the conversation part

+ */ + _FinalStage externalId(Optional externalId); + + _FinalStage externalId(String externalId); + + _FinalStage emailMessageMetadata(Optional emailMessageMetadata); + + _FinalStage emailMessageMetadata(EmailMessageMetadata emailMessageMetadata); + + _FinalStage metadata(Optional metadata); + + _FinalStage metadata(ConversationPartMetadata metadata); + + /** + *

Indicates the current state of conversation when the conversation part was created.

+ */ + _FinalStage state(Optional state); + + _FinalStage state(State state); + + /** + *

A list of tags objects associated with the conversation part.

+ */ + _FinalStage tags(Optional> tags); + + _FinalStage tags(List tags); + + _FinalStage eventDetails(Optional eventDetails); + + _FinalStage eventDetails(EventDetails eventDetails); + + /** + *

The app package code if this part was created via API. null if the part was not created via API.

+ */ + _FinalStage appPackageCode(Optional appPackageCode); + + _FinalStage appPackageCode(String appPackageCode); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public static final class Builder + implements TypeStage, + IdStage, + PartTypeStage, + CreatedAtStage, + UpdatedAtStage, + AuthorStage, + RedactedStage, + _FinalStage { + private String type; - private Optional id = Optional.empty(); + private String id; - private Optional partType = Optional.empty(); + private String partType; - private Optional body = Optional.empty(); + private int createdAt; - private Optional createdAt = Optional.empty(); + private int updatedAt; - private Optional updatedAt = Optional.empty(); + private ConversationPartAuthor author; - private Optional notifiedAt = Optional.empty(); + private boolean redacted; - private Optional assignedTo = Optional.empty(); + private Optional appPackageCode = Optional.empty(); - private Optional author = Optional.empty(); + private Optional eventDetails = Optional.empty(); - private Optional> attachments = Optional.empty(); + private Optional> tags = Optional.empty(); - private Optional externalId = Optional.empty(); + private Optional state = Optional.empty(); - private Optional redacted = Optional.empty(); + private Optional metadata = Optional.empty(); private Optional emailMessageMetadata = Optional.empty(); - private Optional metadata = Optional.empty(); + private Optional externalId = Optional.empty(); - private Optional state = Optional.empty(); + private Optional> attachments = Optional.empty(); - private Optional> tags = Optional.empty(); + private Optional assignedTo = Optional.empty(); - private Optional eventDetails = Optional.empty(); + private Optional notifiedAt = Optional.empty(); - private Optional appPackageCode = Optional.empty(); + private Optional body = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(ConversationPart other) { type(other.getType()); id(other.getId()); @@ -366,244 +496,283 @@ public Builder from(ConversationPart other) { /** *

Always conversation_part

+ *

Always conversation_part

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(String type) { - this.type = Optional.ofNullable(type); + @java.lang.Override + @JsonSetter("type") + public IdStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); return this; } /** *

The id representing the conversation part.

+ *

The id representing the conversation part.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); + @java.lang.Override + @JsonSetter("id") + public PartTypeStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } /** *

The type of conversation part.

+ *

The type of conversation part.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "part_type", nulls = Nulls.SKIP) - public Builder partType(Optional partType) { - this.partType = partType; - return this; - } - - public Builder partType(String partType) { - this.partType = Optional.ofNullable(partType); - return this; - } - - /** - *

The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.

- */ - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Optional body) { - this.body = body; - return this; - } - - public Builder body(String body) { - this.body = Optional.ofNullable(body); + @java.lang.Override + @JsonSetter("part_type") + public CreatedAtStage partType(@NotNull String partType) { + this.partType = Objects.requireNonNull(partType, "partType must not be null"); return this; } /** *

The time the conversation part was created.

+ *

The time the conversation part was created.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "created_at", nulls = Nulls.SKIP) - public Builder createdAt(Optional createdAt) { + @java.lang.Override + @JsonSetter("created_at") + public UpdatedAtStage createdAt(int createdAt) { this.createdAt = createdAt; return this; } - public Builder createdAt(Integer createdAt) { - this.createdAt = Optional.ofNullable(createdAt); - return this; - } - /** *

The last time the conversation part was updated.

+ *

The last time the conversation part was updated.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) - public Builder updatedAt(Optional updatedAt) { + @java.lang.Override + @JsonSetter("updated_at") + public AuthorStage updatedAt(int updatedAt) { this.updatedAt = updatedAt; return this; } - public Builder updatedAt(Integer updatedAt) { - this.updatedAt = Optional.ofNullable(updatedAt); + @java.lang.Override + @JsonSetter("author") + public RedactedStage author(@NotNull ConversationPartAuthor author) { + this.author = Objects.requireNonNull(author, "author must not be null"); return this; } /** - *

The time the user was notified with the conversation part.

+ *

Whether or not the conversation part has been redacted.

+ *

Whether or not the conversation part has been redacted.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "notified_at", nulls = Nulls.SKIP) - public Builder notifiedAt(Optional notifiedAt) { - this.notifiedAt = notifiedAt; + @java.lang.Override + @JsonSetter("redacted") + public _FinalStage redacted(boolean redacted) { + this.redacted = redacted; return this; } - public Builder notifiedAt(Integer notifiedAt) { - this.notifiedAt = Optional.ofNullable(notifiedAt); + /** + *

The app package code if this part was created via API. null if the part was not created via API.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage appPackageCode(String appPackageCode) { + this.appPackageCode = Optional.ofNullable(appPackageCode); return this; } /** - *

The id of the admin that was assigned the conversation by this conversation_part (null if there has been no change in assignment.)

+ *

The app package code if this part was created via API. null if the part was not created via API.

*/ - @JsonSetter(value = "assigned_to", nulls = Nulls.SKIP) - public Builder assignedTo(Optional assignedTo) { - this.assignedTo = assignedTo; + @java.lang.Override + @JsonSetter(value = "app_package_code", nulls = Nulls.SKIP) + public _FinalStage appPackageCode(Optional appPackageCode) { + this.appPackageCode = appPackageCode; return this; } - public Builder assignedTo(Reference assignedTo) { - this.assignedTo = Optional.ofNullable(assignedTo); + @java.lang.Override + public _FinalStage eventDetails(EventDetails eventDetails) { + this.eventDetails = Optional.ofNullable(eventDetails); return this; } - @JsonSetter(value = "author", nulls = Nulls.SKIP) - public Builder author(Optional author) { - this.author = author; + @java.lang.Override + @JsonSetter(value = "event_details", nulls = Nulls.SKIP) + public _FinalStage eventDetails(Optional eventDetails) { + this.eventDetails = eventDetails; return this; } - public Builder author(ConversationPartAuthor author) { - this.author = Optional.ofNullable(author); + /** + *

A list of tags objects associated with the conversation part.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage tags(List tags) { + this.tags = Optional.ofNullable(tags); return this; } /** - *

A list of attachments for the part.

+ *

A list of tags objects associated with the conversation part.

*/ - @JsonSetter(value = "attachments", nulls = Nulls.SKIP) - public Builder attachments(Optional> attachments) { - this.attachments = attachments; + @java.lang.Override + @JsonSetter(value = "tags", nulls = Nulls.SKIP) + public _FinalStage tags(Optional> tags) { + this.tags = tags; return this; } - public Builder attachments(List attachments) { - this.attachments = Optional.ofNullable(attachments); + /** + *

Indicates the current state of conversation when the conversation part was created.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage state(State state) { + this.state = Optional.ofNullable(state); return this; } /** - *

The external id of the conversation part

+ *

Indicates the current state of conversation when the conversation part was created.

*/ - @JsonSetter(value = "external_id", nulls = Nulls.SKIP) - public Builder externalId(Optional externalId) { - this.externalId = externalId; + @java.lang.Override + @JsonSetter(value = "state", nulls = Nulls.SKIP) + public _FinalStage state(Optional state) { + this.state = state; return this; } - public Builder externalId(String externalId) { - this.externalId = Optional.ofNullable(externalId); + @java.lang.Override + public _FinalStage metadata(ConversationPartMetadata metadata) { + this.metadata = Optional.ofNullable(metadata); return this; } - /** - *

Whether or not the conversation part has been redacted.

- */ - @JsonSetter(value = "redacted", nulls = Nulls.SKIP) - public Builder redacted(Optional redacted) { - this.redacted = redacted; + @java.lang.Override + @JsonSetter(value = "metadata", nulls = Nulls.SKIP) + public _FinalStage metadata(Optional metadata) { + this.metadata = metadata; return this; } - public Builder redacted(Boolean redacted) { - this.redacted = Optional.ofNullable(redacted); + @java.lang.Override + public _FinalStage emailMessageMetadata(EmailMessageMetadata emailMessageMetadata) { + this.emailMessageMetadata = Optional.ofNullable(emailMessageMetadata); return this; } + @java.lang.Override @JsonSetter(value = "email_message_metadata", nulls = Nulls.SKIP) - public Builder emailMessageMetadata(Optional emailMessageMetadata) { + public _FinalStage emailMessageMetadata(Optional emailMessageMetadata) { this.emailMessageMetadata = emailMessageMetadata; return this; } - public Builder emailMessageMetadata(EmailMessageMetadata emailMessageMetadata) { - this.emailMessageMetadata = Optional.ofNullable(emailMessageMetadata); - return this; - } - - @JsonSetter(value = "metadata", nulls = Nulls.SKIP) - public Builder metadata(Optional metadata) { - this.metadata = metadata; + /** + *

The external id of the conversation part

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage externalId(String externalId) { + this.externalId = Optional.ofNullable(externalId); return this; } - public Builder metadata(ConversationPartMetadata metadata) { - this.metadata = Optional.ofNullable(metadata); + /** + *

The external id of the conversation part

+ */ + @java.lang.Override + @JsonSetter(value = "external_id", nulls = Nulls.SKIP) + public _FinalStage externalId(Optional externalId) { + this.externalId = externalId; return this; } /** - *

Indicates the current state of conversation when the conversation part was created.

+ *

A list of attachments for the part.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "state", nulls = Nulls.SKIP) - public Builder state(Optional state) { - this.state = state; + @java.lang.Override + public _FinalStage attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); return this; } - public Builder state(State state) { - this.state = Optional.ofNullable(state); + /** + *

A list of attachments for the part.

+ */ + @java.lang.Override + @JsonSetter(value = "attachments", nulls = Nulls.SKIP) + public _FinalStage attachments(Optional> attachments) { + this.attachments = attachments; return this; } /** - *

A list of tags objects associated with the conversation part.

+ *

The id of the admin that was assigned the conversation by this conversation_part (null if there has been no change in assignment.)

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "tags", nulls = Nulls.SKIP) - public Builder tags(Optional> tags) { - this.tags = tags; + @java.lang.Override + public _FinalStage assignedTo(Reference assignedTo) { + this.assignedTo = Optional.ofNullable(assignedTo); return this; } - public Builder tags(List tags) { - this.tags = Optional.ofNullable(tags); + /** + *

The id of the admin that was assigned the conversation by this conversation_part (null if there has been no change in assignment.)

+ */ + @java.lang.Override + @JsonSetter(value = "assigned_to", nulls = Nulls.SKIP) + public _FinalStage assignedTo(Optional assignedTo) { + this.assignedTo = assignedTo; return this; } - @JsonSetter(value = "event_details", nulls = Nulls.SKIP) - public Builder eventDetails(Optional eventDetails) { - this.eventDetails = eventDetails; + /** + *

The time the user was notified with the conversation part.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage notifiedAt(Integer notifiedAt) { + this.notifiedAt = Optional.ofNullable(notifiedAt); return this; } - public Builder eventDetails(EventDetails eventDetails) { - this.eventDetails = Optional.ofNullable(eventDetails); + /** + *

The time the user was notified with the conversation part.

+ */ + @java.lang.Override + @JsonSetter(value = "notified_at", nulls = Nulls.SKIP) + public _FinalStage notifiedAt(Optional notifiedAt) { + this.notifiedAt = notifiedAt; return this; } /** - *

The app package code if this part was created via API. null if the part was not created via API.

+ *

The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "app_package_code", nulls = Nulls.SKIP) - public Builder appPackageCode(Optional appPackageCode) { - this.appPackageCode = appPackageCode; + @java.lang.Override + public _FinalStage body(String body) { + this.body = Optional.ofNullable(body); return this; } - public Builder appPackageCode(String appPackageCode) { - this.appPackageCode = Optional.ofNullable(appPackageCode); + /** + *

The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Optional body) { + this.body = body; return this; } + @java.lang.Override public ConversationPart build() { return new ConversationPart( type, diff --git a/src/main/java/com/intercom/api/types/ConversationPartAuthor.java b/src/main/java/com/intercom/api/types/ConversationPartAuthor.java index 8c9f983c..c8329cf2 100644 --- a/src/main/java/com/intercom/api/types/ConversationPartAuthor.java +++ b/src/main/java/com/intercom/api/types/ConversationPartAuthor.java @@ -16,13 +16,14 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConversationPartAuthor.Builder.class) public final class ConversationPartAuthor { - private final Optional type; + private final String type; - private final Optional id; + private final String id; private final Optional name; @@ -35,8 +36,8 @@ public final class ConversationPartAuthor { private final Map additionalProperties; private ConversationPartAuthor( - Optional type, - Optional id, + String type, + String id, Optional name, Optional email, Optional fromAiAgent, @@ -55,7 +56,7 @@ private ConversationPartAuthor( * @return The type of the author */ @JsonProperty("type") - public Optional getType() { + public String getType() { return type; } @@ -63,7 +64,7 @@ public Optional getType() { * @return The id of the author */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -129,29 +130,78 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static TypeStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public interface TypeStage { + /** + *

The type of the author

+ */ + IdStage type(@NotNull String type); - private Optional id = Optional.empty(); + Builder from(ConversationPartAuthor other); + } - private Optional name = Optional.empty(); + public interface IdStage { + /** + *

The id of the author

+ */ + _FinalStage id(@NotNull String id); + } - private Optional email = Optional.empty(); + public interface _FinalStage { + ConversationPartAuthor build(); - private Optional fromAiAgent = Optional.empty(); + /** + *

The name of the author

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + /** + *

The email of the author

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + + /** + *

If this conversation part was sent by the AI Agent

+ */ + _FinalStage fromAiAgent(Optional fromAiAgent); + + _FinalStage fromAiAgent(Boolean fromAiAgent); + + /** + *

If this conversation part body was generated by the AI Agent

+ */ + _FinalStage isAiAnswer(Optional isAiAnswer); + + _FinalStage isAiAnswer(Boolean isAiAnswer); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, IdStage, _FinalStage { + private String type; + + private String id; private Optional isAiAnswer = Optional.empty(); + private Optional fromAiAgent = Optional.empty(); + + private Optional email = Optional.empty(); + + private Optional name = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(ConversationPartAuthor other) { type(other.getType()); id(other.getId()); @@ -164,88 +214,109 @@ public Builder from(ConversationPartAuthor other) { /** *

The type of the author

+ *

The type of the author

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(String type) { - this.type = Optional.ofNullable(type); + @java.lang.Override + @JsonSetter("type") + public IdStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); return this; } /** *

The id of the author

+ *

The id of the author

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } - public Builder id(String id) { - this.id = Optional.ofNullable(id); + /** + *

If this conversation part body was generated by the AI Agent

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage isAiAnswer(Boolean isAiAnswer) { + this.isAiAnswer = Optional.ofNullable(isAiAnswer); return this; } /** - *

The name of the author

+ *

If this conversation part body was generated by the AI Agent

*/ - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; + @java.lang.Override + @JsonSetter(value = "is_ai_answer", nulls = Nulls.SKIP) + public _FinalStage isAiAnswer(Optional isAiAnswer) { + this.isAiAnswer = isAiAnswer; return this; } - public Builder name(String name) { - this.name = Optional.ofNullable(name); + /** + *

If this conversation part was sent by the AI Agent

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage fromAiAgent(Boolean fromAiAgent) { + this.fromAiAgent = Optional.ofNullable(fromAiAgent); return this; } /** - *

The email of the author

+ *

If this conversation part was sent by the AI Agent

*/ - @JsonSetter(value = "email", nulls = Nulls.SKIP) - public Builder email(Optional email) { - this.email = email; + @java.lang.Override + @JsonSetter(value = "from_ai_agent", nulls = Nulls.SKIP) + public _FinalStage fromAiAgent(Optional fromAiAgent) { + this.fromAiAgent = fromAiAgent; return this; } - public Builder email(String email) { + /** + *

The email of the author

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { this.email = Optional.ofNullable(email); return this; } /** - *

If this conversation part was sent by the AI Agent

+ *

The email of the author

*/ - @JsonSetter(value = "from_ai_agent", nulls = Nulls.SKIP) - public Builder fromAiAgent(Optional fromAiAgent) { - this.fromAiAgent = fromAiAgent; - return this; - } - - public Builder fromAiAgent(Boolean fromAiAgent) { - this.fromAiAgent = Optional.ofNullable(fromAiAgent); + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; return this; } /** - *

If this conversation part body was generated by the AI Agent

+ *

The name of the author

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "is_ai_answer", nulls = Nulls.SKIP) - public Builder isAiAnswer(Optional isAiAnswer) { - this.isAiAnswer = isAiAnswer; + @java.lang.Override + public _FinalStage name(String name) { + this.name = Optional.ofNullable(name); return this; } - public Builder isAiAnswer(Boolean isAiAnswer) { - this.isAiAnswer = Optional.ofNullable(isAiAnswer); + /** + *

The name of the author

+ */ + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; return this; } + @java.lang.Override public ConversationPartAuthor build() { return new ConversationPartAuthor(type, id, name, email, fromAiAgent, isAiAnswer, additionalProperties); } diff --git a/src/main/java/com/intercom/api/types/ConversationRating.java b/src/main/java/com/intercom/api/types/ConversationRating.java index a6c6f190..52090bbe 100644 --- a/src/main/java/com/intercom/api/types/ConversationRating.java +++ b/src/main/java/com/intercom/api/types/ConversationRating.java @@ -20,11 +20,11 @@ @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConversationRating.Builder.class) public final class ConversationRating { - private final Optional rating; + private final int rating; private final Optional remark; - private final Optional createdAt; + private final int createdAt; private final Optional updatedAt; @@ -35,9 +35,9 @@ public final class ConversationRating { private final Map additionalProperties; private ConversationRating( - Optional rating, + int rating, Optional remark, - Optional createdAt, + int createdAt, Optional updatedAt, Optional contact, Optional teammate, @@ -55,7 +55,7 @@ private ConversationRating( * @return The rating, between 1 and 5, for the conversation. */ @JsonProperty("rating") - public Optional getRating() { + public int getRating() { return rating; } @@ -71,7 +71,7 @@ public Optional getRemark() { * @return The time the rating was requested in the conversation being rated. */ @JsonProperty("created_at") - public Optional getCreatedAt() { + public int getCreatedAt() { return createdAt; } @@ -105,9 +105,9 @@ public Map getAdditionalProperties() { } private boolean equalTo(ConversationRating other) { - return rating.equals(other.rating) + return rating == other.rating && remark.equals(other.remark) - && createdAt.equals(other.createdAt) + && createdAt == other.createdAt && updatedAt.equals(other.updatedAt) && contact.equals(other.contact) && teammate.equals(other.teammate); @@ -123,29 +123,72 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static RatingStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional rating = Optional.empty(); + public interface RatingStage { + /** + *

The rating, between 1 and 5, for the conversation.

+ */ + CreatedAtStage rating(int rating); - private Optional remark = Optional.empty(); + Builder from(ConversationRating other); + } - private Optional createdAt = Optional.empty(); + public interface CreatedAtStage { + /** + *

The time the rating was requested in the conversation being rated.

+ */ + _FinalStage createdAt(int createdAt); + } - private Optional updatedAt = Optional.empty(); + public interface _FinalStage { + ConversationRating build(); - private Optional contact = Optional.empty(); + /** + *

An optional field to add a remark to correspond to the number rating

+ */ + _FinalStage remark(Optional remark); + + _FinalStage remark(String remark); + + /** + *

The time the rating was last updated.

+ */ + _FinalStage updatedAt(Optional updatedAt); + + _FinalStage updatedAt(Integer updatedAt); + + _FinalStage contact(Optional contact); + + _FinalStage contact(ContactReference contact); + + _FinalStage teammate(Optional teammate); + + _FinalStage teammate(Reference teammate); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements RatingStage, CreatedAtStage, _FinalStage { + private int rating; + + private int createdAt; private Optional teammate = Optional.empty(); + private Optional contact = Optional.empty(); + + private Optional updatedAt = Optional.empty(); + + private Optional remark = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(ConversationRating other) { rating(other.getRating()); remark(other.getRemark()); @@ -158,82 +201,95 @@ public Builder from(ConversationRating other) { /** *

The rating, between 1 and 5, for the conversation.

+ *

The rating, between 1 and 5, for the conversation.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "rating", nulls = Nulls.SKIP) - public Builder rating(Optional rating) { + @java.lang.Override + @JsonSetter("rating") + public CreatedAtStage rating(int rating) { this.rating = rating; return this; } - public Builder rating(Integer rating) { - this.rating = Optional.ofNullable(rating); + /** + *

The time the rating was requested in the conversation being rated.

+ *

The time the rating was requested in the conversation being rated.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + @JsonSetter("created_at") + public _FinalStage createdAt(int createdAt) { + this.createdAt = createdAt; return this; } - /** - *

An optional field to add a remark to correspond to the number rating

- */ - @JsonSetter(value = "remark", nulls = Nulls.SKIP) - public Builder remark(Optional remark) { - this.remark = remark; + @java.lang.Override + public _FinalStage teammate(Reference teammate) { + this.teammate = Optional.ofNullable(teammate); return this; } - public Builder remark(String remark) { - this.remark = Optional.ofNullable(remark); + @java.lang.Override + @JsonSetter(value = "teammate", nulls = Nulls.SKIP) + public _FinalStage teammate(Optional teammate) { + this.teammate = teammate; return this; } - /** - *

The time the rating was requested in the conversation being rated.

- */ - @JsonSetter(value = "created_at", nulls = Nulls.SKIP) - public Builder createdAt(Optional createdAt) { - this.createdAt = createdAt; + @java.lang.Override + public _FinalStage contact(ContactReference contact) { + this.contact = Optional.ofNullable(contact); return this; } - public Builder createdAt(Integer createdAt) { - this.createdAt = Optional.ofNullable(createdAt); + @java.lang.Override + @JsonSetter(value = "contact", nulls = Nulls.SKIP) + public _FinalStage contact(Optional contact) { + this.contact = contact; return this; } /** *

The time the rating was last updated.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) - public Builder updatedAt(Optional updatedAt) { - this.updatedAt = updatedAt; - return this; - } - - public Builder updatedAt(Integer updatedAt) { + @java.lang.Override + public _FinalStage updatedAt(Integer updatedAt) { this.updatedAt = Optional.ofNullable(updatedAt); return this; } - @JsonSetter(value = "contact", nulls = Nulls.SKIP) - public Builder contact(Optional contact) { - this.contact = contact; - return this; - } - - public Builder contact(ContactReference contact) { - this.contact = Optional.ofNullable(contact); + /** + *

The time the rating was last updated.

+ */ + @java.lang.Override + @JsonSetter(value = "updated_at", nulls = Nulls.SKIP) + public _FinalStage updatedAt(Optional updatedAt) { + this.updatedAt = updatedAt; return this; } - @JsonSetter(value = "teammate", nulls = Nulls.SKIP) - public Builder teammate(Optional teammate) { - this.teammate = teammate; + /** + *

An optional field to add a remark to correspond to the number rating

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage remark(String remark) { + this.remark = Optional.ofNullable(remark); return this; } - public Builder teammate(Reference teammate) { - this.teammate = Optional.ofNullable(teammate); + /** + *

An optional field to add a remark to correspond to the number rating

+ */ + @java.lang.Override + @JsonSetter(value = "remark", nulls = Nulls.SKIP) + public _FinalStage remark(Optional remark) { + this.remark = remark; return this; } + @java.lang.Override public ConversationRating build() { return new ConversationRating( rating, remark, createdAt, updatedAt, contact, teammate, additionalProperties); diff --git a/src/main/java/com/intercom/api/types/ConversationSource.java b/src/main/java/com/intercom/api/types/ConversationSource.java index be3c72e8..6c3ec993 100644 --- a/src/main/java/com/intercom/api/types/ConversationSource.java +++ b/src/main/java/com/intercom/api/types/ConversationSource.java @@ -19,40 +19,41 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = ConversationSource.Builder.class) public final class ConversationSource { - private final Optional type; + private final Type type; - private final Optional id; + private final String id; - private final Optional deliveredAs; + private final String deliveredAs; private final Optional subject; private final Optional body; - private final Optional author; + private final ConversationPartAuthor author; private final Optional> attachments; private final Optional url; - private final Optional redacted; + private final boolean redacted; private final Map additionalProperties; private ConversationSource( - Optional type, - Optional id, - Optional deliveredAs, + Type type, + String id, + String deliveredAs, Optional subject, Optional body, - Optional author, + ConversationPartAuthor author, Optional> attachments, Optional url, - Optional redacted, + boolean redacted, Map additionalProperties) { this.type = type; this.id = id; @@ -70,7 +71,7 @@ private ConversationSource( * @return This includes conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp. */ @JsonProperty("type") - public Optional getType() { + public Type getType() { return type; } @@ -78,7 +79,7 @@ public Optional getType() { * @return The id representing the message. */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -86,7 +87,7 @@ public Optional getId() { * @return The conversation's initiation type. Possible values are customer_initiated, campaigns_initiated (legacy campaigns), operator_initiated (Custom bot), automated (Series and other outbounds with dynamic audience message) and admin_initiated (fixed audience message, ticket initiated by an admin, group email). */ @JsonProperty("delivered_as") - public Optional getDeliveredAs() { + public String getDeliveredAs() { return deliveredAs; } @@ -107,7 +108,7 @@ public Optional getBody() { } @JsonProperty("author") - public Optional getAuthor() { + public ConversationPartAuthor getAuthor() { return author; } @@ -131,7 +132,7 @@ public Optional getUrl() { * @return Whether or not the source message has been redacted. Only applicable for contact initiated messages. */ @JsonProperty("redacted") - public Optional getRedacted() { + public boolean getRedacted() { return redacted; } @@ -155,7 +156,7 @@ private boolean equalTo(ConversationSource other) { && author.equals(other.author) && attachments.equals(other.attachments) && url.equals(other.url) - && redacted.equals(other.redacted); + && redacted == other.redacted; } @java.lang.Override @@ -177,35 +178,103 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static TypeStage builder() { return new Builder(); } + public interface TypeStage { + /** + *

This includes conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp.

+ */ + IdStage type(@NotNull Type type); + + Builder from(ConversationSource other); + } + + public interface IdStage { + /** + *

The id representing the message.

+ */ + DeliveredAsStage id(@NotNull String id); + } + + public interface DeliveredAsStage { + /** + *

The conversation's initiation type. Possible values are customer_initiated, campaigns_initiated (legacy campaigns), operator_initiated (Custom bot), automated (Series and other outbounds with dynamic audience message) and admin_initiated (fixed audience message, ticket initiated by an admin, group email).

+ */ + AuthorStage deliveredAs(@NotNull String deliveredAs); + } + + public interface AuthorStage { + RedactedStage author(@NotNull ConversationPartAuthor author); + } + + public interface RedactedStage { + /** + *

Whether or not the source message has been redacted. Only applicable for contact initiated messages.

+ */ + _FinalStage redacted(boolean redacted); + } + + public interface _FinalStage { + ConversationSource build(); + + /** + *

Optional. The message subject. For Twitter, this will show a generic message regarding why the subject is obscured.

+ */ + _FinalStage subject(Optional subject); + + _FinalStage subject(String subject); + + /** + *

The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.

+ */ + _FinalStage body(Optional body); + + _FinalStage body(String body); + + /** + *

A list of attachments for the part.

+ */ + _FinalStage attachments(Optional> attachments); + + _FinalStage attachments(List attachments); + + /** + *

The URL where the conversation was started. For Twitter, Email, and Bots, this will be blank.

+ */ + _FinalStage url(Optional url); + + _FinalStage url(String url); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public static final class Builder + implements TypeStage, IdStage, DeliveredAsStage, AuthorStage, RedactedStage, _FinalStage { + private Type type; - private Optional id = Optional.empty(); + private String id; - private Optional deliveredAs = Optional.empty(); + private String deliveredAs; - private Optional subject = Optional.empty(); + private ConversationPartAuthor author; - private Optional body = Optional.empty(); + private boolean redacted; - private Optional author = Optional.empty(); + private Optional url = Optional.empty(); private Optional> attachments = Optional.empty(); - private Optional url = Optional.empty(); + private Optional body = Optional.empty(); - private Optional redacted = Optional.empty(); + private Optional subject = Optional.empty(); @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(ConversationSource other) { type(other.getType()); id(other.getId()); @@ -221,127 +290,140 @@ public Builder from(ConversationSource other) { /** *

This includes conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp.

+ *

This includes conversation, email, facebook, instagram, phone_call, phone_switch, push, sms, twitter and whatsapp.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(Type type) { - this.type = Optional.ofNullable(type); + @java.lang.Override + @JsonSetter("type") + public IdStage type(@NotNull Type type) { + this.type = Objects.requireNonNull(type, "type must not be null"); return this; } /** *

The id representing the message.

+ *

The id representing the message.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; - return this; - } - - public Builder id(String id) { - this.id = Optional.ofNullable(id); + @java.lang.Override + @JsonSetter("id") + public DeliveredAsStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } /** *

The conversation's initiation type. Possible values are customer_initiated, campaigns_initiated (legacy campaigns), operator_initiated (Custom bot), automated (Series and other outbounds with dynamic audience message) and admin_initiated (fixed audience message, ticket initiated by an admin, group email).

+ *

The conversation's initiation type. Possible values are customer_initiated, campaigns_initiated (legacy campaigns), operator_initiated (Custom bot), automated (Series and other outbounds with dynamic audience message) and admin_initiated (fixed audience message, ticket initiated by an admin, group email).

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "delivered_as", nulls = Nulls.SKIP) - public Builder deliveredAs(Optional deliveredAs) { - this.deliveredAs = deliveredAs; + @java.lang.Override + @JsonSetter("delivered_as") + public AuthorStage deliveredAs(@NotNull String deliveredAs) { + this.deliveredAs = Objects.requireNonNull(deliveredAs, "deliveredAs must not be null"); return this; } - public Builder deliveredAs(String deliveredAs) { - this.deliveredAs = Optional.ofNullable(deliveredAs); + @java.lang.Override + @JsonSetter("author") + public RedactedStage author(@NotNull ConversationPartAuthor author) { + this.author = Objects.requireNonNull(author, "author must not be null"); return this; } /** - *

Optional. The message subject. For Twitter, this will show a generic message regarding why the subject is obscured.

+ *

Whether or not the source message has been redacted. Only applicable for contact initiated messages.

+ *

Whether or not the source message has been redacted. Only applicable for contact initiated messages.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "subject", nulls = Nulls.SKIP) - public Builder subject(Optional subject) { - this.subject = subject; - return this; - } - - public Builder subject(String subject) { - this.subject = Optional.ofNullable(subject); + @java.lang.Override + @JsonSetter("redacted") + public _FinalStage redacted(boolean redacted) { + this.redacted = redacted; return this; } /** - *

The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.

+ *

The URL where the conversation was started. For Twitter, Email, and Bots, this will be blank.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "body", nulls = Nulls.SKIP) - public Builder body(Optional body) { - this.body = body; - return this; - } - - public Builder body(String body) { - this.body = Optional.ofNullable(body); + @java.lang.Override + public _FinalStage url(String url) { + this.url = Optional.ofNullable(url); return this; } - @JsonSetter(value = "author", nulls = Nulls.SKIP) - public Builder author(Optional author) { - this.author = author; + /** + *

The URL where the conversation was started. For Twitter, Email, and Bots, this will be blank.

+ */ + @java.lang.Override + @JsonSetter(value = "url", nulls = Nulls.SKIP) + public _FinalStage url(Optional url) { + this.url = url; return this; } - public Builder author(ConversationPartAuthor author) { - this.author = Optional.ofNullable(author); + /** + *

A list of attachments for the part.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage attachments(List attachments) { + this.attachments = Optional.ofNullable(attachments); return this; } /** *

A list of attachments for the part.

*/ + @java.lang.Override @JsonSetter(value = "attachments", nulls = Nulls.SKIP) - public Builder attachments(Optional> attachments) { + public _FinalStage attachments(Optional> attachments) { this.attachments = attachments; return this; } - public Builder attachments(List attachments) { - this.attachments = Optional.ofNullable(attachments); - return this; - } - /** - *

The URL where the conversation was started. For Twitter, Email, and Bots, this will be blank.

+ *

The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public Builder url(Optional url) { - this.url = url; + @java.lang.Override + public _FinalStage body(String body) { + this.body = Optional.ofNullable(body); return this; } - public Builder url(String url) { - this.url = Optional.ofNullable(url); + /** + *

The message body, which may contain HTML. For Twitter, this will show a generic message regarding why the body is obscured.

+ */ + @java.lang.Override + @JsonSetter(value = "body", nulls = Nulls.SKIP) + public _FinalStage body(Optional body) { + this.body = body; return this; } /** - *

Whether or not the source message has been redacted. Only applicable for contact initiated messages.

+ *

Optional. The message subject. For Twitter, this will show a generic message regarding why the subject is obscured.

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "redacted", nulls = Nulls.SKIP) - public Builder redacted(Optional redacted) { - this.redacted = redacted; + @java.lang.Override + public _FinalStage subject(String subject) { + this.subject = Optional.ofNullable(subject); return this; } - public Builder redacted(Boolean redacted) { - this.redacted = Optional.ofNullable(redacted); + /** + *

Optional. The message subject. For Twitter, this will show a generic message regarding why the subject is obscured.

+ */ + @java.lang.Override + @JsonSetter(value = "subject", nulls = Nulls.SKIP) + public _FinalStage subject(Optional subject) { + this.subject = subject; return this; } + @java.lang.Override public ConversationSource build() { return new ConversationSource( type, id, deliveredAs, subject, body, author, attachments, url, redacted, additionalProperties); diff --git a/src/main/java/com/intercom/api/types/LinkedObject.java b/src/main/java/com/intercom/api/types/LinkedObject.java index 18ef0b98..703c80ec 100644 --- a/src/main/java/com/intercom/api/types/LinkedObject.java +++ b/src/main/java/com/intercom/api/types/LinkedObject.java @@ -18,23 +18,20 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = LinkedObject.Builder.class) public final class LinkedObject { - private final Optional type; + private final Type type; - private final Optional id; + private final String id; private final Optional category; private final Map additionalProperties; - private LinkedObject( - Optional type, - Optional id, - Optional category, - Map additionalProperties) { + private LinkedObject(Type type, String id, Optional category, Map additionalProperties) { this.type = type; this.id = id; this.category = category; @@ -45,7 +42,7 @@ private LinkedObject( * @return ticket or conversation */ @JsonProperty("type") - public Optional getType() { + public Type getType() { return type; } @@ -53,7 +50,7 @@ public Optional getType() { * @return The ID of the linked object */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -90,15 +87,42 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static TypeStage builder() { return new Builder(); } + public interface TypeStage { + /** + *

ticket or conversation

+ */ + IdStage type(@NotNull Type type); + + Builder from(LinkedObject other); + } + + public interface IdStage { + /** + *

The ID of the linked object

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + LinkedObject build(); + + /** + *

Category of the Linked Ticket Object.

+ */ + _FinalStage category(Optional category); + + _FinalStage category(Category category); + } + @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public static final class Builder implements TypeStage, IdStage, _FinalStage { + private Type type; - private Optional id = Optional.empty(); + private String id; private Optional category = Optional.empty(); @@ -107,6 +131,7 @@ public static final class Builder { private Builder() {} + @java.lang.Override public Builder from(LinkedObject other) { type(other.getType()); id(other.getId()); @@ -116,46 +141,49 @@ public Builder from(LinkedObject other) { /** *

ticket or conversation

+ *

ticket or conversation

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(Type type) { - this.type = Optional.ofNullable(type); + @java.lang.Override + @JsonSetter("type") + public IdStage type(@NotNull Type type) { + this.type = Objects.requireNonNull(type, "type must not be null"); return this; } /** *

The ID of the linked object

+ *

The ID of the linked object

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } - public Builder id(String id) { - this.id = Optional.ofNullable(id); + /** + *

Category of the Linked Ticket Object.

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage category(Category category) { + this.category = Optional.ofNullable(category); return this; } /** *

Category of the Linked Ticket Object.

*/ + @java.lang.Override @JsonSetter(value = "category", nulls = Nulls.SKIP) - public Builder category(Optional category) { + public _FinalStage category(Optional category) { this.category = category; return this; } - public Builder category(Category category) { - this.category = Optional.ofNullable(category); - return this; - } - + @java.lang.Override public LinkedObject build() { return new LinkedObject(type, id, category, additionalProperties); } diff --git a/src/main/java/com/intercom/api/types/PartAttachment.java b/src/main/java/com/intercom/api/types/PartAttachment.java index d3091dd4..41ceefa1 100644 --- a/src/main/java/com/intercom/api/types/PartAttachment.java +++ b/src/main/java/com/intercom/api/types/PartAttachment.java @@ -16,15 +16,16 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = PartAttachment.Builder.class) public final class PartAttachment { - private final Optional type; + private final String type; - private final Optional name; + private final String name; - private final Optional url; + private final String url; private final Optional contentType; @@ -37,9 +38,9 @@ public final class PartAttachment { private final Map additionalProperties; private PartAttachment( - Optional type, - Optional name, - Optional url, + String type, + String name, + String url, Optional contentType, Optional filesize, Optional width, @@ -59,7 +60,7 @@ private PartAttachment( * @return The type of attachment */ @JsonProperty("type") - public Optional getType() { + public String getType() { return type; } @@ -67,7 +68,7 @@ public Optional getType() { * @return The name of the attachment */ @JsonProperty("name") - public Optional getName() { + public String getName() { return name; } @@ -75,7 +76,7 @@ public Optional getName() { * @return The URL of the attachment */ @JsonProperty("url") - public Optional getUrl() { + public String getUrl() { return url; } @@ -142,31 +143,87 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static TypeStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public interface TypeStage { + /** + *

The type of attachment

+ */ + NameStage type(@NotNull String type); - private Optional name = Optional.empty(); + Builder from(PartAttachment other); + } - private Optional url = Optional.empty(); + public interface NameStage { + /** + *

The name of the attachment

+ */ + UrlStage name(@NotNull String name); + } - private Optional contentType = Optional.empty(); + public interface UrlStage { + /** + *

The URL of the attachment

+ */ + _FinalStage url(@NotNull String url); + } - private Optional filesize = Optional.empty(); + public interface _FinalStage { + PartAttachment build(); - private Optional width = Optional.empty(); + /** + *

The content type of the attachment

+ */ + _FinalStage contentType(Optional contentType); + + _FinalStage contentType(String contentType); + + /** + *

The size of the attachment

+ */ + _FinalStage filesize(Optional filesize); + + _FinalStage filesize(Integer filesize); + + /** + *

The width of the attachment

+ */ + _FinalStage width(Optional width); + + _FinalStage width(Integer width); + + /** + *

The height of the attachment

+ */ + _FinalStage height(Optional height); + + _FinalStage height(Integer height); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, NameStage, UrlStage, _FinalStage { + private String type; + + private String name; + + private String url; private Optional height = Optional.empty(); + private Optional width = Optional.empty(); + + private Optional filesize = Optional.empty(); + + private Optional contentType = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(PartAttachment other) { type(other.getType()); name(other.getName()); @@ -180,102 +237,121 @@ public Builder from(PartAttachment other) { /** *

The type of attachment

+ *

The type of attachment

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(String type) { - this.type = Optional.ofNullable(type); + @java.lang.Override + @JsonSetter("type") + public NameStage type(@NotNull String type) { + this.type = Objects.requireNonNull(type, "type must not be null"); return this; } /** *

The name of the attachment

+ *

The name of the attachment

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; - return this; - } - - public Builder name(String name) { - this.name = Optional.ofNullable(name); + @java.lang.Override + @JsonSetter("name") + public UrlStage name(@NotNull String name) { + this.name = Objects.requireNonNull(name, "name must not be null"); return this; } /** *

The URL of the attachment

+ *

The URL of the attachment

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "url", nulls = Nulls.SKIP) - public Builder url(Optional url) { - this.url = url; + @java.lang.Override + @JsonSetter("url") + public _FinalStage url(@NotNull String url) { + this.url = Objects.requireNonNull(url, "url must not be null"); return this; } - public Builder url(String url) { - this.url = Optional.ofNullable(url); + /** + *

The height of the attachment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage height(Integer height) { + this.height = Optional.ofNullable(height); return this; } /** - *

The content type of the attachment

+ *

The height of the attachment

*/ - @JsonSetter(value = "content_type", nulls = Nulls.SKIP) - public Builder contentType(Optional contentType) { - this.contentType = contentType; + @java.lang.Override + @JsonSetter(value = "height", nulls = Nulls.SKIP) + public _FinalStage height(Optional height) { + this.height = height; return this; } - public Builder contentType(String contentType) { - this.contentType = Optional.ofNullable(contentType); + /** + *

The width of the attachment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage width(Integer width) { + this.width = Optional.ofNullable(width); return this; } /** - *

The size of the attachment

+ *

The width of the attachment

*/ - @JsonSetter(value = "filesize", nulls = Nulls.SKIP) - public Builder filesize(Optional filesize) { - this.filesize = filesize; + @java.lang.Override + @JsonSetter(value = "width", nulls = Nulls.SKIP) + public _FinalStage width(Optional width) { + this.width = width; return this; } - public Builder filesize(Integer filesize) { + /** + *

The size of the attachment

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage filesize(Integer filesize) { this.filesize = Optional.ofNullable(filesize); return this; } /** - *

The width of the attachment

+ *

The size of the attachment

*/ - @JsonSetter(value = "width", nulls = Nulls.SKIP) - public Builder width(Optional width) { - this.width = width; - return this; - } - - public Builder width(Integer width) { - this.width = Optional.ofNullable(width); + @java.lang.Override + @JsonSetter(value = "filesize", nulls = Nulls.SKIP) + public _FinalStage filesize(Optional filesize) { + this.filesize = filesize; return this; } /** - *

The height of the attachment

+ *

The content type of the attachment

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "height", nulls = Nulls.SKIP) - public Builder height(Optional height) { - this.height = height; + @java.lang.Override + public _FinalStage contentType(String contentType) { + this.contentType = Optional.ofNullable(contentType); return this; } - public Builder height(Integer height) { - this.height = Optional.ofNullable(height); + /** + *

The content type of the attachment

+ */ + @java.lang.Override + @JsonSetter(value = "content_type", nulls = Nulls.SKIP) + public _FinalStage contentType(Optional contentType) { + this.contentType = contentType; return this; } + @java.lang.Override public PartAttachment build() { return new PartAttachment(type, name, url, contentType, filesize, width, height, additionalProperties); } diff --git a/src/main/java/com/intercom/api/types/TicketPartAuthor.java b/src/main/java/com/intercom/api/types/TicketPartAuthor.java index 5ea8e7c6..64f6dc98 100644 --- a/src/main/java/com/intercom/api/types/TicketPartAuthor.java +++ b/src/main/java/com/intercom/api/types/TicketPartAuthor.java @@ -18,13 +18,14 @@ import java.util.Map; import java.util.Objects; import java.util.Optional; +import org.jetbrains.annotations.NotNull; @JsonInclude(JsonInclude.Include.NON_ABSENT) @JsonDeserialize(builder = TicketPartAuthor.Builder.class) public final class TicketPartAuthor { - private final Optional type; + private final Type type; - private final Optional id; + private final String id; private final Optional name; @@ -33,8 +34,8 @@ public final class TicketPartAuthor { private final Map additionalProperties; private TicketPartAuthor( - Optional type, - Optional id, + Type type, + String id, Optional name, Optional email, Map additionalProperties) { @@ -49,7 +50,7 @@ private TicketPartAuthor( * @return The type of the author */ @JsonProperty("type") - public Optional getType() { + public Type getType() { return type; } @@ -57,7 +58,7 @@ public Optional getType() { * @return The id of the author */ @JsonProperty("id") - public Optional getId() { + public String getId() { return id; } @@ -102,25 +103,60 @@ public String toString() { return ObjectMappers.stringify(this); } - public static Builder builder() { + public static TypeStage builder() { return new Builder(); } - @JsonIgnoreProperties(ignoreUnknown = true) - public static final class Builder { - private Optional type = Optional.empty(); + public interface TypeStage { + /** + *

The type of the author

+ */ + IdStage type(@NotNull Type type); - private Optional id = Optional.empty(); + Builder from(TicketPartAuthor other); + } - private Optional name = Optional.empty(); + public interface IdStage { + /** + *

The id of the author

+ */ + _FinalStage id(@NotNull String id); + } + + public interface _FinalStage { + TicketPartAuthor build(); + + /** + *

The name of the author

+ */ + _FinalStage name(Optional name); + + _FinalStage name(String name); + + /** + *

The email of the author

+ */ + _FinalStage email(Optional email); + + _FinalStage email(String email); + } + + @JsonIgnoreProperties(ignoreUnknown = true) + public static final class Builder implements TypeStage, IdStage, _FinalStage { + private Type type; + + private String id; private Optional email = Optional.empty(); + private Optional name = Optional.empty(); + @JsonAnySetter private Map additionalProperties = new HashMap<>(); private Builder() {} + @java.lang.Override public Builder from(TicketPartAuthor other) { type(other.getType()); id(other.getId()); @@ -131,60 +167,69 @@ public Builder from(TicketPartAuthor other) { /** *

The type of the author

+ *

The type of the author

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "type", nulls = Nulls.SKIP) - public Builder type(Optional type) { - this.type = type; - return this; - } - - public Builder type(Type type) { - this.type = Optional.ofNullable(type); + @java.lang.Override + @JsonSetter("type") + public IdStage type(@NotNull Type type) { + this.type = Objects.requireNonNull(type, "type must not be null"); return this; } /** *

The id of the author

+ *

The id of the author

+ * @return Reference to {@code this} so that method calls can be chained together. */ - @JsonSetter(value = "id", nulls = Nulls.SKIP) - public Builder id(Optional id) { - this.id = id; + @java.lang.Override + @JsonSetter("id") + public _FinalStage id(@NotNull String id) { + this.id = Objects.requireNonNull(id, "id must not be null"); return this; } - public Builder id(String id) { - this.id = Optional.ofNullable(id); + /** + *

The email of the author

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage email(String email) { + this.email = Optional.ofNullable(email); return this; } /** - *

The name of the author

+ *

The email of the author

*/ - @JsonSetter(value = "name", nulls = Nulls.SKIP) - public Builder name(Optional name) { - this.name = name; + @java.lang.Override + @JsonSetter(value = "email", nulls = Nulls.SKIP) + public _FinalStage email(Optional email) { + this.email = email; return this; } - public Builder name(String name) { + /** + *

The name of the author

+ * @return Reference to {@code this} so that method calls can be chained together. + */ + @java.lang.Override + public _FinalStage name(String name) { this.name = Optional.ofNullable(name); return this; } /** - *

The email of the author

+ *

The name of the author

*/ - @JsonSetter(value = "email", nulls = Nulls.SKIP) - public Builder email(Optional email) { - this.email = email; - return this; - } - - public Builder email(String email) { - this.email = Optional.ofNullable(email); + @java.lang.Override + @JsonSetter(value = "name", nulls = Nulls.SKIP) + public _FinalStage name(Optional name) { + this.name = name; return this; } + @java.lang.Override public TicketPartAuthor build() { return new TicketPartAuthor(type, id, name, email, additionalProperties); } From 4fba9d489aaab39beb1f6a3a05f3b324e019ba31 Mon Sep 17 00:00:00 2001 From: mailson Date: Tue, 3 Feb 2026 17:37:09 -0800 Subject: [PATCH 2/2] Fix integration tests for non-Optional fields Update tests to handle fields that are now non-Optional after adding required field arrays to the OpenAPI schema overrides: - TeamsTest: team.getId() now returns String directly - SegmentsTest: segment.getId() now returns String directly - ConversationsTest: conversationPart.getId() now returns String directly Co-Authored-By: Claude Opus 4.5 --- .../java/com/intercom/api/integration/ConversationsTest.java | 3 +-- src/test/java/com/intercom/api/integration/SegmentsTest.java | 2 +- src/test/java/com/intercom/api/integration/TeamsTest.java | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/test/java/com/intercom/api/integration/ConversationsTest.java b/src/test/java/com/intercom/api/integration/ConversationsTest.java index a3e6f9f7..a0f4a2c6 100644 --- a/src/test/java/com/intercom/api/integration/ConversationsTest.java +++ b/src/test/java/com/intercom/api/integration/ConversationsTest.java @@ -318,8 +318,7 @@ public void testRedactConversationPart() { .conversationPartId(conversation .getConversationParts() .flatMap(parts -> parts.getConversationParts()) - .map(list -> list.get(2)) - .flatMap(part -> part.getId()) + .map(list -> list.get(2).getId()) .orElse("")) .build())); diff --git a/src/test/java/com/intercom/api/integration/SegmentsTest.java b/src/test/java/com/intercom/api/integration/SegmentsTest.java index 80701e88..2b4aca81 100644 --- a/src/test/java/com/intercom/api/integration/SegmentsTest.java +++ b/src/test/java/com/intercom/api/integration/SegmentsTest.java @@ -24,7 +24,7 @@ public void before() { .getSegments() .orElseThrow(() -> new RuntimeException("Segments list is required")) .get(0); - segmentId = segment.getId().orElseThrow(() -> new RuntimeException("Segment ID is required")); + segmentId = segment.getId(); } @Test diff --git a/src/test/java/com/intercom/api/integration/TeamsTest.java b/src/test/java/com/intercom/api/integration/TeamsTest.java index 26fc16d0..d18fd5bd 100644 --- a/src/test/java/com/intercom/api/integration/TeamsTest.java +++ b/src/test/java/com/intercom/api/integration/TeamsTest.java @@ -23,8 +23,7 @@ public void before() { .getTeams() .orElseThrow(() -> new RuntimeException("Teams list is required")) .get(0) - .getId() - .orElseThrow(() -> new RuntimeException("Team ID is required")); + .getId(); } @Test