diff --git a/.codegen.json b/.codegen.json index 450692ca5..a179b8393 100644 --- a/.codegen.json +++ b/.codegen.json @@ -1 +1 @@ -{ "engineHash": "6772894", "specHash": "7f8494a", "version": "10.21.0" } +{ "engineHash": "6772894", "specHash": "7cec401", "version": "10.21.0" } diff --git a/docs/README.md b/docs/README.md index 6da729c0c..ce93ff79c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -14,6 +14,7 @@ General explanations of the available functionality and examples of how to use the SDK are available by topic: * [Ai](ai.md) +* [Aisessions](aisessions.md) * [Aistudio](aistudio.md) * [Appitemassociations](appitemassociations.md) * [Archives](archives.md) diff --git a/docs/aisessions.md b/docs/aisessions.md new file mode 100644 index 000000000..a288f080b --- /dev/null +++ b/docs/aisessions.md @@ -0,0 +1,74 @@ +# AiSessionsManager + + +- [List AI sessions](#list-ai-sessions) +- [Delete AI session](#delete-ai-session) + +## List AI sessions + +Returns a marker-paginated list of the AI sessions that the authenticated +user can read and that were created through the Box public API. Entries are +ordered by `sort` and `direction`, defaulting to `updated_at` descending so +the most recently active session appears first. + +The access token must have both the `ai.readwrite` and `root_readwrite` +scopes. + +A page may contain fewer than `limit` entries while further pages remain. +Treat a non-null `next_marker` as the only signal that more results exist. + +This operation is performed by calling function `getAiSessionsV2026R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/get-ai-sessions/). + +*Currently we don't have an example for calling `getAiSessionsV2026R0` in integration tests* + +### Arguments + +- queryParams `GetAiSessionsV2026R0QueryParams` + - Query parameters of getAiSessionsV2026R0 method +- headers `GetAiSessionsV2026R0Headers` + - Headers of getAiSessionsV2026R0 method + + +### Returns + +This function returns a value of type `AiSessionsV2026R0`. + +Returns a paginated list of AI sessions. + + +## Delete AI session + +Deletes an AI session created through the Box public API, together with its +agent tasks. The session's agent-generated files and uploaded files are +moved to the trash. Files attached as sources from elsewhere in Box are not +affected. Deleting a session does not stop a running task or notify the +agent. + +The access token must have both the `ai.readwrite` and `root_readwrite` +scopes. + +This operation is performed by calling function `deleteAiSessionByIdV2026R0`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/v2026.0/delete-ai-sessions-id/). + +*Currently we don't have an example for calling `deleteAiSessionByIdV2026R0` in integration tests* + +### Arguments + +- aiSessionId `String` + - The unique identifier of the AI session. This is the same value returned as `id` by the list endpoint and used as the A2A `contextId`. Example: "23489723" +- headers `DeleteAiSessionByIdV2026R0Headers` + - Headers of deleteAiSessionByIdV2026R0 method + + +### Returns + +This function returns a value of type `void`. + +Returns an empty response when the AI session was successfully deleted. + + diff --git a/src/main/java/com/box/sdkgen/client/BoxClient.java b/src/main/java/com/box/sdkgen/client/BoxClient.java index a46b0c350..5cc1e6b45 100644 --- a/src/main/java/com/box/sdkgen/client/BoxClient.java +++ b/src/main/java/com/box/sdkgen/client/BoxClient.java @@ -4,6 +4,7 @@ import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; import com.box.sdkgen.managers.ai.AiManager; +import com.box.sdkgen.managers.aisessions.AiSessionsManager; import com.box.sdkgen.managers.aistudio.AiStudioManager; import com.box.sdkgen.managers.appitemassociations.AppItemAssociationsManager; import com.box.sdkgen.managers.archives.ArchivesManager; @@ -285,6 +286,8 @@ public class BoxClient { public final ShuttleManager shuttle; + public final AiSessionsManager aiSessions; + public BoxClient(Authentication auth) { this.auth = auth; this.networkSession = new NetworkSession.Builder().baseUrls(new BaseUrls()).build(); @@ -649,6 +652,8 @@ public BoxClient(Authentication auth) { new QueryManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); this.shuttle = new ShuttleManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); + this.aiSessions = + new AiSessionsManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); } protected BoxClient(Builder builder) { @@ -1015,6 +1020,8 @@ protected BoxClient(Builder builder) { new QueryManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); this.shuttle = new ShuttleManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); + this.aiSessions = + new AiSessionsManager.Builder().auth(this.auth).networkSession(this.networkSession).build(); } /** @@ -1490,6 +1497,10 @@ public ShuttleManager getShuttle() { return shuttle; } + public AiSessionsManager getAiSessions() { + return aiSessions; + } + public static class Builder { protected final Authentication auth; diff --git a/src/main/java/com/box/sdkgen/managers/aisessions/AiSessionsManager.java b/src/main/java/com/box/sdkgen/managers/aisessions/AiSessionsManager.java new file mode 100644 index 000000000..50bc8ee3f --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aisessions/AiSessionsManager.java @@ -0,0 +1,180 @@ +package com.box.sdkgen.managers.aisessions; + +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.aisessionsv2026r0.AiSessionsV2026R0; +import com.box.sdkgen.serialization.json.JsonManager; +import java.util.Map; + +public class AiSessionsManager { + + public Authentication auth; + + public NetworkSession networkSession; + + public AiSessionsManager() { + this.networkSession = new NetworkSession(); + } + + protected AiSessionsManager(Builder builder) { + this.auth = builder.auth; + this.networkSession = builder.networkSession; + } + + /** + * Returns a marker-paginated list of the AI sessions that the authenticated user can read and + * that were created through the Box public API. Entries are ordered by `sort` and `direction`, + * defaulting to `updated_at` descending so the most recently active session appears first. + * + *

The access token must have both the `ai.readwrite` and `root_readwrite` scopes. + * + *

A page may contain fewer than `limit` entries while further pages remain. Treat a non-null + * `next_marker` as the only signal that more results exist. + * + * @param queryParams Query parameters of getAiSessionsV2026R0 method + */ + public AiSessionsV2026R0 getAiSessionsV2026R0(GetAiSessionsV2026R0QueryParams queryParams) { + return getAiSessionsV2026R0(queryParams, new GetAiSessionsV2026R0Headers()); + } + + /** + * Returns a marker-paginated list of the AI sessions that the authenticated user can read and + * that were created through the Box public API. Entries are ordered by `sort` and `direction`, + * defaulting to `updated_at` descending so the most recently active session appears first. + * + *

The access token must have both the `ai.readwrite` and `root_readwrite` scopes. + * + *

A page may contain fewer than `limit` entries while further pages remain. Treat a non-null + * `next_marker` as the only signal that more results exist. + * + * @param queryParams Query parameters of getAiSessionsV2026R0 method + * @param headers Headers of getAiSessionsV2026R0 method + */ + public AiSessionsV2026R0 getAiSessionsV2026R0( + GetAiSessionsV2026R0QueryParams queryParams, GetAiSessionsV2026R0Headers headers) { + Map queryParamsMap = + prepareParams( + mapOf( + entryOf("source", convertToString(queryParams.getSource())), + entryOf("marker", convertToString(queryParams.getMarker())), + entryOf("sort", convertToString(queryParams.getSort())), + entryOf("direction", convertToString(queryParams.getDirection())), + entryOf("limit", convertToString(queryParams.getLimit())), + entryOf("client_ids", convertToString(queryParams.getClientIds())))); + 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/ai_sessions"), + "GET") + .params(queryParamsMap) + .headers(headersMap) + .responseFormat(ResponseFormat.JSON) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + return JsonManager.deserialize(response.getData(), AiSessionsV2026R0.class); + } + + /** + * Deletes an AI session created through the Box public API, together with its agent tasks. The + * session's agent-generated files and uploaded files are moved to the trash. Files attached as + * sources from elsewhere in Box are not affected. Deleting a session does not stop a running task + * or notify the agent. + * + *

The access token must have both the `ai.readwrite` and `root_readwrite` scopes. + * + * @param aiSessionId The unique identifier of the AI session. This is the same value returned as + * `id` by the list endpoint and used as the A2A `contextId`. Example: "23489723" + */ + public void deleteAiSessionByIdV2026R0(String aiSessionId) { + deleteAiSessionByIdV2026R0(aiSessionId, new DeleteAiSessionByIdV2026R0Headers()); + } + + /** + * Deletes an AI session created through the Box public API, together with its agent tasks. The + * session's agent-generated files and uploaded files are moved to the trash. Files attached as + * sources from elsewhere in Box are not affected. Deleting a session does not stop a running task + * or notify the agent. + * + *

The access token must have both the `ai.readwrite` and `root_readwrite` scopes. + * + * @param aiSessionId The unique identifier of the AI session. This is the same value returned as + * `id` by the list endpoint and used as the A2A `contextId`. Example: "23489723" + * @param headers Headers of deleteAiSessionByIdV2026R0 method + */ + public void deleteAiSessionByIdV2026R0( + String aiSessionId, DeleteAiSessionByIdV2026R0Headers 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/ai_sessions/", + convertToString(aiSessionId)), + "DELETE") + .headers(headersMap) + .responseFormat(ResponseFormat.NO_CONTENT) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + } + + 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 AiSessionsManager build() { + if (this.networkSession == null) { + this.networkSession = new NetworkSession(); + } + return new AiSessionsManager(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aisessions/DeleteAiSessionByIdV2026R0Headers.java b/src/main/java/com/box/sdkgen/managers/aisessions/DeleteAiSessionByIdV2026R0Headers.java new file mode 100644 index 000000000..08eda388d --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aisessions/DeleteAiSessionByIdV2026R0Headers.java @@ -0,0 +1,68 @@ +package com.box.sdkgen.managers.aisessions; + +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 DeleteAiSessionByIdV2026R0Headers { + + /** Version header. */ + public EnumWrapper boxVersion; + + /** Extra headers that will be included in the HTTP request. */ + public Map extraHeaders; + + public DeleteAiSessionByIdV2026R0Headers() { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + this.extraHeaders = mapOf(); + } + + protected DeleteAiSessionByIdV2026R0Headers(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 DeleteAiSessionByIdV2026R0Headers build() { + if (this.boxVersion == null) { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + } + if (this.extraHeaders == null) { + this.extraHeaders = mapOf(); + } + return new DeleteAiSessionByIdV2026R0Headers(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0Headers.java b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0Headers.java new file mode 100644 index 000000000..a2ab1a8b8 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0Headers.java @@ -0,0 +1,68 @@ +package com.box.sdkgen.managers.aisessions; + +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 GetAiSessionsV2026R0Headers { + + /** Version header. */ + public EnumWrapper boxVersion; + + /** Extra headers that will be included in the HTTP request. */ + public Map extraHeaders; + + public GetAiSessionsV2026R0Headers() { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + this.extraHeaders = mapOf(); + } + + protected GetAiSessionsV2026R0Headers(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 GetAiSessionsV2026R0Headers build() { + if (this.boxVersion == null) { + this.boxVersion = new EnumWrapper(BoxVersionHeaderV2026R0._2026_0); + } + if (this.extraHeaders == null) { + this.extraHeaders = mapOf(); + } + return new GetAiSessionsV2026R0Headers(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParams.java b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParams.java new file mode 100644 index 000000000..882d158c9 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParams.java @@ -0,0 +1,147 @@ +package com.box.sdkgen.managers.aisessions; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import java.util.List; + +public class GetAiSessionsV2026R0QueryParams { + + /** Restricts the list to AI sessions with this origin. The only supported value is `api`. */ + public final EnumWrapper source; + + /** + * The position marker at which to begin returning results, as returned in `next_marker` by the + * previous page. Omit it for the first page. All other parameters must match the request that + * returned the marker. + */ + public String marker; + + /** + * The field to sort results by. Possible values are `created_at`, `updated_at`, and `name`. + * Default is `updated_at`, which advances on each turn of session activity. + */ + public EnumWrapper sort; + + /** + * The direction to sort results in, either ascending (`asc`) or descending (`desc`). Default is + * `desc`. + */ + public EnumWrapper direction; + + /** + * The maximum number of AI sessions to return per page. The maximum is `100`; larger values are + * treated as `100`. The server may return fewer entries than requested. + */ + public Integer limit; + + /** + * A comma-separated list of OAuth client IDs. Restricts the list to AI sessions created by any of + * these applications. Client IDs that match no application are ignored, so the response is an + * empty list if none of them match. Empty entries are ignored, and an empty value is treated as + * if the parameter were not provided. + */ + public List clientIds; + + public GetAiSessionsV2026R0QueryParams(GetAiSessionsV2026R0QueryParamsSourceField source) { + this.source = new EnumWrapper(source); + } + + public GetAiSessionsV2026R0QueryParams( + EnumWrapper source) { + this.source = source; + } + + protected GetAiSessionsV2026R0QueryParams(Builder builder) { + this.source = builder.source; + this.marker = builder.marker; + this.sort = builder.sort; + this.direction = builder.direction; + this.limit = builder.limit; + this.clientIds = builder.clientIds; + } + + public EnumWrapper getSource() { + return source; + } + + public String getMarker() { + return marker; + } + + public EnumWrapper getSort() { + return sort; + } + + public EnumWrapper getDirection() { + return direction; + } + + public Integer getLimit() { + return limit; + } + + public List getClientIds() { + return clientIds; + } + + public static class Builder { + + protected final EnumWrapper source; + + protected String marker; + + protected EnumWrapper sort; + + protected EnumWrapper direction; + + protected Integer limit; + + protected List clientIds; + + public Builder(GetAiSessionsV2026R0QueryParamsSourceField source) { + this.source = new EnumWrapper(source); + } + + public Builder(EnumWrapper source) { + this.source = source; + } + + public Builder marker(String marker) { + this.marker = marker; + return this; + } + + public Builder sort(GetAiSessionsV2026R0QueryParamsSortField sort) { + this.sort = new EnumWrapper(sort); + return this; + } + + public Builder sort(EnumWrapper sort) { + this.sort = sort; + return this; + } + + public Builder direction(GetAiSessionsV2026R0QueryParamsDirectionField direction) { + this.direction = new EnumWrapper(direction); + return this; + } + + public Builder direction(EnumWrapper direction) { + this.direction = direction; + return this; + } + + public Builder limit(Integer limit) { + this.limit = limit; + return this; + } + + public Builder clientIds(List clientIds) { + this.clientIds = clientIds; + return this; + } + + public GetAiSessionsV2026R0QueryParams build() { + return new GetAiSessionsV2026R0QueryParams(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParamsDirectionField.java b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParamsDirectionField.java new file mode 100644 index 000000000..c7c77b9ce --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParamsDirectionField.java @@ -0,0 +1,65 @@ +package com.box.sdkgen.managers.aisessions; + +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 GetAiSessionsV2026R0QueryParamsDirectionField implements Valuable { + ASC("asc"), + DESC("desc"); + + private final String value; + + GetAiSessionsV2026R0QueryParamsDirectionField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class GetAiSessionsV2026R0QueryParamsDirectionFieldDeserializer + extends JsonDeserializer> { + + public GetAiSessionsV2026R0QueryParamsDirectionFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(GetAiSessionsV2026R0QueryParamsDirectionField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class GetAiSessionsV2026R0QueryParamsDirectionFieldSerializer + extends JsonSerializer> { + + public GetAiSessionsV2026R0QueryParamsDirectionFieldSerializer() { + 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/managers/aisessions/GetAiSessionsV2026R0QueryParamsSortField.java b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParamsSortField.java new file mode 100644 index 000000000..2fd9d26ab --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParamsSortField.java @@ -0,0 +1,66 @@ +package com.box.sdkgen.managers.aisessions; + +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 GetAiSessionsV2026R0QueryParamsSortField implements Valuable { + CREATED_AT("created_at"), + UPDATED_AT("updated_at"), + NAME("name"); + + private final String value; + + GetAiSessionsV2026R0QueryParamsSortField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class GetAiSessionsV2026R0QueryParamsSortFieldDeserializer + extends JsonDeserializer> { + + public GetAiSessionsV2026R0QueryParamsSortFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(GetAiSessionsV2026R0QueryParamsSortField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class GetAiSessionsV2026R0QueryParamsSortFieldSerializer + extends JsonSerializer> { + + public GetAiSessionsV2026R0QueryParamsSortFieldSerializer() { + 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/managers/aisessions/GetAiSessionsV2026R0QueryParamsSourceField.java b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParamsSourceField.java new file mode 100644 index 000000000..767d9eb60 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aisessions/GetAiSessionsV2026R0QueryParamsSourceField.java @@ -0,0 +1,64 @@ +package com.box.sdkgen.managers.aisessions; + +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 GetAiSessionsV2026R0QueryParamsSourceField implements Valuable { + API("api"); + + private final String value; + + GetAiSessionsV2026R0QueryParamsSourceField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class GetAiSessionsV2026R0QueryParamsSourceFieldDeserializer + extends JsonDeserializer> { + + public GetAiSessionsV2026R0QueryParamsSourceFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(GetAiSessionsV2026R0QueryParamsSourceField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class GetAiSessionsV2026R0QueryParamsSourceFieldSerializer + extends JsonSerializer> { + + public GetAiSessionsV2026R0QueryParamsSourceFieldSerializer() { + 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/signrequestbase/SignRequestBase.java b/src/main/java/com/box/sdkgen/schemas/signrequestbase/SignRequestBase.java index b144af275..c02786273 100644 --- a/src/main/java/com/box/sdkgen/schemas/signrequestbase/SignRequestBase.java +++ b/src/main/java/com/box/sdkgen/schemas/signrequestbase/SignRequestBase.java @@ -48,10 +48,10 @@ public class SignRequestBase extends SerializableObject { * Message to include in sign request email. The field is cleaned through sanitization of specific * characters. However, some html tags are allowed. Links included in the message are also * converted to hyperlinks in the email. The message may contain the following html tags including - * `a`, `abbr`, `acronym`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and `strong`. - * Be aware that when the text to html ratio is too high, the email may end up in spam filters. - * Custom styles on these tags are not allowed. If this field is not passed, a default message - * will be used. + * `a`, `abbr`, `b`, `blockquote`, `code`, `em`, `i`, `ul`, `li`, `ol`, and `strong`. Be aware + * that when the text to html ratio is too high, the email may end up in spam filters. Custom + * styles on these tags are not allowed. If this field is not passed, a default message will be + * used. */ @JsonProperty("email_message") @Nullable diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionsv2026r0/AiSessionsV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionsv2026r0/AiSessionsV2026R0.java new file mode 100644 index 000000000..9918160b7 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionsv2026r0/AiSessionsV2026R0.java @@ -0,0 +1,117 @@ +package com.box.sdkgen.schemas.v2026r0.aisessionsv2026r0; + +import com.box.sdkgen.internal.Nullable; +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.v2026r0.aisessionv2026r0.AiSessionV2026R0; +import com.fasterxml.jackson.annotation.JsonFilter; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Objects; + +/** A paginated list of AI sessions. */ +@JsonFilter("nullablePropertyFilter") +public class AiSessionsV2026R0 extends SerializableObject { + + /** A list of AI sessions. The list is empty when there are no results. */ + protected final List entries; + + /** + * The limit that was used for these entries. This will be the same as the `limit` query parameter + * unless that value exceeded the maximum value allowed. The maximum value varies by API. + */ + protected final long limit; + + /** The marker for the start of the next page of results. */ + @JsonProperty("next_marker") + @Nullable + protected String nextMarker; + + public AiSessionsV2026R0( + @JsonProperty("entries") List entries, @JsonProperty("limit") long limit) { + super(); + this.entries = entries; + this.limit = limit; + } + + protected AiSessionsV2026R0(Builder builder) { + super(); + this.entries = builder.entries; + this.limit = builder.limit; + this.nextMarker = builder.nextMarker; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public List getEntries() { + return entries; + } + + public long getLimit() { + return limit; + } + + public String getNextMarker() { + return nextMarker; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiSessionsV2026R0 casted = (AiSessionsV2026R0) o; + return Objects.equals(entries, casted.entries) + && Objects.equals(limit, casted.limit) + && Objects.equals(nextMarker, casted.nextMarker); + } + + @Override + public int hashCode() { + return Objects.hash(entries, limit, nextMarker); + } + + @Override + public String toString() { + return "AiSessionsV2026R0{" + + "entries='" + + entries + + '\'' + + ", " + + "limit='" + + limit + + '\'' + + ", " + + "nextMarker='" + + nextMarker + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected final List entries; + + protected final long limit; + + protected String nextMarker; + + public Builder(List entries, long limit) { + super(); + this.entries = entries; + this.limit = limit; + } + + public Builder nextMarker(String nextMarker) { + this.nextMarker = nextMarker; + this.markNullableFieldAsSet("next_marker"); + return this; + } + + public AiSessionsV2026R0 build() { + return new AiSessionsV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionv2026r0/AiSessionV2026R0.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionv2026r0/AiSessionV2026R0.java new file mode 100644 index 000000000..ee4513536 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionv2026r0/AiSessionV2026R0.java @@ -0,0 +1,289 @@ +package com.box.sdkgen.schemas.v2026r0.aisessionv2026r0; + +import com.box.sdkgen.internal.Nullable; +import com.box.sdkgen.internal.NullableFieldTracker; +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.internal.utils.DateTimeUtils; +import com.box.sdkgen.schemas.v2026r0.userbasev2026r0.UserBaseV2026R0; +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.time.OffsetDateTime; +import java.util.Objects; + +/** + * A standard representation of an AI session. An AI session holds the conversation state for a + * series of interactions with a Box AI agent. Its `id` is the A2A context identifier for that + * conversation. + */ +@JsonFilter("nullablePropertyFilter") +public class AiSessionV2026R0 extends SerializableObject { + + /** The value is always `ai_session`. */ + @JsonDeserialize(using = AiSessionV2026R0TypeField.AiSessionV2026R0TypeFieldDeserializer.class) + @JsonSerialize(using = AiSessionV2026R0TypeField.AiSessionV2026R0TypeFieldSerializer.class) + protected EnumWrapper type; + + /** + * The unique identifier for the AI session. This is also the A2A `contextId` for the + * conversation. Treat the value as opaque. + */ + protected final String id; + + /** + * The display name of the AI session. Sessions created through the A2A API are named + * automatically. The value is `null` only when no name was recorded. + */ + @Nullable protected String name; + + /** + * The origin of the AI session. Currently always `api`. New values may be added, so clients must + * tolerate values they do not recognize. + */ + @JsonDeserialize( + using = AiSessionV2026R0SourceField.AiSessionV2026R0SourceFieldDeserializer.class) + @JsonSerialize(using = AiSessionV2026R0SourceField.AiSessionV2026R0SourceFieldSerializer.class) + protected EnumWrapper source; + + /** + * The OAuth client ID of the application that created the AI session, as shown in the Developer + * Console. The value is `null` if the application is not known. + */ + @JsonProperty("client_id") + @Nullable + protected String clientId; + + @JsonProperty("created_by") + protected final UserBaseV2026R0 createdBy; + + @JsonProperty("updated_by") + protected final UserBaseV2026R0 updatedBy; + + /** The date and time when the AI session was created. */ + @JsonProperty("created_at") + @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) + @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) + protected final OffsetDateTime createdAt; + + /** + * The date and time when the AI session was last updated. It advances on each turn of session + * activity, so it also serves as the most recently used ordering. + */ + @JsonProperty("updated_at") + @JsonSerialize(using = DateTimeUtils.DateTimeSerializer.class) + @JsonDeserialize(using = DateTimeUtils.DateTimeDeserializer.class) + protected final OffsetDateTime updatedAt; + + public AiSessionV2026R0( + @JsonProperty("id") String id, + @JsonProperty("created_by") UserBaseV2026R0 createdBy, + @JsonProperty("updated_by") UserBaseV2026R0 updatedBy, + @JsonProperty("created_at") OffsetDateTime createdAt, + @JsonProperty("updated_at") OffsetDateTime updatedAt) { + super(); + this.id = id; + this.createdBy = createdBy; + this.updatedBy = updatedBy; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + this.type = new EnumWrapper(AiSessionV2026R0TypeField.AI_SESSION); + this.source = new EnumWrapper(AiSessionV2026R0SourceField.API); + } + + protected AiSessionV2026R0(Builder builder) { + super(); + this.type = builder.type; + this.id = builder.id; + this.name = builder.name; + this.source = builder.source; + this.clientId = builder.clientId; + this.createdBy = builder.createdBy; + this.updatedBy = builder.updatedBy; + this.createdAt = builder.createdAt; + this.updatedAt = builder.updatedAt; + markNullableFieldsAsSet(builder.getExplicitlySetNullableFields()); + } + + public EnumWrapper getType() { + return type; + } + + public String getId() { + return id; + } + + public String getName() { + return name; + } + + public EnumWrapper getSource() { + return source; + } + + public String getClientId() { + return clientId; + } + + public UserBaseV2026R0 getCreatedBy() { + return createdBy; + } + + public UserBaseV2026R0 getUpdatedBy() { + return updatedBy; + } + + public OffsetDateTime getCreatedAt() { + return createdAt; + } + + public OffsetDateTime getUpdatedAt() { + return updatedAt; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiSessionV2026R0 casted = (AiSessionV2026R0) o; + return Objects.equals(type, casted.type) + && Objects.equals(id, casted.id) + && Objects.equals(name, casted.name) + && Objects.equals(source, casted.source) + && Objects.equals(clientId, casted.clientId) + && Objects.equals(createdBy, casted.createdBy) + && Objects.equals(updatedBy, casted.updatedBy) + && Objects.equals(createdAt, casted.createdAt) + && Objects.equals(updatedAt, casted.updatedAt); + } + + @Override + public int hashCode() { + return Objects.hash( + type, id, name, source, clientId, createdBy, updatedBy, createdAt, updatedAt); + } + + @Override + public String toString() { + return "AiSessionV2026R0{" + + "type='" + + type + + '\'' + + ", " + + "id='" + + id + + '\'' + + ", " + + "name='" + + name + + '\'' + + ", " + + "source='" + + source + + '\'' + + ", " + + "clientId='" + + clientId + + '\'' + + ", " + + "createdBy='" + + createdBy + + '\'' + + ", " + + "updatedBy='" + + updatedBy + + '\'' + + ", " + + "createdAt='" + + createdAt + + '\'' + + ", " + + "updatedAt='" + + updatedAt + + '\'' + + "}"; + } + + public static class Builder extends NullableFieldTracker { + + protected EnumWrapper type; + + protected final String id; + + protected String name; + + protected EnumWrapper source; + + protected String clientId; + + protected final UserBaseV2026R0 createdBy; + + protected final UserBaseV2026R0 updatedBy; + + protected final OffsetDateTime createdAt; + + protected final OffsetDateTime updatedAt; + + public Builder( + String id, + UserBaseV2026R0 createdBy, + UserBaseV2026R0 updatedBy, + OffsetDateTime createdAt, + OffsetDateTime updatedAt) { + super(); + this.id = id; + this.createdBy = createdBy; + this.updatedBy = updatedBy; + this.createdAt = createdAt; + this.updatedAt = updatedAt; + } + + public Builder type(AiSessionV2026R0TypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public Builder type(EnumWrapper type) { + this.type = type; + return this; + } + + public Builder name(String name) { + this.name = name; + this.markNullableFieldAsSet("name"); + return this; + } + + public Builder source(AiSessionV2026R0SourceField source) { + this.source = new EnumWrapper(source); + return this; + } + + public Builder source(EnumWrapper source) { + this.source = source; + return this; + } + + public Builder clientId(String clientId) { + this.clientId = clientId; + this.markNullableFieldAsSet("client_id"); + return this; + } + + public AiSessionV2026R0 build() { + if (this.type == null) { + this.type = + new EnumWrapper(AiSessionV2026R0TypeField.AI_SESSION); + } + if (this.source == null) { + this.source = new EnumWrapper(AiSessionV2026R0SourceField.API); + } + return new AiSessionV2026R0(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionv2026r0/AiSessionV2026R0SourceField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionv2026r0/AiSessionV2026R0SourceField.java new file mode 100644 index 000000000..d63f712b4 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionv2026r0/AiSessionV2026R0SourceField.java @@ -0,0 +1,64 @@ +package com.box.sdkgen.schemas.v2026r0.aisessionv2026r0; + +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 AiSessionV2026R0SourceField implements Valuable { + API("api"); + + private final String value; + + AiSessionV2026R0SourceField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class AiSessionV2026R0SourceFieldDeserializer + extends JsonDeserializer> { + + public AiSessionV2026R0SourceFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AiSessionV2026R0SourceField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AiSessionV2026R0SourceFieldSerializer + extends JsonSerializer> { + + public AiSessionV2026R0SourceFieldSerializer() { + 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/aisessionv2026r0/AiSessionV2026R0TypeField.java b/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionv2026r0/AiSessionV2026R0TypeField.java new file mode 100644 index 000000000..ad1bcfb11 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/v2026r0/aisessionv2026r0/AiSessionV2026R0TypeField.java @@ -0,0 +1,64 @@ +package com.box.sdkgen.schemas.v2026r0.aisessionv2026r0; + +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 AiSessionV2026R0TypeField implements Valuable { + AI_SESSION("ai_session"); + + private final String value; + + AiSessionV2026R0TypeField(String value) { + this.value = value; + } + + @JsonValue + public String getValue() { + return value; + } + + public static class AiSessionV2026R0TypeFieldDeserializer + extends JsonDeserializer> { + + public AiSessionV2026R0TypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AiSessionV2026R0TypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AiSessionV2026R0TypeFieldSerializer + extends JsonSerializer> { + + public AiSessionV2026R0TypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +}