diff --git a/docs/README.md b/docs/README.md index f943d670..033b4226 100644 --- a/docs/README.md +++ b/docs/README.md @@ -6,6 +6,7 @@ General explanations of the available functionality and examples of how to use the SDK are available by topic: * [Ai](ai.md) +* [Aistudio](aistudio.md) * [Appitemassociations](appitemassociations.md) * [Authorization](authorization.md) * [Avatars](avatars.md) diff --git a/docs/aistudio.md b/docs/aistudio.md new file mode 100644 index 00000000..4576179f --- /dev/null +++ b/docs/aistudio.md @@ -0,0 +1,158 @@ +# AiStudioManager + + +- [List AI agents](#list-ai-agents) +- [Create AI agent](#create-ai-agent) +- [Update AI agent](#update-ai-agent) +- [Get AI agent by agent ID](#get-ai-agent-by-agent-id) +- [Delete AI agent](#delete-ai-agent) + +## List AI agents + +Lists AI agents based on the provided parameters. + +This operation is performed by calling function `getAiAgents`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/get-ai-agents/). + + +``` +client.getAiStudio().getAiAgents() +``` + +### Arguments + +- queryParams `GetAiAgentsQueryParams` + - Query parameters of getAiAgents method +- headers `GetAiAgentsHeaders` + - Headers of getAiAgents method + + +### Returns + +This function returns a value of type `AiMultipleAgentResponse`. + +A successful response including the agents list. + + +## Create AI agent + +Creates an AI agent. At least one of the following capabilities must be provided: `ask`, `text_gen`, `extract`. + +This operation is performed by calling function `createAiAgent`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/post-ai-agents/). + + +``` +client.getAiStudio().createAiAgent(new CreateAiAgent.CreateAiAgentBuilder(agentName, "enabled").ask(new AiStudioAgentAsk("enabled", "desc1")).build()) +``` + +### Arguments + +- requestBody `CreateAiAgent` + - Request body of createAiAgent method +- headers `CreateAiAgentHeaders` + - Headers of createAiAgent method + + +### Returns + +This function returns a value of type `AiSingleAgentResponseFull`. + +Definition of created AI agent. + + +## Update AI agent + +Updates an AI agent. + +This operation is performed by calling function `updateAiAgentById`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/put-ai-agents-id/). + + +``` +client.getAiStudio().updateAiAgentById(createdAgent.getId(), new CreateAiAgent.CreateAiAgentBuilder(agentName, "enabled").ask(new AiStudioAgentAsk("disabled", "desc2")).build()) +``` + +### Arguments + +- agentId `String` + - The ID of the agent to update. Example: "1234" +- requestBody `CreateAiAgent` + - Request body of updateAiAgentById method +- headers `UpdateAiAgentByIdHeaders` + - Headers of updateAiAgentById method + + +### Returns + +This function returns a value of type `AiSingleAgentResponseFull`. + +Definition of created AI agent. + + +## Get AI agent by agent ID + +Gets an AI Agent using the `agent_id` parameter. + +This operation is performed by calling function `getAiAgentById`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/get-ai-agents-id/). + + +``` +client.getAiStudio().getAiAgentById(createdAgent.getId(), new GetAiAgentByIdQueryParams.GetAiAgentByIdQueryParamsBuilder().fields(Arrays.asList("ask")).build()) +``` + +### Arguments + +- agentId `String` + - The agent id to get. Example: "1234" +- queryParams `GetAiAgentByIdQueryParams` + - Query parameters of getAiAgentById method +- headers `GetAiAgentByIdHeaders` + - Headers of getAiAgentById method + + +### Returns + +This function returns a value of type `AiSingleAgentResponseFull`. + +A successful response including the agent. + + +## Delete AI agent + +Deletes an AI agent using the provided parameters. + +This operation is performed by calling function `deleteAiAgentById`. + +See the endpoint docs at +[API Reference](https://developer.box.com/reference/delete-ai-agents-id/). + + +``` +client.getAiStudio().deleteAiAgentById(createdAgent.getId()) +``` + +### Arguments + +- agentId `String` + - The ID of the agent to delete. Example: "1234" +- headers `DeleteAiAgentByIdHeaders` + - Headers of deleteAiAgentById method + + +### Returns + +This function returns a value of type `void`. + +A successful response with no content. + + diff --git a/docs/docgen.md b/docs/docgen.md index 32a92d76..fba91701 100644 --- a/docs/docgen.md +++ b/docs/docgen.md @@ -3,8 +3,8 @@ - [Get Box Doc Gen job by ID](#get-box-doc-gen-job-by-id) - [List all Box Doc Gen jobs](#list-all-box-doc-gen-jobs) -- [Get Box Doc Gen jobs in a batch with a specific ID](#get-box-doc-gen-jobs-in-a-batch-with-a-specific-id) -- [Generate document using a Box Doc Gen template](#generate-document-using-a-box-doc-gen-template) +- [Get Box Doc Gen jobs by batch ID](#get-box-doc-gen-jobs-by-batch-id) +- [Generate document using Box Doc Gen template](#generate-document-using-box-doc-gen-template) ## Get Box Doc Gen job by ID @@ -64,7 +64,7 @@ This function returns a value of type `DocGenJobsFullV2025R0`. A list of Box Doc Gen jobs. -## Get Box Doc Gen jobs in a batch with a specific ID +## Get Box Doc Gen jobs by batch ID Lists Box Doc Gen jobs in a batch @@ -95,7 +95,7 @@ This function returns a value of type `DocGenJobsV2025R0`. Returns a list of Box Doc Gen jobs in a Box Doc Gen batch. -## Generate document using a Box Doc Gen template +## Generate document using Box Doc Gen template Generates a document using a Box Doc Gen template. diff --git a/docs/docgentemplate.md b/docs/docgentemplate.md index 0b583ff6..493b3458 100644 --- a/docs/docgentemplate.md +++ b/docs/docgentemplate.md @@ -1,14 +1,14 @@ # DocgenTemplateManager -- [Create a Box Doc Gen template](#create-a-box-doc-gen-template) +- [Create Box Doc Gen template](#create-box-doc-gen-template) - [List Box Doc Gen templates](#list-box-doc-gen-templates) - [Delete Box Doc Gen template](#delete-box-doc-gen-template) - [Get Box Doc Gen template by ID](#get-box-doc-gen-template-by-id) - [List all Box Doc Gen template tags in template](#list-all-box-doc-gen-template-tags-in-template) - [Get list of all Box Doc Gen jobs for template](#get-list-of-all-box-doc-gen-jobs-for-template) -## Create a Box Doc Gen template +## Create Box Doc Gen template Marks a file as a Box Doc Gen template. diff --git a/src/main/java/com/box/sdkgen/client/BoxClient.java b/src/main/java/com/box/sdkgen/client/BoxClient.java index ca7f4734..5e16fea7 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.aistudio.AiStudioManager; import com.box.sdkgen.managers.appitemassociations.AppItemAssociationsManager; import com.box.sdkgen.managers.authorization.AuthorizationManager; import com.box.sdkgen.managers.avatars.AvatarsManager; @@ -231,6 +232,8 @@ public class BoxClient { public final AiManager ai; + public final AiStudioManager aiStudio; + public final DocgenTemplateManager docgenTemplate; public final DocgenManager docgen; @@ -592,6 +595,11 @@ public BoxClient(Authentication auth) { .auth(this.auth) .networkSession(this.networkSession) .build(); + this.aiStudio = + new AiStudioManager.AiStudioManagerBuilder() + .auth(this.auth) + .networkSession(this.networkSession) + .build(); this.docgenTemplate = new DocgenTemplateManager.DocgenTemplateManagerBuilder() .auth(this.auth) @@ -960,6 +968,11 @@ protected BoxClient(BoxClientBuilder builder) { .auth(this.auth) .networkSession(this.networkSession) .build(); + this.aiStudio = + new AiStudioManager.AiStudioManagerBuilder() + .auth(this.auth) + .networkSession(this.networkSession) + .build(); this.docgenTemplate = new DocgenTemplateManager.DocgenTemplateManagerBuilder() .auth(this.auth) @@ -1319,6 +1332,10 @@ public AiManager getAi() { return ai; } + public AiStudioManager getAiStudio() { + return aiStudio; + } + public DocgenTemplateManager getDocgenTemplate() { return docgenTemplate; } diff --git a/src/main/java/com/box/sdkgen/managers/aistudio/AiStudioManager.java b/src/main/java/com/box/sdkgen/managers/aistudio/AiStudioManager.java new file mode 100644 index 00000000..16a53a8f --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aistudio/AiStudioManager.java @@ -0,0 +1,219 @@ +package com.box.sdkgen.managers.aistudio; + +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.aimultipleagentresponse.AiMultipleAgentResponse; +import com.box.sdkgen.schemas.aisingleagentresponsefull.AiSingleAgentResponseFull; +import com.box.sdkgen.schemas.createaiagent.CreateAiAgent; +import com.box.sdkgen.serialization.json.JsonManager; +import java.util.Map; + +public class AiStudioManager { + + public Authentication auth; + + public NetworkSession networkSession; + + public AiStudioManager() { + this.networkSession = new NetworkSession(); + } + + protected AiStudioManager(AiStudioManagerBuilder builder) { + this.auth = builder.auth; + this.networkSession = builder.networkSession; + } + + public AiMultipleAgentResponse getAiAgents() { + return getAiAgents(new GetAiAgentsQueryParams(), new GetAiAgentsHeaders()); + } + + public AiMultipleAgentResponse getAiAgents(GetAiAgentsQueryParams queryParams) { + return getAiAgents(queryParams, new GetAiAgentsHeaders()); + } + + public AiMultipleAgentResponse getAiAgents(GetAiAgentsHeaders headers) { + return getAiAgents(new GetAiAgentsQueryParams(), headers); + } + + public AiMultipleAgentResponse getAiAgents( + GetAiAgentsQueryParams queryParams, GetAiAgentsHeaders headers) { + Map queryParamsMap = + prepareParams( + mapOf( + entryOf("mode", convertToString(queryParams.getMode())), + entryOf("fields", convertToString(queryParams.getFields())), + entryOf("agent_state", convertToString(queryParams.getAgentState())), + entryOf("include_box_default", convertToString(queryParams.getIncludeBoxDefault())), + entryOf("marker", convertToString(queryParams.getMarker())), + entryOf("limit", convertToString(queryParams.getLimit())))); + Map headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders())); + FetchResponse response = + this.networkSession + .getNetworkClient() + .fetch( + new FetchOptions.FetchOptionsBuilder( + String.join( + "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/ai_agents"), + "GET") + .params(queryParamsMap) + .headers(headersMap) + .responseFormat(ResponseFormat.JSON) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + return JsonManager.deserialize(response.getData(), AiMultipleAgentResponse.class); + } + + public AiSingleAgentResponseFull createAiAgent(CreateAiAgent requestBody) { + return createAiAgent(requestBody, new CreateAiAgentHeaders()); + } + + public AiSingleAgentResponseFull createAiAgent( + CreateAiAgent requestBody, CreateAiAgentHeaders headers) { + Map headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders())); + FetchResponse response = + this.networkSession + .getNetworkClient() + .fetch( + new FetchOptions.FetchOptionsBuilder( + String.join( + "", this.networkSession.getBaseUrls().getBaseUrl(), "/2.0/ai_agents"), + "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(), AiSingleAgentResponseFull.class); + } + + public AiSingleAgentResponseFull updateAiAgentById(String agentId, CreateAiAgent requestBody) { + return updateAiAgentById(agentId, requestBody, new UpdateAiAgentByIdHeaders()); + } + + public AiSingleAgentResponseFull updateAiAgentById( + String agentId, CreateAiAgent requestBody, UpdateAiAgentByIdHeaders headers) { + Map headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders())); + FetchResponse response = + this.networkSession + .getNetworkClient() + .fetch( + new FetchOptions.FetchOptionsBuilder( + String.join( + "", + this.networkSession.getBaseUrls().getBaseUrl(), + "/2.0/ai_agents/", + convertToString(agentId)), + "PUT") + .headers(headersMap) + .data(JsonManager.serialize(requestBody)) + .contentType("application/json") + .responseFormat(ResponseFormat.JSON) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + return JsonManager.deserialize(response.getData(), AiSingleAgentResponseFull.class); + } + + public AiSingleAgentResponseFull getAiAgentById(String agentId) { + return getAiAgentById(agentId, new GetAiAgentByIdQueryParams(), new GetAiAgentByIdHeaders()); + } + + public AiSingleAgentResponseFull getAiAgentById( + String agentId, GetAiAgentByIdQueryParams queryParams) { + return getAiAgentById(agentId, queryParams, new GetAiAgentByIdHeaders()); + } + + public AiSingleAgentResponseFull getAiAgentById(String agentId, GetAiAgentByIdHeaders headers) { + return getAiAgentById(agentId, new GetAiAgentByIdQueryParams(), headers); + } + + public AiSingleAgentResponseFull getAiAgentById( + String agentId, GetAiAgentByIdQueryParams queryParams, GetAiAgentByIdHeaders headers) { + Map queryParamsMap = + prepareParams(mapOf(entryOf("fields", convertToString(queryParams.getFields())))); + Map headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders())); + FetchResponse response = + this.networkSession + .getNetworkClient() + .fetch( + new FetchOptions.FetchOptionsBuilder( + String.join( + "", + this.networkSession.getBaseUrls().getBaseUrl(), + "/2.0/ai_agents/", + convertToString(agentId)), + "GET") + .params(queryParamsMap) + .headers(headersMap) + .responseFormat(ResponseFormat.JSON) + .auth(this.auth) + .networkSession(this.networkSession) + .build()); + return JsonManager.deserialize(response.getData(), AiSingleAgentResponseFull.class); + } + + public void deleteAiAgentById(String agentId) { + deleteAiAgentById(agentId, new DeleteAiAgentByIdHeaders()); + } + + public void deleteAiAgentById(String agentId, DeleteAiAgentByIdHeaders headers) { + Map headersMap = prepareParams(mergeMaps(mapOf(), headers.getExtraHeaders())); + FetchResponse response = + this.networkSession + .getNetworkClient() + .fetch( + new FetchOptions.FetchOptionsBuilder( + String.join( + "", + this.networkSession.getBaseUrls().getBaseUrl(), + "/2.0/ai_agents/", + convertToString(agentId)), + "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 AiStudioManagerBuilder { + + protected Authentication auth; + + protected NetworkSession networkSession; + + public AiStudioManagerBuilder auth(Authentication auth) { + this.auth = auth; + return this; + } + + public AiStudioManagerBuilder networkSession(NetworkSession networkSession) { + this.networkSession = networkSession; + return this; + } + + public AiStudioManager build() { + return new AiStudioManager(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aistudio/CreateAiAgentHeaders.java b/src/main/java/com/box/sdkgen/managers/aistudio/CreateAiAgentHeaders.java new file mode 100644 index 00000000..5ad689bf --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aistudio/CreateAiAgentHeaders.java @@ -0,0 +1,36 @@ +package com.box.sdkgen.managers.aistudio; + +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; + +import java.util.Map; + +public class CreateAiAgentHeaders { + + public Map extraHeaders; + + public CreateAiAgentHeaders() { + this.extraHeaders = mapOf(); + } + + protected CreateAiAgentHeaders(CreateAiAgentHeadersBuilder builder) { + this.extraHeaders = builder.extraHeaders; + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public static class CreateAiAgentHeadersBuilder { + + protected Map extraHeaders; + + public CreateAiAgentHeadersBuilder extraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public CreateAiAgentHeaders build() { + return new CreateAiAgentHeaders(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aistudio/DeleteAiAgentByIdHeaders.java b/src/main/java/com/box/sdkgen/managers/aistudio/DeleteAiAgentByIdHeaders.java new file mode 100644 index 00000000..d2634421 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aistudio/DeleteAiAgentByIdHeaders.java @@ -0,0 +1,36 @@ +package com.box.sdkgen.managers.aistudio; + +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; + +import java.util.Map; + +public class DeleteAiAgentByIdHeaders { + + public Map extraHeaders; + + public DeleteAiAgentByIdHeaders() { + this.extraHeaders = mapOf(); + } + + protected DeleteAiAgentByIdHeaders(DeleteAiAgentByIdHeadersBuilder builder) { + this.extraHeaders = builder.extraHeaders; + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public static class DeleteAiAgentByIdHeadersBuilder { + + protected Map extraHeaders; + + public DeleteAiAgentByIdHeadersBuilder extraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public DeleteAiAgentByIdHeaders build() { + return new DeleteAiAgentByIdHeaders(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentByIdHeaders.java b/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentByIdHeaders.java new file mode 100644 index 00000000..adf1e67a --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentByIdHeaders.java @@ -0,0 +1,36 @@ +package com.box.sdkgen.managers.aistudio; + +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; + +import java.util.Map; + +public class GetAiAgentByIdHeaders { + + public Map extraHeaders; + + public GetAiAgentByIdHeaders() { + this.extraHeaders = mapOf(); + } + + protected GetAiAgentByIdHeaders(GetAiAgentByIdHeadersBuilder builder) { + this.extraHeaders = builder.extraHeaders; + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public static class GetAiAgentByIdHeadersBuilder { + + protected Map extraHeaders; + + public GetAiAgentByIdHeadersBuilder extraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public GetAiAgentByIdHeaders build() { + return new GetAiAgentByIdHeaders(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentByIdQueryParams.java b/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentByIdQueryParams.java new file mode 100644 index 00000000..2a4efb6b --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentByIdQueryParams.java @@ -0,0 +1,32 @@ +package com.box.sdkgen.managers.aistudio; + +import java.util.List; + +public class GetAiAgentByIdQueryParams { + + public List fields; + + public GetAiAgentByIdQueryParams() {} + + protected GetAiAgentByIdQueryParams(GetAiAgentByIdQueryParamsBuilder builder) { + this.fields = builder.fields; + } + + public List getFields() { + return fields; + } + + public static class GetAiAgentByIdQueryParamsBuilder { + + protected List fields; + + public GetAiAgentByIdQueryParamsBuilder fields(List fields) { + this.fields = fields; + return this; + } + + public GetAiAgentByIdQueryParams build() { + return new GetAiAgentByIdQueryParams(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentsHeaders.java b/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentsHeaders.java new file mode 100644 index 00000000..0ab189fc --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentsHeaders.java @@ -0,0 +1,36 @@ +package com.box.sdkgen.managers.aistudio; + +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; + +import java.util.Map; + +public class GetAiAgentsHeaders { + + public Map extraHeaders; + + public GetAiAgentsHeaders() { + this.extraHeaders = mapOf(); + } + + protected GetAiAgentsHeaders(GetAiAgentsHeadersBuilder builder) { + this.extraHeaders = builder.extraHeaders; + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public static class GetAiAgentsHeadersBuilder { + + protected Map extraHeaders; + + public GetAiAgentsHeadersBuilder extraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public GetAiAgentsHeaders build() { + return new GetAiAgentsHeaders(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentsQueryParams.java b/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentsQueryParams.java new file mode 100644 index 00000000..90aeb078 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aistudio/GetAiAgentsQueryParams.java @@ -0,0 +1,102 @@ +package com.box.sdkgen.managers.aistudio; + +import java.util.List; + +public class GetAiAgentsQueryParams { + + public List mode; + + public List fields; + + public List agentState; + + public Boolean includeBoxDefault; + + public String marker; + + public Long limit; + + public GetAiAgentsQueryParams() {} + + protected GetAiAgentsQueryParams(GetAiAgentsQueryParamsBuilder builder) { + this.mode = builder.mode; + this.fields = builder.fields; + this.agentState = builder.agentState; + this.includeBoxDefault = builder.includeBoxDefault; + this.marker = builder.marker; + this.limit = builder.limit; + } + + public List getMode() { + return mode; + } + + public List getFields() { + return fields; + } + + public List getAgentState() { + return agentState; + } + + public Boolean getIncludeBoxDefault() { + return includeBoxDefault; + } + + public String getMarker() { + return marker; + } + + public Long getLimit() { + return limit; + } + + public static class GetAiAgentsQueryParamsBuilder { + + protected List mode; + + protected List fields; + + protected List agentState; + + protected Boolean includeBoxDefault; + + protected String marker; + + protected Long limit; + + public GetAiAgentsQueryParamsBuilder mode(List mode) { + this.mode = mode; + return this; + } + + public GetAiAgentsQueryParamsBuilder fields(List fields) { + this.fields = fields; + return this; + } + + public GetAiAgentsQueryParamsBuilder agentState(List agentState) { + this.agentState = agentState; + return this; + } + + public GetAiAgentsQueryParamsBuilder includeBoxDefault(Boolean includeBoxDefault) { + this.includeBoxDefault = includeBoxDefault; + return this; + } + + public GetAiAgentsQueryParamsBuilder marker(String marker) { + this.marker = marker; + return this; + } + + public GetAiAgentsQueryParamsBuilder limit(Long limit) { + this.limit = limit; + return this; + } + + public GetAiAgentsQueryParams build() { + return new GetAiAgentsQueryParams(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/managers/aistudio/UpdateAiAgentByIdHeaders.java b/src/main/java/com/box/sdkgen/managers/aistudio/UpdateAiAgentByIdHeaders.java new file mode 100644 index 00000000..b8ecbfc5 --- /dev/null +++ b/src/main/java/com/box/sdkgen/managers/aistudio/UpdateAiAgentByIdHeaders.java @@ -0,0 +1,36 @@ +package com.box.sdkgen.managers.aistudio; + +import static com.box.sdkgen.internal.utils.UtilsManager.mapOf; + +import java.util.Map; + +public class UpdateAiAgentByIdHeaders { + + public Map extraHeaders; + + public UpdateAiAgentByIdHeaders() { + this.extraHeaders = mapOf(); + } + + protected UpdateAiAgentByIdHeaders(UpdateAiAgentByIdHeadersBuilder builder) { + this.extraHeaders = builder.extraHeaders; + } + + public Map getExtraHeaders() { + return extraHeaders; + } + + public static class UpdateAiAgentByIdHeadersBuilder { + + protected Map extraHeaders; + + public UpdateAiAgentByIdHeadersBuilder extraHeaders(Map extraHeaders) { + this.extraHeaders = extraHeaders; + return this; + } + + public UpdateAiAgentByIdHeaders build() { + return new UpdateAiAgentByIdHeaders(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aiagentallowedentity/AiAgentAllowedEntity.java b/src/main/java/com/box/sdkgen/schemas/aiagentallowedentity/AiAgentAllowedEntity.java new file mode 100644 index 00000000..e4eb7ccb --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aiagentallowedentity/AiAgentAllowedEntity.java @@ -0,0 +1,58 @@ +package com.box.sdkgen.schemas.aiagentallowedentity; + +import com.box.sdkgen.internal.OneOfTwo; +import com.box.sdkgen.schemas.groupbase.GroupBase; +import com.box.sdkgen.schemas.userbase.UserBase; +import com.box.sdkgen.serialization.json.JsonManager; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.io.IOException; + +@JsonDeserialize(using = AiAgentAllowedEntity.AiAgentAllowedEntityDeserializer.class) +@JsonSerialize(using = OneOfTwo.OneOfTwoSerializer.class) +public class AiAgentAllowedEntity extends OneOfTwo { + + public AiAgentAllowedEntity(UserBase userBase) { + super(userBase, null); + } + + public AiAgentAllowedEntity(GroupBase groupBase) { + super(null, groupBase); + } + + public UserBase getUserBase() { + return value0; + } + + public GroupBase getGroupBase() { + return value1; + } + + static class AiAgentAllowedEntityDeserializer extends JsonDeserializer { + + public AiAgentAllowedEntityDeserializer() { + super(); + } + + @Override + public AiAgentAllowedEntity deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + JsonNode node = JsonManager.jsonToSerializedData(jp); + JsonNode discriminant0 = node.get("type"); + if (!(discriminant0 == null)) { + switch (discriminant0.asText()) { + case "user": + return new AiAgentAllowedEntity(JsonManager.deserialize(node, UserBase.class)); + case "group": + return new AiAgentAllowedEntity(JsonManager.deserialize(node, GroupBase.class)); + } + } + throw new JsonMappingException(jp, "Unable to deserialize AiAgentAllowedEntity"); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aiagentaskoraiagentreference/AiAgentAskOrAiAgentReference.java b/src/main/java/com/box/sdkgen/schemas/aiagentaskoraiagentreference/AiAgentAskOrAiAgentReference.java new file mode 100644 index 00000000..66ba7b4f --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aiagentaskoraiagentreference/AiAgentAskOrAiAgentReference.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.aiagentaskoraiagentreference; + +import com.box.sdkgen.internal.OneOfTwo; +import com.box.sdkgen.schemas.aiagentask.AiAgentAsk; +import com.box.sdkgen.schemas.aiagentreference.AiAgentReference; +import com.box.sdkgen.serialization.json.JsonManager; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.io.IOException; + +@JsonDeserialize( + using = AiAgentAskOrAiAgentReference.AiAgentAskOrAiAgentReferenceDeserializer.class) +@JsonSerialize(using = OneOfTwo.OneOfTwoSerializer.class) +public class AiAgentAskOrAiAgentReference extends OneOfTwo { + + public AiAgentAskOrAiAgentReference(AiAgentAsk aiAgentAsk) { + super(aiAgentAsk, null); + } + + public AiAgentAskOrAiAgentReference(AiAgentReference aiAgentReference) { + super(null, aiAgentReference); + } + + public AiAgentAsk getAiAgentAsk() { + return value0; + } + + public AiAgentReference getAiAgentReference() { + return value1; + } + + static class AiAgentAskOrAiAgentReferenceDeserializer + extends JsonDeserializer { + + public AiAgentAskOrAiAgentReferenceDeserializer() { + super(); + } + + @Override + public AiAgentAskOrAiAgentReference deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + JsonNode node = JsonManager.jsonToSerializedData(jp); + JsonNode discriminant0 = node.get("type"); + if (!(discriminant0 == null)) { + switch (discriminant0.asText()) { + case "ai_agent_ask": + return new AiAgentAskOrAiAgentReference( + JsonManager.deserialize(node, AiAgentAsk.class)); + case "ai_agent_id": + return new AiAgentAskOrAiAgentReference( + JsonManager.deserialize(node, AiAgentReference.class)); + } + } + throw new JsonMappingException(jp, "Unable to deserialize AiAgentAskOrAiAgentReference"); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aiagentextractoraiagentreference/AiAgentExtractOrAiAgentReference.java b/src/main/java/com/box/sdkgen/schemas/aiagentextractoraiagentreference/AiAgentExtractOrAiAgentReference.java new file mode 100644 index 00000000..410f5c88 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aiagentextractoraiagentreference/AiAgentExtractOrAiAgentReference.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.aiagentextractoraiagentreference; + +import com.box.sdkgen.internal.OneOfTwo; +import com.box.sdkgen.schemas.aiagentextract.AiAgentExtract; +import com.box.sdkgen.schemas.aiagentreference.AiAgentReference; +import com.box.sdkgen.serialization.json.JsonManager; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.io.IOException; + +@JsonDeserialize( + using = AiAgentExtractOrAiAgentReference.AiAgentExtractOrAiAgentReferenceDeserializer.class) +@JsonSerialize(using = OneOfTwo.OneOfTwoSerializer.class) +public class AiAgentExtractOrAiAgentReference extends OneOfTwo { + + public AiAgentExtractOrAiAgentReference(AiAgentExtract aiAgentExtract) { + super(aiAgentExtract, null); + } + + public AiAgentExtractOrAiAgentReference(AiAgentReference aiAgentReference) { + super(null, aiAgentReference); + } + + public AiAgentExtract getAiAgentExtract() { + return value0; + } + + public AiAgentReference getAiAgentReference() { + return value1; + } + + static class AiAgentExtractOrAiAgentReferenceDeserializer + extends JsonDeserializer { + + public AiAgentExtractOrAiAgentReferenceDeserializer() { + super(); + } + + @Override + public AiAgentExtractOrAiAgentReference deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + JsonNode node = JsonManager.jsonToSerializedData(jp); + JsonNode discriminant0 = node.get("type"); + if (!(discriminant0 == null)) { + switch (discriminant0.asText()) { + case "ai_agent_extract": + return new AiAgentExtractOrAiAgentReference( + JsonManager.deserialize(node, AiAgentExtract.class)); + case "ai_agent_id": + return new AiAgentExtractOrAiAgentReference( + JsonManager.deserialize(node, AiAgentReference.class)); + } + } + throw new JsonMappingException(jp, "Unable to deserialize AiAgentExtractOrAiAgentReference"); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aiagentextractstructuredoraiagentreference/AiAgentExtractStructuredOrAiAgentReference.java b/src/main/java/com/box/sdkgen/schemas/aiagentextractstructuredoraiagentreference/AiAgentExtractStructuredOrAiAgentReference.java new file mode 100644 index 00000000..d5704650 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aiagentextractstructuredoraiagentreference/AiAgentExtractStructuredOrAiAgentReference.java @@ -0,0 +1,67 @@ +package com.box.sdkgen.schemas.aiagentextractstructuredoraiagentreference; + +import com.box.sdkgen.internal.OneOfTwo; +import com.box.sdkgen.schemas.aiagentextractstructured.AiAgentExtractStructured; +import com.box.sdkgen.schemas.aiagentreference.AiAgentReference; +import com.box.sdkgen.serialization.json.JsonManager; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.io.IOException; + +@JsonDeserialize( + using = + AiAgentExtractStructuredOrAiAgentReference + .AiAgentExtractStructuredOrAiAgentReferenceDeserializer.class) +@JsonSerialize(using = OneOfTwo.OneOfTwoSerializer.class) +public class AiAgentExtractStructuredOrAiAgentReference + extends OneOfTwo { + + public AiAgentExtractStructuredOrAiAgentReference( + AiAgentExtractStructured aiAgentExtractStructured) { + super(aiAgentExtractStructured, null); + } + + public AiAgentExtractStructuredOrAiAgentReference(AiAgentReference aiAgentReference) { + super(null, aiAgentReference); + } + + public AiAgentExtractStructured getAiAgentExtractStructured() { + return value0; + } + + public AiAgentReference getAiAgentReference() { + return value1; + } + + static class AiAgentExtractStructuredOrAiAgentReferenceDeserializer + extends JsonDeserializer { + + public AiAgentExtractStructuredOrAiAgentReferenceDeserializer() { + super(); + } + + @Override + public AiAgentExtractStructuredOrAiAgentReference deserialize( + JsonParser jp, DeserializationContext ctxt) throws IOException { + JsonNode node = JsonManager.jsonToSerializedData(jp); + JsonNode discriminant0 = node.get("type"); + if (!(discriminant0 == null)) { + switch (discriminant0.asText()) { + case "ai_agent_extract_structured": + return new AiAgentExtractStructuredOrAiAgentReference( + JsonManager.deserialize(node, AiAgentExtractStructured.class)); + case "ai_agent_id": + return new AiAgentExtractStructuredOrAiAgentReference( + JsonManager.deserialize(node, AiAgentReference.class)); + } + } + throw new JsonMappingException( + jp, "Unable to deserialize AiAgentExtractStructuredOrAiAgentReference"); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReference.java b/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReference.java new file mode 100644 index 00000000..a91aa5e2 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReference.java @@ -0,0 +1,83 @@ +package com.box.sdkgen.schemas.aiagentreference; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +public class AiAgentReference extends SerializableObject { + + @JsonDeserialize(using = AiAgentReferenceTypeField.AiAgentReferenceTypeFieldDeserializer.class) + @JsonSerialize(using = AiAgentReferenceTypeField.AiAgentReferenceTypeFieldSerializer.class) + protected EnumWrapper type; + + protected String id; + + public AiAgentReference() { + super(); + this.type = new EnumWrapper(AiAgentReferenceTypeField.AI_AGENT_ID); + } + + protected AiAgentReference(AiAgentReferenceBuilder builder) { + super(); + this.type = builder.type; + this.id = builder.id; + } + + public EnumWrapper getType() { + return type; + } + + public String getId() { + return id; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiAgentReference casted = (AiAgentReference) o; + return Objects.equals(type, casted.type) && Objects.equals(id, casted.id); + } + + @Override + public int hashCode() { + return Objects.hash(type, id); + } + + @Override + public String toString() { + return "AiAgentReference{" + "type='" + type + '\'' + ", " + "id='" + id + '\'' + "}"; + } + + public static class AiAgentReferenceBuilder { + + protected EnumWrapper type; + + protected String id; + + public AiAgentReferenceBuilder type(AiAgentReferenceTypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public AiAgentReferenceBuilder type(EnumWrapper type) { + this.type = type; + return this; + } + + public AiAgentReferenceBuilder id(String id) { + this.id = id; + return this; + } + + public AiAgentReference build() { + return new AiAgentReference(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReferenceTypeField.java b/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReferenceTypeField.java new file mode 100644 index 00000000..5a1b7bd5 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aiagentreference/AiAgentReferenceTypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.aiagentreference; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum AiAgentReferenceTypeField implements Valuable { + AI_AGENT_ID("ai_agent_id"); + + private final String value; + + AiAgentReferenceTypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class AiAgentReferenceTypeFieldDeserializer + extends JsonDeserializer> { + + public AiAgentReferenceTypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AiAgentReferenceTypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AiAgentReferenceTypeFieldSerializer + extends JsonSerializer> { + + public AiAgentReferenceTypeFieldSerializer() { + 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/aiagentreferenceoraiagenttextgen/AiAgentReferenceOrAiAgentTextGen.java b/src/main/java/com/box/sdkgen/schemas/aiagentreferenceoraiagenttextgen/AiAgentReferenceOrAiAgentTextGen.java new file mode 100644 index 00000000..f4fd762e --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aiagentreferenceoraiagenttextgen/AiAgentReferenceOrAiAgentTextGen.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.aiagentreferenceoraiagenttextgen; + +import com.box.sdkgen.internal.OneOfTwo; +import com.box.sdkgen.schemas.aiagentreference.AiAgentReference; +import com.box.sdkgen.schemas.aiagenttextgen.AiAgentTextGen; +import com.box.sdkgen.serialization.json.JsonManager; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.io.IOException; + +@JsonDeserialize( + using = AiAgentReferenceOrAiAgentTextGen.AiAgentReferenceOrAiAgentTextGenDeserializer.class) +@JsonSerialize(using = OneOfTwo.OneOfTwoSerializer.class) +public class AiAgentReferenceOrAiAgentTextGen extends OneOfTwo { + + public AiAgentReferenceOrAiAgentTextGen(AiAgentReference aiAgentReference) { + super(aiAgentReference, null); + } + + public AiAgentReferenceOrAiAgentTextGen(AiAgentTextGen aiAgentTextGen) { + super(null, aiAgentTextGen); + } + + public AiAgentReference getAiAgentReference() { + return value0; + } + + public AiAgentTextGen getAiAgentTextGen() { + return value1; + } + + static class AiAgentReferenceOrAiAgentTextGenDeserializer + extends JsonDeserializer { + + public AiAgentReferenceOrAiAgentTextGenDeserializer() { + super(); + } + + @Override + public AiAgentReferenceOrAiAgentTextGen deserialize(JsonParser jp, DeserializationContext ctxt) + throws IOException { + JsonNode node = JsonManager.jsonToSerializedData(jp); + JsonNode discriminant0 = node.get("type"); + if (!(discriminant0 == null)) { + switch (discriminant0.asText()) { + case "ai_agent_id": + return new AiAgentReferenceOrAiAgentTextGen( + JsonManager.deserialize(node, AiAgentReference.class)); + case "ai_agent_text_gen": + return new AiAgentReferenceOrAiAgentTextGen( + JsonManager.deserialize(node, AiAgentTextGen.class)); + } + } + throw new JsonMappingException(jp, "Unable to deserialize AiAgentReferenceOrAiAgentTextGen"); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aiask/AiAsk.java b/src/main/java/com/box/sdkgen/schemas/aiask/AiAsk.java index 972957e4..30bd19bf 100644 --- a/src/main/java/com/box/sdkgen/schemas/aiask/AiAsk.java +++ b/src/main/java/com/box/sdkgen/schemas/aiask/AiAsk.java @@ -1,7 +1,7 @@ package com.box.sdkgen.schemas.aiask; import com.box.sdkgen.internal.SerializableObject; -import com.box.sdkgen.schemas.aiagentask.AiAgentAsk; +import com.box.sdkgen.schemas.aiagentaskoraiagentreference.AiAgentAskOrAiAgentReference; import com.box.sdkgen.schemas.aidialoguehistory.AiDialogueHistory; import com.box.sdkgen.schemas.aiitemask.AiItemAsk; import com.box.sdkgen.serialization.json.EnumWrapper; @@ -28,7 +28,7 @@ public class AiAsk extends SerializableObject { protected Boolean includeCitations; @JsonProperty("ai_agent") - protected AiAgentAsk aiAgent; + protected AiAgentAskOrAiAgentReference aiAgent; public AiAsk( @JsonProperty("mode") EnumWrapper mode, @@ -77,7 +77,7 @@ public Boolean getIncludeCitations() { return includeCitations; } - public AiAgentAsk getAiAgent() { + public AiAgentAskOrAiAgentReference getAiAgent() { return aiAgent; } @@ -144,7 +144,7 @@ public static class AiAskBuilder { protected Boolean includeCitations; - protected AiAgentAsk aiAgent; + protected AiAgentAskOrAiAgentReference aiAgent; public AiAskBuilder(EnumWrapper mode, String prompt, List items) { this.mode = mode; @@ -168,7 +168,7 @@ public AiAskBuilder includeCitations(Boolean includeCitations) { return this; } - public AiAskBuilder aiAgent(AiAgentAsk aiAgent) { + public AiAskBuilder aiAgent(AiAgentAskOrAiAgentReference aiAgent) { this.aiAgent = aiAgent; return this; } diff --git a/src/main/java/com/box/sdkgen/schemas/aiextract/AiExtract.java b/src/main/java/com/box/sdkgen/schemas/aiextract/AiExtract.java index e7271aa6..a1f499c0 100644 --- a/src/main/java/com/box/sdkgen/schemas/aiextract/AiExtract.java +++ b/src/main/java/com/box/sdkgen/schemas/aiextract/AiExtract.java @@ -1,7 +1,7 @@ package com.box.sdkgen.schemas.aiextract; import com.box.sdkgen.internal.SerializableObject; -import com.box.sdkgen.schemas.aiagentextract.AiAgentExtract; +import com.box.sdkgen.schemas.aiagentextractoraiagentreference.AiAgentExtractOrAiAgentReference; import com.box.sdkgen.schemas.aiitembase.AiItemBase; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -14,7 +14,7 @@ public class AiExtract extends SerializableObject { protected final List items; @JsonProperty("ai_agent") - protected AiAgentExtract aiAgent; + protected AiAgentExtractOrAiAgentReference aiAgent; public AiExtract( @JsonProperty("prompt") String prompt, @JsonProperty("items") List items) { @@ -38,7 +38,7 @@ public List getItems() { return items; } - public AiAgentExtract getAiAgent() { + public AiAgentExtractOrAiAgentReference getAiAgent() { return aiAgent; } @@ -84,14 +84,14 @@ public static class AiExtractBuilder { protected final List items; - protected AiAgentExtract aiAgent; + protected AiAgentExtractOrAiAgentReference aiAgent; public AiExtractBuilder(String prompt, List items) { this.prompt = prompt; this.items = items; } - public AiExtractBuilder aiAgent(AiAgentExtract aiAgent) { + public AiExtractBuilder aiAgent(AiAgentExtractOrAiAgentReference aiAgent) { this.aiAgent = aiAgent; return this; } diff --git a/src/main/java/com/box/sdkgen/schemas/aiextractstructured/AiExtractStructured.java b/src/main/java/com/box/sdkgen/schemas/aiextractstructured/AiExtractStructured.java index 53bbbbdc..49103ae2 100644 --- a/src/main/java/com/box/sdkgen/schemas/aiextractstructured/AiExtractStructured.java +++ b/src/main/java/com/box/sdkgen/schemas/aiextractstructured/AiExtractStructured.java @@ -1,7 +1,7 @@ package com.box.sdkgen.schemas.aiextractstructured; import com.box.sdkgen.internal.SerializableObject; -import com.box.sdkgen.schemas.aiagentextractstructured.AiAgentExtractStructured; +import com.box.sdkgen.schemas.aiagentextractstructuredoraiagentreference.AiAgentExtractStructuredOrAiAgentReference; import com.box.sdkgen.schemas.aiitembase.AiItemBase; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -17,7 +17,7 @@ public class AiExtractStructured extends SerializableObject { protected List fields; @JsonProperty("ai_agent") - protected AiAgentExtractStructured aiAgent; + protected AiAgentExtractStructuredOrAiAgentReference aiAgent; public AiExtractStructured(@JsonProperty("items") List items) { super(); @@ -44,7 +44,7 @@ public List getFields() { return fields; } - public AiAgentExtractStructured getAiAgent() { + public AiAgentExtractStructuredOrAiAgentReference getAiAgent() { return aiAgent; } @@ -97,7 +97,7 @@ public static class AiExtractStructuredBuilder { protected List fields; - protected AiAgentExtractStructured aiAgent; + protected AiAgentExtractStructuredOrAiAgentReference aiAgent; public AiExtractStructuredBuilder(List items) { this.items = items; @@ -114,7 +114,7 @@ public AiExtractStructuredBuilder fields(List fi return this; } - public AiExtractStructuredBuilder aiAgent(AiAgentExtractStructured aiAgent) { + public AiExtractStructuredBuilder aiAgent(AiAgentExtractStructuredOrAiAgentReference aiAgent) { this.aiAgent = aiAgent; return this; } diff --git a/src/main/java/com/box/sdkgen/schemas/aimultipleagentresponse/AiMultipleAgentResponse.java b/src/main/java/com/box/sdkgen/schemas/aimultipleagentresponse/AiMultipleAgentResponse.java new file mode 100644 index 00000000..52dc8c43 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aimultipleagentresponse/AiMultipleAgentResponse.java @@ -0,0 +1,124 @@ +package com.box.sdkgen.schemas.aimultipleagentresponse; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.aisingleagentresponsefull.AiSingleAgentResponseFull; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Objects; + +public class AiMultipleAgentResponse extends SerializableObject { + + protected Long limit; + + @JsonProperty("next_marker") + protected String nextMarker; + + @JsonProperty("prev_marker") + protected String prevMarker; + + protected final List entries; + + public AiMultipleAgentResponse(@JsonProperty("entries") List entries) { + super(); + this.entries = entries; + } + + protected AiMultipleAgentResponse(AiMultipleAgentResponseBuilder builder) { + super(); + this.limit = builder.limit; + this.nextMarker = builder.nextMarker; + this.prevMarker = builder.prevMarker; + this.entries = builder.entries; + } + + public Long getLimit() { + return limit; + } + + public String getNextMarker() { + return nextMarker; + } + + public String getPrevMarker() { + return prevMarker; + } + + public List getEntries() { + return entries; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiMultipleAgentResponse casted = (AiMultipleAgentResponse) o; + return Objects.equals(limit, casted.limit) + && Objects.equals(nextMarker, casted.nextMarker) + && Objects.equals(prevMarker, casted.prevMarker) + && Objects.equals(entries, casted.entries); + } + + @Override + public int hashCode() { + return Objects.hash(limit, nextMarker, prevMarker, entries); + } + + @Override + public String toString() { + return "AiMultipleAgentResponse{" + + "limit='" + + limit + + '\'' + + ", " + + "nextMarker='" + + nextMarker + + '\'' + + ", " + + "prevMarker='" + + prevMarker + + '\'' + + ", " + + "entries='" + + entries + + '\'' + + "}"; + } + + public static class AiMultipleAgentResponseBuilder { + + protected Long limit; + + protected String nextMarker; + + protected String prevMarker; + + protected final List entries; + + public AiMultipleAgentResponseBuilder(List entries) { + this.entries = entries; + } + + public AiMultipleAgentResponseBuilder limit(Long limit) { + this.limit = limit; + return this; + } + + public AiMultipleAgentResponseBuilder nextMarker(String nextMarker) { + this.nextMarker = nextMarker; + return this; + } + + public AiMultipleAgentResponseBuilder prevMarker(String prevMarker) { + this.prevMarker = prevMarker; + return this; + } + + public AiMultipleAgentResponse build() { + return new AiMultipleAgentResponse(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aisingleagentresponse/AiSingleAgentResponse.java b/src/main/java/com/box/sdkgen/schemas/aisingleagentresponse/AiSingleAgentResponse.java new file mode 100644 index 00000000..eb9f26cb --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aisingleagentresponse/AiSingleAgentResponse.java @@ -0,0 +1,282 @@ +package com.box.sdkgen.schemas.aisingleagentresponse; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.aiagentallowedentity.AiAgentAllowedEntity; +import com.box.sdkgen.schemas.userbase.UserBase; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.List; +import java.util.Objects; + +public class AiSingleAgentResponse extends SerializableObject { + + protected final String id; + + @JsonDeserialize( + using = AiSingleAgentResponseTypeField.AiSingleAgentResponseTypeFieldDeserializer.class) + @JsonSerialize( + using = AiSingleAgentResponseTypeField.AiSingleAgentResponseTypeFieldSerializer.class) + protected EnumWrapper type; + + protected final String origin; + + protected final String name; + + @JsonProperty("access_state") + protected final String accessState; + + @JsonProperty("created_by") + protected UserBase createdBy; + + @JsonProperty("created_at") + protected String createdAt; + + @JsonProperty("modified_by") + protected UserBase modifiedBy; + + @JsonProperty("modified_at") + protected String modifiedAt; + + @JsonProperty("icon_reference") + protected String iconReference; + + @JsonProperty("allowed_entities") + protected List allowedEntities; + + public AiSingleAgentResponse( + @JsonProperty("id") String id, + @JsonProperty("origin") String origin, + @JsonProperty("name") String name, + @JsonProperty("access_state") String accessState) { + super(); + this.id = id; + this.origin = origin; + this.name = name; + this.accessState = accessState; + } + + protected AiSingleAgentResponse(AiSingleAgentResponseBuilder builder) { + super(); + this.id = builder.id; + this.type = builder.type; + this.origin = builder.origin; + this.name = builder.name; + this.accessState = builder.accessState; + this.createdBy = builder.createdBy; + this.createdAt = builder.createdAt; + this.modifiedBy = builder.modifiedBy; + this.modifiedAt = builder.modifiedAt; + this.iconReference = builder.iconReference; + this.allowedEntities = builder.allowedEntities; + } + + public String getId() { + return id; + } + + public EnumWrapper getType() { + return type; + } + + public String getOrigin() { + return origin; + } + + public String getName() { + return name; + } + + public String getAccessState() { + return accessState; + } + + public UserBase getCreatedBy() { + return createdBy; + } + + public String getCreatedAt() { + return createdAt; + } + + public UserBase getModifiedBy() { + return modifiedBy; + } + + public String getModifiedAt() { + return modifiedAt; + } + + public String getIconReference() { + return iconReference; + } + + public List getAllowedEntities() { + return allowedEntities; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiSingleAgentResponse casted = (AiSingleAgentResponse) o; + return Objects.equals(id, casted.id) + && Objects.equals(type, casted.type) + && Objects.equals(origin, casted.origin) + && Objects.equals(name, casted.name) + && Objects.equals(accessState, casted.accessState) + && Objects.equals(createdBy, casted.createdBy) + && Objects.equals(createdAt, casted.createdAt) + && Objects.equals(modifiedBy, casted.modifiedBy) + && Objects.equals(modifiedAt, casted.modifiedAt) + && Objects.equals(iconReference, casted.iconReference) + && Objects.equals(allowedEntities, casted.allowedEntities); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + type, + origin, + name, + accessState, + createdBy, + createdAt, + modifiedBy, + modifiedAt, + iconReference, + allowedEntities); + } + + @Override + public String toString() { + return "AiSingleAgentResponse{" + + "id='" + + id + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "origin='" + + origin + + '\'' + + ", " + + "name='" + + name + + '\'' + + ", " + + "accessState='" + + accessState + + '\'' + + ", " + + "createdBy='" + + createdBy + + '\'' + + ", " + + "createdAt='" + + createdAt + + '\'' + + ", " + + "modifiedBy='" + + modifiedBy + + '\'' + + ", " + + "modifiedAt='" + + modifiedAt + + '\'' + + ", " + + "iconReference='" + + iconReference + + '\'' + + ", " + + "allowedEntities='" + + allowedEntities + + '\'' + + "}"; + } + + public static class AiSingleAgentResponseBuilder { + + protected final String id; + + protected EnumWrapper type; + + protected final String origin; + + protected final String name; + + protected final String accessState; + + protected UserBase createdBy; + + protected String createdAt; + + protected UserBase modifiedBy; + + protected String modifiedAt; + + protected String iconReference; + + protected List allowedEntities; + + public AiSingleAgentResponseBuilder(String id, String origin, String name, String accessState) { + this.id = id; + this.origin = origin; + this.name = name; + this.accessState = accessState; + } + + public AiSingleAgentResponseBuilder type(AiSingleAgentResponseTypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public AiSingleAgentResponseBuilder type(EnumWrapper type) { + this.type = type; + return this; + } + + public AiSingleAgentResponseBuilder createdBy(UserBase createdBy) { + this.createdBy = createdBy; + return this; + } + + public AiSingleAgentResponseBuilder createdAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + public AiSingleAgentResponseBuilder modifiedBy(UserBase modifiedBy) { + this.modifiedBy = modifiedBy; + return this; + } + + public AiSingleAgentResponseBuilder modifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + public AiSingleAgentResponseBuilder iconReference(String iconReference) { + this.iconReference = iconReference; + return this; + } + + public AiSingleAgentResponseBuilder allowedEntities( + List allowedEntities) { + this.allowedEntities = allowedEntities; + return this; + } + + public AiSingleAgentResponse build() { + return new AiSingleAgentResponse(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aisingleagentresponse/AiSingleAgentResponseTypeField.java b/src/main/java/com/box/sdkgen/schemas/aisingleagentresponse/AiSingleAgentResponseTypeField.java new file mode 100644 index 00000000..bd48fcfd --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aisingleagentresponse/AiSingleAgentResponseTypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.aisingleagentresponse; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum AiSingleAgentResponseTypeField implements Valuable { + AI_AGENT("ai_agent"); + + private final String value; + + AiSingleAgentResponseTypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class AiSingleAgentResponseTypeFieldDeserializer + extends JsonDeserializer> { + + public AiSingleAgentResponseTypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AiSingleAgentResponseTypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AiSingleAgentResponseTypeFieldSerializer + extends JsonSerializer> { + + public AiSingleAgentResponseTypeFieldSerializer() { + 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/aisingleagentresponsefull/AiSingleAgentResponseFull.java b/src/main/java/com/box/sdkgen/schemas/aisingleagentresponsefull/AiSingleAgentResponseFull.java new file mode 100644 index 00000000..8b267008 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aisingleagentresponsefull/AiSingleAgentResponseFull.java @@ -0,0 +1,237 @@ +package com.box.sdkgen.schemas.aisingleagentresponsefull; + +import com.box.sdkgen.schemas.aiagentallowedentity.AiAgentAllowedEntity; +import com.box.sdkgen.schemas.aisingleagentresponse.AiSingleAgentResponse; +import com.box.sdkgen.schemas.aisingleagentresponse.AiSingleAgentResponseTypeField; +import com.box.sdkgen.schemas.aistudioagentask.AiStudioAgentAsk; +import com.box.sdkgen.schemas.aistudioagentextract.AiStudioAgentExtract; +import com.box.sdkgen.schemas.aistudioagenttextgen.AiStudioAgentTextGen; +import com.box.sdkgen.schemas.userbase.UserBase; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Objects; + +public class AiSingleAgentResponseFull extends AiSingleAgentResponse { + + protected AiStudioAgentAsk ask; + + @JsonProperty("text_gen") + protected AiStudioAgentTextGen textGen; + + protected AiStudioAgentExtract extract; + + public AiSingleAgentResponseFull( + @JsonProperty("id") String id, + @JsonProperty("origin") String origin, + @JsonProperty("name") String name, + @JsonProperty("access_state") String accessState) { + super(id, origin, name, accessState); + } + + protected AiSingleAgentResponseFull(AiSingleAgentResponseFullBuilder builder) { + super(builder); + this.ask = builder.ask; + this.textGen = builder.textGen; + this.extract = builder.extract; + } + + public AiStudioAgentAsk getAsk() { + return ask; + } + + public AiStudioAgentTextGen getTextGen() { + return textGen; + } + + public AiStudioAgentExtract getExtract() { + return extract; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiSingleAgentResponseFull casted = (AiSingleAgentResponseFull) o; + return Objects.equals(id, casted.id) + && Objects.equals(type, casted.type) + && Objects.equals(origin, casted.origin) + && Objects.equals(name, casted.name) + && Objects.equals(accessState, casted.accessState) + && Objects.equals(createdBy, casted.createdBy) + && Objects.equals(createdAt, casted.createdAt) + && Objects.equals(modifiedBy, casted.modifiedBy) + && Objects.equals(modifiedAt, casted.modifiedAt) + && Objects.equals(iconReference, casted.iconReference) + && Objects.equals(allowedEntities, casted.allowedEntities) + && Objects.equals(ask, casted.ask) + && Objects.equals(textGen, casted.textGen) + && Objects.equals(extract, casted.extract); + } + + @Override + public int hashCode() { + return Objects.hash( + id, + type, + origin, + name, + accessState, + createdBy, + createdAt, + modifiedBy, + modifiedAt, + iconReference, + allowedEntities, + ask, + textGen, + extract); + } + + @Override + public String toString() { + return "AiSingleAgentResponseFull{" + + "id='" + + id + + '\'' + + ", " + + "type='" + + type + + '\'' + + ", " + + "origin='" + + origin + + '\'' + + ", " + + "name='" + + name + + '\'' + + ", " + + "accessState='" + + accessState + + '\'' + + ", " + + "createdBy='" + + createdBy + + '\'' + + ", " + + "createdAt='" + + createdAt + + '\'' + + ", " + + "modifiedBy='" + + modifiedBy + + '\'' + + ", " + + "modifiedAt='" + + modifiedAt + + '\'' + + ", " + + "iconReference='" + + iconReference + + '\'' + + ", " + + "allowedEntities='" + + allowedEntities + + '\'' + + ", " + + "ask='" + + ask + + '\'' + + ", " + + "textGen='" + + textGen + + '\'' + + ", " + + "extract='" + + extract + + '\'' + + "}"; + } + + public static class AiSingleAgentResponseFullBuilder extends AiSingleAgentResponseBuilder { + + protected AiStudioAgentAsk ask; + + protected AiStudioAgentTextGen textGen; + + protected AiStudioAgentExtract extract; + + public AiSingleAgentResponseFullBuilder( + String id, String origin, String name, String accessState) { + super(id, origin, name, accessState); + } + + public AiSingleAgentResponseFullBuilder ask(AiStudioAgentAsk ask) { + this.ask = ask; + return this; + } + + public AiSingleAgentResponseFullBuilder textGen(AiStudioAgentTextGen textGen) { + this.textGen = textGen; + return this; + } + + public AiSingleAgentResponseFullBuilder extract(AiStudioAgentExtract extract) { + this.extract = extract; + return this; + } + + @Override + public AiSingleAgentResponseFullBuilder type(AiSingleAgentResponseTypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + @Override + public AiSingleAgentResponseFullBuilder type(EnumWrapper type) { + this.type = type; + return this; + } + + @Override + public AiSingleAgentResponseFullBuilder createdBy(UserBase createdBy) { + this.createdBy = createdBy; + return this; + } + + @Override + public AiSingleAgentResponseFullBuilder createdAt(String createdAt) { + this.createdAt = createdAt; + return this; + } + + @Override + public AiSingleAgentResponseFullBuilder modifiedBy(UserBase modifiedBy) { + this.modifiedBy = modifiedBy; + return this; + } + + @Override + public AiSingleAgentResponseFullBuilder modifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + return this; + } + + @Override + public AiSingleAgentResponseFullBuilder iconReference(String iconReference) { + this.iconReference = iconReference; + return this; + } + + @Override + public AiSingleAgentResponseFullBuilder allowedEntities( + List allowedEntities) { + this.allowedEntities = allowedEntities; + return this; + } + + public AiSingleAgentResponseFull build() { + return new AiSingleAgentResponseFull(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aistudioagentask/AiStudioAgentAsk.java b/src/main/java/com/box/sdkgen/schemas/aistudioagentask/AiStudioAgentAsk.java new file mode 100644 index 00000000..b8ef1dfd --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aistudioagentask/AiStudioAgentAsk.java @@ -0,0 +1,224 @@ +package com.box.sdkgen.schemas.aistudioagentask; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.aistudioagentbasictexttool.AiStudioAgentBasicTextTool; +import com.box.sdkgen.schemas.aistudioagentlongtexttool.AiStudioAgentLongTextTool; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +public class AiStudioAgentAsk extends SerializableObject { + + @JsonDeserialize(using = AiStudioAgentAskTypeField.AiStudioAgentAskTypeFieldDeserializer.class) + @JsonSerialize(using = AiStudioAgentAskTypeField.AiStudioAgentAskTypeFieldSerializer.class) + protected EnumWrapper type; + + @JsonProperty("access_state") + protected final String accessState; + + protected final String description; + + @JsonProperty("custom_instructions") + protected String customInstructions; + + @JsonProperty("long_text") + protected AiStudioAgentLongTextTool longText; + + @JsonProperty("basic_text") + protected AiStudioAgentBasicTextTool basicText; + + @JsonProperty("long_text_multi") + protected AiStudioAgentLongTextTool longTextMulti; + + @JsonProperty("basic_text_multi") + protected AiStudioAgentBasicTextTool basicTextMulti; + + public AiStudioAgentAsk( + @JsonProperty("access_state") String accessState, + @JsonProperty("description") String description) { + super(); + this.accessState = accessState; + this.description = description; + this.type = new EnumWrapper(AiStudioAgentAskTypeField.AI_AGENT_ASK); + } + + protected AiStudioAgentAsk(AiStudioAgentAskBuilder builder) { + super(); + this.type = builder.type; + this.accessState = builder.accessState; + this.description = builder.description; + this.customInstructions = builder.customInstructions; + this.longText = builder.longText; + this.basicText = builder.basicText; + this.longTextMulti = builder.longTextMulti; + this.basicTextMulti = builder.basicTextMulti; + } + + public EnumWrapper getType() { + return type; + } + + public String getAccessState() { + return accessState; + } + + public String getDescription() { + return description; + } + + public String getCustomInstructions() { + return customInstructions; + } + + public AiStudioAgentLongTextTool getLongText() { + return longText; + } + + public AiStudioAgentBasicTextTool getBasicText() { + return basicText; + } + + public AiStudioAgentLongTextTool getLongTextMulti() { + return longTextMulti; + } + + public AiStudioAgentBasicTextTool getBasicTextMulti() { + return basicTextMulti; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiStudioAgentAsk casted = (AiStudioAgentAsk) o; + return Objects.equals(type, casted.type) + && Objects.equals(accessState, casted.accessState) + && Objects.equals(description, casted.description) + && Objects.equals(customInstructions, casted.customInstructions) + && Objects.equals(longText, casted.longText) + && Objects.equals(basicText, casted.basicText) + && Objects.equals(longTextMulti, casted.longTextMulti) + && Objects.equals(basicTextMulti, casted.basicTextMulti); + } + + @Override + public int hashCode() { + return Objects.hash( + type, + accessState, + description, + customInstructions, + longText, + basicText, + longTextMulti, + basicTextMulti); + } + + @Override + public String toString() { + return "AiStudioAgentAsk{" + + "type='" + + type + + '\'' + + ", " + + "accessState='" + + accessState + + '\'' + + ", " + + "description='" + + description + + '\'' + + ", " + + "customInstructions='" + + customInstructions + + '\'' + + ", " + + "longText='" + + longText + + '\'' + + ", " + + "basicText='" + + basicText + + '\'' + + ", " + + "longTextMulti='" + + longTextMulti + + '\'' + + ", " + + "basicTextMulti='" + + basicTextMulti + + '\'' + + "}"; + } + + public static class AiStudioAgentAskBuilder { + + protected EnumWrapper type; + + protected final String accessState; + + protected final String description; + + protected String customInstructions; + + protected AiStudioAgentLongTextTool longText; + + protected AiStudioAgentBasicTextTool basicText; + + protected AiStudioAgentLongTextTool longTextMulti; + + protected AiStudioAgentBasicTextTool basicTextMulti; + + public AiStudioAgentAskBuilder(String accessState, String description) { + this.accessState = accessState; + this.description = description; + this.type = + new EnumWrapper(AiStudioAgentAskTypeField.AI_AGENT_ASK); + } + + public AiStudioAgentAskBuilder type(AiStudioAgentAskTypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public AiStudioAgentAskBuilder type(EnumWrapper type) { + this.type = type; + return this; + } + + public AiStudioAgentAskBuilder customInstructions(String customInstructions) { + this.customInstructions = customInstructions; + return this; + } + + public AiStudioAgentAskBuilder longText(AiStudioAgentLongTextTool longText) { + this.longText = longText; + return this; + } + + public AiStudioAgentAskBuilder basicText(AiStudioAgentBasicTextTool basicText) { + this.basicText = basicText; + return this; + } + + public AiStudioAgentAskBuilder longTextMulti(AiStudioAgentLongTextTool longTextMulti) { + this.longTextMulti = longTextMulti; + return this; + } + + public AiStudioAgentAskBuilder basicTextMulti(AiStudioAgentBasicTextTool basicTextMulti) { + this.basicTextMulti = basicTextMulti; + return this; + } + + public AiStudioAgentAsk build() { + return new AiStudioAgentAsk(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aistudioagentask/AiStudioAgentAskTypeField.java b/src/main/java/com/box/sdkgen/schemas/aistudioagentask/AiStudioAgentAskTypeField.java new file mode 100644 index 00000000..b6a1a942 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aistudioagentask/AiStudioAgentAskTypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.aistudioagentask; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum AiStudioAgentAskTypeField implements Valuable { + AI_AGENT_ASK("ai_agent_ask"); + + private final String value; + + AiStudioAgentAskTypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class AiStudioAgentAskTypeFieldDeserializer + extends JsonDeserializer> { + + public AiStudioAgentAskTypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AiStudioAgentAskTypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AiStudioAgentAskTypeFieldSerializer + extends JsonSerializer> { + + public AiStudioAgentAskTypeFieldSerializer() { + 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/aistudioagentbasicgentool/AiStudioAgentBasicGenTool.java b/src/main/java/com/box/sdkgen/schemas/aistudioagentbasicgentool/AiStudioAgentBasicGenTool.java new file mode 100644 index 00000000..50c01b99 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aistudioagentbasicgentool/AiStudioAgentBasicGenTool.java @@ -0,0 +1,155 @@ +package com.box.sdkgen.schemas.aistudioagentbasicgentool; + +import com.box.sdkgen.schemas.aiagentbasicgentool.AiAgentBasicGenTool; +import com.box.sdkgen.schemas.aiagentlongtexttooltextgen.AiAgentLongTextToolTextGenEmbeddingsField; +import com.box.sdkgen.schemas.aillmendpointparamsawsoraillmendpointparamsgoogleoraillmendpointparamsopenai.AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +public class AiStudioAgentBasicGenTool extends AiAgentBasicGenTool { + + @JsonProperty("is_custom_instructions_included") + protected Boolean isCustomInstructionsIncluded; + + public AiStudioAgentBasicGenTool() { + super(); + } + + protected AiStudioAgentBasicGenTool(AiStudioAgentBasicGenToolBuilder builder) { + super(builder); + this.isCustomInstructionsIncluded = builder.isCustomInstructionsIncluded; + } + + public Boolean getIsCustomInstructionsIncluded() { + return isCustomInstructionsIncluded; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiStudioAgentBasicGenTool casted = (AiStudioAgentBasicGenTool) o; + return Objects.equals(model, casted.model) + && Objects.equals(numTokensForCompletion, casted.numTokensForCompletion) + && Objects.equals(llmEndpointParams, casted.llmEndpointParams) + && Objects.equals(systemMessage, casted.systemMessage) + && Objects.equals(promptTemplate, casted.promptTemplate) + && Objects.equals(embeddings, casted.embeddings) + && Objects.equals(contentTemplate, casted.contentTemplate) + && Objects.equals(isCustomInstructionsIncluded, casted.isCustomInstructionsIncluded); + } + + @Override + public int hashCode() { + return Objects.hash( + model, + numTokensForCompletion, + llmEndpointParams, + systemMessage, + promptTemplate, + embeddings, + contentTemplate, + isCustomInstructionsIncluded); + } + + @Override + public String toString() { + return "AiStudioAgentBasicGenTool{" + + "model='" + + model + + '\'' + + ", " + + "numTokensForCompletion='" + + numTokensForCompletion + + '\'' + + ", " + + "llmEndpointParams='" + + llmEndpointParams + + '\'' + + ", " + + "systemMessage='" + + systemMessage + + '\'' + + ", " + + "promptTemplate='" + + promptTemplate + + '\'' + + ", " + + "embeddings='" + + embeddings + + '\'' + + ", " + + "contentTemplate='" + + contentTemplate + + '\'' + + ", " + + "isCustomInstructionsIncluded='" + + isCustomInstructionsIncluded + + '\'' + + "}"; + } + + public static class AiStudioAgentBasicGenToolBuilder extends AiAgentBasicGenToolBuilder { + + protected Boolean isCustomInstructionsIncluded; + + public AiStudioAgentBasicGenToolBuilder isCustomInstructionsIncluded( + Boolean isCustomInstructionsIncluded) { + this.isCustomInstructionsIncluded = isCustomInstructionsIncluded; + return this; + } + + @Override + public AiStudioAgentBasicGenToolBuilder model(String model) { + this.model = model; + return this; + } + + @Override + public AiStudioAgentBasicGenToolBuilder numTokensForCompletion(Long numTokensForCompletion) { + this.numTokensForCompletion = numTokensForCompletion; + return this; + } + + @Override + public AiStudioAgentBasicGenToolBuilder llmEndpointParams( + AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi + llmEndpointParams) { + this.llmEndpointParams = llmEndpointParams; + return this; + } + + @Override + public AiStudioAgentBasicGenToolBuilder systemMessage(String systemMessage) { + this.systemMessage = systemMessage; + return this; + } + + @Override + public AiStudioAgentBasicGenToolBuilder promptTemplate(String promptTemplate) { + this.promptTemplate = promptTemplate; + return this; + } + + @Override + public AiStudioAgentBasicGenToolBuilder embeddings( + AiAgentLongTextToolTextGenEmbeddingsField embeddings) { + this.embeddings = embeddings; + return this; + } + + @Override + public AiStudioAgentBasicGenToolBuilder contentTemplate(String contentTemplate) { + this.contentTemplate = contentTemplate; + return this; + } + + public AiStudioAgentBasicGenTool build() { + return new AiStudioAgentBasicGenTool(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aistudioagentbasictexttool/AiStudioAgentBasicTextTool.java b/src/main/java/com/box/sdkgen/schemas/aistudioagentbasictexttool/AiStudioAgentBasicTextTool.java new file mode 100644 index 00000000..ad93af5a --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aistudioagentbasictexttool/AiStudioAgentBasicTextTool.java @@ -0,0 +1,129 @@ +package com.box.sdkgen.schemas.aistudioagentbasictexttool; + +import com.box.sdkgen.schemas.aiagentbasictexttool.AiAgentBasicTextTool; +import com.box.sdkgen.schemas.aillmendpointparamsawsoraillmendpointparamsgoogleoraillmendpointparamsopenai.AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +public class AiStudioAgentBasicTextTool extends AiAgentBasicTextTool { + + @JsonProperty("is_custom_instructions_included") + protected Boolean isCustomInstructionsIncluded; + + public AiStudioAgentBasicTextTool() { + super(); + } + + protected AiStudioAgentBasicTextTool(AiStudioAgentBasicTextToolBuilder builder) { + super(builder); + this.isCustomInstructionsIncluded = builder.isCustomInstructionsIncluded; + } + + public Boolean getIsCustomInstructionsIncluded() { + return isCustomInstructionsIncluded; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiStudioAgentBasicTextTool casted = (AiStudioAgentBasicTextTool) o; + return Objects.equals(model, casted.model) + && Objects.equals(numTokensForCompletion, casted.numTokensForCompletion) + && Objects.equals(llmEndpointParams, casted.llmEndpointParams) + && Objects.equals(systemMessage, casted.systemMessage) + && Objects.equals(promptTemplate, casted.promptTemplate) + && Objects.equals(isCustomInstructionsIncluded, casted.isCustomInstructionsIncluded); + } + + @Override + public int hashCode() { + return Objects.hash( + model, + numTokensForCompletion, + llmEndpointParams, + systemMessage, + promptTemplate, + isCustomInstructionsIncluded); + } + + @Override + public String toString() { + return "AiStudioAgentBasicTextTool{" + + "model='" + + model + + '\'' + + ", " + + "numTokensForCompletion='" + + numTokensForCompletion + + '\'' + + ", " + + "llmEndpointParams='" + + llmEndpointParams + + '\'' + + ", " + + "systemMessage='" + + systemMessage + + '\'' + + ", " + + "promptTemplate='" + + promptTemplate + + '\'' + + ", " + + "isCustomInstructionsIncluded='" + + isCustomInstructionsIncluded + + '\'' + + "}"; + } + + public static class AiStudioAgentBasicTextToolBuilder extends AiAgentBasicTextToolBuilder { + + protected Boolean isCustomInstructionsIncluded; + + public AiStudioAgentBasicTextToolBuilder isCustomInstructionsIncluded( + Boolean isCustomInstructionsIncluded) { + this.isCustomInstructionsIncluded = isCustomInstructionsIncluded; + return this; + } + + @Override + public AiStudioAgentBasicTextToolBuilder model(String model) { + this.model = model; + return this; + } + + @Override + public AiStudioAgentBasicTextToolBuilder numTokensForCompletion(Long numTokensForCompletion) { + this.numTokensForCompletion = numTokensForCompletion; + return this; + } + + @Override + public AiStudioAgentBasicTextToolBuilder llmEndpointParams( + AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi + llmEndpointParams) { + this.llmEndpointParams = llmEndpointParams; + return this; + } + + @Override + public AiStudioAgentBasicTextToolBuilder systemMessage(String systemMessage) { + this.systemMessage = systemMessage; + return this; + } + + @Override + public AiStudioAgentBasicTextToolBuilder promptTemplate(String promptTemplate) { + this.promptTemplate = promptTemplate; + return this; + } + + public AiStudioAgentBasicTextTool build() { + return new AiStudioAgentBasicTextTool(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aistudioagentextract/AiStudioAgentExtract.java b/src/main/java/com/box/sdkgen/schemas/aistudioagentextract/AiStudioAgentExtract.java new file mode 100644 index 00000000..5d9d7ee5 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aistudioagentextract/AiStudioAgentExtract.java @@ -0,0 +1,181 @@ +package com.box.sdkgen.schemas.aistudioagentextract; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.aistudioagentbasictexttool.AiStudioAgentBasicTextTool; +import com.box.sdkgen.schemas.aistudioagentlongtexttool.AiStudioAgentLongTextTool; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +public class AiStudioAgentExtract extends SerializableObject { + + @JsonDeserialize( + using = AiStudioAgentExtractTypeField.AiStudioAgentExtractTypeFieldDeserializer.class) + @JsonSerialize( + using = AiStudioAgentExtractTypeField.AiStudioAgentExtractTypeFieldSerializer.class) + protected EnumWrapper type; + + @JsonProperty("access_state") + protected final String accessState; + + protected final String description; + + @JsonProperty("custom_instructions") + protected String customInstructions; + + @JsonProperty("long_text") + protected AiStudioAgentLongTextTool longText; + + @JsonProperty("basic_text") + protected AiStudioAgentBasicTextTool basicText; + + public AiStudioAgentExtract( + @JsonProperty("access_state") String accessState, + @JsonProperty("description") String description) { + super(); + this.accessState = accessState; + this.description = description; + this.type = + new EnumWrapper( + AiStudioAgentExtractTypeField.AI_AGENT_EXTRACT); + } + + protected AiStudioAgentExtract(AiStudioAgentExtractBuilder builder) { + super(); + this.type = builder.type; + this.accessState = builder.accessState; + this.description = builder.description; + this.customInstructions = builder.customInstructions; + this.longText = builder.longText; + this.basicText = builder.basicText; + } + + public EnumWrapper getType() { + return type; + } + + public String getAccessState() { + return accessState; + } + + public String getDescription() { + return description; + } + + public String getCustomInstructions() { + return customInstructions; + } + + public AiStudioAgentLongTextTool getLongText() { + return longText; + } + + public AiStudioAgentBasicTextTool getBasicText() { + return basicText; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiStudioAgentExtract casted = (AiStudioAgentExtract) o; + return Objects.equals(type, casted.type) + && Objects.equals(accessState, casted.accessState) + && Objects.equals(description, casted.description) + && Objects.equals(customInstructions, casted.customInstructions) + && Objects.equals(longText, casted.longText) + && Objects.equals(basicText, casted.basicText); + } + + @Override + public int hashCode() { + return Objects.hash(type, accessState, description, customInstructions, longText, basicText); + } + + @Override + public String toString() { + return "AiStudioAgentExtract{" + + "type='" + + type + + '\'' + + ", " + + "accessState='" + + accessState + + '\'' + + ", " + + "description='" + + description + + '\'' + + ", " + + "customInstructions='" + + customInstructions + + '\'' + + ", " + + "longText='" + + longText + + '\'' + + ", " + + "basicText='" + + basicText + + '\'' + + "}"; + } + + public static class AiStudioAgentExtractBuilder { + + protected EnumWrapper type; + + protected final String accessState; + + protected final String description; + + protected String customInstructions; + + protected AiStudioAgentLongTextTool longText; + + protected AiStudioAgentBasicTextTool basicText; + + public AiStudioAgentExtractBuilder(String accessState, String description) { + this.accessState = accessState; + this.description = description; + this.type = + new EnumWrapper( + AiStudioAgentExtractTypeField.AI_AGENT_EXTRACT); + } + + public AiStudioAgentExtractBuilder type(AiStudioAgentExtractTypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public AiStudioAgentExtractBuilder type(EnumWrapper type) { + this.type = type; + return this; + } + + public AiStudioAgentExtractBuilder customInstructions(String customInstructions) { + this.customInstructions = customInstructions; + return this; + } + + public AiStudioAgentExtractBuilder longText(AiStudioAgentLongTextTool longText) { + this.longText = longText; + return this; + } + + public AiStudioAgentExtractBuilder basicText(AiStudioAgentBasicTextTool basicText) { + this.basicText = basicText; + return this; + } + + public AiStudioAgentExtract build() { + return new AiStudioAgentExtract(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aistudioagentextract/AiStudioAgentExtractTypeField.java b/src/main/java/com/box/sdkgen/schemas/aistudioagentextract/AiStudioAgentExtractTypeField.java new file mode 100644 index 00000000..58ea0c31 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aistudioagentextract/AiStudioAgentExtractTypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.aistudioagentextract; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum AiStudioAgentExtractTypeField implements Valuable { + AI_AGENT_EXTRACT("ai_agent_extract"); + + private final String value; + + AiStudioAgentExtractTypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class AiStudioAgentExtractTypeFieldDeserializer + extends JsonDeserializer> { + + public AiStudioAgentExtractTypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AiStudioAgentExtractTypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AiStudioAgentExtractTypeFieldSerializer + extends JsonSerializer> { + + public AiStudioAgentExtractTypeFieldSerializer() { + 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/aistudioagentlongtexttool/AiStudioAgentLongTextTool.java b/src/main/java/com/box/sdkgen/schemas/aistudioagentlongtexttool/AiStudioAgentLongTextTool.java new file mode 100644 index 00000000..95d837bd --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aistudioagentlongtexttool/AiStudioAgentLongTextTool.java @@ -0,0 +1,143 @@ +package com.box.sdkgen.schemas.aistudioagentlongtexttool; + +import com.box.sdkgen.schemas.aiagentlongtexttool.AiAgentLongTextTool; +import com.box.sdkgen.schemas.aiagentlongtexttool.AiAgentLongTextToolEmbeddingsField; +import com.box.sdkgen.schemas.aillmendpointparamsawsoraillmendpointparamsgoogleoraillmendpointparamsopenai.AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Objects; + +public class AiStudioAgentLongTextTool extends AiAgentLongTextTool { + + @JsonProperty("is_custom_instructions_included") + protected Boolean isCustomInstructionsIncluded; + + public AiStudioAgentLongTextTool() { + super(); + } + + protected AiStudioAgentLongTextTool(AiStudioAgentLongTextToolBuilder builder) { + super(builder); + this.isCustomInstructionsIncluded = builder.isCustomInstructionsIncluded; + } + + public Boolean getIsCustomInstructionsIncluded() { + return isCustomInstructionsIncluded; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiStudioAgentLongTextTool casted = (AiStudioAgentLongTextTool) o; + return Objects.equals(model, casted.model) + && Objects.equals(numTokensForCompletion, casted.numTokensForCompletion) + && Objects.equals(llmEndpointParams, casted.llmEndpointParams) + && Objects.equals(systemMessage, casted.systemMessage) + && Objects.equals(promptTemplate, casted.promptTemplate) + && Objects.equals(embeddings, casted.embeddings) + && Objects.equals(isCustomInstructionsIncluded, casted.isCustomInstructionsIncluded); + } + + @Override + public int hashCode() { + return Objects.hash( + model, + numTokensForCompletion, + llmEndpointParams, + systemMessage, + promptTemplate, + embeddings, + isCustomInstructionsIncluded); + } + + @Override + public String toString() { + return "AiStudioAgentLongTextTool{" + + "model='" + + model + + '\'' + + ", " + + "numTokensForCompletion='" + + numTokensForCompletion + + '\'' + + ", " + + "llmEndpointParams='" + + llmEndpointParams + + '\'' + + ", " + + "systemMessage='" + + systemMessage + + '\'' + + ", " + + "promptTemplate='" + + promptTemplate + + '\'' + + ", " + + "embeddings='" + + embeddings + + '\'' + + ", " + + "isCustomInstructionsIncluded='" + + isCustomInstructionsIncluded + + '\'' + + "}"; + } + + public static class AiStudioAgentLongTextToolBuilder extends AiAgentLongTextToolBuilder { + + protected Boolean isCustomInstructionsIncluded; + + public AiStudioAgentLongTextToolBuilder isCustomInstructionsIncluded( + Boolean isCustomInstructionsIncluded) { + this.isCustomInstructionsIncluded = isCustomInstructionsIncluded; + return this; + } + + @Override + public AiStudioAgentLongTextToolBuilder model(String model) { + this.model = model; + return this; + } + + @Override + public AiStudioAgentLongTextToolBuilder numTokensForCompletion(Long numTokensForCompletion) { + this.numTokensForCompletion = numTokensForCompletion; + return this; + } + + @Override + public AiStudioAgentLongTextToolBuilder llmEndpointParams( + AiLlmEndpointParamsAwsOrAiLlmEndpointParamsGoogleOrAiLlmEndpointParamsOpenAi + llmEndpointParams) { + this.llmEndpointParams = llmEndpointParams; + return this; + } + + @Override + public AiStudioAgentLongTextToolBuilder systemMessage(String systemMessage) { + this.systemMessage = systemMessage; + return this; + } + + @Override + public AiStudioAgentLongTextToolBuilder promptTemplate(String promptTemplate) { + this.promptTemplate = promptTemplate; + return this; + } + + @Override + public AiStudioAgentLongTextToolBuilder embeddings( + AiAgentLongTextToolEmbeddingsField embeddings) { + this.embeddings = embeddings; + return this; + } + + public AiStudioAgentLongTextTool build() { + return new AiStudioAgentLongTextTool(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aistudioagenttextgen/AiStudioAgentTextGen.java b/src/main/java/com/box/sdkgen/schemas/aistudioagenttextgen/AiStudioAgentTextGen.java new file mode 100644 index 00000000..d2dec912 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aistudioagenttextgen/AiStudioAgentTextGen.java @@ -0,0 +1,160 @@ +package com.box.sdkgen.schemas.aistudioagenttextgen; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.aistudioagentbasicgentool.AiStudioAgentBasicGenTool; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.Objects; + +public class AiStudioAgentTextGen extends SerializableObject { + + @JsonDeserialize( + using = AiStudioAgentTextGenTypeField.AiStudioAgentTextGenTypeFieldDeserializer.class) + @JsonSerialize( + using = AiStudioAgentTextGenTypeField.AiStudioAgentTextGenTypeFieldSerializer.class) + protected EnumWrapper type; + + @JsonProperty("access_state") + protected final String accessState; + + protected final String description; + + @JsonProperty("custom_instructions") + protected String customInstructions; + + @JsonProperty("basic_gen") + protected AiStudioAgentBasicGenTool basicGen; + + public AiStudioAgentTextGen( + @JsonProperty("access_state") String accessState, + @JsonProperty("description") String description) { + super(); + this.accessState = accessState; + this.description = description; + this.type = + new EnumWrapper( + AiStudioAgentTextGenTypeField.AI_AGENT_TEXT_GEN); + } + + protected AiStudioAgentTextGen(AiStudioAgentTextGenBuilder builder) { + super(); + this.type = builder.type; + this.accessState = builder.accessState; + this.description = builder.description; + this.customInstructions = builder.customInstructions; + this.basicGen = builder.basicGen; + } + + public EnumWrapper getType() { + return type; + } + + public String getAccessState() { + return accessState; + } + + public String getDescription() { + return description; + } + + public String getCustomInstructions() { + return customInstructions; + } + + public AiStudioAgentBasicGenTool getBasicGen() { + return basicGen; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + AiStudioAgentTextGen casted = (AiStudioAgentTextGen) o; + return Objects.equals(type, casted.type) + && Objects.equals(accessState, casted.accessState) + && Objects.equals(description, casted.description) + && Objects.equals(customInstructions, casted.customInstructions) + && Objects.equals(basicGen, casted.basicGen); + } + + @Override + public int hashCode() { + return Objects.hash(type, accessState, description, customInstructions, basicGen); + } + + @Override + public String toString() { + return "AiStudioAgentTextGen{" + + "type='" + + type + + '\'' + + ", " + + "accessState='" + + accessState + + '\'' + + ", " + + "description='" + + description + + '\'' + + ", " + + "customInstructions='" + + customInstructions + + '\'' + + ", " + + "basicGen='" + + basicGen + + '\'' + + "}"; + } + + public static class AiStudioAgentTextGenBuilder { + + protected EnumWrapper type; + + protected final String accessState; + + protected final String description; + + protected String customInstructions; + + protected AiStudioAgentBasicGenTool basicGen; + + public AiStudioAgentTextGenBuilder(String accessState, String description) { + this.accessState = accessState; + this.description = description; + this.type = + new EnumWrapper( + AiStudioAgentTextGenTypeField.AI_AGENT_TEXT_GEN); + } + + public AiStudioAgentTextGenBuilder type(AiStudioAgentTextGenTypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public AiStudioAgentTextGenBuilder type(EnumWrapper type) { + this.type = type; + return this; + } + + public AiStudioAgentTextGenBuilder customInstructions(String customInstructions) { + this.customInstructions = customInstructions; + return this; + } + + public AiStudioAgentTextGenBuilder basicGen(AiStudioAgentBasicGenTool basicGen) { + this.basicGen = basicGen; + return this; + } + + public AiStudioAgentTextGen build() { + return new AiStudioAgentTextGen(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/aistudioagenttextgen/AiStudioAgentTextGenTypeField.java b/src/main/java/com/box/sdkgen/schemas/aistudioagenttextgen/AiStudioAgentTextGenTypeField.java new file mode 100644 index 00000000..e5c3ced6 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/aistudioagenttextgen/AiStudioAgentTextGenTypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.aistudioagenttextgen; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum AiStudioAgentTextGenTypeField implements Valuable { + AI_AGENT_TEXT_GEN("ai_agent_text_gen"); + + private final String value; + + AiStudioAgentTextGenTypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class AiStudioAgentTextGenTypeFieldDeserializer + extends JsonDeserializer> { + + public AiStudioAgentTextGenTypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(AiStudioAgentTextGenTypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class AiStudioAgentTextGenTypeFieldSerializer + extends JsonSerializer> { + + public AiStudioAgentTextGenTypeFieldSerializer() { + 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/aitextgen/AiTextGen.java b/src/main/java/com/box/sdkgen/schemas/aitextgen/AiTextGen.java index 902f8b5f..b360fd3d 100644 --- a/src/main/java/com/box/sdkgen/schemas/aitextgen/AiTextGen.java +++ b/src/main/java/com/box/sdkgen/schemas/aitextgen/AiTextGen.java @@ -1,7 +1,7 @@ package com.box.sdkgen.schemas.aitextgen; import com.box.sdkgen.internal.SerializableObject; -import com.box.sdkgen.schemas.aiagenttextgen.AiAgentTextGen; +import com.box.sdkgen.schemas.aiagentreferenceoraiagenttextgen.AiAgentReferenceOrAiAgentTextGen; import com.box.sdkgen.schemas.aidialoguehistory.AiDialogueHistory; import com.fasterxml.jackson.annotation.JsonProperty; import java.util.List; @@ -17,7 +17,7 @@ public class AiTextGen extends SerializableObject { protected List dialogueHistory; @JsonProperty("ai_agent") - protected AiAgentTextGen aiAgent; + protected AiAgentReferenceOrAiAgentTextGen aiAgent; public AiTextGen( @JsonProperty("prompt") String prompt, @@ -47,7 +47,7 @@ public List getDialogueHistory() { return dialogueHistory; } - public AiAgentTextGen getAiAgent() { + public AiAgentReferenceOrAiAgentTextGen getAiAgent() { return aiAgent; } @@ -100,7 +100,7 @@ public static class AiTextGenBuilder { protected List dialogueHistory; - protected AiAgentTextGen aiAgent; + protected AiAgentReferenceOrAiAgentTextGen aiAgent; public AiTextGenBuilder(String prompt, List items) { this.prompt = prompt; @@ -112,7 +112,7 @@ public AiTextGenBuilder dialogueHistory(List dialogueHistory) return this; } - public AiTextGenBuilder aiAgent(AiAgentTextGen aiAgent) { + public AiTextGenBuilder aiAgent(AiAgentReferenceOrAiAgentTextGen aiAgent) { this.aiAgent = aiAgent; return this; } diff --git a/src/main/java/com/box/sdkgen/schemas/createaiagent/CreateAiAgent.java b/src/main/java/com/box/sdkgen/schemas/createaiagent/CreateAiAgent.java new file mode 100644 index 00000000..e232c444 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/createaiagent/CreateAiAgent.java @@ -0,0 +1,216 @@ +package com.box.sdkgen.schemas.createaiagent; + +import com.box.sdkgen.internal.SerializableObject; +import com.box.sdkgen.schemas.aiagentallowedentity.AiAgentAllowedEntity; +import com.box.sdkgen.schemas.aistudioagentask.AiStudioAgentAsk; +import com.box.sdkgen.schemas.aistudioagentextract.AiStudioAgentExtract; +import com.box.sdkgen.schemas.aistudioagenttextgen.AiStudioAgentTextGen; +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import java.util.List; +import java.util.Objects; + +public class CreateAiAgent extends SerializableObject { + + @JsonDeserialize(using = CreateAiAgentTypeField.CreateAiAgentTypeFieldDeserializer.class) + @JsonSerialize(using = CreateAiAgentTypeField.CreateAiAgentTypeFieldSerializer.class) + protected EnumWrapper type; + + protected final String name; + + @JsonProperty("access_state") + protected final String accessState; + + @JsonProperty("icon_reference") + protected String iconReference; + + @JsonProperty("allowed_entities") + protected List allowedEntities; + + protected AiStudioAgentAsk ask; + + @JsonProperty("text_gen") + protected AiStudioAgentTextGen textGen; + + protected AiStudioAgentExtract extract; + + public CreateAiAgent( + @JsonProperty("name") String name, @JsonProperty("access_state") String accessState) { + super(); + this.name = name; + this.accessState = accessState; + this.type = new EnumWrapper(CreateAiAgentTypeField.AI_AGENT); + } + + protected CreateAiAgent(CreateAiAgentBuilder builder) { + super(); + this.type = builder.type; + this.name = builder.name; + this.accessState = builder.accessState; + this.iconReference = builder.iconReference; + this.allowedEntities = builder.allowedEntities; + this.ask = builder.ask; + this.textGen = builder.textGen; + this.extract = builder.extract; + } + + public EnumWrapper getType() { + return type; + } + + public String getName() { + return name; + } + + public String getAccessState() { + return accessState; + } + + public String getIconReference() { + return iconReference; + } + + public List getAllowedEntities() { + return allowedEntities; + } + + public AiStudioAgentAsk getAsk() { + return ask; + } + + public AiStudioAgentTextGen getTextGen() { + return textGen; + } + + public AiStudioAgentExtract getExtract() { + return extract; + } + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + CreateAiAgent casted = (CreateAiAgent) o; + return Objects.equals(type, casted.type) + && Objects.equals(name, casted.name) + && Objects.equals(accessState, casted.accessState) + && Objects.equals(iconReference, casted.iconReference) + && Objects.equals(allowedEntities, casted.allowedEntities) + && Objects.equals(ask, casted.ask) + && Objects.equals(textGen, casted.textGen) + && Objects.equals(extract, casted.extract); + } + + @Override + public int hashCode() { + return Objects.hash( + type, name, accessState, iconReference, allowedEntities, ask, textGen, extract); + } + + @Override + public String toString() { + return "CreateAiAgent{" + + "type='" + + type + + '\'' + + ", " + + "name='" + + name + + '\'' + + ", " + + "accessState='" + + accessState + + '\'' + + ", " + + "iconReference='" + + iconReference + + '\'' + + ", " + + "allowedEntities='" + + allowedEntities + + '\'' + + ", " + + "ask='" + + ask + + '\'' + + ", " + + "textGen='" + + textGen + + '\'' + + ", " + + "extract='" + + extract + + '\'' + + "}"; + } + + public static class CreateAiAgentBuilder { + + protected EnumWrapper type; + + protected final String name; + + protected final String accessState; + + protected String iconReference; + + protected List allowedEntities; + + protected AiStudioAgentAsk ask; + + protected AiStudioAgentTextGen textGen; + + protected AiStudioAgentExtract extract; + + public CreateAiAgentBuilder(String name, String accessState) { + this.name = name; + this.accessState = accessState; + this.type = new EnumWrapper(CreateAiAgentTypeField.AI_AGENT); + } + + public CreateAiAgentBuilder type(CreateAiAgentTypeField type) { + this.type = new EnumWrapper(type); + return this; + } + + public CreateAiAgentBuilder type(EnumWrapper type) { + this.type = type; + return this; + } + + public CreateAiAgentBuilder iconReference(String iconReference) { + this.iconReference = iconReference; + return this; + } + + public CreateAiAgentBuilder allowedEntities(List allowedEntities) { + this.allowedEntities = allowedEntities; + return this; + } + + public CreateAiAgentBuilder ask(AiStudioAgentAsk ask) { + this.ask = ask; + return this; + } + + public CreateAiAgentBuilder textGen(AiStudioAgentTextGen textGen) { + this.textGen = textGen; + return this; + } + + public CreateAiAgentBuilder extract(AiStudioAgentExtract extract) { + this.extract = extract; + return this; + } + + public CreateAiAgent build() { + return new CreateAiAgent(this); + } + } +} diff --git a/src/main/java/com/box/sdkgen/schemas/createaiagent/CreateAiAgentTypeField.java b/src/main/java/com/box/sdkgen/schemas/createaiagent/CreateAiAgentTypeField.java new file mode 100644 index 00000000..c7ec4f90 --- /dev/null +++ b/src/main/java/com/box/sdkgen/schemas/createaiagent/CreateAiAgentTypeField.java @@ -0,0 +1,62 @@ +package com.box.sdkgen.schemas.createaiagent; + +import com.box.sdkgen.serialization.json.EnumWrapper; +import com.box.sdkgen.serialization.json.Valuable; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JsonDeserializer; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import java.io.IOException; +import java.util.Arrays; + +public enum CreateAiAgentTypeField implements Valuable { + AI_AGENT("ai_agent"); + + private final String value; + + CreateAiAgentTypeField(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + public static class CreateAiAgentTypeFieldDeserializer + extends JsonDeserializer> { + + public CreateAiAgentTypeFieldDeserializer() { + super(); + } + + @Override + public EnumWrapper deserialize( + JsonParser p, DeserializationContext ctxt) throws IOException { + String value = p.getValueAsString(); + return Arrays.stream(CreateAiAgentTypeField.values()) + .filter((v) -> v.getValue().equalsIgnoreCase(value)) + .findFirst() + .map(EnumWrapper::new) + .orElse(new EnumWrapper(value)); + } + } + + public static class CreateAiAgentTypeFieldSerializer + extends JsonSerializer> { + + public CreateAiAgentTypeFieldSerializer() { + super(); + } + + @Override + public void serialize( + EnumWrapper value, + JsonGenerator gen, + SerializerProvider serializers) + throws IOException { + gen.writeString(value.getStringValue()); + } + } +} diff --git a/src/test/java/com/box/sdkgen/test/aistudio/AiStudioITest.java b/src/test/java/com/box/sdkgen/test/aistudio/AiStudioITest.java new file mode 100644 index 00000000..40e5681b --- /dev/null +++ b/src/test/java/com/box/sdkgen/test/aistudio/AiStudioITest.java @@ -0,0 +1,61 @@ +package com.box.sdkgen.test.aistudio; + +import static com.box.sdkgen.internal.utils.UtilsManager.convertToString; +import static com.box.sdkgen.internal.utils.UtilsManager.getUuid; +import static com.box.sdkgen.test.commons.CommonsManager.getDefaultClient; + +import com.box.sdkgen.client.BoxClient; +import com.box.sdkgen.managers.aistudio.GetAiAgentByIdQueryParams; +import com.box.sdkgen.schemas.aimultipleagentresponse.AiMultipleAgentResponse; +import com.box.sdkgen.schemas.aisingleagentresponsefull.AiSingleAgentResponseFull; +import com.box.sdkgen.schemas.aistudioagentask.AiStudioAgentAsk; +import com.box.sdkgen.schemas.createaiagent.CreateAiAgent; +import java.util.Arrays; +import org.junit.jupiter.api.Test; + +public class AiStudioITest { + + private static final BoxClient client = getDefaultClient(); + + @Test + public void testAiStudioCrud() { + String agentName = getUuid(); + AiSingleAgentResponseFull createdAgent = + client + .getAiStudio() + .createAiAgent( + new CreateAiAgent.CreateAiAgentBuilder(agentName, "enabled") + .ask(new AiStudioAgentAsk("enabled", "desc1")) + .build()); + assert createdAgent.getName().equals(agentName); + AiMultipleAgentResponse agents = client.getAiStudio().getAiAgents(); + int numAgents = agents.getEntries().size(); + assert convertToString(agents.getEntries().get(0).getType()).equals("ai_agent"); + AiSingleAgentResponseFull retrievedAgent = + client + .getAiStudio() + .getAiAgentById( + createdAgent.getId(), + new GetAiAgentByIdQueryParams.GetAiAgentByIdQueryParamsBuilder() + .fields(Arrays.asList("ask")) + .build()); + assert retrievedAgent.getName().equals(agentName); + assert convertToString(retrievedAgent.getAccessState()).equals("enabled"); + assert convertToString(retrievedAgent.getAsk().getAccessState()).equals("enabled"); + assert retrievedAgent.getAsk().getDescription().equals("desc1"); + AiSingleAgentResponseFull updatedAgent = + client + .getAiStudio() + .updateAiAgentById( + createdAgent.getId(), + new CreateAiAgent.CreateAiAgentBuilder(agentName, "enabled") + .ask(new AiStudioAgentAsk("disabled", "desc2")) + .build()); + assert convertToString(updatedAgent.getAccessState()).equals("enabled"); + assert convertToString(updatedAgent.getAsk().getAccessState()).equals("disabled"); + assert updatedAgent.getAsk().getDescription().equals("desc2"); + client.getAiStudio().deleteAiAgentById(createdAgent.getId()); + AiMultipleAgentResponse agentsAfterDelete = client.getAiStudio().getAiAgents(); + assert agentsAfterDelete.getEntries().size() == numAgents - 1; + } +}