From 6d0db87bfbc596b39975fc7296581b29c3d3fe98 Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Fri, 17 Jul 2026 03:20:43 -0700 Subject: [PATCH 1/3] 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 3d5a94ee8..2ab12051e 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "7601181", "specHash": "54953fe", "version": "10.15.2" } +{ "engineHash": "2cee311", "specHash": "54953fe", "version": "10.15.2" } From f2328c1d7ac90ffa55db8c7ac91d618dbde6151c Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Thu, 23 Jul 2026 07:50:34 -0700 Subject: [PATCH 2/3] 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 2ab12051e..97e4d7047 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "2cee311", "specHash": "54953fe", "version": "10.15.2" } +{ "engineHash": "2cee311", "specHash": "50e6d8a", "version": "10.15.2" } From 101e91b2b76d6c679693bf18d29a394d5894951b Mon Sep 17 00:00:00 2001 From: box-sdk-build Date: Thu, 23 Jul 2026 13:51:05 -0700 Subject: [PATCH 3/3] docs: Query insights API (box/box-openapi#610) --- .codegen.json | 2 +- docs/README.md | 1 + docs/query.md | 63 ++++++ .../java/com/box/sdkgen/client/BoxClient.java | 11 + .../CreateQueryInsightV2026R0Headers.java | 68 ++++++ .../query/CreateQueryV2026R0Headers.java | 68 ++++++ .../sdkgen/managers/query/QueryManager.java | 162 ++++++++++++++ .../box/sdkgen/schemas/filefull/FileFull.java | 202 +++++++++++++++++- ...ullAllowedSharedLinkAccessLevelsField.java | 66 ++++++ .../sdkgen/schemas/folderfull/FolderFull.java | 38 +++- .../MetadataQueryResultItem.java | 19 ++ .../RecentItemResource.java | 23 ++ .../searchresultitem/SearchResultItem.java | 23 ++ .../SearchResultWithSharedLinkItem.java | 23 ++ .../QueryAncestorReferenceV2026R0.java | 65 ++++++ .../QueryInsightEntryV2026R0.java | 107 ++++++++++ .../QueryInsightEntryV2026R0TypeField.java | 66 ++++++ .../QueryInsightMetricResultV2026R0.java | 66 ++++++ .../QueryInsightsGroupByV2026R0.java | 93 ++++++++ .../QueryInsightsMetricDefinitionV2026R0.java | 84 ++++++++ ...ightsMetricDefinitionV2026R0TypeField.java | 68 ++++++ .../QueryInsightsRequestBodyV2026R0.java | 73 +++++++ ...yInsightsRequestBodyV2026R0QueryField.java | 149 +++++++++++++ .../QueryInsightsV2026R0.java | 50 +++++ .../QueryOrderByV2026R0.java | 80 +++++++ .../QueryOrderByV2026R0DirectionField.java | 65 ++++++ .../QueryRequestBodyV2026R0.java | 172 +++++++++++++++ .../QueryRequestBodyV2026R0QueryField.java | 122 +++++++++++ .../QueryResultEntryV2026R0.java | 113 ++++++++++ .../QueryResultsV2026R0.java | 121 +++++++++++ .../box/sdkgen/schemas/weblink/WebLink.java | 132 +++++++++++- ...inkAllowedSharedLinkAccessLevelsField.java | 66 ++++++ 32 files changed, 2451 insertions(+), 10 deletions(-) create mode 100644 docs/query.md create mode 100644 src/main/java/com/box/sdkgen/managers/query/CreateQueryInsightV2026R0Headers.java create mode 100644 src/main/java/com/box/sdkgen/managers/query/CreateQueryV2026R0Headers.java create mode 100644 src/main/java/com/box/sdkgen/managers/query/QueryManager.java create mode 100644 src/main/java/com/box/sdkgen/schemas/filefull/FileFullAllowedSharedLinkAccessLevelsField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryancestorreferencev2026r0/QueryAncestorReferenceV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightentryv2026r0/QueryInsightEntryV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightentryv2026r0/QueryInsightEntryV2026R0TypeField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightmetricresultv2026r0/QueryInsightMetricResultV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsgroupbyv2026r0/QueryInsightsGroupByV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsmetricdefinitionv2026r0/QueryInsightsMetricDefinitionV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsmetricdefinitionv2026r0/QueryInsightsMetricDefinitionV2026R0TypeField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsrequestbodyv2026r0/QueryInsightsRequestBodyV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsrequestbodyv2026r0/QueryInsightsRequestBodyV2026R0QueryField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsv2026r0/QueryInsightsV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryorderbyv2026r0/QueryOrderByV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryorderbyv2026r0/QueryOrderByV2026R0DirectionField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryrequestbodyv2026r0/QueryRequestBodyV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryrequestbodyv2026r0/QueryRequestBodyV2026R0QueryField.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryresultentryv2026r0/QueryResultEntryV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/v2026r0/queryresultsv2026r0/QueryResultsV2026R0.java create mode 100644 src/main/java/com/box/sdkgen/schemas/weblink/WebLinkAllowedSharedLinkAccessLevelsField.java diff --git a/.codegen.json b/.codegen.json index 97e4d7047..019b48732 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "2cee311", "specHash": "50e6d8a", "version": "10.15.2" } +{ "engineHash": "2cee311", "specHash": "cc375ad", "version": "10.15.2" } diff --git a/docs/README.md b/docs/README.md index 1257ffc42..c41719199 100644 --- a/docs/README.md +++ b/docs/README.md @@ -62,6 +62,7 @@ the SDK are available by topic: * [Metadatataxonomies](metadatataxonomies.md) * [Metadatatemplates](metadatatemplates.md) * [Notes](notes.md) +* [Query](query.md) * [Recentitems](recentitems.md) * [Retentionpolicies](retentionpolicies.md) * [Retentionpolicyassignments](retentionpolicyassignments.md) diff --git a/docs/query.md b/docs/query.md new file mode 100644 index 000000000..97ba71b71 --- /dev/null +++ b/docs/query.md @@ -0,0 +1,63 @@ +# QueryManager + + +- [Query for Box items](#query-for-box-items) +- [Create insights for Box items](#create-insights-for-box-items) + +## Query for Box items + +Runs a query to discover Box items using a logical predicate that can filter +across item fields and metadata templates. Results can be sorted, paginated, +and shaped to include additional item or metadata fields. + +This operation is performed by calling function `createQueryV2026R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/post-query/). + +*Currently we don't have an example for calling `createQueryV2026R0` in integration tests* + +### Arguments + +- requestBody `QueryRequestBodyV2026R0` + - Request body of createQueryV2026R0 method +- headers `CreateQueryV2026R0Headers` + - Headers of createQueryV2026R0 method + + +### Returns + +This function returns a value of type `QueryResultsV2026R0`. + +Returns a paginated list of items matching the query. + + +## Create insights for Box items + +Computes aggregated metrics over Box items matching a query predicate. +Filters are applied first, followed by optional grouping, after which the +requested metrics (such as `sum`, `avg`, `min`, `max`, and `count`) are +computed for each resulting group or over the entire filtered dataset. + +This operation is performed by calling function `createQueryInsightV2026R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/post-query-insights/). + +*Currently we don't have an example for calling `createQueryInsightV2026R0` in integration tests* + +### Arguments + +- requestBody `QueryInsightsRequestBodyV2026R0` + - Request body of createQueryInsightV2026R0 method +- headers `CreateQueryInsightV2026R0Headers` + - Headers of createQueryInsightV2026R0 method + + +### Returns + +This function returns a value of type `QueryInsightsV2026R0`. + +Returns the computed insight entries. + + diff --git a/src/main/java/com/box/sdkgen/client/BoxClient.java b/src/main/java/com/box/sdkgen/client/BoxClient.java index 9988474df..ca6d8f7d3 100644 --- a/src/main/java/com/box/sdkgen/client/BoxClient.java +++ b/src/main/java/com/box/sdkgen/client/BoxClient.java @@ -52,6 +52,7 @@ import com.box.sdkgen.managers.metadatataxonomies.MetadataTaxonomiesManager; import com.box.sdkgen.managers.metadatatemplates.MetadataTemplatesManager; import com.box.sdkgen.managers.notes.NotesManager; +import com.box.sdkgen.managers.query.QueryManager; import com.box.sdkgen.managers.recentitems.RecentItemsManager; import com.box.sdkgen.managers.retentionpolicies.RetentionPoliciesManager; import com.box.sdkgen.managers.retentionpolicyassignments.RetentionPolicyAssignmentsManager; @@ -276,6 +277,8 @@ public class BoxClient { public final NotesManager notes; + public final QueryManager query; + public BoxClient(Authentication auth) { this.auth = auth; this.networkSession = new NetworkSession.Builder().baseUrls(new BaseUrls()).build(); @@ -631,6 +634,8 @@ public BoxClient(Authentication auth) { .build(); this.notes = new NotesManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); + this.query = + new QueryManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); } protected BoxClient(Builder builder) { @@ -988,6 +993,8 @@ protected BoxClient(Builder builder) { .build(); this.notes = new NotesManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); + this.query = + new QueryManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); } /** @@ -1451,6 +1458,10 @@ public NotesManager getNotes() { return notes; } + public QueryManager getQuery() { + return query; + } + public static class Builder { protected final Authentication auth; diff --git a/src/main/java/com/box/sdkgen/managers/query/CreateQueryInsightV2026R0Headers.java b/src/main/java/com/box/sdkgen/managers/query/CreateQueryInsightV2026R0Headers.java new file mode 100644 index 000000000..270d0bc36 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/query/CreateQueryInsightV2026R0Headers.java @@ -0,0 +1,68 @@ +package com.box.sdkgen.managers.query; + +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; + +import com.box.sdkgen.parameters.v2026r0.boxversionheaderv2026r0.BoxVersionHeaderV2026R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import java.util.Map; + +public class CreateQueryInsightV2026R0Headers { + + /** Version header. */ + public EnumWrapper boxVersion; + + /** Extra headers that will be included in the HTTP request. */ + public Map extraHeaders; + + public CreateQueryInsightV2026R0Headers() { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + this.extraHeaders = mapOf(); + } + + protected CreateQueryInsightV2026R0Headers(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(BoxVersionHeaderV2026R0 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 CreateQueryInsightV2026R0Headers build() { + if (this.boxVersion == null) { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + } + if (this.extraHeaders == null) { + this.extraHeaders = mapOf(); + } + return new CreateQueryInsightV2026R0Headers(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/query/CreateQueryV2026R0Headers.java b/src/main/java/com/box/sdkgen/managers/query/CreateQueryV2026R0Headers.java new file mode 100644 index 000000000..baca10638 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/query/CreateQueryV2026R0Headers.java @@ -0,0 +1,68 @@ +package com.box.sdkgen.managers.query; + +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; + +import com.box.sdkgen.parameters.v2026r0.boxversionheaderv2026r0.BoxVersionHeaderV2026R0; +import com.box.sdkgen.serialization.json.EnumWrapper; +import java.util.Map; + +public class CreateQueryV2026R0Headers { + + /** Version header. */ + public EnumWrapper boxVersion; + + /** Extra headers that will be included in the HTTP request. */ + public Map extraHeaders; + + public CreateQueryV2026R0Headers() { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + this.extraHeaders = mapOf(); + } + + protected CreateQueryV2026R0Headers(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(BoxVersionHeaderV2026R0 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 CreateQueryV2026R0Headers build() { + if (this.boxVersion == null) { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + } + if (this.extraHeaders == null) { + this.extraHeaders = mapOf(); + } + return new CreateQueryV2026R0Headers(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/query/QueryManager.java b/src/main/java/com/box/sdkgen/managers/query/QueryManager.java new file mode 100644 index 000000000..843443118 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/query/QueryManager.java @@ -0,0 +1,162 @@ +package com.box.sdkgen.managers.query; + +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.v2026r0.queryinsightsrequestbodyv2026r0.QueryInsightsRequestBodyV2026R0; +import com.box.sdkgen.schemas.v2026r0.queryinsightsv2026r0.QueryInsightsV2026R0; +import com.box.sdkgen.schemas.v2026r0.queryrequestbodyv2026r0.QueryRequestBodyV2026R0; +import com.box.sdkgen.schemas.v2026r0.queryresultsv2026r0.QueryResultsV2026R0; +import com.box.sdkgen.serialization.json.JsonManager; +import java.util.Map; + +public class QueryManager { + + public Authentication auth; + + public NetworkSession networkSession; + + public QueryManager() { + this.networkSession = new NetworkSession(); + } + + protected QueryManager(Builder builder) { + this.auth = builder.auth; + this.networkSession = builder.networkSession; + } + + /** + * Runs a query to discover Box items using a logical predicate that can filter across item fields + * and metadata templates. Results can be sorted, paginated, and shaped to include additional item + * or metadata fields. + * + * @param requestBody Request body of createQueryV2026R0 method + */ + public QueryResultsV2026R0 createQueryV2026R0(QueryRequestBodyV2026R0 requestBody) { + return createQueryV2026R0(requestBody, new CreateQueryV2026R0Headers()); + } + + /** + * Runs a query to discover Box items using a logical predicate that can filter across item fields + * and metadata templates. Results can be sorted, paginated, and shaped to include additional item + * or metadata fields. + * + * @param requestBody Request body of createQueryV2026R0 method + * @param headers Headers of createQueryV2026R0 method + */ + public QueryResultsV2026R0 createQueryV2026R0( + QueryRequestBodyV2026R0 requestBody, CreateQueryV2026R0Headers headers) { + 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/query"), + "POST") + .headers(headersMap) + .data(JsonManager.serialize(requestBody)) + .contentType("application/json") + .responseFormat(ResponseFormat.JSON) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + return JsonManager.deserialize(response.getData(), QueryResultsV2026R0.class); + } + + /** + * Computes aggregated metrics over Box items matching a query predicate. Filters are applied + * first, followed by optional grouping, after which the requested metrics (such as `sum`, `avg`, + * `min`, `max`, and `count`) are computed for each resulting group or over the entire filtered + * dataset. + * + * @param requestBody Request body of createQueryInsightV2026R0 method + */ + public QueryInsightsV2026R0 createQueryInsightV2026R0( + QueryInsightsRequestBodyV2026R0 requestBody) { + return createQueryInsightV2026R0(requestBody, new CreateQueryInsightV2026R0Headers()); + } + + /** + * Computes aggregated metrics over Box items matching a query predicate. Filters are applied + * first, followed by optional grouping, after which the requested metrics (such as `sum`, `avg`, + * `min`, `max`, and `count`) are computed for each resulting group or over the entire filtered + * dataset. + * + * @param requestBody Request body of createQueryInsightV2026R0 method + * @param headers Headers of createQueryInsightV2026R0 method + */ + public QueryInsightsV2026R0 createQueryInsightV2026R0( + QueryInsightsRequestBodyV2026R0 requestBody, CreateQueryInsightV2026R0Headers headers) { + 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/query_insights"), + "POST") + .headers(headersMap) + .data(JsonManager.serialize(requestBody)) + .contentType("application/json") + .responseFormat(ResponseFormat.JSON) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + return JsonManager.deserialize(response.getData(), QueryInsightsV2026R0.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 QueryManager build() { + if (this.networkSession == null) { + this.networkSession = new NetworkSession(); + } + return new QueryManager(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/filefull/FileFull.java b/src/main/java/com/box/sdkgen/schemas/filefull/FileFull.java index 7e9a52ed4..a72cfbd0a 100644 --- a/src/main/java/com/box/sdkgen/schemas/filefull/FileFull.java +++ b/src/main/java/com/box/sdkgen/schemas/filefull/FileFull.java @@ -2,6 +2,7 @@ import com.box.sdkgen.internal.Nullable; import com.box.sdkgen.internal.utils.DateTimeUtils; +import com.box.sdkgen.schemas.collection.Collection; import com.box.sdkgen.schemas.file.File; import com.box.sdkgen.schemas.file.FileItemStatusField; import com.box.sdkgen.schemas.file.FilePathCollectionField; @@ -125,6 +126,54 @@ public class FileFull extends File { @JsonProperty("is_associated_with_app_item") protected Boolean isAssociatedWithAppItem; + /** + * The collections that this file belongs to. + * + *

For more information, see the [collections + * guide](https://developer.box.com/guides/collections). + */ + protected List collections; + + /** + * Whether the file's binary content is eligible to be downloaded. + * + *

This is a content-level flag and does not reflect whether the current user is authorized to + * download the file. Use `permissions.can_download`, when available, for that. + */ + @JsonProperty("is_download_available") + protected Boolean isDownloadAvailable; + + /** + * A pre-authorized, expiring URL for directly downloading the file's content. Requires + * authentication and is valid only for the current session. + * + *

This field is only returned for files, not folders or web links. + */ + @JsonProperty("download_url") + protected String downloadUrl; + + /** + * A stable API URL for the file content endpoint, `/2.0/files/{id}/content`. Unlike + * `download_url`, authorization is evaluated when the URL is requested with a valid access token. + * + *

This field is only returned for files, not folders or web links. + */ + @JsonProperty("authenticated_download_url") + protected String authenticatedDownloadUrl; + + /** + * The shared link access levels the authenticated user is allowed to use when creating or + * updating a shared link for this file. + * + *

The list depends on item policy and user authorization, so it may be narrower than the + * levels available to the owner. An empty array means no access level is available to this user. + */ + @JsonDeserialize(using = AllowedSharedLinkAccessLevelsDeserializer.class) + @JsonSerialize(using = AllowedSharedLinkAccessLevelsSerializer.class) + @JsonProperty("allowed_shared_link_access_levels") + protected List> + allowedSharedLinkAccessLevels; + public FileFull(@JsonProperty("id") String id) { super(id); } @@ -152,6 +201,11 @@ protected FileFull(Builder builder) { this.dispositionAt = builder.dispositionAt; this.sharedLinkPermissionOptions = builder.sharedLinkPermissionOptions; this.isAssociatedWithAppItem = builder.isAssociatedWithAppItem; + this.collections = builder.collections; + this.isDownloadAvailable = builder.isDownloadAvailable; + this.downloadUrl = builder.downloadUrl; + this.authenticatedDownloadUrl = builder.authenticatedDownloadUrl; + this.allowedSharedLinkAccessLevels = builder.allowedSharedLinkAccessLevels; markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); } @@ -240,6 +294,27 @@ public Boolean getIsAssociatedWithAppItem() { return isAssociatedWithAppItem; } + public List getCollections() { + return collections; + } + + public Boolean getIsDownloadAvailable() { + return isDownloadAvailable; + } + + public String getDownloadUrl() { + return downloadUrl; + } + + public String getAuthenticatedDownloadUrl() { + return authenticatedDownloadUrl; + } + + public List> + getAllowedSharedLinkAccessLevels() { + return allowedSharedLinkAccessLevels; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -291,7 +366,12 @@ public boolean equals(Object o) { && Objects.equals(uploaderDisplayName, casted.uploaderDisplayName) && Objects.equals(dispositionAt, casted.dispositionAt) && Objects.equals(sharedLinkPermissionOptions, casted.sharedLinkPermissionOptions) - && Objects.equals(isAssociatedWithAppItem, casted.isAssociatedWithAppItem); + && Objects.equals(isAssociatedWithAppItem, casted.isAssociatedWithAppItem) + && Objects.equals(collections, casted.collections) + && Objects.equals(isDownloadAvailable, casted.isDownloadAvailable) + && Objects.equals(downloadUrl, casted.downloadUrl) + && Objects.equals(authenticatedDownloadUrl, casted.authenticatedDownloadUrl) + && Objects.equals(allowedSharedLinkAccessLevels, casted.allowedSharedLinkAccessLevels); } @Override @@ -339,7 +419,12 @@ public int hashCode() { uploaderDisplayName, dispositionAt, sharedLinkPermissionOptions, - isAssociatedWithAppItem); + isAssociatedWithAppItem, + collections, + isDownloadAvailable, + downloadUrl, + authenticatedDownloadUrl, + allowedSharedLinkAccessLevels); } @Override @@ -516,6 +601,26 @@ public String toString() { + "isAssociatedWithAppItem='" + isAssociatedWithAppItem + '\'' + + ", " + + "collections='" + + collections + + '\'' + + ", " + + "isDownloadAvailable='" + + isDownloadAvailable + + '\'' + + ", " + + "downloadUrl='" + + downloadUrl + + '\'' + + ", " + + "authenticatedDownloadUrl='" + + authenticatedDownloadUrl + + '\'' + + ", " + + "allowedSharedLinkAccessLevels='" + + allowedSharedLinkAccessLevels + + '\'' + "}"; } @@ -564,6 +669,17 @@ public static class Builder extends File.Builder { protected Boolean isAssociatedWithAppItem; + protected List collections; + + protected Boolean isDownloadAvailable; + + protected String downloadUrl; + + protected String authenticatedDownloadUrl; + + protected List> + allowedSharedLinkAccessLevels; + public Builder(String id) { super(id); } @@ -682,6 +798,34 @@ public Builder isAssociatedWithAppItem(Boolean isAssociatedWithAppItem) { return this; } + public Builder collections(List collections) { + this.collections = collections; + return this; + } + + public Builder isDownloadAvailable(Boolean isDownloadAvailable) { + this.isDownloadAvailable = isDownloadAvailable; + return this; + } + + public Builder downloadUrl(String downloadUrl) { + this.downloadUrl = downloadUrl; + return this; + } + + public Builder authenticatedDownloadUrl(String authenticatedDownloadUrl) { + this.authenticatedDownloadUrl = authenticatedDownloadUrl; + return this; + } + + public Builder allowedSharedLinkAccessLevels( + List allowedSharedLinkAccessLevels) { + this.allowedSharedLinkAccessLevels = + EnumWrapper.wrapValuableEnumList( + allowedSharedLinkAccessLevels, FileFullAllowedSharedLinkAccessLevelsField.class); + return this; + } + @Override public Builder etag(String etag) { this.etag = etag; @@ -938,4 +1082,58 @@ public void serialize( gen.writeEndArray(); } } + + public static class AllowedSharedLinkAccessLevelsDeserializer + extends JsonDeserializer>> { + + public final JsonDeserializer> + elementDeserializer; + + public AllowedSharedLinkAccessLevelsDeserializer() { + super(); + this.elementDeserializer = + new FileFullAllowedSharedLinkAccessLevelsField + .FileFullAllowedSharedLinkAccessLevelsFieldDeserializer(); + } + + @Override + public List> deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + JsonNode node = p.getCodec().readTree(p); + List> elements = new ArrayList<>(); + for (JsonNode item : node) { + JsonParser pa = item.traverse(p.getCodec()); + pa.nextToken(); + elements.add(elementDeserializer.deserialize(pa, ctxt)); + } + return elements; + } + } + + public static class AllowedSharedLinkAccessLevelsSerializer + extends JsonSerializer>> { + + public final JsonSerializer> + elementSerializer; + + public AllowedSharedLinkAccessLevelsSerializer() { + super(); + this.elementSerializer = + new FileFullAllowedSharedLinkAccessLevelsField + .FileFullAllowedSharedLinkAccessLevelsFieldSerializer(); + } + + @Override + public void serialize( + List> value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeStartArray(); + for (EnumWrapper item : value) { + elementSerializer.serialize(item, gen, serializers); + } + gen.writeEndArray(); + } + } } diff --git a/src/main/java/com/box/sdkgen/schemas/filefull/FileFullAllowedSharedLinkAccessLevelsField.java b/src/main/java/com/box/sdkgen/schemas/filefull/FileFullAllowedSharedLinkAccessLevelsField.java new file mode 100644 index 000000000..25b7e50cb --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/filefull/FileFullAllowedSharedLinkAccessLevelsField.java @@ -0,0 +1,66 @@ +package com.box.sdkgen.schemas.filefull; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +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 FileFullAllowedSharedLinkAccessLevelsField implements Valuable { + OPEN("open"), + COMPANY("company"), + COLLABORATORS("collaborators"); + + private final String value; + + FileFullAllowedSharedLinkAccessLevelsField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class FileFullAllowedSharedLinkAccessLevelsFieldDeserializer + extends JsonDeserializer> { + + public FileFullAllowedSharedLinkAccessLevelsFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(FileFullAllowedSharedLinkAccessLevelsField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class FileFullAllowedSharedLinkAccessLevelsFieldSerializer + extends JsonSerializer> { + + public FileFullAllowedSharedLinkAccessLevelsFieldSerializer() { + 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/folderfull/FolderFull.java b/src/main/java/com/box/sdkgen/schemas/folderfull/FolderFull.java index 32b0b5d94..93cb2a8a6 100644 --- a/src/main/java/com/box/sdkgen/schemas/folderfull/FolderFull.java +++ b/src/main/java/com/box/sdkgen/schemas/folderfull/FolderFull.java @@ -1,5 +1,6 @@ package com.box.sdkgen.schemas.folderfull; +import com.box.sdkgen.schemas.collection.Collection; import com.box.sdkgen.schemas.folder.Folder; import com.box.sdkgen.schemas.folder.FolderFolderUploadEmailField; import com.box.sdkgen.schemas.folder.FolderItemStatusField; @@ -60,10 +61,11 @@ public class FolderFull extends Folder { protected Boolean isCollaborationRestrictedToEnterprise; /** - * A list of access levels that are available for this folder. + * The shared link access levels the authenticated user is allowed to use when creating or + * updating a shared link for this folder. * - *

For some folders, like the root folder, this will always be an empty list as sharing is not - * allowed at that level. + *

The list depends on item policy and user authorization. For some folders, like the root + * folder, this is always empty as sharing is not allowed at that level. */ @JsonDeserialize(using = AllowedSharedLinkAccessLevelsDeserializer.class) @JsonSerialize(using = AllowedSharedLinkAccessLevelsSerializer.class) @@ -106,6 +108,14 @@ public class FolderFull extends Folder { @JsonProperty("is_associated_with_app_item") protected Boolean isAssociatedWithAppItem; + /** + * The collections that this folder belongs to. + * + *

For more information, see the [collections + * guide](https://developer.box.com/guides/collections). + */ + protected List collections; + public FolderFull(@JsonProperty("id") String id) { super(id); } @@ -127,6 +137,7 @@ protected FolderFull(Builder builder) { this.canNonOwnersViewCollaborators = builder.canNonOwnersViewCollaborators; this.classification = builder.classification; this.isAssociatedWithAppItem = builder.isAssociatedWithAppItem; + this.collections = builder.collections; markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); } @@ -191,6 +202,10 @@ public Boolean getIsAssociatedWithAppItem() { return isAssociatedWithAppItem; } + public List getCollections() { + return collections; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -237,7 +252,8 @@ public boolean equals(Object o) { && Objects.equals(isAccessibleViaSharedLink, casted.isAccessibleViaSharedLink) && Objects.equals(canNonOwnersViewCollaborators, casted.canNonOwnersViewCollaborators) && Objects.equals(classification, casted.classification) - && Objects.equals(isAssociatedWithAppItem, casted.isAssociatedWithAppItem); + && Objects.equals(isAssociatedWithAppItem, casted.isAssociatedWithAppItem) + && Objects.equals(collections, casted.collections); } @Override @@ -279,7 +295,8 @@ public int hashCode() { isAccessibleViaSharedLink, canNonOwnersViewCollaborators, classification, - isAssociatedWithAppItem); + isAssociatedWithAppItem, + collections); } @Override @@ -432,6 +449,10 @@ public String toString() { + "isAssociatedWithAppItem='" + isAssociatedWithAppItem + '\'' + + ", " + + "collections='" + + collections + + '\'' + "}"; } @@ -468,6 +489,8 @@ public static class Builder extends Folder.Builder { protected Boolean isAssociatedWithAppItem; + protected List collections; + public Builder(String id) { super(id); } @@ -558,6 +581,11 @@ public Builder isAssociatedWithAppItem(Boolean isAssociatedWithAppItem) { return this; } + public Builder collections(List collections) { + this.collections = collections; + return this; + } + @Override public Builder etag(String etag) { this.etag = etag; diff --git a/src/main/java/com/box/sdkgen/schemas/metadataqueryresultitem/MetadataQueryResultItem.java b/src/main/java/com/box/sdkgen/schemas/metadataqueryresultitem/MetadataQueryResultItem.java index 23a2fef57..d4e8ac451 100644 --- a/src/main/java/com/box/sdkgen/schemas/metadataqueryresultitem/MetadataQueryResultItem.java +++ b/src/main/java/com/box/sdkgen/schemas/metadataqueryresultitem/MetadataQueryResultItem.java @@ -1,6 +1,7 @@ package com.box.sdkgen.schemas.metadataqueryresultitem; import com.box.sdkgen.internal.OneOfTwo; +import com.box.sdkgen.schemas.collection.Collection; import com.box.sdkgen.schemas.filefull.FileFull; import com.box.sdkgen.schemas.folderfull.FolderFull; import com.box.sdkgen.schemas.foldermini.FolderMini; @@ -34,6 +35,10 @@ public class MetadataQueryResultItem extends OneOfTwo { protected final Boolean isAssociatedWithAppItem; + protected final List collections; + + protected final List allowedSharedLinkAccessLevels; + protected final String description; protected final Long size; @@ -78,6 +83,9 @@ public MetadataQueryResultItem(FileFull fileFull) { this.isExternallyOwned = fileFull.getIsExternallyOwned(); this.hasCollaborations = fileFull.getHasCollaborations(); this.isAssociatedWithAppItem = fileFull.getIsAssociatedWithAppItem(); + this.collections = fileFull.getCollections(); + this.allowedSharedLinkAccessLevels = + EnumWrapper.convertToString(fileFull.getAllowedSharedLinkAccessLevels()); this.description = fileFull.getDescription(); this.size = fileFull.getSize(); this.createdAt = fileFull.getCreatedAt(); @@ -106,6 +114,9 @@ public MetadataQueryResultItem(FolderFull folderFull) { this.isExternallyOwned = folderFull.getIsExternallyOwned(); this.hasCollaborations = folderFull.getHasCollaborations(); this.isAssociatedWithAppItem = folderFull.getIsAssociatedWithAppItem(); + this.collections = folderFull.getCollections(); + this.allowedSharedLinkAccessLevels = + EnumWrapper.convertToString(folderFull.getAllowedSharedLinkAccessLevels()); this.description = folderFull.getDescription(); this.size = folderFull.getSize(); this.createdAt = folderFull.getCreatedAt(); @@ -166,6 +177,14 @@ public boolean getIsAssociatedWithAppItem() { return isAssociatedWithAppItem; } + public List getCollections() { + return collections; + } + + public List getAllowedSharedLinkAccessLevels() { + return allowedSharedLinkAccessLevels; + } + public String getDescription() { return description; } diff --git a/src/main/java/com/box/sdkgen/schemas/recentitemresource/RecentItemResource.java b/src/main/java/com/box/sdkgen/schemas/recentitemresource/RecentItemResource.java index 2bc62d002..2694351e0 100644 --- a/src/main/java/com/box/sdkgen/schemas/recentitemresource/RecentItemResource.java +++ b/src/main/java/com/box/sdkgen/schemas/recentitemresource/RecentItemResource.java @@ -1,6 +1,7 @@ package com.box.sdkgen.schemas.recentitemresource; import com.box.sdkgen.internal.OneOfThree; +import com.box.sdkgen.schemas.collection.Collection; import com.box.sdkgen.schemas.filefull.FileFull; import com.box.sdkgen.schemas.folderfull.FolderFull; import com.box.sdkgen.schemas.foldermini.FolderMini; @@ -17,11 +18,16 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.List; @JsonDeserialize(using = RecentItemResource.RecentItemResourceDeserializer.class) @JsonSerialize(using = OneOfThree.OneOfThreeSerializer.class) public class RecentItemResource extends OneOfThree { + protected final List collections; + + protected final List allowedSharedLinkAccessLevels; + protected final String description; protected final OffsetDateTime createdAt; @@ -54,6 +60,9 @@ public class RecentItemResource extends OneOfThree getCollections() { + return collections; + } + + public List getAllowedSharedLinkAccessLevels() { + return allowedSharedLinkAccessLevels; + } + public String getDescription() { return description; } diff --git a/src/main/java/com/box/sdkgen/schemas/searchresultitem/SearchResultItem.java b/src/main/java/com/box/sdkgen/schemas/searchresultitem/SearchResultItem.java index dcd481ec4..ec74d9cd3 100644 --- a/src/main/java/com/box/sdkgen/schemas/searchresultitem/SearchResultItem.java +++ b/src/main/java/com/box/sdkgen/schemas/searchresultitem/SearchResultItem.java @@ -1,6 +1,7 @@ package com.box.sdkgen.schemas.searchresultitem; import com.box.sdkgen.internal.OneOfThree; +import com.box.sdkgen.schemas.collection.Collection; import com.box.sdkgen.schemas.filefull.FileFull; import com.box.sdkgen.schemas.folderfull.FolderFull; import com.box.sdkgen.schemas.foldermini.FolderMini; @@ -17,11 +18,16 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.List; @JsonDeserialize(using = SearchResultItem.SearchResultItemDeserializer.class) @JsonSerialize(using = OneOfThree.OneOfThreeSerializer.class) public class SearchResultItem extends OneOfThree { + protected final List collections; + + protected final List allowedSharedLinkAccessLevels; + protected final String description; protected final OffsetDateTime createdAt; @@ -54,6 +60,9 @@ public class SearchResultItem extends OneOfThree public SearchResultItem(FileFull fileFull) { super(fileFull, null, null); + this.collections = fileFull.getCollections(); + this.allowedSharedLinkAccessLevels = + EnumWrapper.convertToString(fileFull.getAllowedSharedLinkAccessLevels()); this.description = fileFull.getDescription(); this.createdAt = fileFull.getCreatedAt(); this.modifiedAt = fileFull.getModifiedAt(); @@ -73,6 +82,9 @@ public SearchResultItem(FileFull fileFull) { public SearchResultItem(FolderFull folderFull) { super(null, folderFull, null); + this.collections = folderFull.getCollections(); + this.allowedSharedLinkAccessLevels = + EnumWrapper.convertToString(folderFull.getAllowedSharedLinkAccessLevels()); this.description = folderFull.getDescription(); this.createdAt = folderFull.getCreatedAt(); this.modifiedAt = folderFull.getModifiedAt(); @@ -92,6 +104,9 @@ public SearchResultItem(FolderFull folderFull) { public SearchResultItem(WebLink webLink) { super(null, null, webLink); + this.collections = webLink.getCollections(); + this.allowedSharedLinkAccessLevels = + EnumWrapper.convertToString(webLink.getAllowedSharedLinkAccessLevels()); this.description = webLink.getDescription(); this.createdAt = webLink.getCreatedAt(); this.modifiedAt = webLink.getModifiedAt(); @@ -133,6 +148,14 @@ public WebLink getWebLink() { return value2; } + public List getCollections() { + return collections; + } + + public List getAllowedSharedLinkAccessLevels() { + return allowedSharedLinkAccessLevels; + } + public String getDescription() { return description; } diff --git a/src/main/java/com/box/sdkgen/schemas/searchresultwithsharedlinkitem/SearchResultWithSharedLinkItem.java b/src/main/java/com/box/sdkgen/schemas/searchresultwithsharedlinkitem/SearchResultWithSharedLinkItem.java index 15769f9cb..eb0b0ffbb 100644 --- a/src/main/java/com/box/sdkgen/schemas/searchresultwithsharedlinkitem/SearchResultWithSharedLinkItem.java +++ b/src/main/java/com/box/sdkgen/schemas/searchresultwithsharedlinkitem/SearchResultWithSharedLinkItem.java @@ -1,6 +1,7 @@ package com.box.sdkgen.schemas.searchresultwithsharedlinkitem; import com.box.sdkgen.internal.OneOfThree; +import com.box.sdkgen.schemas.collection.Collection; import com.box.sdkgen.schemas.filefull.FileFull; import com.box.sdkgen.schemas.folderfull.FolderFull; import com.box.sdkgen.schemas.foldermini.FolderMini; @@ -17,12 +18,17 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.io.IOException; import java.time.OffsetDateTime; +import java.util.List; @JsonDeserialize( using = SearchResultWithSharedLinkItem.SearchResultWithSharedLinkItemDeserializer.class) @JsonSerialize(using = OneOfThree.OneOfThreeSerializer.class) public class SearchResultWithSharedLinkItem extends OneOfThree { + protected final List collections; + + protected final List allowedSharedLinkAccessLevels; + protected final String description; protected final OffsetDateTime createdAt; @@ -55,6 +61,9 @@ public class SearchResultWithSharedLinkItem extends OneOfThree getCollections() { + return collections; + } + + public List getAllowedSharedLinkAccessLevels() { + return allowedSharedLinkAccessLevels; + } + public String getDescription() { return description; } diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryancestorreferencev2026r0/QueryAncestorReferenceV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryancestorreferencev2026r0/QueryAncestorReferenceV2026R0.java new file mode 100644 index 000000000..01a0a36fa --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryancestorreferencev2026r0/QueryAncestorReferenceV2026R0.java @@ -0,0 +1,65 @@ +package com.box.sdkgen.schemas.v2026r0.queryancestorreferencev2026r0; + +import com.box.sdkgen.internal.SerializableObject; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +/** + * A reference to an ancestor entity used to restrict query results to that entity and its recursive + * descendants. + */ +@JsonFilter("nullablePropertyFilter") +public class QueryAncestorReferenceV2026R0 extends SerializableObject { + + /** The unique identifier of the ancestor entity. */ + protected final String id; + + /** The type of the ancestor entity. Possible value: folder. */ + protected final String type; + + public QueryAncestorReferenceV2026R0( + @JsonProperty("id") String id, @JsonProperty("type") String type) { + super(); + this.id = id; + this.type = type; + } + + public String getId() { + return id; + } + + public String getType() { + return type; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryAncestorReferenceV2026R0 casted = (QueryAncestorReferenceV2026R0) o; + return Objects.equals(id, casted.id) && Objects.equals(type, casted.type); + } + + @Override + public int hashCode() { + return Objects.hash(id, type); + } + + @Override + public String toString() { + return "QueryAncestorReferenceV2026R0{" + + "id='" + + id + + '\'' + + ", " + + "type='" + + type + + '\'' + + "}"; + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightentryv2026r0/QueryInsightEntryV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightentryv2026r0/QueryInsightEntryV2026R0.java new file mode 100644 index 000000000..fec73503c --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightentryv2026r0/QueryInsightEntryV2026R0.java @@ -0,0 +1,107 @@ +package com.box.sdkgen.schemas.v2026r0.queryinsightentryv2026r0; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2026r0.queryinsightmetricresultv2026r0.QueryInsightMetricResultV2026R0; +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.Map; +import java.util.Objects; + +/** + * A single computed insight entry, containing its grouping keys (if applicable) and the computed + * metrics. + */ +@JsonFilter("nullablePropertyFilter") +public class QueryInsightEntryV2026R0 extends SerializableObject { + + /** + * The grouping key values associated with the entry. Contains one value per `group_by` field for + * `group` entries, and is empty for `overall` and `other` entries. + */ + protected final List key; + + /** The type of insight entry, indicating how the associated metrics are aggregated. */ + @JsonDeserialize( + using = QueryInsightEntryV2026R0TypeField.QueryInsightEntryV2026R0TypeFieldDeserializer.class) + @JsonSerialize( + using = QueryInsightEntryV2026R0TypeField.QueryInsightEntryV2026R0TypeFieldSerializer.class) + protected final EnumWrapper type; + + /** + * A map of metric aliases to their computed results. For `other` entries, the count is reported + * under the `totalCountBeyondTopGroups` key. + */ + protected final Map metrics; + + public QueryInsightEntryV2026R0( + List key, + QueryInsightEntryV2026R0TypeField type, + Map metrics) { + super(); + this.key = key; + this.type = new EnumWrapper(type); + this.metrics = metrics; + } + + public QueryInsightEntryV2026R0( + @JsonProperty("key") List key, + @JsonProperty("type") EnumWrapper type, + @JsonProperty("metrics") Map metrics) { + super(); + this.key = key; + this.type = type; + this.metrics = metrics; + } + + public List getKey() { + return key; + } + + public EnumWrapper getType() { + return type; + } + + public Map getMetrics() { + return metrics; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryInsightEntryV2026R0 casted = (QueryInsightEntryV2026R0) o; + return Objects.equals(key, casted.key) + && Objects.equals(type, casted.type) + && Objects.equals(metrics, casted.metrics); + } + + @Override + public int hashCode() { + return Objects.hash(key, type, metrics); + } + + @Override + public String toString() { + return "QueryInsightEntryV2026R0{" + + "key='" + + key + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "metrics='" + + metrics + + '\'' + + "}"; + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightentryv2026r0/QueryInsightEntryV2026R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightentryv2026r0/QueryInsightEntryV2026R0TypeField.java new file mode 100644 index 000000000..d5218fdd1 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightentryv2026r0/QueryInsightEntryV2026R0TypeField.java @@ -0,0 +1,66 @@ +package com.box.sdkgen.schemas.v2026r0.queryinsightentryv2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +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 QueryInsightEntryV2026R0TypeField implements Valuable { + GROUP("group"), + OVERALL("overall"), + OTHER("other"); + + private final String value; + + QueryInsightEntryV2026R0TypeField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class QueryInsightEntryV2026R0TypeFieldDeserializer + extends JsonDeserializer> { + + public QueryInsightEntryV2026R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(QueryInsightEntryV2026R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class QueryInsightEntryV2026R0TypeFieldSerializer + extends JsonSerializer> { + + public QueryInsightEntryV2026R0TypeFieldSerializer() { + 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/v2026r0/queryinsightmetricresultv2026r0/QueryInsightMetricResultV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightmetricresultv2026r0/QueryInsightMetricResultV2026R0.java new file mode 100644 index 000000000..8660e72f2 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightmetricresultv2026r0/QueryInsightMetricResultV2026R0.java @@ -0,0 +1,66 @@ +package com.box.sdkgen.schemas.v2026r0.queryinsightmetricresultv2026r0; + +import com.box.sdkgen.internal.SerializableObject; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.Objects; + +/** The computed result for a single metric, including the metric type and its computed value(s). */ +@JsonFilter("nullablePropertyFilter") +public class QueryInsightMetricResultV2026R0 extends SerializableObject { + + /** The metric type that was computed. */ + protected final String type; + + /** + * The computed metric result(s), keyed by the metric function (for example `sum`, `avg`, `min`, + * `max`, or `count`). + */ + protected final Map values; + + public QueryInsightMetricResultV2026R0( + @JsonProperty("type") String type, @JsonProperty("values") Map values) { + super(); + this.type = type; + this.values = values; + } + + public String getType() { + return type; + } + + public Map getValues() { + return values; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryInsightMetricResultV2026R0 casted = (QueryInsightMetricResultV2026R0) o; + return Objects.equals(type, casted.type) && Objects.equals(values, casted.values); + } + + @Override + public int hashCode() { + return Objects.hash(type, values); + } + + @Override + public String toString() { + return "QueryInsightMetricResultV2026R0{" + + "type='" + + type + + '\'' + + ", " + + "values='" + + values + + '\'' + + "}"; + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsgroupbyv2026r0/QueryInsightsGroupByV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsgroupbyv2026r0/QueryInsightsGroupByV2026R0.java new file mode 100644 index 000000000..861a7b6b6 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsgroupbyv2026r0/QueryInsightsGroupByV2026R0.java @@ -0,0 +1,93 @@ +package com.box.sdkgen.schemas.v2026r0.queryinsightsgroupbyv2026r0; + +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; + +/** + * Defines a single grouping criterion for an insights request. Currently only a single grouping + * field is supported. + */ +@JsonFilter("nullablePropertyFilter") +public class QueryInsightsGroupByV2026R0 extends SerializableObject { + + /** The fully qualified field name to group by. Supports metadata and item properties. */ + protected final String field; + + /** The maximum number of buckets to return for the grouping. Defaults to `5`. */ + @JsonProperty("bucket_limit") + protected Integer bucketLimit; + + public QueryInsightsGroupByV2026R0(@JsonProperty("field") String field) { + super(); + this.field = field; + } + + protected QueryInsightsGroupByV2026R0(Builder builder) { + super(); + this.field = builder.field; + this.bucketLimit = builder.bucketLimit; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getField() { + return field; + } + + public Integer getBucketLimit() { + return bucketLimit; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryInsightsGroupByV2026R0 casted = (QueryInsightsGroupByV2026R0) o; + return Objects.equals(field, casted.field) && Objects.equals(bucketLimit, casted.bucketLimit); + } + + @Override + public int hashCode() { + return Objects.hash(field, bucketLimit); + } + + @Override + public String toString() { + return "QueryInsightsGroupByV2026R0{" + + "field='" + + field + + '\'' + + ", " + + "bucketLimit='" + + bucketLimit + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final String field; + + protected Integer bucketLimit; + + public Builder(String field) { + super(); + this.field = field; + } + + public Builder bucketLimit(Integer bucketLimit) { + this.bucketLimit = bucketLimit; + return this; + } + + public QueryInsightsGroupByV2026R0 build() { + return new QueryInsightsGroupByV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsmetricdefinitionv2026r0/QueryInsightsMetricDefinitionV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsmetricdefinitionv2026r0/QueryInsightsMetricDefinitionV2026R0.java new file mode 100644 index 000000000..fc7a8d01a --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsmetricdefinitionv2026r0/QueryInsightsMetricDefinitionV2026R0.java @@ -0,0 +1,84 @@ +package com.box.sdkgen.schemas.v2026r0.queryinsightsmetricdefinitionv2026r0; + +import com.box.sdkgen.internal.SerializableObject; +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; + +/** + * Defines a single metric to compute, including the aggregation function and the field it is + * applied to. + */ +@JsonFilter("nullablePropertyFilter") +public class QueryInsightsMetricDefinitionV2026R0 extends SerializableObject { + + /** The aggregation function to apply. */ + @JsonDeserialize( + using = + QueryInsightsMetricDefinitionV2026R0TypeField + .QueryInsightsMetricDefinitionV2026R0TypeFieldDeserializer.class) + @JsonSerialize( + using = + QueryInsightsMetricDefinitionV2026R0TypeField + .QueryInsightsMetricDefinitionV2026R0TypeFieldSerializer.class) + protected final EnumWrapper type; + + /** The fully qualified field name on which the metric is computed. */ + protected final String field; + + public QueryInsightsMetricDefinitionV2026R0( + QueryInsightsMetricDefinitionV2026R0TypeField type, String field) { + super(); + this.type = new EnumWrapper(type); + this.field = field; + } + + public QueryInsightsMetricDefinitionV2026R0( + @JsonProperty("type") EnumWrapper type, + @JsonProperty("field") String field) { + super(); + this.type = type; + this.field = field; + } + + public EnumWrapper getType() { + return type; + } + + public String getField() { + return field; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryInsightsMetricDefinitionV2026R0 casted = (QueryInsightsMetricDefinitionV2026R0) o; + return Objects.equals(type, casted.type) && Objects.equals(field, casted.field); + } + + @Override + public int hashCode() { + return Objects.hash(type, field); + } + + @Override + public String toString() { + return "QueryInsightsMetricDefinitionV2026R0{" + + "type='" + + type + + '\'' + + ", " + + "field='" + + field + + '\'' + + "}"; + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsmetricdefinitionv2026r0/QueryInsightsMetricDefinitionV2026R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsmetricdefinitionv2026r0/QueryInsightsMetricDefinitionV2026R0TypeField.java new file mode 100644 index 000000000..0d2e7d90f --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsmetricdefinitionv2026r0/QueryInsightsMetricDefinitionV2026R0TypeField.java @@ -0,0 +1,68 @@ +package com.box.sdkgen.schemas.v2026r0.queryinsightsmetricdefinitionv2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +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 QueryInsightsMetricDefinitionV2026R0TypeField implements Valuable { + SUM("sum"), + AVG("avg"), + MIN("min"), + MAX("max"), + COUNT("count"); + + private final String value; + + QueryInsightsMetricDefinitionV2026R0TypeField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class QueryInsightsMetricDefinitionV2026R0TypeFieldDeserializer + extends JsonDeserializer> { + + public QueryInsightsMetricDefinitionV2026R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(QueryInsightsMetricDefinitionV2026R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class QueryInsightsMetricDefinitionV2026R0TypeFieldSerializer + extends JsonSerializer> { + + public QueryInsightsMetricDefinitionV2026R0TypeFieldSerializer() { + 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/v2026r0/queryinsightsrequestbodyv2026r0/QueryInsightsRequestBodyV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsrequestbodyv2026r0/QueryInsightsRequestBodyV2026R0.java new file mode 100644 index 000000000..183d1f668 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsrequestbodyv2026r0/QueryInsightsRequestBodyV2026R0.java @@ -0,0 +1,73 @@ +package com.box.sdkgen.schemas.v2026r0.queryinsightsrequestbodyv2026r0; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2026r0.queryinsightsmetricdefinitionv2026r0.QueryInsightsMetricDefinitionV2026R0; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.Objects; + +/** Request body describing the filtering, grouping, and metrics for an insights computation. */ +@JsonFilter("nullablePropertyFilter") +public class QueryInsightsRequestBodyV2026R0 extends SerializableObject { + + /** + * The filtering and grouping definition. Filters are applied first, followed by grouping, before + * metrics are computed. + */ + protected final QueryInsightsRequestBodyV2026R0QueryField query; + + /** + * A map of user-defined metric aliases to their definitions. A maximum of 10 metrics may be + * defined. Each alias must be a unique, non-empty string of up to 256 characters, containing only + * letters, digits, `_`, `-`, or `.`, and must not start with a digit, `_`, `-`, or `.`. May be + * empty to request only a total count. + */ + protected final Map metrics; + + public QueryInsightsRequestBodyV2026R0( + @JsonProperty("query") QueryInsightsRequestBodyV2026R0QueryField query, + @JsonProperty("metrics") Map metrics) { + super(); + this.query = query; + this.metrics = metrics; + } + + public QueryInsightsRequestBodyV2026R0QueryField getQuery() { + return query; + } + + public Map getMetrics() { + return metrics; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryInsightsRequestBodyV2026R0 casted = (QueryInsightsRequestBodyV2026R0) o; + return Objects.equals(query, casted.query) && Objects.equals(metrics, casted.metrics); + } + + @Override + public int hashCode() { + return Objects.hash(query, metrics); + } + + @Override + public String toString() { + return "QueryInsightsRequestBodyV2026R0{" + + "query='" + + query + + '\'' + + ", " + + "metrics='" + + metrics + + '\'' + + "}"; + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsrequestbodyv2026r0/QueryInsightsRequestBodyV2026R0QueryField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsrequestbodyv2026r0/QueryInsightsRequestBodyV2026R0QueryField.java new file mode 100644 index 000000000..e47b8c64e --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsrequestbodyv2026r0/QueryInsightsRequestBodyV2026R0QueryField.java @@ -0,0 +1,149 @@ +package com.box.sdkgen.schemas.v2026r0.queryinsightsrequestbodyv2026r0; + +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2026r0.queryancestorreferencev2026r0.QueryAncestorReferenceV2026R0; +import com.box.sdkgen.schemas.v2026r0.queryinsightsgroupbyv2026r0.QueryInsightsGroupByV2026R0; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonFilter("nullablePropertyFilter") +public class QueryInsightsRequestBodyV2026R0QueryField extends SerializableObject { + + /** + * A logical expression used to filter the dataset prior to metric computation, similar to an SQL + * `WHERE` clause. May include named parameters referenced as `:placeholder`. + */ + protected final String predicate; + + /** + * A map of placeholder names (without the `:` prefix) to their values. Required only when the + * predicate contains parameter placeholders. The type of each value must match the type of the + * field it is compared to. + */ + protected Map params; + + /** + * Restricts results to items contained within any of the specified ancestors. The user must have + * access to every listed ancestor. When omitted, insights are computed across all accessible + * items. + */ + protected List ancestors; + + /** + * Defines how data is grouped for insights computation. Currently only a single grouping field is + * supported. + */ + @JsonProperty("group_by") + protected List groupBy; + + public QueryInsightsRequestBodyV2026R0QueryField(@JsonProperty("predicate") String predicate) { + super(); + this.predicate = predicate; + } + + protected QueryInsightsRequestBodyV2026R0QueryField(Builder builder) { + super(); + this.predicate = builder.predicate; + this.params = builder.params; + this.ancestors = builder.ancestors; + this.groupBy = builder.groupBy; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getPredicate() { + return predicate; + } + + public Map getParams() { + return params; + } + + public List getAncestors() { + return ancestors; + } + + public List getGroupBy() { + return groupBy; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryInsightsRequestBodyV2026R0QueryField casted = + (QueryInsightsRequestBodyV2026R0QueryField) o; + return Objects.equals(predicate, casted.predicate) + && Objects.equals(params, casted.params) + && Objects.equals(ancestors, casted.ancestors) + && Objects.equals(groupBy, casted.groupBy); + } + + @Override + public int hashCode() { + return Objects.hash(predicate, params, ancestors, groupBy); + } + + @Override + public String toString() { + return "QueryInsightsRequestBodyV2026R0QueryField{" + + "predicate='" + + predicate + + '\'' + + ", " + + "params='" + + params + + '\'' + + ", " + + "ancestors='" + + ancestors + + '\'' + + ", " + + "groupBy='" + + groupBy + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final String predicate; + + protected Map params; + + protected List ancestors; + + protected List groupBy; + + public Builder(String predicate) { + super(); + this.predicate = predicate; + } + + public Builder params(Map params) { + this.params = params; + return this; + } + + public Builder ancestors(List ancestors) { + this.ancestors = ancestors; + return this; + } + + public Builder groupBy(List groupBy) { + this.groupBy = groupBy; + return this; + } + + public QueryInsightsRequestBodyV2026R0QueryField build() { + return new QueryInsightsRequestBodyV2026R0QueryField(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsv2026r0/QueryInsightsV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsv2026r0/QueryInsightsV2026R0.java new file mode 100644 index 000000000..332d591fd --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryinsightsv2026r0/QueryInsightsV2026R0.java @@ -0,0 +1,50 @@ +package com.box.sdkgen.schemas.v2026r0.queryinsightsv2026r0; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2026r0.queryinsightentryv2026r0.QueryInsightEntryV2026R0; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Objects; + +/** The computed results of an insights request, as a list of insight entries. */ +@JsonFilter("nullablePropertyFilter") +public class QueryInsightsV2026R0 extends SerializableObject { + + /** + * The list of computed insight entries. Each entry corresponds to a group, the overall dataset, + * or the aggregate of groups outside the top results. + */ + protected final List insights; + + public QueryInsightsV2026R0(@JsonProperty("insights") List insights) { + super(); + this.insights = insights; + } + + public List getInsights() { + return insights; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryInsightsV2026R0 casted = (QueryInsightsV2026R0) o; + return Objects.equals(insights, casted.insights); + } + + @Override + public int hashCode() { + return Objects.hash(insights); + } + + @Override + public String toString() { + return "QueryInsightsV2026R0{" + "insights='" + insights + '\'' + "}"; + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryorderbyv2026r0/QueryOrderByV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryorderbyv2026r0/QueryOrderByV2026R0.java new file mode 100644 index 000000000..d6ee2aafc --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryorderbyv2026r0/QueryOrderByV2026R0.java @@ -0,0 +1,80 @@ +package com.box.sdkgen.schemas.v2026r0.queryorderbyv2026r0; + +import com.box.sdkgen.internal.SerializableObject; +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 single sorting criterion applied to the query result set. Multiple criteria are applied + * sequentially in the order specified. + */ +@JsonFilter("nullablePropertyFilter") +public class QueryOrderByV2026R0 extends SerializableObject { + + /** The fully qualified field key to sort by. */ + @JsonProperty("field_key") + protected final String fieldKey; + + /** The direction in which results are ordered. */ + @JsonDeserialize( + using = QueryOrderByV2026R0DirectionField.QueryOrderByV2026R0DirectionFieldDeserializer.class) + @JsonSerialize( + using = QueryOrderByV2026R0DirectionField.QueryOrderByV2026R0DirectionFieldSerializer.class) + protected final EnumWrapper direction; + + public QueryOrderByV2026R0(String fieldKey, QueryOrderByV2026R0DirectionField direction) { + super(); + this.fieldKey = fieldKey; + this.direction = new EnumWrapper(direction); + } + + public QueryOrderByV2026R0( + @JsonProperty("field_key") String fieldKey, + @JsonProperty("direction") EnumWrapper direction) { + super(); + this.fieldKey = fieldKey; + this.direction = direction; + } + + public String getFieldKey() { + return fieldKey; + } + + public EnumWrapper getDirection() { + return direction; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryOrderByV2026R0 casted = (QueryOrderByV2026R0) o; + return Objects.equals(fieldKey, casted.fieldKey) && Objects.equals(direction, casted.direction); + } + + @Override + public int hashCode() { + return Objects.hash(fieldKey, direction); + } + + @Override + public String toString() { + return "QueryOrderByV2026R0{" + + "fieldKey='" + + fieldKey + + '\'' + + ", " + + "direction='" + + direction + + '\'' + + "}"; + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryorderbyv2026r0/QueryOrderByV2026R0DirectionField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryorderbyv2026r0/QueryOrderByV2026R0DirectionField.java new file mode 100644 index 000000000..2995eda47 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryorderbyv2026r0/QueryOrderByV2026R0DirectionField.java @@ -0,0 +1,65 @@ +package com.box.sdkgen.schemas.v2026r0.queryorderbyv2026r0; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +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 QueryOrderByV2026R0DirectionField implements Valuable { + ASC("asc"), + DESC("desc"); + + private final String value; + + QueryOrderByV2026R0DirectionField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class QueryOrderByV2026R0DirectionFieldDeserializer + extends JsonDeserializer> { + + public QueryOrderByV2026R0DirectionFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(QueryOrderByV2026R0DirectionField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class QueryOrderByV2026R0DirectionFieldSerializer + extends JsonSerializer> { + + public QueryOrderByV2026R0DirectionFieldSerializer() { + 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/v2026r0/queryrequestbodyv2026r0/QueryRequestBodyV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryrequestbodyv2026r0/QueryRequestBodyV2026R0.java new file mode 100644 index 000000000..f6302143b --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryrequestbodyv2026r0/QueryRequestBodyV2026R0.java @@ -0,0 +1,172 @@ +package com.box.sdkgen.schemas.v2026r0.queryrequestbodyv2026r0; + +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2026r0.queryorderbyv2026r0.QueryOrderByV2026R0; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Objects; + +/** + * Request body describing the query to run, including the filtering predicate, optional sorting, + * pagination, and the fields to return for each result. + */ +@JsonFilter("nullablePropertyFilter") +public class QueryRequestBodyV2026R0 extends SerializableObject { + + /** + * The query definition, including the filtering predicate and its optional parameters and + * ancestor restrictions. + */ + protected final QueryRequestBodyV2026R0QueryField query; + + /** + * The sorting criteria for the result set. Entries are applied sequentially to define multi-level + * sorting. + */ + @JsonProperty("order_by") + protected List orderBy; + + /** The maximum number of results to return. Defaults to `50` when not provided. */ + protected Integer limit; + + /** + * Controls which additional fields are included in each result entry. Each value must be one of: + * a fully qualified item field key (for example `box:item:name`), a metadata template key to + * hydrate the full template (for example `enterprise_12345678:project`), or a specific metadata + * template field key to hydrate a single field from the template (for example + * `enterprise_12345678:project:name`). When omitted, entries include only the item type and + * identifier. + */ + protected List fields; + + /** + * An opaque token returned from a previous response, used to continue retrieval. When provided, + * all other request parameters must exactly match those of the original request. + */ + protected String marker; + + public QueryRequestBodyV2026R0(@JsonProperty("query") QueryRequestBodyV2026R0QueryField query) { + super(); + this.query = query; + } + + protected QueryRequestBodyV2026R0(Builder builder) { + super(); + this.query = builder.query; + this.orderBy = builder.orderBy; + this.limit = builder.limit; + this.fields = builder.fields; + this.marker = builder.marker; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public QueryRequestBodyV2026R0QueryField getQuery() { + return query; + } + + public List getOrderBy() { + return orderBy; + } + + public Integer getLimit() { + return limit; + } + + public List getFields() { + return fields; + } + + public String getMarker() { + return marker; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryRequestBodyV2026R0 casted = (QueryRequestBodyV2026R0) o; + return Objects.equals(query, casted.query) + && Objects.equals(orderBy, casted.orderBy) + && Objects.equals(limit, casted.limit) + && Objects.equals(fields, casted.fields) + && Objects.equals(marker, casted.marker); + } + + @Override + public int hashCode() { + return Objects.hash(query, orderBy, limit, fields, marker); + } + + @Override + public String toString() { + return "QueryRequestBodyV2026R0{" + + "query='" + + query + + '\'' + + ", " + + "orderBy='" + + orderBy + + '\'' + + ", " + + "limit='" + + limit + + '\'' + + ", " + + "fields='" + + fields + + '\'' + + ", " + + "marker='" + + marker + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final QueryRequestBodyV2026R0QueryField query; + + protected List orderBy; + + protected Integer limit; + + protected List fields; + + protected String marker; + + public Builder(QueryRequestBodyV2026R0QueryField query) { + super(); + this.query = query; + } + + public Builder orderBy(List orderBy) { + this.orderBy = orderBy; + return this; + } + + public Builder limit(Integer limit) { + this.limit = limit; + return this; + } + + public Builder fields(List fields) { + this.fields = fields; + return this; + } + + public Builder marker(String marker) { + this.marker = marker; + return this; + } + + public QueryRequestBodyV2026R0 build() { + return new QueryRequestBodyV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryrequestbodyv2026r0/QueryRequestBodyV2026R0QueryField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryrequestbodyv2026r0/QueryRequestBodyV2026R0QueryField.java new file mode 100644 index 000000000..812f25278 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryrequestbodyv2026r0/QueryRequestBodyV2026R0QueryField.java @@ -0,0 +1,122 @@ +package com.box.sdkgen.schemas.v2026r0.queryrequestbodyv2026r0; + +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2026r0.queryancestorreferencev2026r0.QueryAncestorReferenceV2026R0; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +@JsonFilter("nullablePropertyFilter") +public class QueryRequestBodyV2026R0QueryField extends SerializableObject { + + /** + * A logical expression used to filter the dataset, similar to an SQL `WHERE` clause. May include + * named parameters referenced as `:placeholder`. + */ + protected final String predicate; + + /** + * A map of placeholder names (without the `:` prefix) to their values. Required only when the + * predicate contains parameter placeholders. The type of each value must match the type of the + * field it is compared to. + */ + protected Map params; + + /** + * Restricts results to the specified ancestor entities and their recursive descendants. The user + * must have read access to every listed ancestor. + */ + protected List ancestors; + + public QueryRequestBodyV2026R0QueryField(@JsonProperty("predicate") String predicate) { + super(); + this.predicate = predicate; + } + + protected QueryRequestBodyV2026R0QueryField(Builder builder) { + super(); + this.predicate = builder.predicate; + this.params = builder.params; + this.ancestors = builder.ancestors; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getPredicate() { + return predicate; + } + + public Map getParams() { + return params; + } + + public List getAncestors() { + return ancestors; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryRequestBodyV2026R0QueryField casted = (QueryRequestBodyV2026R0QueryField) o; + return Objects.equals(predicate, casted.predicate) + && Objects.equals(params, casted.params) + && Objects.equals(ancestors, casted.ancestors); + } + + @Override + public int hashCode() { + return Objects.hash(predicate, params, ancestors); + } + + @Override + public String toString() { + return "QueryRequestBodyV2026R0QueryField{" + + "predicate='" + + predicate + + '\'' + + ", " + + "params='" + + params + + '\'' + + ", " + + "ancestors='" + + ancestors + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final String predicate; + + protected Map params; + + protected List ancestors; + + public Builder(String predicate) { + super(); + this.predicate = predicate; + } + + public Builder params(Map params) { + this.params = params; + return this; + } + + public Builder ancestors(List ancestors) { + this.ancestors = ancestors; + return this; + } + + public QueryRequestBodyV2026R0QueryField build() { + return new QueryRequestBodyV2026R0QueryField(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryresultentryv2026r0/QueryResultEntryV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryresultentryv2026r0/QueryResultEntryV2026R0.java new file mode 100644 index 000000000..f66d2cfd7 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryresultentryv2026r0/QueryResultEntryV2026R0.java @@ -0,0 +1,113 @@ +package com.box.sdkgen.schemas.v2026r0.queryresultentryv2026r0; + +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.fasterxml.jackson.annotation.JsonAnyGetter; +import com.fasterxml.jackson.annotation.JsonAnySetter; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; +import java.util.Objects; + +/** + * A single item matching the query. Always includes the item `type` and `id`. If a `fields` + * parameter was specified in the request, then additional item and/or metadata fields will be + * provided. + */ +@JsonFilter("nullablePropertyFilter") +public class QueryResultEntryV2026R0 extends SerializableObject { + + /** The unique identifier of the matching item. */ + protected final String id; + + /** The type of the matching item. */ + protected final String type; + + @JsonAnyGetter @JsonAnySetter protected Map extraData; + + public QueryResultEntryV2026R0(@JsonProperty("id") String id, @JsonProperty("type") String type) { + super(); + this.id = id; + this.type = type; + } + + protected QueryResultEntryV2026R0(Builder builder) { + super(); + this.id = builder.id; + this.type = builder.type; + this.extraData = builder.extraData; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public String getId() { + return id; + } + + public String getType() { + return type; + } + + public Map getExtraData() { + return extraData; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryResultEntryV2026R0 casted = (QueryResultEntryV2026R0) o; + return Objects.equals(id, casted.id) + && Objects.equals(type, casted.type) + && Objects.equals(extraData, casted.extraData); + } + + @Override + public int hashCode() { + return Objects.hash(id, type, extraData); + } + + @Override + public String toString() { + return "QueryResultEntryV2026R0{" + + "id='" + + id + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "extraData='" + + extraData + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final String id; + + protected final String type; + + protected Map extraData; + + public Builder(String id, String type) { + super(); + this.id = id; + this.type = type; + } + + public Builder extraData(Map extraData) { + this.extraData = extraData; + return this; + } + + public QueryResultEntryV2026R0 build() { + return new QueryResultEntryV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/queryresultsv2026r0/QueryResultsV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryresultsv2026r0/QueryResultsV2026R0.java new file mode 100644 index 000000000..f53488c0b --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/queryresultsv2026r0/QueryResultsV2026R0.java @@ -0,0 +1,121 @@ +package com.box.sdkgen.schemas.v2026r0.queryresultsv2026r0; + +import com.box.sdkgen.internal.Nullable; +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2026r0.queryresultentryv2026r0.QueryResultEntryV2026R0; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Objects; + +/** A paginated list of items matching the query, using milestone-based marker pagination. */ +@JsonFilter("nullablePropertyFilter") +public class QueryResultsV2026R0 extends SerializableObject { + + /** The list of items matching the query predicate. */ + protected final List entries; + + /** + * The marker for the start of the next page of results. When `null`, there are no further results + * available. + */ + @JsonProperty("next_marker") + @Nullable + protected String nextMarker; + + /** + * The limit that was used for this request. This will be the same as the limit query parameter + * unless that value exceeded the maximum value allowed. + */ + protected final int limit; + + public QueryResultsV2026R0( + @JsonProperty("entries") List entries, + @JsonProperty("limit") int limit) { + super(); + this.entries = entries; + this.limit = limit; + } + + protected QueryResultsV2026R0(Builder builder) { + super(); + this.entries = builder.entries; + this.nextMarker = builder.nextMarker; + this.limit = builder.limit; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public List getEntries() { + return entries; + } + + public String getNextMarker() { + return nextMarker; + } + + public int getLimit() { + return limit; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + QueryResultsV2026R0 casted = (QueryResultsV2026R0) o; + return Objects.equals(entries, casted.entries) + && Objects.equals(nextMarker, casted.nextMarker) + && Objects.equals(limit, casted.limit); + } + + @Override + public int hashCode() { + return Objects.hash(entries, nextMarker, limit); + } + + @Override + public String toString() { + return "QueryResultsV2026R0{" + + "entries='" + + entries + + '\'' + + ", " + + "nextMarker='" + + nextMarker + + '\'' + + ", " + + "limit='" + + limit + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final List entries; + + protected String nextMarker; + + protected final int limit; + + public Builder(List entries, int limit) { + super(); + this.entries = entries; + this.limit = limit; + } + + public Builder nextMarker(String nextMarker) { + this.nextMarker = nextMarker; + this.markNullableFieldAsSet("next_marker"); + return this; + } + + public QueryResultsV2026R0 build() { + return new QueryResultsV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/weblink/WebLink.java b/src/main/java/com/box/sdkgen/schemas/weblink/WebLink.java index e21029282..d6ad85ee5 100644 --- a/src/main/java/com/box/sdkgen/schemas/weblink/WebLink.java +++ b/src/main/java/com/box/sdkgen/schemas/weblink/WebLink.java @@ -2,16 +2,28 @@ import com.box.sdkgen.internal.Nullable; import com.box.sdkgen.internal.utils.DateTimeUtils; +import com.box.sdkgen.schemas.collection.Collection; import com.box.sdkgen.schemas.foldermini.FolderMini; import com.box.sdkgen.schemas.usermini.UserMini; import com.box.sdkgen.schemas.weblinkbase.WebLinkBaseTypeField; import com.box.sdkgen.schemas.weblinkmini.WebLinkMini; import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; import com.fasterxml.jackson.annotation.JsonFilter; import com.fasterxml.jackson.annotation.JsonProperty; +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.JsonNode; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.io.IOException; import java.time.OffsetDateTime; +import java.util.ArrayList; +import java.util.List; import java.util.Objects; /** @@ -79,6 +91,27 @@ public class WebLink extends WebLinkMini { @JsonProperty("item_status") protected EnumWrapper itemStatus; + /** + * The collections that this web link belongs to. + * + *

For more information, see the [collections + * guide](https://developer.box.com/guides/collections). + */ + protected List collections; + + /** + * The shared link access levels the authenticated user is allowed to use when creating or + * updating a shared link for this web link. + * + *

The list depends on item policy and user authorization, so it may be narrower than the + * levels available to the owner. An empty array means no access level is available to this user. + */ + @JsonDeserialize(using = AllowedSharedLinkAccessLevelsDeserializer.class) + @JsonSerialize(using = AllowedSharedLinkAccessLevelsSerializer.class) + @JsonProperty("allowed_shared_link_access_levels") + protected List> + allowedSharedLinkAccessLevels; + public WebLink(@JsonProperty("id") String id) { super(id); } @@ -97,6 +130,8 @@ protected WebLink(Builder builder) { this.ownedBy = builder.ownedBy; this.sharedLink = builder.sharedLink; this.itemStatus = builder.itemStatus; + this.collections = builder.collections; + this.allowedSharedLinkAccessLevels = builder.allowedSharedLinkAccessLevels; markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); } @@ -148,6 +183,15 @@ public EnumWrapper getItemStatus() { return itemStatus; } + public List getCollections() { + return collections; + } + + public List> + getAllowedSharedLinkAccessLevels() { + return allowedSharedLinkAccessLevels; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -174,7 +218,9 @@ public boolean equals(Object o) { && Objects.equals(modifiedBy, casted.modifiedBy) && Objects.equals(ownedBy, casted.ownedBy) && Objects.equals(sharedLink, casted.sharedLink) - && Objects.equals(itemStatus, casted.itemStatus); + && Objects.equals(itemStatus, casted.itemStatus) + && Objects.equals(collections, casted.collections) + && Objects.equals(allowedSharedLinkAccessLevels, casted.allowedSharedLinkAccessLevels); } @Override @@ -197,7 +243,9 @@ public int hashCode() { modifiedBy, ownedBy, sharedLink, - itemStatus); + itemStatus, + collections, + allowedSharedLinkAccessLevels); } @Override @@ -274,6 +322,14 @@ public String toString() { + "itemStatus='" + itemStatus + '\'' + + ", " + + "collections='" + + collections + + '\'' + + ", " + + "allowedSharedLinkAccessLevels='" + + allowedSharedLinkAccessLevels + + '\'' + "}"; } @@ -303,6 +359,11 @@ public static class Builder extends WebLinkMini.Builder { protected EnumWrapper itemStatus; + protected List collections; + + protected List> + allowedSharedLinkAccessLevels; + public Builder(String id) { super(id); } @@ -374,6 +435,19 @@ public Builder itemStatus(EnumWrapper itemStatus) { return this; } + public Builder collections(List collections) { + this.collections = collections; + return this; + } + + public Builder allowedSharedLinkAccessLevels( + List allowedSharedLinkAccessLevels) { + this.allowedSharedLinkAccessLevels = + EnumWrapper.wrapValuableEnumList( + allowedSharedLinkAccessLevels, WebLinkAllowedSharedLinkAccessLevelsField.class); + return this; + } + @Override public Builder type(WebLinkBaseTypeField type) { this.type = new EnumWrapper(type); @@ -417,4 +491,58 @@ public WebLink build() { return new WebLink(this); } } + + public static class AllowedSharedLinkAccessLevelsDeserializer + extends JsonDeserializer>> { + + public final JsonDeserializer> + elementDeserializer; + + public AllowedSharedLinkAccessLevelsDeserializer() { + super(); + this.elementDeserializer = + new WebLinkAllowedSharedLinkAccessLevelsField + .WebLinkAllowedSharedLinkAccessLevelsFieldDeserializer(); + } + + @Override + public List> deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + JsonNode node = p.getCodec().readTree(p); + List> elements = new ArrayList<>(); + for (JsonNode item : node) { + JsonParser pa = item.traverse(p.getCodec()); + pa.nextToken(); + elements.add(elementDeserializer.deserialize(pa, ctxt)); + } + return elements; + } + } + + public static class AllowedSharedLinkAccessLevelsSerializer + extends JsonSerializer>> { + + public final JsonSerializer> + elementSerializer; + + public AllowedSharedLinkAccessLevelsSerializer() { + super(); + this.elementSerializer = + new WebLinkAllowedSharedLinkAccessLevelsField + .WebLinkAllowedSharedLinkAccessLevelsFieldSerializer(); + } + + @Override + public void serialize( + List> value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeStartArray(); + for (EnumWrapper item : value) { + elementSerializer.serialize(item, gen, serializers); + } + gen.writeEndArray(); + } + } } diff --git a/src/main/java/com/box/sdkgen/schemas/weblink/WebLinkAllowedSharedLinkAccessLevelsField.java b/src/main/java/com/box/sdkgen/schemas/weblink/WebLinkAllowedSharedLinkAccessLevelsField.java new file mode 100644 index 000000000..8e7305cbe --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/weblink/WebLinkAllowedSharedLinkAccessLevelsField.java @@ -0,0 +1,66 @@ +package com.box.sdkgen.schemas.weblink; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.annotation.JsonValue; +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 WebLinkAllowedSharedLinkAccessLevelsField implements Valuable { + OPEN("open"), + COMPANY("company"), + COLLABORATORS("collaborators"); + + private final String value; + + WebLinkAllowedSharedLinkAccessLevelsField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class WebLinkAllowedSharedLinkAccessLevelsFieldDeserializer + extends JsonDeserializer> { + + public WebLinkAllowedSharedLinkAccessLevelsFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(WebLinkAllowedSharedLinkAccessLevelsField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class WebLinkAllowedSharedLinkAccessLevelsFieldSerializer + extends JsonSerializer> { + + public WebLinkAllowedSharedLinkAccessLevelsFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +}