From 27bb9778124b466d21d11464b49176472569ccda Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Tue, 24 Mar 2026 10:11:28 -0700 Subject: [PATCH 1/4] docs: Fix legal hold policy docs (box/box-openapi#1554) (box/box-openapi#590) --- .codegen.json | 2 +- docs/sdkgen/trasheditems.md | 4 +- .../trasheditems/TrashedItemsManager.java | 20 ++ .../LegalHoldPolicyAssignedItem.java | 258 ++++-------------- .../LegalHoldPolicyAssignedItemTypeField.java | 67 +++++ .../LegalHoldPolicyAssignment.java | 22 +- 6 files changed, 151 insertions(+), 222 deletions(-) create mode 100644 src/main/java/com/box/sdkgen/schemas/legalholdpolicyassigneditem/LegalHoldPolicyAssignedItemTypeField.java diff --git a/.codegen.json b/.codegen.json index 244dc4a93..5d8d7f751 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "7c01dda", "specHash": "2bd751f", "version": "5.5.0" } +{ "engineHash": "7c01dda", "specHash": "74a1e4a", "version": "5.5.0" } diff --git a/docs/sdkgen/trasheditems.md b/docs/sdkgen/trasheditems.md index 1643b531d..d48d50648 100644 --- a/docs/sdkgen/trasheditems.md +++ b/docs/sdkgen/trasheditems.md @@ -13,7 +13,9 @@ in with the `fields` parameter to retrieve those specific attributes that are not returned by default. This endpoint defaults to use offset-based pagination, yet also supports -marker-based pagination using the `marker` parameter. +marker-based pagination using the `marker` parameter. + +The number of entries returned may be less than `total_count`. For example, if a user deletes items from a shared folder and is later removed as a collaborator, those deleted items will no longer appear in this endpoint’s results, even though they are still included in `total_count`. This operation is performed by calling function `getTrashedItems`. diff --git a/src/main/java/com/box/sdkgen/managers/trasheditems/TrashedItemsManager.java b/src/main/java/com/box/sdkgen/managers/trasheditems/TrashedItemsManager.java index 4f29152a5..2e7d65cd9 100644 --- a/src/main/java/com/box/sdkgen/managers/trasheditems/TrashedItemsManager.java +++ b/src/main/java/com/box/sdkgen/managers/trasheditems/TrashedItemsManager.java @@ -38,6 +38,11 @@ protected TrashedItemsManager(Builder builder) { * *

This endpoint defaults to use offset-based pagination, yet also supports marker-based * pagination using the `marker` parameter. + * + *

The number of entries returned may be less than `total_count`. For example, if a user + * deletes items from a shared folder and is later removed as a collaborator, those deleted items + * will no longer appear in this endpoint’s results, even though they are still included in + * `total_count`. */ public Items getTrashedItems() { return getTrashedItems(new GetTrashedItemsQueryParams(), new GetTrashedItemsHeaders()); @@ -52,6 +57,11 @@ public Items getTrashedItems() { *

This endpoint defaults to use offset-based pagination, yet also supports marker-based * pagination using the `marker` parameter. * + *

The number of entries returned may be less than `total_count`. For example, if a user + * deletes items from a shared folder and is later removed as a collaborator, those deleted items + * will no longer appear in this endpoint’s results, even though they are still included in + * `total_count`. + * * @param queryParams Query parameters of getTrashedItems method */ public Items getTrashedItems(GetTrashedItemsQueryParams queryParams) { @@ -67,6 +77,11 @@ public Items getTrashedItems(GetTrashedItemsQueryParams queryParams) { *

This endpoint defaults to use offset-based pagination, yet also supports marker-based * pagination using the `marker` parameter. * + *

The number of entries returned may be less than `total_count`. For example, if a user + * deletes items from a shared folder and is later removed as a collaborator, those deleted items + * will no longer appear in this endpoint’s results, even though they are still included in + * `total_count`. + * * @param headers Headers of getTrashedItems method */ public Items getTrashedItems(GetTrashedItemsHeaders headers) { @@ -82,6 +97,11 @@ public Items getTrashedItems(GetTrashedItemsHeaders headers) { *

This endpoint defaults to use offset-based pagination, yet also supports marker-based * pagination using the `marker` parameter. * + *

The number of entries returned may be less than `total_count`. For example, if a user + * deletes items from a shared folder and is later removed as a collaborator, those deleted items + * will no longer appear in this endpoint’s results, even though they are still included in + * `total_count`. + * * @param queryParams Query parameters of getTrashedItems method * @param headers Headers of getTrashedItems method */ diff --git a/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassigneditem/LegalHoldPolicyAssignedItem.java b/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassigneditem/LegalHoldPolicyAssignedItem.java index 57735e084..82f2fda00 100644 --- a/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassigneditem/LegalHoldPolicyAssignedItem.java +++ b/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassigneditem/LegalHoldPolicyAssignedItem.java @@ -1,221 +1,79 @@ package com.box.sdkgen.schemas.legalholdpolicyassigneditem; -import com.box.sdkgen.internal.OneOfThree; -import com.box.sdkgen.schemas.file.File; -import com.box.sdkgen.schemas.folder.Folder; -import com.box.sdkgen.schemas.foldermini.FolderMini; -import com.box.sdkgen.schemas.usermini.UserMini; -import com.box.sdkgen.schemas.weblink.WebLink; +import com.box.sdkgen.internal.SerializableObject; import com.box.sdkgen.serialization.json.EnumWrapper; -import com.box.sdkgen.serialization.json.JsonManager; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JsonDeserializer; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import java.io.IOException; -import java.time.OffsetDateTime; - -@JsonDeserialize(using = LegalHoldPolicyAssignedItem.LegalHoldPolicyAssignedItemDeserializer.class) -@JsonSerialize(using = OneOfThree.OneOfThreeSerializer.class) -public class LegalHoldPolicyAssignedItem extends OneOfThree { - - protected final String description; - - protected final OffsetDateTime createdAt; - - protected final OffsetDateTime modifiedAt; - - protected final OffsetDateTime trashedAt; - - protected final OffsetDateTime purgedAt; - - protected final UserMini createdBy; - - protected final UserMini modifiedBy; - - protected final UserMini ownedBy; - - protected final FolderMini parent; - - protected final String itemStatus; - - protected final String sequenceId; - - protected final String name; - +import java.util.Objects; + +/** The item that the legal hold policy is assigned to. Includes type and ID. */ +@JsonFilter("nullablePropertyFilter") +public class LegalHoldPolicyAssignedItem extends SerializableObject { + + /** The type of item the policy is assigned to. */ + @JsonDeserialize( + using = + LegalHoldPolicyAssignedItemTypeField.LegalHoldPolicyAssignedItemTypeFieldDeserializer + .class) + @JsonSerialize( + using = + LegalHoldPolicyAssignedItemTypeField.LegalHoldPolicyAssignedItemTypeFieldSerializer.class) + protected final EnumWrapper type; + + /** The ID of the item the policy is assigned to. */ protected final String id; - protected final String etag; - - protected final String type; - - public LegalHoldPolicyAssignedItem(File file) { - super(file, null, null); - this.description = file.getDescription(); - this.createdAt = file.getCreatedAt(); - this.modifiedAt = file.getModifiedAt(); - this.trashedAt = file.getTrashedAt(); - this.purgedAt = file.getPurgedAt(); - this.createdBy = file.getCreatedBy(); - this.modifiedBy = file.getModifiedBy(); - this.ownedBy = file.getOwnedBy(); - this.parent = file.getParent(); - this.itemStatus = EnumWrapper.convertToString(file.getItemStatus()); - this.sequenceId = file.getSequenceId(); - this.name = file.getName(); - this.id = file.getId(); - this.etag = file.getEtag(); - this.type = EnumWrapper.convertToString(file.getType()); - } - - public LegalHoldPolicyAssignedItem(Folder folder) { - super(null, folder, null); - this.description = folder.getDescription(); - this.createdAt = folder.getCreatedAt(); - this.modifiedAt = folder.getModifiedAt(); - this.trashedAt = folder.getTrashedAt(); - this.purgedAt = folder.getPurgedAt(); - this.createdBy = folder.getCreatedBy(); - this.modifiedBy = folder.getModifiedBy(); - this.ownedBy = folder.getOwnedBy(); - this.parent = folder.getParent(); - this.itemStatus = EnumWrapper.convertToString(folder.getItemStatus()); - this.sequenceId = folder.getSequenceId(); - this.name = folder.getName(); - this.id = folder.getId(); - this.etag = folder.getEtag(); - this.type = EnumWrapper.convertToString(folder.getType()); - } - - public LegalHoldPolicyAssignedItem(WebLink webLink) { - super(null, null, webLink); - this.description = webLink.getDescription(); - this.createdAt = webLink.getCreatedAt(); - this.modifiedAt = webLink.getModifiedAt(); - this.trashedAt = webLink.getTrashedAt(); - this.purgedAt = webLink.getPurgedAt(); - this.createdBy = webLink.getCreatedBy(); - this.modifiedBy = webLink.getModifiedBy(); - this.ownedBy = webLink.getOwnedBy(); - this.parent = webLink.getParent(); - this.itemStatus = EnumWrapper.convertToString(webLink.getItemStatus()); - this.sequenceId = webLink.getSequenceId(); - this.name = webLink.getName(); - this.id = webLink.getId(); - this.etag = webLink.getEtag(); - this.type = EnumWrapper.convertToString(webLink.getType()); - } - - public boolean isFile() { - return value0 != null; - } - - public File getFile() { - return value0; - } - - public boolean isFolder() { - return value1 != null; - } - - public Folder getFolder() { - return value1; - } - - public boolean isWebLink() { - return value2 != null; + public LegalHoldPolicyAssignedItem(LegalHoldPolicyAssignedItemTypeField type, String id) { + super(); + this.type = new EnumWrapper(type); + this.id = id; } - public WebLink getWebLink() { - return value2; + public LegalHoldPolicyAssignedItem( + @JsonProperty("type") EnumWrapper type, + @JsonProperty("id") String id) { + super(); + this.type = type; + this.id = id; } - public String getDescription() { - return description; - } - - public OffsetDateTime getCreatedAt() { - return createdAt; - } - - public OffsetDateTime getModifiedAt() { - return modifiedAt; - } - - public OffsetDateTime getTrashedAt() { - return trashedAt; - } - - public OffsetDateTime getPurgedAt() { - return purgedAt; - } - - public UserMini getCreatedBy() { - return createdBy; - } - - public UserMini getModifiedBy() { - return modifiedBy; - } - - public UserMini getOwnedBy() { - return ownedBy; - } - - public FolderMini getParent() { - return parent; - } - - public String getItemStatus() { - return itemStatus; - } - - public String getSequenceId() { - return sequenceId; - } - - public String getName() { - return name; + public EnumWrapper getType() { + return type; } public String getId() { return id; } - public String getEtag() { - return etag; - } - - public String getType() { - return type; - } - - static class LegalHoldPolicyAssignedItemDeserializer - extends JsonDeserializer { - - public LegalHoldPolicyAssignedItemDeserializer() { - super(); + @Override + public boolean equals(Object o) { + if (this == o) { + return true; } - - @Override - public LegalHoldPolicyAssignedItem deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException { - JsonNode node = JsonManager.jsonToSerializedData(jp); - JsonNode discriminant0 = node.get("type"); - if (!(discriminant0 == null)) { - switch (discriminant0.asText()) { - case "file": - return new LegalHoldPolicyAssignedItem(JsonManager.deserialize(node, File.class)); - case "folder": - return new LegalHoldPolicyAssignedItem(JsonManager.deserialize(node, Folder.class)); - case "web_link": - return new LegalHoldPolicyAssignedItem(JsonManager.deserialize(node, WebLink.class)); - } - } - throw new JsonMappingException(jp, "Unable to deserialize LegalHoldPolicyAssignedItem"); + if (o == null || getClass() != o.getClass()) { + return false; } + LegalHoldPolicyAssignedItem casted = (LegalHoldPolicyAssignedItem) o; + return Objects.equals(type, casted.type) && Objects.equals(id, casted.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + return "LegalHoldPolicyAssignedItem{" + + "type='" + + type + + '\'' + + ", " + + "id='" + + id + + '\'' + + "}"; } } diff --git a/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassigneditem/LegalHoldPolicyAssignedItemTypeField.java b/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassigneditem/LegalHoldPolicyAssignedItemTypeField.java new file mode 100644 index 000000000..00c8965bd --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassigneditem/LegalHoldPolicyAssignedItemTypeField.java @@ -0,0 +1,67 @@ +package com.box.sdkgen.schemas.legalholdpolicyassigneditem; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum LegalHoldPolicyAssignedItemTypeField implements Valuable { + FILE("file"), + FILE_VERSION("file_version"), + FOLDER("folder"), + USER("user"), + OWNERSHIP("ownership"), + INTERACTIONS("interactions"); + + private final String value; + + LegalHoldPolicyAssignedItemTypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class LegalHoldPolicyAssignedItemTypeFieldDeserializer + extends JsonDeserializer> { + + public LegalHoldPolicyAssignedItemTypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(LegalHoldPolicyAssignedItemTypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class LegalHoldPolicyAssignedItemTypeFieldSerializer + extends JsonSerializer> { + + public LegalHoldPolicyAssignedItemTypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassignment/LegalHoldPolicyAssignment.java b/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassignment/LegalHoldPolicyAssignment.java index 092811ec2..6a1a1db1f 100644 --- a/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassignment/LegalHoldPolicyAssignment.java +++ b/src/main/java/com/box/sdkgen/schemas/legalholdpolicyassignment/LegalHoldPolicyAssignment.java @@ -1,14 +1,11 @@ package com.box.sdkgen.schemas.legalholdpolicyassignment; import com.box.sdkgen.internal.utils.DateTimeUtils; -import com.box.sdkgen.schemas.file.File; -import com.box.sdkgen.schemas.folder.Folder; import com.box.sdkgen.schemas.legalholdpolicyassigneditem.LegalHoldPolicyAssignedItem; import com.box.sdkgen.schemas.legalholdpolicyassignmentbase.LegalHoldPolicyAssignmentBase; import com.box.sdkgen.schemas.legalholdpolicyassignmentbase.LegalHoldPolicyAssignmentBaseTypeField; import com.box.sdkgen.schemas.legalholdpolicymini.LegalHoldPolicyMini; import com.box.sdkgen.schemas.usermini.UserMini; -import com.box.sdkgen.schemas.weblink.WebLink; import com.box.sdkgen.serialization.json.EnumWrapper; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonProperty; @@ -18,8 +15,8 @@ import java.util.Objects; /** - * Legal Hold Assignments are used to assign Legal Hold Policies to Users, Folders, Files, or File - * Versions. + * Legal Hold Assignments are used to assign Legal Hold Policies to an item type of: Users, Folders, + * Files, File Versions, Ownership, or Interactions. * *

Creating a Legal Hold Assignment puts a hold on the File-Versions that belong to the * Assignment's 'apply-to' entity. @@ -159,21 +156,6 @@ public Builder legalHoldPolicy(LegalHoldPolicyMini legalHoldPolicy) { return this; } - public Builder assignedTo(File assignedTo) { - this.assignedTo = new LegalHoldPolicyAssignedItem(assignedTo); - return this; - } - - public Builder assignedTo(Folder assignedTo) { - this.assignedTo = new LegalHoldPolicyAssignedItem(assignedTo); - return this; - } - - public Builder assignedTo(WebLink assignedTo) { - this.assignedTo = new LegalHoldPolicyAssignedItem(assignedTo); - return this; - } - public Builder assignedTo(LegalHoldPolicyAssignedItem assignedTo) { this.assignedTo = assignedTo; return this; From 4ec9e50f3b19361d0079b3f35048421419a72a95 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Wed, 25 Mar 2026 08:45:25 -0700 Subject: [PATCH 2/4] chore: Update `.codegen.json` with commit hash of `codegen` and `openapi` spec [skip ci] --- .codegen.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codegen.json b/.codegen.json index 5d8d7f751..adc91d64e 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "7c01dda", "specHash": "74a1e4a", "version": "5.5.0" } +{ "engineHash": "02fdae4", "specHash": "74a1e4a", "version": "5.5.0" } From 3c49d0db1cd97e5270c515d01b5a4f9bf6bb2cd6 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Wed, 25 Mar 2026 09:15:51 -0700 Subject: [PATCH 3/4] fix: typo in content_types 'tags' value (box/box-openapi#591) --- .codegen.json | 2 +- ...orContentQueryParamsContentTypesField.java | 2 +- .../HubItemOperationResultV2025R0.java | 24 ++++++++++++++++++- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/.codegen.json b/.codegen.json index adc91d64e..a223386e9 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "02fdae4", "specHash": "74a1e4a", "version": "5.5.0" } +{ "engineHash": "02fdae4", "specHash": "c8e3a85", "version": "5.5.0" } diff --git a/src/main/java/com/box/sdkgen/managers/search/SearchForContentQueryParamsContentTypesField.java b/src/main/java/com/box/sdkgen/managers/search/SearchForContentQueryParamsContentTypesField.java index d4c7a02ec..c1a936693 100644 --- a/src/main/java/com/box/sdkgen/managers/search/SearchForContentQueryParamsContentTypesField.java +++ b/src/main/java/com/box/sdkgen/managers/search/SearchForContentQueryParamsContentTypesField.java @@ -16,7 +16,7 @@ public enum SearchForContentQueryParamsContentTypesField implements Valuable { DESCRIPTION("description"), FILE_CONTENT("file_content"), COMMENTS("comments"), - TAG("tag"); + TAGS("tags"); private final String value; diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemoperationresultv2025r0/HubItemOperationResultV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemoperationresultv2025r0/HubItemOperationResultV2025R0.java index 47039d3e4..c4af34af7 100644 --- a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemoperationresultv2025r0/HubItemOperationResultV2025R0.java +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemoperationresultv2025r0/HubItemOperationResultV2025R0.java @@ -7,6 +7,7 @@ import com.box.sdkgen.schemas.v2025r0.hubitemreferencev2025r0.HubItemReferenceV2025R0; import com.box.sdkgen.schemas.v2025r0.weblinkreferencev2025r0.WeblinkReferenceV2025R0; import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; import java.util.Objects; /** Result of a Box Hub item operation. */ @@ -18,6 +19,10 @@ public class HubItemOperationResultV2025R0 extends SerializableObject { protected HubItemReferenceV2025R0 item; + /** The ID of the parent block the item was added to. */ + @JsonProperty("parent_id") + protected String parentId; + /** The HTTP status code of the operation. */ protected Long status; @@ -32,6 +37,7 @@ protected HubItemOperationResultV2025R0(Builder builder) { super(); this.action = builder.action; this.item = builder.item; + this.parentId = builder.parentId; this.status = builder.status; this.error = builder.error; markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); @@ -45,6 +51,10 @@ public HubItemReferenceV2025R0 getItem() { return item; } + public String getParentId() { + return parentId; + } + public Long getStatus() { return status; } @@ -64,13 +74,14 @@ public boolean equals(Object o) { HubItemOperationResultV2025R0 casted = (HubItemOperationResultV2025R0) o; return Objects.equals(action, casted.action) && Objects.equals(item, casted.item) + && Objects.equals(parentId, casted.parentId) && Objects.equals(status, casted.status) && Objects.equals(error, casted.error); } @Override public int hashCode() { - return Objects.hash(action, item, status, error); + return Objects.hash(action, item, parentId, status, error); } @Override @@ -84,6 +95,10 @@ public String toString() { + item + '\'' + ", " + + "parentId='" + + parentId + + '\'' + + ", " + "status='" + status + '\'' @@ -100,6 +115,8 @@ public static class Builder extends NullableFieldTracker { protected HubItemReferenceV2025R0 item; + protected String parentId; + protected Long status; protected String error; @@ -129,6 +146,11 @@ public Builder item(HubItemReferenceV2025R0 item) { return this; } + public Builder parentId(String parentId) { + this.parentId = parentId; + return this; + } + public Builder status(Long status) { this.status = status; return this; From 257dbff05fbbbbe8cabeda68007e65a5bd01f588 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Thu, 26 Mar 2026 04:45:16 -0700 Subject: [PATCH 4/4] feat: Enable new hubs endpoints (box/box-codegen#930) --- .codegen.json | 2 +- docs/sdkgen/README.md | 1 + docs/sdkgen/hubdocument.md | 69 +++++++ .../sdkgen/hubdocument/HubDocumentITest.java | 48 +++++ .../java/com/box/sdkgen/client/BoxClient.java | 17 ++ .../GetHubDocumentBlocksV2025R0Headers.java | 68 +++++++ ...etHubDocumentBlocksV2025R0QueryParams.java | 83 +++++++++ .../GetHubDocumentPagesV2025R0Headers.java | 68 +++++++ ...GetHubDocumentPagesV2025R0QueryParams.java | 71 +++++++ .../hubdocument/HubDocumentManager.java | 176 ++++++++++++++++++ .../HubCalloutBoxTextBlockV2025R0.java | 131 +++++++++++++ ...ubCalloutBoxTextBlockV2025R0TypeField.java | 62 ++++++ .../HubDividerBlockV2025R0.java | 108 +++++++++++ .../HubDividerBlockV2025R0TypeField.java | 62 ++++++ .../HubDocumentBlockEntryV2025R0.java | 159 ++++++++++++++++ .../HubDocumentBlocksV2025R0.java | 160 ++++++++++++++++ .../HubDocumentBlocksV2025R0TypeField.java | 62 ++++++ .../HubDocumentBlockV2025R0.java | 93 +++++++++ .../HubDocumentPagesV2025R0.java | 159 ++++++++++++++++ .../HubDocumentPagesV2025R0TypeField.java | 62 ++++++ .../HubDocumentPageV2025R0.java | 132 +++++++++++++ .../HubItemListBlockV2025R0.java | 109 +++++++++++ .../HubItemListBlockV2025R0TypeField.java | 62 ++++++ .../HubParagraphTextBlockV2025R0.java | 131 +++++++++++++ ...HubParagraphTextBlockV2025R0TypeField.java | 62 ++++++ .../HubSectionTitleTextBlockV2025R0.java | 131 +++++++++++++ ...SectionTitleTextBlockV2025R0TypeField.java | 62 ++++++ 27 files changed, 2349 insertions(+), 1 deletion(-) create mode 100644 docs/sdkgen/hubdocument.md create mode 100644 src/intTest/java/com/box/sdkgen/hubdocument/HubDocumentITest.java create mode 100644 src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentBlocksV2025R0Headers.java create mode 100644 src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentBlocksV2025R0QueryParams.java create mode 100644 src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentPagesV2025R0Headers.java create mode 100644 src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentPagesV2025R0QueryParams.java create mode 100644 src/main/java/com/box/sdkgen/managers/hubdocument/HubDocumentManager.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubcalloutboxtextblockv2025r0/HubCalloutBoxTextBlockV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubcalloutboxtextblockv2025r0/HubCalloutBoxTextBlockV2025R0TypeField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubdividerblockv2025r0/HubDividerBlockV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubdividerblockv2025r0/HubDividerBlockV2025R0TypeField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblockentryv2025r0/HubDocumentBlockEntryV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblocksv2025r0/HubDocumentBlocksV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblocksv2025r0/HubDocumentBlocksV2025R0TypeField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblockv2025r0/HubDocumentBlockV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagesv2025r0/HubDocumentPagesV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagesv2025r0/HubDocumentPagesV2025R0TypeField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagev2025r0/HubDocumentPageV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemlistblockv2025r0/HubItemListBlockV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemlistblockv2025r0/HubItemListBlockV2025R0TypeField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubparagraphtextblockv2025r0/HubParagraphTextBlockV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubparagraphtextblockv2025r0/HubParagraphTextBlockV2025R0TypeField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubsectiontitletextblockv2025r0/HubSectionTitleTextBlockV2025R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2025r0/hubsectiontitletextblockv2025r0/HubSectionTitleTextBlockV2025R0TypeField.java diff --git a/.codegen.json b/.codegen.json index a223386e9..1b30f7dcb 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "02fdae4", "specHash": "c8e3a85", "version": "5.5.0" } +{ "engineHash": "e77f966", "specHash": "c8e3a85", "version": "5.5.0" } diff --git a/docs/sdkgen/README.md b/docs/sdkgen/README.md index 0b0f89473..1dc5612dc 100644 --- a/docs/sdkgen/README.md +++ b/docs/sdkgen/README.md @@ -48,6 +48,7 @@ the SDK are available by topic: * [Folderwatermarks](folderwatermarks.md) * [Groups](groups.md) * [Hubcollaborations](hubcollaborations.md) +* [Hubdocument](hubdocument.md) * [Hubitems](hubitems.md) * [Hubs](hubs.md) * [Integrationmappings](integrationmappings.md) diff --git a/docs/sdkgen/hubdocument.md b/docs/sdkgen/hubdocument.md new file mode 100644 index 000000000..d4d45eb3a --- /dev/null +++ b/docs/sdkgen/hubdocument.md @@ -0,0 +1,69 @@ +# HubDocumentManager + + +- [List Hub Document Pages](#list-hub-document-pages) +- [List Hub Document blocks for page](#list-hub-document-blocks-for-page) + +## List Hub Document Pages + +Retrieves a list of Hub Document Pages for the specified hub. +Includes both root-level pages and sub pages. + +This operation is performed by calling function `getHubDocumentPagesV2025R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/get-hub-document-pages/). + + +``` +client.getHubDocument().getHubDocumentPagesV2025R0(new GetHubDocumentPagesV2025R0QueryParams(hubId)) +``` + +### Arguments + +- queryParams `GetHubDocumentPagesV2025R0QueryParams` + - Query parameters of getHubDocumentPagesV2025R0 method +- headers `GetHubDocumentPagesV2025R0Headers` + - Headers of getHubDocumentPagesV2025R0 method + + +### Returns + +This function returns a value of type `HubDocumentPagesV2025R0`. + +Returns a Hub Document Pages response whose `entries` array contains root-level pages and sub pages. Includes pagination when more results are available. + + +## List Hub Document blocks for page + +Retrieves a sorted list of all Hub Document Blocks on a specified page in the hub document, excluding items. +Blocks are hierarchically organized by their `parent_id`. +Blocks are sorted in order based on user specification in the user interface. +The response will only include content blocks that belong to the specified page. This will not include sub pages or sub page content blocks. + +This operation is performed by calling function `getHubDocumentBlocksV2025R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2025.0/get-hub-document-blocks/). + + +``` +client.getHubDocument().getHubDocumentBlocksV2025R0(new GetHubDocumentBlocksV2025R0QueryParams(hubId, pageId)) +``` + +### Arguments + +- queryParams `GetHubDocumentBlocksV2025R0QueryParams` + - Query parameters of getHubDocumentBlocksV2025R0 method +- headers `GetHubDocumentBlocksV2025R0Headers` + - Headers of getHubDocumentBlocksV2025R0 method + + +### Returns + +This function returns a value of type `HubDocumentBlocksV2025R0`. + +Returns a Hub Document Blocks response whose `entries` array contains all content blocks of the specified page, except for items. +To retrieve items, use the `GET /hub_items` endpoint. + + diff --git a/src/intTest/java/com/box/sdkgen/hubdocument/HubDocumentITest.java b/src/intTest/java/com/box/sdkgen/hubdocument/HubDocumentITest.java new file mode 100644 index 000000000..1c3a5dda7 --- /dev/null +++ b/src/intTest/java/com/box/sdkgen/hubdocument/HubDocumentITest.java @@ -0,0 +1,48 @@ +package com.box.sdkgen.hubdocument; + +import static com.box.sdkgen.commons.CommonsManager.getDefaultClientWithUserSubject; +import static com.box.sdkgen.internal.utils.UtilsManager.convertToString; +import static com.box.sdkgen.internal.utils.UtilsManager.getEnvVar; +import static com.box.sdkgen.internal.utils.UtilsManager.getUuid; + +import com.box.sdkgen.client.BoxClient; +import com.box.sdkgen.managers.hubdocument.GetHubDocumentBlocksV2025R0QueryParams; +import com.box.sdkgen.managers.hubdocument.GetHubDocumentPagesV2025R0QueryParams; +import com.box.sdkgen.schemas.v2025r0.hubcreaterequestv2025r0.HubCreateRequestV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubdocumentblockentryv2025r0.HubDocumentBlockEntryV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubdocumentblocksv2025r0.HubDocumentBlocksV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubdocumentpagesv2025r0.HubDocumentPagesV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubdocumentpagev2025r0.HubDocumentPageV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubv2025r0.HubV2025R0; +import org.junit.jupiter.api.Test; + +public class HubDocumentITest { + + private static final BoxClient client = getDefaultClientWithUserSubject(getEnvVar("USER_ID")); + + @Test + public void testGetHubDocumentPagesAndBlocks() { + String hubTitle = getUuid(); + HubV2025R0 createdHub = + client.getHubs().createHubV2025R0(new HubCreateRequestV2025R0(hubTitle)); + String hubId = createdHub.getId(); + HubDocumentPagesV2025R0 pages = + client + .getHubDocument() + .getHubDocumentPagesV2025R0(new GetHubDocumentPagesV2025R0QueryParams(hubId)); + assert pages.getEntries().size() > 0; + assert convertToString(pages.getType()).equals("document_pages"); + HubDocumentPageV2025R0 firstPage = pages.getEntries().get(0); + assert convertToString(firstPage.getType()).equals("page"); + String pageId = firstPage.getId(); + HubDocumentBlocksV2025R0 blocks = + client + .getHubDocument() + .getHubDocumentBlocksV2025R0(new GetHubDocumentBlocksV2025R0QueryParams(hubId, pageId)); + assert convertToString(blocks.getType()).equals("document_blocks"); + assert blocks.getEntries().size() > 0; + HubDocumentBlockEntryV2025R0 firstBlock = blocks.getEntries().get(0); + assert convertToString(firstBlock.getType()).equals("item_list"); + client.getHubs().deleteHubByIdV2025R0(hubId); + } +} diff --git a/src/main/java/com/box/sdkgen/client/BoxClient.java b/src/main/java/com/box/sdkgen/client/BoxClient.java index e11f46248..e45762637 100644 --- a/src/main/java/com/box/sdkgen/client/BoxClient.java +++ b/src/main/java/com/box/sdkgen/client/BoxClient.java @@ -38,6 +38,7 @@ import com.box.sdkgen.managers.folderwatermarks.FolderWatermarksManager; import com.box.sdkgen.managers.groups.GroupsManager; import com.box.sdkgen.managers.hubcollaborations.HubCollaborationsManager; +import com.box.sdkgen.managers.hubdocument.HubDocumentManager; import com.box.sdkgen.managers.hubitems.HubItemsManager; import com.box.sdkgen.managers.hubs.HubsManager; import com.box.sdkgen.managers.integrationmappings.IntegrationMappingsManager; @@ -261,6 +262,8 @@ public class BoxClient { public final HubItemsManager hubItems; + public final HubDocumentManager hubDocument; + public final ShieldListsManager shieldLists; public final ArchivesManager archives; @@ -598,6 +601,11 @@ public BoxClient(Authentication auth) { .build(); this.hubItems = new HubItemsManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); + this.hubDocument = + new HubDocumentManager.Builder() + .auth(this.auth) + .networkSession(this.networkSession) + .build(); this.shieldLists = new ShieldListsManager.Builder() .auth(this.auth) @@ -943,6 +951,11 @@ protected BoxClient(Builder builder) { .build(); this.hubItems = new HubItemsManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); + this.hubDocument = + new HubDocumentManager.Builder() + .auth(this.auth) + .networkSession(this.networkSession) + .build(); this.shieldLists = new ShieldListsManager.Builder() .auth(this.auth) @@ -1394,6 +1407,10 @@ public HubItemsManager getHubItems() { return hubItems; } + public HubDocumentManager getHubDocument() { + return hubDocument; + } + public ShieldListsManager getShieldLists() { return shieldLists; } diff --git a/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentBlocksV2025R0Headers.java b/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentBlocksV2025R0Headers.java new file mode 100644 index 000000000..5236153c7 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentBlocksV2025R0Headers.java @@ -0,0 +1,68 @@ +package com.box.sdkgen.managers.hubdocument; + +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; + +import com.box.sdkgen.parameters.v2025r0.boxversionheaderv2025r0.BoxVersionHeaderV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import java.util.Map; + +public class GetHubDocumentBlocksV2025R0Headers { + + /** Version header. */ + public EnumWrapper boxVersion; + + /** Extra headers that will be included in the HTTP request. */ + public Map extraHeaders; + + public GetHubDocumentBlocksV2025R0Headers() { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2025R0._2025_0); + this.extraHeaders = mapOf(); + } + + protected GetHubDocumentBlocksV2025R0Headers(Builder builder) { + this.boxVersion = builder.boxVersion; + this.extraHeaders = builder.extraHeaders; + } + + public EnumWrapper getBoxVersion() { + return boxVersion; + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public static class Builder { + + protected EnumWrapper boxVersion; + + protected Map extraHeaders; + + public Builder() {} + + public Builder boxVersion(BoxVersionHeaderV2025R0 boxVersion) { + this.boxVersion = new EnumWrapper(boxVersion); + return this; + } + + public Builder boxVersion(EnumWrapper boxVersion) { + this.boxVersion = boxVersion; + return this; + } + + public Builder extraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public GetHubDocumentBlocksV2025R0Headers build() { + if (this.boxVersion == null) { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2025R0._2025_0); + } + if (this.extraHeaders == null) { + this.extraHeaders = mapOf(); + } + return new GetHubDocumentBlocksV2025R0Headers(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentBlocksV2025R0QueryParams.java b/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentBlocksV2025R0QueryParams.java new file mode 100644 index 000000000..daf0e1e3d --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentBlocksV2025R0QueryParams.java @@ -0,0 +1,83 @@ +package com.box.sdkgen.managers.hubdocument; + +public class GetHubDocumentBlocksV2025R0QueryParams { + + /** + * The unique identifier that represent a hub. + * + *

The ID for any hub can be determined by visiting this hub in the web application and copying + * the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is + * `123`. + */ + public final String hubId; + + /** The unique identifier of a page within the Box Hub. */ + public final String pageId; + + /** + * Defines the position marker at which to begin returning results. This is used when paginating + * using marker-based pagination. + */ + public String marker; + + /** The maximum number of items to return per page. */ + public Long limit; + + public GetHubDocumentBlocksV2025R0QueryParams(String hubId, String pageId) { + this.hubId = hubId; + this.pageId = pageId; + } + + protected GetHubDocumentBlocksV2025R0QueryParams(Builder builder) { + this.hubId = builder.hubId; + this.pageId = builder.pageId; + this.marker = builder.marker; + this.limit = builder.limit; + } + + public String getHubId() { + return hubId; + } + + public String getPageId() { + return pageId; + } + + public String getMarker() { + return marker; + } + + public Long getLimit() { + return limit; + } + + public static class Builder { + + protected final String hubId; + + protected final String pageId; + + protected String marker; + + protected Long limit; + + public Builder(String hubId, String pageId) { + this.hubId = hubId; + this.pageId = pageId; + } + + public Builder marker(String marker) { + this.marker = marker; + return this; + } + + public Builder limit(Long limit) { + this.limit = limit; + return this; + } + + public GetHubDocumentBlocksV2025R0QueryParams build() { + return new GetHubDocumentBlocksV2025R0QueryParams(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentPagesV2025R0Headers.java b/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentPagesV2025R0Headers.java new file mode 100644 index 000000000..615e4010c --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentPagesV2025R0Headers.java @@ -0,0 +1,68 @@ +package com.box.sdkgen.managers.hubdocument; + +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; + +import com.box.sdkgen.parameters.v2025r0.boxversionheaderv2025r0.BoxVersionHeaderV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import java.util.Map; + +public class GetHubDocumentPagesV2025R0Headers { + + /** Version header. */ + public EnumWrapper boxVersion; + + /** Extra headers that will be included in the HTTP request. */ + public Map extraHeaders; + + public GetHubDocumentPagesV2025R0Headers() { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2025R0._2025_0); + this.extraHeaders = mapOf(); + } + + protected GetHubDocumentPagesV2025R0Headers(Builder builder) { + this.boxVersion = builder.boxVersion; + this.extraHeaders = builder.extraHeaders; + } + + public EnumWrapper getBoxVersion() { + return boxVersion; + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public static class Builder { + + protected EnumWrapper boxVersion; + + protected Map extraHeaders; + + public Builder() {} + + public Builder boxVersion(BoxVersionHeaderV2025R0 boxVersion) { + this.boxVersion = new EnumWrapper(boxVersion); + return this; + } + + public Builder boxVersion(EnumWrapper boxVersion) { + this.boxVersion = boxVersion; + return this; + } + + public Builder extraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public GetHubDocumentPagesV2025R0Headers build() { + if (this.boxVersion == null) { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2025R0._2025_0); + } + if (this.extraHeaders == null) { + this.extraHeaders = mapOf(); + } + return new GetHubDocumentPagesV2025R0Headers(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentPagesV2025R0QueryParams.java b/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentPagesV2025R0QueryParams.java new file mode 100644 index 000000000..24869f310 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/hubdocument/GetHubDocumentPagesV2025R0QueryParams.java @@ -0,0 +1,71 @@ +package com.box.sdkgen.managers.hubdocument; + +public class GetHubDocumentPagesV2025R0QueryParams { + + /** + * The unique identifier that represent a hub. + * + *

The ID for any hub can be determined by visiting this hub in the web application and copying + * the ID from the URL. For example, for the URL `https://*.app.box.com/hubs/123` the `hub_id` is + * `123`. + */ + public final String hubId; + + /** + * Defines the position marker at which to begin returning results. This is used when paginating + * using marker-based pagination. + */ + public String marker; + + /** The maximum number of items to return per page. */ + public Long limit; + + public GetHubDocumentPagesV2025R0QueryParams(String hubId) { + this.hubId = hubId; + } + + protected GetHubDocumentPagesV2025R0QueryParams(Builder builder) { + this.hubId = builder.hubId; + this.marker = builder.marker; + this.limit = builder.limit; + } + + public String getHubId() { + return hubId; + } + + public String getMarker() { + return marker; + } + + public Long getLimit() { + return limit; + } + + public static class Builder { + + protected final String hubId; + + protected String marker; + + protected Long limit; + + public Builder(String hubId) { + this.hubId = hubId; + } + + public Builder marker(String marker) { + this.marker = marker; + return this; + } + + public Builder limit(Long limit) { + this.limit = limit; + return this; + } + + public GetHubDocumentPagesV2025R0QueryParams build() { + return new GetHubDocumentPagesV2025R0QueryParams(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/hubdocument/HubDocumentManager.java b/src/main/java/com/box/sdkgen/managers/hubdocument/HubDocumentManager.java new file mode 100644 index 000000000..cd0255980 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/hubdocument/HubDocumentManager.java @@ -0,0 +1,176 @@ +package com.box.sdkgen.managers.hubdocument; + +import static com.box.sdkgen.internal.utils.UtilsManager.convertToString; +import static com.box.sdkgen.internal.utils.UtilsManager.entryOf; +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; +import static com.box.sdkgen.internal.utils.UtilsManager.mergeMaps; +import static com.box.sdkgen.internal.utils.UtilsManager.prepareParams; + +import com.box.sdkgen.networking.auth.Authentication; +import com.box.sdkgen.networking.fetchoptions.FetchOptions; +import com.box.sdkgen.networking.fetchoptions.ResponseFormat; +import com.box.sdkgen.networking.fetchresponse.FetchResponse; +import com.box.sdkgen.networking.network.NetworkSession; +import com.box.sdkgen.schemas.v2025r0.hubdocumentblocksv2025r0.HubDocumentBlocksV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubdocumentpagesv2025r0.HubDocumentPagesV2025R0; +import com.box.sdkgen.serialization.json.JsonManager; +import java.util.Map; + +public class HubDocumentManager { + + public Authentication auth; + + public NetworkSession networkSession; + + public HubDocumentManager() { + this.networkSession = new NetworkSession(); + } + + protected HubDocumentManager(Builder builder) { + this.auth = builder.auth; + this.networkSession = builder.networkSession; + } + + /** + * Retrieves a list of Hub Document Pages for the specified hub. Includes both root-level pages + * and sub pages. + * + * @param queryParams Query parameters of getHubDocumentPagesV2025R0 method + */ + public HubDocumentPagesV2025R0 getHubDocumentPagesV2025R0( + GetHubDocumentPagesV2025R0QueryParams queryParams) { + return getHubDocumentPagesV2025R0(queryParams, new GetHubDocumentPagesV2025R0Headers()); + } + + /** + * Retrieves a list of Hub Document Pages for the specified hub. Includes both root-level pages + * and sub pages. + * + * @param queryParams Query parameters of getHubDocumentPagesV2025R0 method + * @param headers Headers of getHubDocumentPagesV2025R0 method + */ + public HubDocumentPagesV2025R0 getHubDocumentPagesV2025R0( + GetHubDocumentPagesV2025R0QueryParams queryParams, + GetHubDocumentPagesV2025R0Headers headers) { + Map queryParamsMap = + prepareParams( + mapOf( + entryOf("hub_id", convertToString(queryParams.getHubId())), + entryOf("marker", convertToString(queryParams.getMarker())), + entryOf("limit", convertToString(queryParams.getLimit())))); + Map headersMap = + prepareParams( + mergeMaps( + mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))), + headers.getExtraHeaders())); + FetchResponse response = + this.networkSession + .getNetworkClient() + .fetch( + new FetchOptions.Builder( + String.join( + "", + this.networkSession.getBaseUrls().getBaseUrl(), + "/2.0/hub_document_pages"), + "GET") + .params(queryParamsMap) + .headers(headersMap) + .responseFormat(ResponseFormat.JSON) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + return JsonManager.deserialize(response.getData(), HubDocumentPagesV2025R0.class); + } + + /** + * Retrieves a sorted list of all Hub Document Blocks on a specified page in the hub document, + * excluding items. Blocks are hierarchically organized by their `parent_id`. Blocks are sorted in + * order based on user specification in the user interface. The response will only include content + * blocks that belong to the specified page. This will not include sub pages or sub page content + * blocks. + * + * @param queryParams Query parameters of getHubDocumentBlocksV2025R0 method + */ + public HubDocumentBlocksV2025R0 getHubDocumentBlocksV2025R0( + GetHubDocumentBlocksV2025R0QueryParams queryParams) { + return getHubDocumentBlocksV2025R0(queryParams, new GetHubDocumentBlocksV2025R0Headers()); + } + + /** + * Retrieves a sorted list of all Hub Document Blocks on a specified page in the hub document, + * excluding items. Blocks are hierarchically organized by their `parent_id`. Blocks are sorted in + * order based on user specification in the user interface. The response will only include content + * blocks that belong to the specified page. This will not include sub pages or sub page content + * blocks. + * + * @param queryParams Query parameters of getHubDocumentBlocksV2025R0 method + * @param headers Headers of getHubDocumentBlocksV2025R0 method + */ + public HubDocumentBlocksV2025R0 getHubDocumentBlocksV2025R0( + GetHubDocumentBlocksV2025R0QueryParams queryParams, + GetHubDocumentBlocksV2025R0Headers headers) { + Map queryParamsMap = + prepareParams( + mapOf( + entryOf("hub_id", convertToString(queryParams.getHubId())), + entryOf("page_id", convertToString(queryParams.getPageId())), + entryOf("marker", convertToString(queryParams.getMarker())), + entryOf("limit", convertToString(queryParams.getLimit())))); + Map headersMap = + prepareParams( + mergeMaps( + mapOf(entryOf("box-version", convertToString(headers.getBoxVersion()))), + headers.getExtraHeaders())); + FetchResponse response = + this.networkSession + .getNetworkClient() + .fetch( + new FetchOptions.Builder( + String.join( + "", + this.networkSession.getBaseUrls().getBaseUrl(), + "/2.0/hub_document_blocks"), + "GET") + .params(queryParamsMap) + .headers(headersMap) + .responseFormat(ResponseFormat.JSON) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + return JsonManager.deserialize(response.getData(), HubDocumentBlocksV2025R0.class); + } + + public Authentication getAuth() { + return auth; + } + + public NetworkSession getNetworkSession() { + return networkSession; + } + + public static class Builder { + + protected Authentication auth; + + protected NetworkSession networkSession; + + public Builder() {} + + public Builder auth(Authentication auth) { + this.auth = auth; + return this; + } + + public Builder networkSession(NetworkSession networkSession) { + this.networkSession = networkSession; + return this; + } + + public HubDocumentManager build() { + if (this.networkSession == null) { + this.networkSession = new NetworkSession(); + } + return new HubDocumentManager(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubcalloutboxtextblockv2025r0/HubCalloutBoxTextBlockV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubcalloutboxtextblockv2025r0/HubCalloutBoxTextBlockV2025R0.java new file mode 100644 index 000000000..115073bd9 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubcalloutboxtextblockv2025r0/HubCalloutBoxTextBlockV2025R0.java @@ -0,0 +1,131 @@ +package com.box.sdkgen.schemas.v2025r0.hubcalloutboxtextblockv2025r0; + +import com.box.sdkgen.schemas.v2025r0.hubdocumentblockv2025r0.HubDocumentBlockV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +/** A callout box block in the Box Hub Document. */ +@JsonFilter("nullablePropertyFilter") +public class HubCalloutBoxTextBlockV2025R0 extends HubDocumentBlockV2025R0 { + + /** The type of this block. The value is always `callout_box`. */ + @JsonDeserialize( + using = + HubCalloutBoxTextBlockV2025R0TypeField.HubCalloutBoxTextBlockV2025R0TypeFieldDeserializer + .class) + @JsonSerialize( + using = + HubCalloutBoxTextBlockV2025R0TypeField.HubCalloutBoxTextBlockV2025R0TypeFieldSerializer + .class) + protected EnumWrapper type; + + /** Text content of the block. Includes rich text formatting. */ + protected final String fragment; + + public HubCalloutBoxTextBlockV2025R0( + @JsonProperty("id") String id, @JsonProperty("fragment") String fragment) { + super(id); + this.fragment = fragment; + this.type = + new EnumWrapper( + HubCalloutBoxTextBlockV2025R0TypeField.CALLOUT_BOX); + } + + protected HubCalloutBoxTextBlockV2025R0(Builder builder) { + super(builder); + this.type = builder.type; + this.fragment = builder.fragment; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public EnumWrapper getType() { + return type; + } + + public String getFragment() { + return fragment; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HubCalloutBoxTextBlockV2025R0 casted = (HubCalloutBoxTextBlockV2025R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(parentId, casted.parentId) + && Objects.equals(type, casted.type) + && Objects.equals(fragment, casted.fragment); + } + + @Override + public int hashCode() { + return Objects.hash(id, parentId, type, fragment); + } + + @Override + public String toString() { + return "HubCalloutBoxTextBlockV2025R0{" + + "id='" + + id + + '\'' + + ", " + + "parentId='" + + parentId + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "fragment='" + + fragment + + '\'' + + "}"; + } + + public static class Builder extends HubDocumentBlockV2025R0.Builder { + + protected EnumWrapper type; + + protected final String fragment; + + public Builder(String id, String fragment) { + super(id); + this.fragment = fragment; + } + + public Builder type(HubCalloutBoxTextBlockV2025R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + @Override + public Builder parentId(String parentId) { + this.parentId = parentId; + this.markNullableFieldAsSet("parent_id"); + return this; + } + + public HubCalloutBoxTextBlockV2025R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper( + HubCalloutBoxTextBlockV2025R0TypeField.CALLOUT_BOX); + } + return new HubCalloutBoxTextBlockV2025R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubcalloutboxtextblockv2025r0/HubCalloutBoxTextBlockV2025R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubcalloutboxtextblockv2025r0/HubCalloutBoxTextBlockV2025R0TypeField.java new file mode 100644 index 000000000..d1a5d3cc5 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubcalloutboxtextblockv2025r0/HubCalloutBoxTextBlockV2025R0TypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.v2025r0.hubcalloutboxtextblockv2025r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum HubCalloutBoxTextBlockV2025R0TypeField implements Valuable { + CALLOUT_BOX("callout_box"); + + private final String value; + + HubCalloutBoxTextBlockV2025R0TypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class HubCalloutBoxTextBlockV2025R0TypeFieldDeserializer + extends JsonDeserializer> { + + public HubCalloutBoxTextBlockV2025R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(HubCalloutBoxTextBlockV2025R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class HubCalloutBoxTextBlockV2025R0TypeFieldSerializer + extends JsonSerializer> { + + public HubCalloutBoxTextBlockV2025R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdividerblockv2025r0/HubDividerBlockV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdividerblockv2025r0/HubDividerBlockV2025R0.java new file mode 100644 index 000000000..974319ad2 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdividerblockv2025r0/HubDividerBlockV2025R0.java @@ -0,0 +1,108 @@ +package com.box.sdkgen.schemas.v2025r0.hubdividerblockv2025r0; + +import com.box.sdkgen.schemas.v2025r0.hubdocumentblockv2025r0.HubDocumentBlockV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +/** A divider block in the Box Hub Document. */ +@JsonFilter("nullablePropertyFilter") +public class HubDividerBlockV2025R0 extends HubDocumentBlockV2025R0 { + + /** The type of this block. The value is always `divider`. */ + @JsonDeserialize( + using = HubDividerBlockV2025R0TypeField.HubDividerBlockV2025R0TypeFieldDeserializer.class) + @JsonSerialize( + using = HubDividerBlockV2025R0TypeField.HubDividerBlockV2025R0TypeFieldSerializer.class) + protected EnumWrapper type; + + public HubDividerBlockV2025R0(@JsonProperty("id") String id) { + super(id); + this.type = + new EnumWrapper(HubDividerBlockV2025R0TypeField.DIVIDER); + } + + protected HubDividerBlockV2025R0(Builder builder) { + super(builder); + this.type = builder.type; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public EnumWrapper getType() { + return type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HubDividerBlockV2025R0 casted = (HubDividerBlockV2025R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(parentId, casted.parentId) + && Objects.equals(type, casted.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, parentId, type); + } + + @Override + public String toString() { + return "HubDividerBlockV2025R0{" + + "id='" + + id + + '\'' + + ", " + + "parentId='" + + parentId + + '\'' + + ", " + + "type='" + + type + + '\'' + + "}"; + } + + public static class Builder extends HubDocumentBlockV2025R0.Builder { + + protected EnumWrapper type; + + public Builder(String id) { + super(id); + } + + public Builder type(HubDividerBlockV2025R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + @Override + public Builder parentId(String parentId) { + this.parentId = parentId; + this.markNullableFieldAsSet("parent_id"); + return this; + } + + public HubDividerBlockV2025R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper( + HubDividerBlockV2025R0TypeField.DIVIDER); + } + return new HubDividerBlockV2025R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdividerblockv2025r0/HubDividerBlockV2025R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdividerblockv2025r0/HubDividerBlockV2025R0TypeField.java new file mode 100644 index 000000000..371ab3cb3 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdividerblockv2025r0/HubDividerBlockV2025R0TypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.v2025r0.hubdividerblockv2025r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum HubDividerBlockV2025R0TypeField implements Valuable { + DIVIDER("divider"); + + private final String value; + + HubDividerBlockV2025R0TypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class HubDividerBlockV2025R0TypeFieldDeserializer + extends JsonDeserializer> { + + public HubDividerBlockV2025R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(HubDividerBlockV2025R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class HubDividerBlockV2025R0TypeFieldSerializer + extends JsonSerializer> { + + public HubDividerBlockV2025R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblockentryv2025r0/HubDocumentBlockEntryV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblockentryv2025r0/HubDocumentBlockEntryV2025R0.java new file mode 100644 index 000000000..c24a16eab --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblockentryv2025r0/HubDocumentBlockEntryV2025R0.java @@ -0,0 +1,159 @@ +package com.box.sdkgen.schemas.v2025r0.hubdocumentblockentryv2025r0; + +import com.box.sdkgen.internal.OneOfFive; +import com.box.sdkgen.schemas.v2025r0.hubcalloutboxtextblockv2025r0.HubCalloutBoxTextBlockV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubdividerblockv2025r0.HubDividerBlockV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubitemlistblockv2025r0.HubItemListBlockV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubparagraphtextblockv2025r0.HubParagraphTextBlockV2025R0; +import com.box.sdkgen.schemas.v2025r0.hubsectiontitletextblockv2025r0.HubSectionTitleTextBlockV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.JsonManager; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.io.IOException; + +@JsonDeserialize( + using = HubDocumentBlockEntryV2025R0.HubDocumentBlockEntryV2025R0Deserializer.class) +@JsonSerialize(using = OneOfFive.OneOfFiveSerializer.class) +public class HubDocumentBlockEntryV2025R0 + extends OneOfFive< + HubParagraphTextBlockV2025R0, + HubSectionTitleTextBlockV2025R0, + HubCalloutBoxTextBlockV2025R0, + HubItemListBlockV2025R0, + HubDividerBlockV2025R0> { + + protected final String type; + + protected final String id; + + protected final String parentId; + + public HubDocumentBlockEntryV2025R0(HubParagraphTextBlockV2025R0 hubParagraphTextBlockV2025R0) { + super(hubParagraphTextBlockV2025R0, null, null, null, null); + this.type = EnumWrapper.convertToString(hubParagraphTextBlockV2025R0.getType()); + this.id = hubParagraphTextBlockV2025R0.getId(); + this.parentId = hubParagraphTextBlockV2025R0.getParentId(); + } + + public HubDocumentBlockEntryV2025R0( + HubSectionTitleTextBlockV2025R0 hubSectionTitleTextBlockV2025R0) { + super(null, hubSectionTitleTextBlockV2025R0, null, null, null); + this.type = EnumWrapper.convertToString(hubSectionTitleTextBlockV2025R0.getType()); + this.id = hubSectionTitleTextBlockV2025R0.getId(); + this.parentId = hubSectionTitleTextBlockV2025R0.getParentId(); + } + + public HubDocumentBlockEntryV2025R0(HubCalloutBoxTextBlockV2025R0 hubCalloutBoxTextBlockV2025R0) { + super(null, null, hubCalloutBoxTextBlockV2025R0, null, null); + this.type = EnumWrapper.convertToString(hubCalloutBoxTextBlockV2025R0.getType()); + this.id = hubCalloutBoxTextBlockV2025R0.getId(); + this.parentId = hubCalloutBoxTextBlockV2025R0.getParentId(); + } + + public HubDocumentBlockEntryV2025R0(HubItemListBlockV2025R0 hubItemListBlockV2025R0) { + super(null, null, null, hubItemListBlockV2025R0, null); + this.type = EnumWrapper.convertToString(hubItemListBlockV2025R0.getType()); + this.id = hubItemListBlockV2025R0.getId(); + this.parentId = hubItemListBlockV2025R0.getParentId(); + } + + public HubDocumentBlockEntryV2025R0(HubDividerBlockV2025R0 hubDividerBlockV2025R0) { + super(null, null, null, null, hubDividerBlockV2025R0); + this.type = EnumWrapper.convertToString(hubDividerBlockV2025R0.getType()); + this.id = hubDividerBlockV2025R0.getId(); + this.parentId = hubDividerBlockV2025R0.getParentId(); + } + + public boolean isHubParagraphTextBlockV2025R0() { + return value0 != null; + } + + public HubParagraphTextBlockV2025R0 getHubParagraphTextBlockV2025R0() { + return value0; + } + + public boolean isHubSectionTitleTextBlockV2025R0() { + return value1 != null; + } + + public HubSectionTitleTextBlockV2025R0 getHubSectionTitleTextBlockV2025R0() { + return value1; + } + + public boolean isHubCalloutBoxTextBlockV2025R0() { + return value2 != null; + } + + public HubCalloutBoxTextBlockV2025R0 getHubCalloutBoxTextBlockV2025R0() { + return value2; + } + + public boolean isHubItemListBlockV2025R0() { + return value3 != null; + } + + public HubItemListBlockV2025R0 getHubItemListBlockV2025R0() { + return value3; + } + + public boolean isHubDividerBlockV2025R0() { + return value4 != null; + } + + public HubDividerBlockV2025R0 getHubDividerBlockV2025R0() { + return value4; + } + + public String getType() { + return type; + } + + public String getId() { + return id; + } + + public String getParentId() { + return parentId; + } + + static class HubDocumentBlockEntryV2025R0Deserializer + extends JsonDeserializer { + + public HubDocumentBlockEntryV2025R0Deserializer() { + super(); + } + + @Override + public HubDocumentBlockEntryV2025R0 deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + JsonNode node = JsonManager.jsonToSerializedData(jp); + JsonNode discriminant0 = node.get("type"); + if (!(discriminant0 == null)) { + switch (discriminant0.asText()) { + case "paragraph": + return new HubDocumentBlockEntryV2025R0( + JsonManager.deserialize(node, HubParagraphTextBlockV2025R0.class)); + case "section_title": + return new HubDocumentBlockEntryV2025R0( + JsonManager.deserialize(node, HubSectionTitleTextBlockV2025R0.class)); + case "callout_box": + return new HubDocumentBlockEntryV2025R0( + JsonManager.deserialize(node, HubCalloutBoxTextBlockV2025R0.class)); + case "item_list": + return new HubDocumentBlockEntryV2025R0( + JsonManager.deserialize(node, HubItemListBlockV2025R0.class)); + case "divider": + return new HubDocumentBlockEntryV2025R0( + JsonManager.deserialize(node, HubDividerBlockV2025R0.class)); + } + } + throw new JsonMappingException(jp, "Unable to deserialize HubDocumentBlockEntryV2025R0"); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblocksv2025r0/HubDocumentBlocksV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblocksv2025r0/HubDocumentBlocksV2025R0.java new file mode 100644 index 000000000..b6efa80f5 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblocksv2025r0/HubDocumentBlocksV2025R0.java @@ -0,0 +1,160 @@ +package com.box.sdkgen.schemas.v2025r0.hubdocumentblocksv2025r0; + +import com.box.sdkgen.internal.Nullable; +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2025r0.hubdocumentblockentryv2025r0.HubDocumentBlockEntryV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.List; +import java.util.Objects; + +/** A list of Hub Document blocks. */ +@JsonFilter("nullablePropertyFilter") +public class HubDocumentBlocksV2025R0 extends SerializableObject { + + /** Ordered list of blocks. */ + protected final List entries; + + /** The value will always be `document_blocks`. */ + @JsonDeserialize( + using = HubDocumentBlocksV2025R0TypeField.HubDocumentBlocksV2025R0TypeFieldDeserializer.class) + @JsonSerialize( + using = HubDocumentBlocksV2025R0TypeField.HubDocumentBlocksV2025R0TypeFieldSerializer.class) + protected EnumWrapper type; + + /** + * The limit that was used for these entries. This will be the same as the `limit` query parameter + * unless that value exceeded the maximum value allowed. The maximum value varies by API. + */ + protected Long limit; + + /** The marker for the start of the next page of results. */ + @JsonProperty("next_marker") + @Nullable + protected String nextMarker; + + public HubDocumentBlocksV2025R0( + @JsonProperty("entries") List entries) { + super(); + this.entries = entries; + this.type = + new EnumWrapper( + HubDocumentBlocksV2025R0TypeField.DOCUMENT_BLOCKS); + } + + protected HubDocumentBlocksV2025R0(Builder builder) { + super(); + this.entries = builder.entries; + this.type = builder.type; + this.limit = builder.limit; + this.nextMarker = builder.nextMarker; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public List getEntries() { + return entries; + } + + public EnumWrapper getType() { + return type; + } + + public Long getLimit() { + return limit; + } + + public String getNextMarker() { + return nextMarker; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HubDocumentBlocksV2025R0 casted = (HubDocumentBlocksV2025R0) o; + return Objects.equals(entries, casted.entries) + && Objects.equals(type, casted.type) + && Objects.equals(limit, casted.limit) + && Objects.equals(nextMarker, casted.nextMarker); + } + + @Override + public int hashCode() { + return Objects.hash(entries, type, limit, nextMarker); + } + + @Override + public String toString() { + return "HubDocumentBlocksV2025R0{" + + "entries='" + + entries + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "limit='" + + limit + + '\'' + + ", " + + "nextMarker='" + + nextMarker + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final List entries; + + protected EnumWrapper type; + + protected Long limit; + + protected String nextMarker; + + public Builder(List entries) { + super(); + this.entries = entries; + } + + public Builder type(HubDocumentBlocksV2025R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + public Builder limit(Long limit) { + this.limit = limit; + return this; + } + + public Builder nextMarker(String nextMarker) { + this.nextMarker = nextMarker; + this.markNullableFieldAsSet("next_marker"); + return this; + } + + public HubDocumentBlocksV2025R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper( + HubDocumentBlocksV2025R0TypeField.DOCUMENT_BLOCKS); + } + return new HubDocumentBlocksV2025R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblocksv2025r0/HubDocumentBlocksV2025R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblocksv2025r0/HubDocumentBlocksV2025R0TypeField.java new file mode 100644 index 000000000..6717304e4 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblocksv2025r0/HubDocumentBlocksV2025R0TypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.v2025r0.hubdocumentblocksv2025r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum HubDocumentBlocksV2025R0TypeField implements Valuable { + DOCUMENT_BLOCKS("document_blocks"); + + private final String value; + + HubDocumentBlocksV2025R0TypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class HubDocumentBlocksV2025R0TypeFieldDeserializer + extends JsonDeserializer> { + + public HubDocumentBlocksV2025R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(HubDocumentBlocksV2025R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class HubDocumentBlocksV2025R0TypeFieldSerializer + extends JsonSerializer> { + + public HubDocumentBlocksV2025R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblockv2025r0/HubDocumentBlockV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblockv2025r0/HubDocumentBlockV2025R0.java new file mode 100644 index 000000000..44189c375 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentblockv2025r0/HubDocumentBlockV2025R0.java @@ -0,0 +1,93 @@ +package com.box.sdkgen.schemas.v2025r0.hubdocumentblockv2025r0; + +import com.box.sdkgen.internal.Nullable; +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +/** Base block in the Box Hub Document. */ +@JsonFilter("nullablePropertyFilter") +public class HubDocumentBlockV2025R0 extends SerializableObject { + + /** The unique identifier for this block. */ + protected final String id; + + /** The unique identifier of the parent block. Null for direct children of the page. */ + @JsonProperty("parent_id") + @Nullable + protected String parentId; + + public HubDocumentBlockV2025R0(@JsonProperty("id") String id) { + super(); + this.id = id; + } + + protected HubDocumentBlockV2025R0(Builder builder) { + super(); + this.id = builder.id; + this.parentId = builder.parentId; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getId() { + return id; + } + + public String getParentId() { + return parentId; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HubDocumentBlockV2025R0 casted = (HubDocumentBlockV2025R0) o; + return Objects.equals(id, casted.id) && Objects.equals(parentId, casted.parentId); + } + + @Override + public int hashCode() { + return Objects.hash(id, parentId); + } + + @Override + public String toString() { + return "HubDocumentBlockV2025R0{" + + "id='" + + id + + '\'' + + ", " + + "parentId='" + + parentId + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final String id; + + protected String parentId; + + public Builder(String id) { + super(); + this.id = id; + } + + public Builder parentId(String parentId) { + this.parentId = parentId; + this.markNullableFieldAsSet("parent_id"); + return this; + } + + public HubDocumentBlockV2025R0 build() { + return new HubDocumentBlockV2025R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagesv2025r0/HubDocumentPagesV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagesv2025r0/HubDocumentPagesV2025R0.java new file mode 100644 index 000000000..d7934ad2d --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagesv2025r0/HubDocumentPagesV2025R0.java @@ -0,0 +1,159 @@ +package com.box.sdkgen.schemas.v2025r0.hubdocumentpagesv2025r0; + +import com.box.sdkgen.internal.Nullable; +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2025r0.hubdocumentpagev2025r0.HubDocumentPageV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.List; +import java.util.Objects; + +/** A list of Hub Document Pages. */ +@JsonFilter("nullablePropertyFilter") +public class HubDocumentPagesV2025R0 extends SerializableObject { + + /** Ordered list of pages. */ + protected final List entries; + + /** The value will always be `document_pages`. */ + @JsonDeserialize( + using = HubDocumentPagesV2025R0TypeField.HubDocumentPagesV2025R0TypeFieldDeserializer.class) + @JsonSerialize( + using = HubDocumentPagesV2025R0TypeField.HubDocumentPagesV2025R0TypeFieldSerializer.class) + protected EnumWrapper type; + + /** + * The limit that was used for these entries. This will be the same as the `limit` query parameter + * unless that value exceeded the maximum value allowed. The maximum value varies by API. + */ + protected Long limit; + + /** The marker for the start of the next page of results. */ + @JsonProperty("next_marker") + @Nullable + protected String nextMarker; + + public HubDocumentPagesV2025R0(@JsonProperty("entries") List entries) { + super(); + this.entries = entries; + this.type = + new EnumWrapper( + HubDocumentPagesV2025R0TypeField.DOCUMENT_PAGES); + } + + protected HubDocumentPagesV2025R0(Builder builder) { + super(); + this.entries = builder.entries; + this.type = builder.type; + this.limit = builder.limit; + this.nextMarker = builder.nextMarker; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public List getEntries() { + return entries; + } + + public EnumWrapper getType() { + return type; + } + + public Long getLimit() { + return limit; + } + + public String getNextMarker() { + return nextMarker; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HubDocumentPagesV2025R0 casted = (HubDocumentPagesV2025R0) o; + return Objects.equals(entries, casted.entries) + && Objects.equals(type, casted.type) + && Objects.equals(limit, casted.limit) + && Objects.equals(nextMarker, casted.nextMarker); + } + + @Override + public int hashCode() { + return Objects.hash(entries, type, limit, nextMarker); + } + + @Override + public String toString() { + return "HubDocumentPagesV2025R0{" + + "entries='" + + entries + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "limit='" + + limit + + '\'' + + ", " + + "nextMarker='" + + nextMarker + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final List entries; + + protected EnumWrapper type; + + protected Long limit; + + protected String nextMarker; + + public Builder(List entries) { + super(); + this.entries = entries; + } + + public Builder type(HubDocumentPagesV2025R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + public Builder limit(Long limit) { + this.limit = limit; + return this; + } + + public Builder nextMarker(String nextMarker) { + this.nextMarker = nextMarker; + this.markNullableFieldAsSet("next_marker"); + return this; + } + + public HubDocumentPagesV2025R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper( + HubDocumentPagesV2025R0TypeField.DOCUMENT_PAGES); + } + return new HubDocumentPagesV2025R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagesv2025r0/HubDocumentPagesV2025R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagesv2025r0/HubDocumentPagesV2025R0TypeField.java new file mode 100644 index 000000000..3a59c54cd --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagesv2025r0/HubDocumentPagesV2025R0TypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.v2025r0.hubdocumentpagesv2025r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum HubDocumentPagesV2025R0TypeField implements Valuable { + DOCUMENT_PAGES("document_pages"); + + private final String value; + + HubDocumentPagesV2025R0TypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class HubDocumentPagesV2025R0TypeFieldDeserializer + extends JsonDeserializer> { + + public HubDocumentPagesV2025R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(HubDocumentPagesV2025R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class HubDocumentPagesV2025R0TypeFieldSerializer + extends JsonSerializer> { + + public HubDocumentPagesV2025R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagev2025r0/HubDocumentPageV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagev2025r0/HubDocumentPageV2025R0.java new file mode 100644 index 000000000..e01c3631b --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubdocumentpagev2025r0/HubDocumentPageV2025R0.java @@ -0,0 +1,132 @@ +package com.box.sdkgen.schemas.v2025r0.hubdocumentpagev2025r0; + +import com.box.sdkgen.internal.Nullable; +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +/** A Page in the Box Hub Document. */ +@JsonFilter("nullablePropertyFilter") +public class HubDocumentPageV2025R0 extends SerializableObject { + + /** The unique identifier for this page. */ + protected final String id; + + /** The type of this resource. The value is always `page`. */ + protected final String type; + + /** The unique identifier of the parent page. Null for root-level pages. */ + @JsonProperty("parent_id") + @Nullable + protected String parentId; + + /** The title text of the page. Includes rich text formatting. */ + @JsonProperty("title_fragment") + protected final String titleFragment; + + public HubDocumentPageV2025R0( + @JsonProperty("id") String id, + @JsonProperty("type") String type, + @JsonProperty("title_fragment") String titleFragment) { + super(); + this.id = id; + this.type = type; + this.titleFragment = titleFragment; + } + + protected HubDocumentPageV2025R0(Builder builder) { + super(); + this.id = builder.id; + this.type = builder.type; + this.parentId = builder.parentId; + this.titleFragment = builder.titleFragment; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getId() { + return id; + } + + public String getType() { + return type; + } + + public String getParentId() { + return parentId; + } + + public String getTitleFragment() { + return titleFragment; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HubDocumentPageV2025R0 casted = (HubDocumentPageV2025R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(type, casted.type) + && Objects.equals(parentId, casted.parentId) + && Objects.equals(titleFragment, casted.titleFragment); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, parentId, titleFragment); + } + + @Override + public String toString() { + return "HubDocumentPageV2025R0{" + + "id='" + + id + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "parentId='" + + parentId + + '\'' + + ", " + + "titleFragment='" + + titleFragment + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final String id; + + protected final String type; + + protected String parentId; + + protected final String titleFragment; + + public Builder(String id, String type, String titleFragment) { + super(); + this.id = id; + this.type = type; + this.titleFragment = titleFragment; + } + + public Builder parentId(String parentId) { + this.parentId = parentId; + this.markNullableFieldAsSet("parent_id"); + return this; + } + + public HubDocumentPageV2025R0 build() { + return new HubDocumentPageV2025R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemlistblockv2025r0/HubItemListBlockV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemlistblockv2025r0/HubItemListBlockV2025R0.java new file mode 100644 index 000000000..8435a9737 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemlistblockv2025r0/HubItemListBlockV2025R0.java @@ -0,0 +1,109 @@ +package com.box.sdkgen.schemas.v2025r0.hubitemlistblockv2025r0; + +import com.box.sdkgen.schemas.v2025r0.hubdocumentblockv2025r0.HubDocumentBlockV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +/** An item list block in the Box Hub Document. */ +@JsonFilter("nullablePropertyFilter") +public class HubItemListBlockV2025R0 extends HubDocumentBlockV2025R0 { + + /** The type of this block. The value is always `item_list`. */ + @JsonDeserialize( + using = HubItemListBlockV2025R0TypeField.HubItemListBlockV2025R0TypeFieldDeserializer.class) + @JsonSerialize( + using = HubItemListBlockV2025R0TypeField.HubItemListBlockV2025R0TypeFieldSerializer.class) + protected EnumWrapper type; + + public HubItemListBlockV2025R0(@JsonProperty("id") String id) { + super(id); + this.type = + new EnumWrapper( + HubItemListBlockV2025R0TypeField.ITEM_LIST); + } + + protected HubItemListBlockV2025R0(Builder builder) { + super(builder); + this.type = builder.type; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public EnumWrapper getType() { + return type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HubItemListBlockV2025R0 casted = (HubItemListBlockV2025R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(parentId, casted.parentId) + && Objects.equals(type, casted.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, parentId, type); + } + + @Override + public String toString() { + return "HubItemListBlockV2025R0{" + + "id='" + + id + + '\'' + + ", " + + "parentId='" + + parentId + + '\'' + + ", " + + "type='" + + type + + '\'' + + "}"; + } + + public static class Builder extends HubDocumentBlockV2025R0.Builder { + + protected EnumWrapper type; + + public Builder(String id) { + super(id); + } + + public Builder type(HubItemListBlockV2025R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + @Override + public Builder parentId(String parentId) { + this.parentId = parentId; + this.markNullableFieldAsSet("parent_id"); + return this; + } + + public HubItemListBlockV2025R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper( + HubItemListBlockV2025R0TypeField.ITEM_LIST); + } + return new HubItemListBlockV2025R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemlistblockv2025r0/HubItemListBlockV2025R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemlistblockv2025r0/HubItemListBlockV2025R0TypeField.java new file mode 100644 index 000000000..f56dbd9e9 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubitemlistblockv2025r0/HubItemListBlockV2025R0TypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.v2025r0.hubitemlistblockv2025r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum HubItemListBlockV2025R0TypeField implements Valuable { + ITEM_LIST("item_list"); + + private final String value; + + HubItemListBlockV2025R0TypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class HubItemListBlockV2025R0TypeFieldDeserializer + extends JsonDeserializer> { + + public HubItemListBlockV2025R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(HubItemListBlockV2025R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class HubItemListBlockV2025R0TypeFieldSerializer + extends JsonSerializer> { + + public HubItemListBlockV2025R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubparagraphtextblockv2025r0/HubParagraphTextBlockV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubparagraphtextblockv2025r0/HubParagraphTextBlockV2025R0.java new file mode 100644 index 000000000..f550c97e6 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubparagraphtextblockv2025r0/HubParagraphTextBlockV2025R0.java @@ -0,0 +1,131 @@ +package com.box.sdkgen.schemas.v2025r0.hubparagraphtextblockv2025r0; + +import com.box.sdkgen.schemas.v2025r0.hubdocumentblockv2025r0.HubDocumentBlockV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +/** A paragraph block in the Box Hub Document. */ +@JsonFilter("nullablePropertyFilter") +public class HubParagraphTextBlockV2025R0 extends HubDocumentBlockV2025R0 { + + /** The type of this block. The value is always `paragraph`. */ + @JsonDeserialize( + using = + HubParagraphTextBlockV2025R0TypeField.HubParagraphTextBlockV2025R0TypeFieldDeserializer + .class) + @JsonSerialize( + using = + HubParagraphTextBlockV2025R0TypeField.HubParagraphTextBlockV2025R0TypeFieldSerializer + .class) + protected EnumWrapper type; + + /** Text content of the block. Includes rich text formatting. */ + protected final String fragment; + + public HubParagraphTextBlockV2025R0( + @JsonProperty("id") String id, @JsonProperty("fragment") String fragment) { + super(id); + this.fragment = fragment; + this.type = + new EnumWrapper( + HubParagraphTextBlockV2025R0TypeField.PARAGRAPH); + } + + protected HubParagraphTextBlockV2025R0(Builder builder) { + super(builder); + this.type = builder.type; + this.fragment = builder.fragment; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public EnumWrapper getType() { + return type; + } + + public String getFragment() { + return fragment; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HubParagraphTextBlockV2025R0 casted = (HubParagraphTextBlockV2025R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(parentId, casted.parentId) + && Objects.equals(type, casted.type) + && Objects.equals(fragment, casted.fragment); + } + + @Override + public int hashCode() { + return Objects.hash(id, parentId, type, fragment); + } + + @Override + public String toString() { + return "HubParagraphTextBlockV2025R0{" + + "id='" + + id + + '\'' + + ", " + + "parentId='" + + parentId + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "fragment='" + + fragment + + '\'' + + "}"; + } + + public static class Builder extends HubDocumentBlockV2025R0.Builder { + + protected EnumWrapper type; + + protected final String fragment; + + public Builder(String id, String fragment) { + super(id); + this.fragment = fragment; + } + + public Builder type(HubParagraphTextBlockV2025R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + @Override + public Builder parentId(String parentId) { + this.parentId = parentId; + this.markNullableFieldAsSet("parent_id"); + return this; + } + + public HubParagraphTextBlockV2025R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper( + HubParagraphTextBlockV2025R0TypeField.PARAGRAPH); + } + return new HubParagraphTextBlockV2025R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubparagraphtextblockv2025r0/HubParagraphTextBlockV2025R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubparagraphtextblockv2025r0/HubParagraphTextBlockV2025R0TypeField.java new file mode 100644 index 000000000..e0e062fe5 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubparagraphtextblockv2025r0/HubParagraphTextBlockV2025R0TypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.v2025r0.hubparagraphtextblockv2025r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum HubParagraphTextBlockV2025R0TypeField implements Valuable { + PARAGRAPH("paragraph"); + + private final String value; + + HubParagraphTextBlockV2025R0TypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class HubParagraphTextBlockV2025R0TypeFieldDeserializer + extends JsonDeserializer> { + + public HubParagraphTextBlockV2025R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(HubParagraphTextBlockV2025R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class HubParagraphTextBlockV2025R0TypeFieldSerializer + extends JsonSerializer> { + + public HubParagraphTextBlockV2025R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubsectiontitletextblockv2025r0/HubSectionTitleTextBlockV2025R0.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubsectiontitletextblockv2025r0/HubSectionTitleTextBlockV2025R0.java new file mode 100644 index 000000000..e1297f783 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubsectiontitletextblockv2025r0/HubSectionTitleTextBlockV2025R0.java @@ -0,0 +1,131 @@ +package com.box.sdkgen.schemas.v2025r0.hubsectiontitletextblockv2025r0; + +import com.box.sdkgen.schemas.v2025r0.hubdocumentblockv2025r0.HubDocumentBlockV2025R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +/** A section title block in the Box Hub Document. */ +@JsonFilter("nullablePropertyFilter") +public class HubSectionTitleTextBlockV2025R0 extends HubDocumentBlockV2025R0 { + + /** The type of this block. The value is always `section_title`. */ + @JsonDeserialize( + using = + HubSectionTitleTextBlockV2025R0TypeField + .HubSectionTitleTextBlockV2025R0TypeFieldDeserializer.class) + @JsonSerialize( + using = + HubSectionTitleTextBlockV2025R0TypeField + .HubSectionTitleTextBlockV2025R0TypeFieldSerializer.class) + protected EnumWrapper type; + + /** Text content of the block. Includes rich text formatting. */ + protected final String fragment; + + public HubSectionTitleTextBlockV2025R0( + @JsonProperty("id") String id, @JsonProperty("fragment") String fragment) { + super(id); + this.fragment = fragment; + this.type = + new EnumWrapper( + HubSectionTitleTextBlockV2025R0TypeField.SECTION_TITLE); + } + + protected HubSectionTitleTextBlockV2025R0(Builder builder) { + super(builder); + this.type = builder.type; + this.fragment = builder.fragment; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public EnumWrapper getType() { + return type; + } + + public String getFragment() { + return fragment; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + HubSectionTitleTextBlockV2025R0 casted = (HubSectionTitleTextBlockV2025R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(parentId, casted.parentId) + && Objects.equals(type, casted.type) + && Objects.equals(fragment, casted.fragment); + } + + @Override + public int hashCode() { + return Objects.hash(id, parentId, type, fragment); + } + + @Override + public String toString() { + return "HubSectionTitleTextBlockV2025R0{" + + "id='" + + id + + '\'' + + ", " + + "parentId='" + + parentId + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "fragment='" + + fragment + + '\'' + + "}"; + } + + public static class Builder extends HubDocumentBlockV2025R0.Builder { + + protected EnumWrapper type; + + protected final String fragment; + + public Builder(String id, String fragment) { + super(id); + this.fragment = fragment; + } + + public Builder type(HubSectionTitleTextBlockV2025R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + @Override + public Builder parentId(String parentId) { + this.parentId = parentId; + this.markNullableFieldAsSet("parent_id"); + return this; + } + + public HubSectionTitleTextBlockV2025R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper( + HubSectionTitleTextBlockV2025R0TypeField.SECTION_TITLE); + } + return new HubSectionTitleTextBlockV2025R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2025r0/hubsectiontitletextblockv2025r0/HubSectionTitleTextBlockV2025R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubsectiontitletextblockv2025r0/HubSectionTitleTextBlockV2025R0TypeField.java new file mode 100644 index 000000000..33225e6ee --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2025r0/hubsectiontitletextblockv2025r0/HubSectionTitleTextBlockV2025R0TypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.v2025r0.hubsectiontitletextblockv2025r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum HubSectionTitleTextBlockV2025R0TypeField implements Valuable { + SECTION_TITLE("section_title"); + + private final String value; + + HubSectionTitleTextBlockV2025R0TypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class HubSectionTitleTextBlockV2025R0TypeFieldDeserializer + extends JsonDeserializer> { + + public HubSectionTitleTextBlockV2025R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(HubSectionTitleTextBlockV2025R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class HubSectionTitleTextBlockV2025R0TypeFieldSerializer + extends JsonSerializer> { + + public HubSectionTitleTextBlockV2025R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +}